js/src/tests/ecma_5/strict/eval-variable-environment.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 code;
     8 code =
     9   "eval('var x = 2; typeof x');";
    10 assertEq(testLenientAndStrict(code, returns("number"), returns("number")),
    11          true);
    13 code =
    14   "eval('\"use strict\"; var x = 2; typeof x');";
    15 assertEq(testLenientAndStrict(code, returns("number"), returns("number")),
    16          true);
    18 code =
    19   "eval('var x = 2;'); " +
    20   "typeof x";
    21 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")),
    22          true);
    24 code =
    25   "eval('\"use strict\"; var x = 2;'); " +
    26   "typeof x";
    27 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    28          true);
    30 code =
    31   "eval('\"use strict\"; var x = 2; typeof x'); " +
    32   "typeof x";
    33 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    34          true);
    36 code =
    37   "function test() " +
    38   "{ " +
    39   "  eval('var x = 2;'); " +
    40   "  return typeof x; " +
    41   "} " +
    42   "test();";
    43 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")),
    44          true);
    46 code =
    47   "function test() " +
    48   "{ " +
    49   "  'use strict'; " +
    50   "  eval('var x = 2;'); " +
    51   "  return typeof x; " +
    52   "} " +
    53   "test();";
    54 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    55          true);
    57 code =
    58   "function test() " +
    59   "{ " +
    60   "  eval('\"use strict\"; var x = 2;'); " +
    61   "  return typeof x; " +
    62   "} " +
    63   "test();";
    64 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    65          true);
    67 reportCompare(true, true);

mercurial