mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
69446aded5
This patch has a few side effects:
1. Plugins in the chrome process are "mirrored" to all content processes,
although this mirroring is currently imperfect (bug 1090576
)
2. Plugins are no longer sorted by modification date in nsPluginHost.
3. Plugin exceptions are no longer propagated to JS code. They are ignored.
74 lines
3.2 KiB
HTML
74 lines
3.2 KiB
HTML
<html>
|
|
<head>
|
|
<title>Second Test Plug-in Test</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="utils.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
|
|
<body onload="run()">
|
|
<script class="testbody" type="application/javascript">
|
|
"use strict";
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
|
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
|
|
|
|
function findPlugin(pluginName) {
|
|
for (var i = 0; i < navigator.plugins.length; i++) {
|
|
var plugin = navigator.plugins[i];
|
|
if (plugin.name === pluginName) {
|
|
return plugin;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function findMimeType(mimeTypeType) {
|
|
for (var i = 0; i < navigator.mimeTypes.length; i++) {
|
|
var mimeType = navigator.mimeTypes[i];
|
|
if (mimeType.type === mimeTypeType) {
|
|
return mimeType;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function run() {
|
|
// Add "Test Plug-in" (but not "Second Test Plug-in") to the list of
|
|
// unhidden plugins. This test must modify the "plugins.enumerable_names"
|
|
// pref BEFORE accessing the navigator.plugins or navigator.mimeTypes
|
|
// arrays because they only read the pref when they first initialize
|
|
// their internal arrays!
|
|
var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"].getService(SpecialPowers.Ci.nsIPrefBranch);
|
|
var defaultEnumerableNamesPref = prefs.getCharPref("plugins.enumerable_names");
|
|
SpecialPowers.pushPrefEnv(
|
|
{'set': [["plugins.enumerable_names", defaultEnumerableNamesPref + ",Test Plug-in"]]},
|
|
finishRun
|
|
);
|
|
}
|
|
function finishRun() {
|
|
var pluginElement = document.getElementById("plugin");
|
|
is(pluginElement.identifierToStringTest("foo"), "foo", "Should be able to call a function provided by the plugin");
|
|
|
|
ok(navigator.plugins["Test Plug-in"], "Should have queried a non-hidden plugin named 'Test Plug-in'");
|
|
ok(navigator.plugins["Second Test Plug-in"], "Should have queried a hidden plugin named 'Test Plug-in'");
|
|
|
|
ok(findPlugin("Test Plug-in"), "Should have found a non-hidden plugin named 'Test Plug-in'");
|
|
ok(!findPlugin("Second Test Plug-in"), "Should NOT found a hidden plugin named 'Test Plug-in'");
|
|
|
|
ok(navigator.mimeTypes["application/x-test"], "Should have queried a non-hidden MIME type named 'application/x-test'");
|
|
ok(navigator.mimeTypes["application/x-second-test"], "Should have queried a MIME type named 'application/x-second-test'");
|
|
|
|
ok(findMimeType("application/x-test"), "Should have found a non-hidden MIME type named 'application/x-test'");
|
|
ok(!findMimeType("application/x-second-test"), "Should NOT have found a MIME type named 'application/x-second-test'");
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
</script>
|
|
|
|
<object id="plugin" type="application/x-second-test" width=200 height=200></object>
|
|
</body>
|
|
</html>
|