1 function getTestPlugin(pluginName) {
2 var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(
3 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) {
13 ok(false, "Could not find plugin tag with plugin name '" + name + "'");
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
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;