js/src/tests/js1_5/extensions/regress-291213.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 = 291213;
     8 var summary = 'Do not crash in args_resolve enumerating |arguments|';
     9 var actual = 'No Crash';
    10 var expect = 'No Crash';
    12 var scriptCode = "var result = \"\" + arguments; " +
    13   "for (i in arguments) " +
    14   "result += \"\\\n  \" + i + \" \" + arguments[i]; result;";
    15 var scripts = {};
    17 if (typeof Script == 'undefined')
    18 {
    19   print('Test skipped. Script not defined.');
    20 }
    21 else
    22 {
    23   scripts["A"] = new Script(scriptCode);
    25   scripts["B"] = (function() {
    26                     return new Script(scriptCode);
    27                   })();
    29   scripts["C"] = (function() {
    30                     function x() { "a"; }
    31                     return new Script(scriptCode);
    32                   })();
    34 // any Object (window, document, new Array(), ...)
    35   var anyObj = new Object();
    36   scripts["D"] = (function() {
    37                     function x() { anyObj; }
    38                     return new Script(scriptCode);
    39                   })();
    41   var result;
    42   for (var i in scripts) {
    43     try { result = scripts[i].exec(); }
    44     catch (e) { result = e; }
    45     printStatus(i + ") " + result);
    46   }
    47 }
    48 reportCompare(expect, actual, summary);

mercurial