toolkit/mozapps/extensions/test/xpcshell/test_bug595081.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 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 // Tests that the AddonManager objects cannot be tampered with
     7 function run_test() {
     8   // Setup for test
     9   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
    11   startupManager();
    13   // Verify that properties cannot be changed
    14   let old = AddonManager.STATE_AVAILABLE;
    15   AddonManager.STATE_AVAILABLE = 28;
    16   do_check_eq(AddonManager.STATE_AVAILABLE, old);
    18   // Verify that functions cannot be replaced
    19   AddonManager.isInstallEnabled = function() {
    20     do_throw("Should not be able to replace a function");
    21   }
    22   AddonManager.isInstallEnabled("application/x-xpinstall");
    24   // Verify that properties cannot be added
    25   AddonManager.foo = "bar";
    26   do_check_false("foo" in AddonManager);
    27 }

mercurial