michael@0: // this automatically sets the test plugin to be enabled (not e.g. click-to-play) michael@0: // and resets this afterwards michael@0: michael@0: (function() { michael@0: function getTestPlugin(aPluginName) { michael@0: var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] michael@0: .getService(SpecialPowers.Ci.nsIPluginHost); michael@0: var tags = ph.getPluginTags(); michael@0: for (var tag of tags) { michael@0: if (tag.name == aPluginName) { michael@0: return tag; michael@0: } michael@0: } michael@0: michael@0: ok(false, "Could not find plugin tag with plugin name '" + name + "'"); michael@0: return null; michael@0: } michael@0: michael@0: var plugin = getTestPlugin("Test Plug-in"); michael@0: var oldEnabledState = plugin.enabledState; michael@0: plugin.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED; michael@0: SimpleTest.registerCleanupFunction(function() { michael@0: getTestPlugin("Test Plug-in").enabledState = oldEnabledState; michael@0: }); michael@0: })();