summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/test_hidden_plugin.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/plugins/test/mochitest/test_hidden_plugin.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/plugins/test/mochitest/test_hidden_plugin.html')
-rw-r--r--dom/plugins/test/mochitest/test_hidden_plugin.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_hidden_plugin.html b/dom/plugins/test/mochitest/test_hidden_plugin.html
new file mode 100644
index 000000000..446d8cbbd
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_hidden_plugin.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Test whether we are adding the dummy plugin correctly when there is only 1 plugin and its hidden</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="plugin-utils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<body>
+ <script type="application/javascript;version=1.7">
+ "use strict"
+ {
+ SimpleTest.waitForExplicitFinish();
+ let ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(SpecialPowers.Ci.nsIPluginHost);
+ let plugins = ph.getPluginTags();
+ let testPluginName = plugins[0].name;
+ let oldPrefVal = null;
+ let prefName = "plugins.navigator.hidden_ctp_plugin";
+ try {
+ oldPrefVal = SpecialPowers.getCharPref(prefName);
+ } catch (ex) {}
+ let promise = SpecialPowers.pushPrefEnv({ set: [[prefName, testPluginName]]});
+ promise.then(function() {
+ for (let i = 0; i < plugins.length; i++) {
+ let plugin = plugins[i];
+ let newState = (plugin.name == testPluginName ? SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY :
+ SpecialPowers.Ci.nsIPluginTag.STATE_DISABLED);
+ if (plugin.enabledState != newState) {
+ let oldState = plugin.enabledState;
+ setTestPluginEnabledState(newState, plugin.name);
+ SimpleTest.registerCleanupFunction(function() {
+ if (plugin.enabledState != oldState)
+ setTestPluginEnabledState(oldState, plugin.name);
+ });
+ }
+ }
+ // we have disabled all the plugins except for 1 which is click to play and hidden. The
+ // navigator.plugins list should have only one entry and it should be the dummy plugin.
+ isnot(navigator.plugins.length, 0, "navigator.plugins should not be empty");
+ SimpleTest.finish();
+ });
+ }
+</script>
+</body>