js/src/tests/ecma_3/ExecutionContexts/10.6.1-01.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 290774;
     8 var summary = 'activation object never delegates to Object.prototype';
     9 var actual = '';
    10 var expect = '';
    12 printBugNumber(BUGNUMBER);
    13 printStatus (summary);
    15 var toStringResult;
    16 var evalResult;
    17 var watchResult;
    18 var parseIntResult;
    20 var eval = 'fooEval';
    21 var watch = undefined;
    22 var parseInt = 'fooParseInt';
    25 function toString()
    26 {
    27   return 'fooString';
    28 }
    30 function normal()
    31 {
    32   toStringResult = toString;
    33   evalResult = eval;
    34   watchResult = watch;
    35   parseIntResult = parseInt;
    36 }
    38 function outerinnervar()
    39 {
    40   toStringResult = toString;
    41   evalResult = eval;
    42   watchResult = watch;
    43   parseIntResult = parseInt;
    44   function inner()
    45   {
    46     // addition of any statement
    47     // which accesses a variable
    48     // from the outer scope causes the bug
    49     printStatus(toString);
    50   }
    51 }
    53 expect = true;
    55 printStatus('normal');
    56 printStatus('======');
    57 normal();
    59 printStatus('toStringResult ' + toStringResult);
    60 printStatus('toString ' + toString);
    61 actual = ((toStringResult + '') == (toString + ''));
    62 reportCompare(expect, actual, inSection(1));
    64 printStatus('evalResult ' + evalResult);
    65 printStatus('eval ' + eval);
    66 actual = ((evalResult + '') == (eval + ''));
    67 reportCompare(expect, actual, inSection(2));
    69 printStatus('watchResult ' + watchResult);
    70 printStatus('watch ' + watch);
    71 actual = ((watchResult + '') == (watch + ''));
    72 reportCompare(expect, actual, inSection(3));
    74 printStatus('parseIntResult ' + parseIntResult);
    75 printStatus('parseInt ' + parseInt);
    76 actual = ((parseIntResult + '') == (parseInt + ''));
    77 reportCompare(expect, actual, inSection(4));
    79 printStatus('outerinner');
    80 printStatus('==========');
    82 outerinnervar();
    84 printStatus('toStringResult ' + toStringResult);
    85 printStatus('toString ' + toString);
    86 actual = ((toStringResult + '') == (toString + ''));
    87 reportCompare(expect, actual, inSection(5));
    90 printStatus('evalResult ' + evalResult);
    91 printStatus('eval ' + eval);
    92 actual = ((evalResult + '') == (eval + ''));
    93 reportCompare(expect, actual, inSection(6));
    95 printStatus('watchResult ' + watchResult);
    96 printStatus('watch ' + watch);
    97 actual = ((watchResult + '') == (watch + ''));
    98 reportCompare(expect, actual, inSection(7));
   100 printStatus('parseIntResult ' + parseIntResult);
   101 printStatus('parseInt ' + parseInt);
   102 actual = ((parseIntResult + '') == (parseInt + ''));
   103 reportCompare(expect, actual, inSection(8));

mercurial