js/src/tests/ecma_5/strict/15.4.4.12.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /*
     4  * Any copyright is dedicated to the Public Domain.
     5  * http://creativecommons.org/licenses/publicdomain/
     6  */
     8 function arr() {
     9   return Object.defineProperty([1, 2, 3], 0, {writable: false});
    10 }
    12 function obj() {
    13   var o = {0: 1, 1: 2, 2: 3, length: 3};
    14   Object.defineProperty(o, 0, {writable: false});
    15   return o;
    16 }
    18 assertEq(testLenientAndStrict('var a = arr(); [a.splice(0, 1), a]',
    19                               raisesException(TypeError),
    20                               raisesException(TypeError)),
    21          true);
    23 assertEq(testLenientAndStrict('var o = obj(); [Array.prototype.splice.call(o, 0, 1), o]',
    24                               raisesException(TypeError),
    25                               raisesException(TypeError)),
    26          true);
    28 function agap() {
    29   var a = [1, 2, , 4];
    30   Object.defineProperty(a, 1, {configurable: false});
    31   return a;
    32 }
    34 function ogap() {
    35   var o = {0: 1, 1: 2, /* no 2 */ 3: 4, length: 4};
    36   Object.defineProperty(o, 1, {configurable: false});
    37   return o;
    38 }
    40 assertEq(testLenientAndStrict('var a = agap(); [a.splice(0, 1), a]',
    41                               raisesException(TypeError),
    42                               raisesException(TypeError)),
    43          true);
    45 assertEq(testLenientAndStrict('var o = ogap(); [Array.prototype.splice.call(o, 0, 1), o]',
    46                               raisesException(TypeError),
    47                               raisesException(TypeError)),
    48          true);
    50 reportCompare(true, true);

mercurial