js/src/jit-test/tests/arrays/push-densely-nonwritable-length.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 function f(arr, v)
     2 {
     3   arr.push(v);
     4 }
     6 function basic(out)
     7 {
     8   // Use a much-greater capacity than the eventual non-writable length.
     9   var a = out.a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
    10   Object.defineProperty(a, "length", { writable: false, value: 6 });
    12   f(a, 99);
    13 }
    15 var obj = {};
    16 var a;
    18 try
    19 {
    20   basic(obj);
    21   throw new Error("didn't throw!");
    22 }
    23 catch (e)
    24 {
    25   assertEq(e instanceof TypeError, true, "expected TypeError, got " + e);
    27   a = obj.a;
    28   assertEq(a.hasOwnProperty(6), false);
    29   assertEq(a[6], undefined);
    30   assertEq(a.length, 6);
    31 }

mercurial