js/src/tests/ecma_5/Object/extensibility-02.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 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/licenses/publicdomain/
     4  * Contributor:
     5  *   Jeff Walden <jwalden+code@mit.edu>
     6  */
     8 var gTestfile = '15.2.3.4-01.js';
     9 //-----------------------------------------------------------------------------
    10 var BUGNUMBER = 492849;
    11 var summary = 'ES5: Implement Object.preventExtensions, Object.isExtensible';
    13 print(BUGNUMBER + ": " + summary);
    15 /**************
    16  * BEGIN TEST *
    17  **************/
    19 assertEq(typeof Object.isExtensible, "function");
    20 assertEq(Object.isExtensible.length, 1);
    22 var slowArray = [1, 2, 3];
    23 slowArray.slow = 5;
    24 var objs =
    25   [{}, { 1: 2 }, { a: 3 }, [], [1], [, 1], slowArray, function a(){}, /a/];
    27 for (var i = 0, sz = objs.length; i < sz; i++)
    28 {
    29   var o = objs[i];
    30   assertEq(Object.isExtensible(o), true, "object " + i + " not extensible?");
    32   var o2 = Object.preventExtensions(o);
    33   assertEq(o, o2);
    35   assertEq(Object.isExtensible(o), false, "object " + i + " is extensible?");
    36 }
    38 /******************************************************************************/
    40 reportCompare(true, true);
    42 print("All tests passed!");

mercurial