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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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