js/src/tests/ecma_5/strict/10.4.2.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 /* Direct calls to eval should inherit the strictness of the calling code. */
     9 assertEq(testLenientAndStrict("eval('010')",
    10                               completesNormally,
    11                               raisesException(SyntaxError)),
    12          true);
    14 /*
    15  * Directives in the eval code itself should always override a direct
    16  * caller's strictness.
    17  */
    18 assertEq(testLenientAndStrict("eval('\"use strict\"; 010')",
    19                               raisesException(SyntaxError),
    20                               raisesException(SyntaxError)),
    21          true);
    23 /* Code passed to indirect calls to eval should never be strict. */
    24 assertEq(testLenientAndStrict("var evil=eval; evil('010')",
    25                               completesNormally,
    26                               completesNormally),
    27          true);
    29 /*
    30  * Code passed to the Function constructor never inherits the caller's
    31  * strictness.
    32  */
    33 assertEq(completesNormally("Function('010')"),
    34          true);
    35 assertEq(raisesException(SyntaxError)("Function('\"use strict\"; 010')"),
    36          true);
    38 /*
    39  * If 'eval' causes a frame's primitive |this| to become wrapped, the frame should see the same
    40  * wrapper object as the eval code.
    41  */
    42 var call_this, eval_this;
    43 function f(code) {
    44   /*
    45    * At this point, a primitive |this| has not yet been wrapped. A
    46    * reference to |this| from the eval call should wrap it, and the wrapper
    47    * should be stored where the call frame can see it.
    48    */
    49   eval(code);
    50   call_this = this; 
    51 }
    52 f.call(true, 'eval_this = this');
    53 assertEq(call_this, eval_this);
    55 reportCompare(true, true);

mercurial