toolkit/mozapps/extensions/test/xpcshell/test_bug514327_2.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.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 const Cc = Components.classes;
     6 const Ci = Components.interfaces;
     8 const nsIBLS = Ci.nsIBlocklistService;
    10 // Finds the test nsIPluginTag
    11 function get_test_plugintag() {
    12   var host = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
    13   var tags = host.getPluginTags();
    14   for (let tag of tags) {
    15     if (tag.name == "Test Plug-in")
    16       return tag;
    17   }
    18   return null;
    19 }
    21 function run_test() {
    22   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
    24   copyBlocklistToProfile(do_get_file("data/test_bug514327_2.xml"));
    26   var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS);
    27   var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
    29   var plugin = get_test_plugintag();
    30   if (!plugin)
    31     do_throw("Plugin tag not found");
    33   //run the code after the blocklist is closed
    34   Services.obs.notifyObservers(null, "addon-blocklist-closed", null);
    35   do_execute_soon(function() {
    36     // should be marked as outdated by the blocklist
    37     do_check_true(blocklist.getPluginBlocklistState(plugin, "1", "1.9") == nsIBLS.STATE_OUTDATED);
    39     // should indicate that a warning should be shown
    40     do_check_true(prefs.getBoolPref("plugins.update.notifyUser"));
    41   });
    42 }

mercurial