js/src/tests/ecma_5/extensions/proxy-array-target-length-definition.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  */
     6 var gTestfile = 'proxy-array-target-length-definition.js';
     7 var BUGNUMBER = 905947;
     8 var summary =
     9   "Redefining an array's |length| property when redefining the |length| " +
    10   "property on a proxy with an array as target";
    12 print(BUGNUMBER + ": " + summary);
    14 /**************
    15  * BEGIN TEST *
    16  **************/
    18 var arr = [];
    19 var p = new Proxy(arr, {});
    21 // This really should throw a TypeError, but we're buggy just yet, and this
    22 // silently does nothing.
    23 Object.defineProperty(p, "length", { value: 17, configurable: true });
    25 // Same here.
    26 Object.defineProperty(p, "length", { value: 42, enumerable: true });
    28 // But at least we can check the property went unchanged.
    29 var pd = Object.getOwnPropertyDescriptor(p, "length");
    30 assertEq(pd.value, 0);
    31 assertEq(pd.writable, true);
    32 assertEq(pd.enumerable, false);
    33 assertEq(pd.configurable, false);
    35 var ad = Object.getOwnPropertyDescriptor(arr, "length");
    36 assertEq(ad.value, 0);
    37 assertEq(ad.writable, true);
    38 assertEq(ad.enumerable, false);
    39 assertEq(ad.configurable, false);
    41 /******************************************************************************/
    43 if (typeof reportCompare === "function")
    44   reportCompare(true, true);
    46 print("Tests complete");

mercurial