js/src/tests/js1_8_5/extensions/clone-leaf-object.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)
     2 // -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     3 // Any copyright is dedicated to the Public Domain.
     4 // http://creativecommons.org/licenses/publicdomain/
     6 var a = [new Boolean(true),
     7          new Boolean(false),
     8          new Number(0),
     9          new Number(-0),
    10          new Number(Math.PI),
    11          new Number(0x7fffffff),
    12          new Number(-0x7fffffff),
    13          new Number(0x80000000),
    14          new Number(-0x80000000),
    15          new Number(0xffffffff),
    16          new Number(-0xffffffff),
    17          new Number(0x100000000),
    18          new Number(-0x100000000),
    19          new Number(Number.MIN_VALUE),
    20          new Number(-Number.MIN_VALUE),
    21          new Number(Number.MAX_VALUE),
    22          new Number(-Number.MAX_VALUE),
    23          new Number(1/0),
    24          new Number(-1/0),
    25          new Number(0/0),
    26          new String(""),
    27          new String("\0123\u4567"),
    28          new Date(0),
    29          new Date(-0),
    30          new Date(0x7fffffff),
    31          new Date(-0x7fffffff),
    32          new Date(0x80000000),
    33          new Date(-0x80000000),
    34          new Date(0xffffffff),
    35          new Date(-0xffffffff),
    36          new Date(0x100000000),
    37          new Date(-0x100000000),
    38          new Date(1286523948674),
    39          new Date(8.64e15), // hard-coded in ES5 spec, hard-coded here
    40          new Date(-8.64e15),
    41          new Date(NaN)];
    43 function primitive(a) {
    44     return a instanceof Date ? +a : a.constructor(a);
    45 }
    47 for (var i = 0; i < a.length; i++) {
    48     var x = a[i];
    49     var expectedSource = x.toSource();
    50     var expectedPrimitive = primitive(x);
    51     var expectedProto = x.__proto__;
    52     var expectedString = Object.prototype.toString.call(x);
    53     x.expando = 1;
    54     x.__proto__ = {};
    56     var y = deserialize(serialize(x));
    57     assertEq(y.toSource(), expectedSource);
    58     assertEq(primitive(y), expectedPrimitive);
    59     assertEq(y.__proto__, expectedProto);
    60     assertEq(Object.prototype.toString.call(y), expectedString);
    61     assertEq("expando" in y, false);
    62 }
    64 reportCompare(0, 0);

mercurial