js/src/tests/ecma_5/extensions/preventExtensions-cross-global.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 // |reftest| skip-if(!xulRuntime.shell) -- needs newGlobal()
     2 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  * Contributor:
     6  *   Jeff Walden <jwalden+code@mit.edu>
     7  */
     9 var gTestfile = 'preventExtensions-cross-global.js';
    10 //-----------------------------------------------------------------------------
    11 var BUGNUMBER = 789897;
    12 var summary =
    13   "Object.preventExtensions and Object.isExtensible should work correctly " +
    14   "across globals";
    16 print(BUGNUMBER + ": " + summary);
    18 /**************
    19  * BEGIN TEST *
    20  **************/
    22 var otherGlobal = newGlobal();
    24 var obj = {};
    25 assertEq(otherGlobal.Object.isExtensible(obj), true);
    26 assertEq(otherGlobal.Object.preventExtensions(obj), obj);
    27 assertEq(otherGlobal.Object.isExtensible(obj), false);
    29 var objFromOther = otherGlobal.Object();
    30 assertEq(Object.isExtensible(objFromOther), true);
    31 assertEq(Object.preventExtensions(objFromOther), objFromOther);
    32 assertEq(Object.isExtensible(objFromOther), false);
    34 var proxy = new Proxy({}, {});
    35 assertEq(otherGlobal.Object.isExtensible(proxy), true);
    36 assertEq(otherGlobal.Object.preventExtensions(proxy), proxy);
    37 assertEq(otherGlobal.Object.isExtensible(proxy), false);
    39 var proxyFromOther = otherGlobal.evaluate("new Proxy({}, {})");
    40 assertEq(Object.isExtensible(proxyFromOther), true);
    41 assertEq(Object.preventExtensions(proxyFromOther), proxyFromOther);
    42 assertEq(Object.isExtensible(proxyFromOther), false);
    44 /******************************************************************************/
    46 if (typeof reportCompare === "function")
    47   reportCompare(true, true);
    49 print("Tests complete");

mercurial