js/src/tests/ecma_5/extensions/__proto__.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 = '__proto__.js';
     7 var BUGNUMBER = 770344;
     8 var summary = "__proto__ as accessor";
    10 print(BUGNUMBER + ": " + summary);
    12 /**************
    13  * BEGIN TEST *
    14  **************/
    16 var protoDesc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
    17 assertEq(protoDesc !== null, true);
    18 assertEq(typeof protoDesc, "object");
    19 assertEq(protoDesc.hasOwnProperty("get"), true);
    20 assertEq(protoDesc.hasOwnProperty("set"), true);
    21 assertEq(protoDesc.hasOwnProperty("enumerable"), true);
    22 assertEq(protoDesc.hasOwnProperty("configurable"), true);
    23 assertEq(protoDesc.hasOwnProperty("value"), false);
    24 assertEq(protoDesc.hasOwnProperty("writable"), false);
    26 assertEq(protoDesc.configurable, true);
    27 assertEq(protoDesc.enumerable, false);
    28 assertEq(typeof protoDesc.get, "function", protoDesc.get + "");
    29 assertEq(typeof protoDesc.set, "function", protoDesc.set + "");
    31 assertEq(delete Object.prototype.__proto__, true);
    32 assertEq(Object.getOwnPropertyDescriptor(Object.prototype, "__proto__"),
    33          undefined);
    35 var obj = {};
    36 obj.__proto__ = 5;
    37 assertEq(Object.getPrototypeOf(obj), Object.prototype);
    38 assertEq(obj.hasOwnProperty("__proto__"), true);
    40 var desc = Object.getOwnPropertyDescriptor(obj, "__proto__");
    41 assertEq(desc !== null, true);
    42 assertEq(typeof desc, "object");
    43 assertEq(desc.value, 5);
    44 assertEq(desc.writable, true);
    45 assertEq(desc.enumerable, true);
    46 assertEq(desc.configurable, true);
    48 /******************************************************************************/
    50 if (typeof reportCompare === "function")
    51   reportCompare(true, true);
    53 print("Tests complete");

mercurial