gecko-dev/layout/base/tests/enableTestPlugin.js
2013-09-04 16:07:53 +02:00

26 lines
818 B
JavaScript

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