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.

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

mercurial