browser/base/content/test/general/head_plain.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 function getTestPlugin(pluginName) {
     3   var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
     4                                  .getService(SpecialPowers.Ci.nsIPluginHost);
     5   var tags = ph.getPluginTags();
     6   var name = pluginName || "Test Plug-in";
     7   for (var tag of tags) {
     8     if (tag.name == name) {
     9       return tag;
    10     }
    11   }
    13   ok(false, "Could not find plugin tag with plugin name '" + name + "'");
    14   return null;
    15 }
    17 // call this to set the test plugin(s) initially expected enabled state.
    18 // it will automatically be reset to it's previous value after the test
    19 // ends
    20 function setTestPluginEnabledState(newEnabledState, pluginName) {
    21   var plugin = getTestPlugin(pluginName);
    22   var oldEnabledState = plugin.enabledState;
    23   plugin.enabledState = newEnabledState;
    24   SimpleTest.registerCleanupFunction(function() {
    25     getTestPlugin(pluginName).enabledState = oldEnabledState;
    26   });
    27 }

mercurial