summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/plugins/plugin-javascript-access.html
blob: b304238010a522e4bef8dc45dde020487e9e34e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Installed Plugins</title>
</head>
<body>
<script type="application/x-javascript">
if (window.testRunner)
    testRunner.dumpAsText()

navigator.plugins.refresh(false); // Supposedly helps if new plugins were added.

var foundTestPlugin = false;

for (var i = 0; i < navigator.plugins.length; i++) {
    var plugin = navigator.plugins[i];

    // We can only guarantee that the Test Plugin is installed.
    if (plugin.name != "Blink Test Plugin")
        continue;
    else
        foundTestPlugin = true;

    document.writeln("<p>Name: " + plugin.name + "<\/p>");
    document.writeln("<p>Description: " + plugin.description + "<\/p>");
    document.writeln("<p>Filename: " + plugin.filename + "<\/p>");

    document.writeln("<p>Mime Types:<\/p>");
    for (var mi = 0; mi != plugin.length; ++mi) {
        document.writeln("<p>Type: " + plugin[mi].type + "<\/p>");
        document.writeln("<p>Description: " + plugin[mi].description + "<\/p>");
        document.writeln("<p>Suffixes: " + plugin[mi].suffixes + "<\/p>");
        document.writeln("<br>");

        if (plugin.item(mi).type == plugin[mi].type) {
            document.writeln("<p>Plugin.item() works.<\/p>");
        } else {
            document.writeln("<p>FAIL. Plugin.item() does not work.<\/p>");
        }

        if (plugin.namedItem(plugin[mi].type).type == plugin[mi].type) {
            document.writeln("<p>Plugin.namedItem() works.<\/p>");
        } else {
            document.writeln("<p>FAIL. Plugin.namedItem() does not work.<\/p>");
        }
    }

    if (navigator.plugins.item(i).name == plugin.name) {
        document.writeln("<p>PluginArray.item() works.<\/p>");
    } else {
        document.writeln("<p>FAIL. PluginArray.item() does not work.<\/p>");
    }

    if (navigator.plugins.namedItem(plugin.name).name == plugin.name) {
        document.writeln("<p>PluginArray.namedItem() works.<\/p>");
    } else {
        document.writeln("<p>FAIL. PluginArray.namedItem() does not work.<\/p>");
    }
}

for (var i = 0; i < navigator.mimeTypes.length; i++) {
    var mimeType = navigator.mimeTypes[i];

    // We can only guarantee that the Test PlugIn is installed.
    if (mimeType.type != "application/x-blink-test-plugin")
        continue;

    document.writeln("<p>Type: " + mimeType.type + "<\/p>");
    document.writeln("<p>Description: " + mimeType.description + "<\/p>");
    document.writeln("<p>Suffixes: " + mimeType.suffixes + "<\/p>");

    if (navigator.mimeTypes.item(i).type == mimeType.type) {
        document.writeln("<p>MimeTypeArray.item() works.<\/p>");
    } else {
        document.writeln("<p>FAIL. MimeTypeArray.item() does not work.<\/p>");
    }

    if (navigator.mimeTypes.namedItem(mimeType.type).type == mimeType.type) {
        document.writeln("<p>MimeTypeArray.namedItem() works.<\/p>");
    } else {
        document.writeln("<p>FAIL. MimeTypeArray.namedItem() does not work.<\/p>");
    }
}

if (!foundTestPlugin)
    document.writeln("<p>FAILURE!  (Failed to find blink test plugin)<\/p>");
</script>
</body>
</html>