js/src/tests/js1_5/extensions/regress-164697.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 = 164697;
     8 var summary = '(parent(instance) == parent(constructor))';
     9 var actual = '';
    10 var expect = '';
    12 printBugNumber(BUGNUMBER);
    13 printStatus (summary);
    15 expect = 'true';
    17 runtest('{}', 'Object');
    18 runtest('new Object()', 'Object');
    20 // see https://bugzilla.mozilla.org/show_bug.cgi?id=321669
    21 // for why this test is not contained in a function.
    22 actual = (function (){}).__proto__ == Function.prototype;
    23 reportCompare('true', actual+'',
    24               '(function (){}).__proto__ == Function.prototype');
    26 runtest('new Function(";")', 'Function');
    28 runtest('[]', 'Array');
    29 runtest('new Array()', 'Array');
    31 runtest('new String()', 'String');
    33 runtest('new Boolean()', 'Boolean');
    35 runtest('new Number("1")', 'Number');
    37 runtest('new Date()', 'Date');
    39 runtest('/x/', 'RegExp');
    40 runtest('new RegExp("x")', 'RegExp');
    42 runtest('new Error()', 'Error');
    44 function runtest(myinstance, myconstructor)
    45 {
    46   var expr;
    47   var actual;
    49   if (typeof parent === "function")
    50   {
    51     try
    52     {
    53       expr =
    54         'parent(' + myinstance + ') == ' +
    55         'parent(' + myconstructor + ')';
    56       printStatus(expr);
    57       actual = eval(expr).toString();
    58     }
    59     catch(ex)
    60     {
    61       actual = ex + '';
    62     }
    64     reportCompare(expect, actual, expr);
    65   }
    67   try
    68   {
    69     expr =  '(' + myinstance + ').__proto__ == ' +
    70       myconstructor + '.prototype';
    71     printStatus(expr);
    72     actual = eval(expr).toString();
    73   }
    74   catch(ex)
    75   {
    76     actual = ex + '';
    77   }
    79   reportCompare(expect, actual, expr);
    80 }

mercurial