js/src/tests/ecma_6/Set/forEach-selfhosted-behavior.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 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 987243;
     8 var summary = "Don't use .call(...) in the self-hosted Set.prototype.forEach";
    10 print(BUGNUMBER + ": " + summary);
    12 /**************
    13  * BEGIN TEST *
    14  **************/
    16 var functionCall = Function.prototype.call;
    18 function throwSyntaxError()
    19 {
    20   throw new SyntaxError("Function.prototype.call incorrectly called");
    21 }
    23 function lalala() {}
    25 Function.prototype.call = throwSyntaxError;
    27 new Set().forEach(throwSyntaxError);
    28 new Set([1]).forEach(lalala);
    29 new Set([{}, 4]).forEach(lalala);
    31 Function.prototype.call = function() { this.add(3.141592654); };
    33 new Set().forEach(throwSyntaxError);
    34 new Set(["foo"]).forEach(lalala);
    35 new Set([undefined, NaN]).forEach(lalala);
    37 var callCount = 0;
    38 Function.prototype.call = function() { callCount++; };
    40 new Set().forEach(throwSyntaxError);
    41 new Set([new Number]).forEach(lalala);
    42 new Set([true, new Boolean(false)]).forEach(lalala);
    44 assertEq(callCount, 0);
    46 /******************************************************************************/
    48 if (typeof reportCompare === "function")
    49   reportCompare(true, true);
    51 print("Tests complete");

mercurial