js/src/tests/js1_8_5/regress/regress-383902.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 -*- */
     2 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  */
     7 var c = 0;
     9 function f(a) {
    10   const b = a;
    11   try {
    12     eval('"use strict"; b = 1 + a; c = 1');
    13     assertEq(0, 1);
    14   } catch (e) {
    15     assertEq(e.name, 'TypeError');
    16     assertEq(0, c);
    17     assertEq(a, b);
    18   }
    19 }
    21 var w = 42;
    22 f(w);
    24 c = 2;
    25 try {
    26   eval('"use strict"; function g(x) { const y = x; y = 1 + x; } c = 3');
    27   assertEq(0, 1);
    28 } catch (e) {
    29   assertEq(e.name, 'TypeError');
    30   assertEq(2, c);
    31 }
    33 c = 4;
    34 try {
    35   eval('"use strict"; const z = w; z = 1 + w; c = 5');
    36   assertEq(0, 1);
    37 } catch (e) {
    38   assertEq(e.name, 'TypeError');
    39   assertEq(4, c);
    40   assertEq('z' in this, false);
    41 }
    43 reportCompare(0, 0, "ok");

mercurial