js/src/tests/js1_5/Error/regress-465377.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 = 465377;
     8 var summary = 'instanceof relations between Error objects';
     9 var actual = '';
    10 var expect = '';
    13 //-----------------------------------------------------------------------------
    14 test();
    15 //-----------------------------------------------------------------------------
    17 function test()
    18 {
    19   enterFunc ('test');
    20   printBugNumber(BUGNUMBER);
    21   printStatus (summary);
    23   expect = actual = 'No Exception';
    25   try
    26   {
    27     var list = [
    28       "Error",
    29       "InternalError",
    30       "EvalError",
    31       "RangeError",
    32       "ReferenceError",
    33       "SyntaxError",
    34       "TypeError",
    35       "URIError"
    36       ];
    37     var instances = [];
    39     for (var i = 0; i != list.length; ++i) {
    40       var name = list[i];
    41       var constructor = this[name];
    42       var tmp = constructor.name;
    43       if (tmp !== name)
    44         throw "Bad value for "+name+".name: "+uneval(tmp);
    45       instances[i] = new constructor();
    46     }
    48     for (var i = 0; i != instances.length; ++i) {
    49       var instance = instances[i];
    50       var name = instance.name;
    51       var constructor = instance.constructor;
    52       if (constructor !== this[name])
    53         throw "Bad value of (new "+name+").constructor: "+uneval(tmp);
    54       var tmp = constructor.name;
    55       if (tmp !== name)
    56         throw "Bad value for constructor.name: "+uneval(tmp);
    57       if (!(instance instanceof Object))
    58         throw "Bad instanceof Object for "+name;
    59       if (!(instance instanceof Error))
    60         throw "Bad instanceof Error for "+name;
    61       if (!(instance instanceof constructor))
    62         throw "Bad instanceof constructor for "+name;
    63       if (instance instanceof Function)
    64         throw "Bad instanceof Function for "+name;
    65       for (var j = 1; j != instances.length; ++j) {
    66         if (i != j && instance instanceof instances[j].constructor) {
    67           throw "Unexpected (new "+name+") instanceof "+ instances[j].name;
    68         }
    69       }
    70     }
    72     print("OK");
    73   }
    74   catch(ex)
    75   {
    76     actual = ex + '';
    77   }
    78   reportCompare(expect, actual, summary);
    80   exitFunc ('test');
    81 }

mercurial