Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | |
michael@0 | 2 | function getTestPlugin(pluginName) { |
michael@0 | 3 | var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] |
michael@0 | 4 | .getService(SpecialPowers.Ci.nsIPluginHost); |
michael@0 | 5 | var tags = ph.getPluginTags(); |
michael@0 | 6 | var name = pluginName || "Test Plug-in"; |
michael@0 | 7 | for (var tag of tags) { |
michael@0 | 8 | if (tag.name == name) { |
michael@0 | 9 | return tag; |
michael@0 | 10 | } |
michael@0 | 11 | } |
michael@0 | 12 | |
michael@0 | 13 | ok(false, "Could not find plugin tag with plugin name '" + name + "'"); |
michael@0 | 14 | return null; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | // call this to set the test plugin(s) initially expected enabled state. |
michael@0 | 18 | // it will automatically be reset to it's previous value after the test |
michael@0 | 19 | // ends |
michael@0 | 20 | function setTestPluginEnabledState(newEnabledState, pluginName) { |
michael@0 | 21 | var plugin = getTestPlugin(pluginName); |
michael@0 | 22 | var oldEnabledState = plugin.enabledState; |
michael@0 | 23 | plugin.enabledState = newEnabledState; |
michael@0 | 24 | SimpleTest.registerCleanupFunction(function() { |
michael@0 | 25 | getTestPlugin(pluginName).enabledState = oldEnabledState; |
michael@0 | 26 | }); |
michael@0 | 27 | } |