js/src/tests/js1_8/extensions/regress-476414-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 // |reftest| skip-if(!xulRuntime.shell) slow
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 476414;
     9 var summary = 'Do not crash @ GetGCThingFlags';
    10 var actual = '';
    11 var expect = '';
    13 printBugNumber(BUGNUMBER);
    14 printStatus (summary);
    16 function whatToTestSpidermonkeyTrunk(code)
    17 {
    18   return {
    19   allowExec: true
    20       };
    21 }
    22 whatToTest = whatToTestSpidermonkeyTrunk;
    23 function tryItOut(code)
    24 {
    25   var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " "));
    26   var f = new Function(code);
    27   if (wtt.allowExec && f) {
    28     rv = tryRunning(f, code);
    29   }
    30 }
    31 function tryRunning(f, code)
    32 {
    33   try { 
    34     var rv = f();
    35   } catch(runError) {}
    36 }
    37 var realFunction = Function;
    38 var realUneval = uneval;
    39 var realToString = toString;
    40 var realToSource = toSource;
    41 function tryEnsureSanity()
    42 {
    43   delete Function;
    44   delete uneval;
    45   delete toSource;
    46   delete toString;
    47   Function = realFunction;
    48   uneval = realUneval;
    49   toSource = realToSource;
    50   toString = realToString;
    51 }
    52 for (let iters = 0; iters < 2000; ++iters) { 
    53   count=27745; tryItOut("with({x: (c) = (x2 = [])})false;");
    54   tryEnsureSanity();
    55   count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield  \"\"  } ): break; }");
    56   tryEnsureSanity();
    57   count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } ");
    58   tryEnsureSanity();
    59   count=45197; tryItOut("M:with((p={}, (p.z = <x/> ===  '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }");
    60   tryEnsureSanity();
    61   gc();
    62   tryEnsureSanity();
    63   count=45254; tryItOut("for each (NaN in this);");
    64   tryEnsureSanity();
    65 }
    67 reportCompare(expect, actual, summary);

mercurial