js/src/tests/ecma_3/Exceptions/15.11.7.6-002.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  *
     8  * Date:    14 April 2003
     9  * SUMMARY: Prototype of predefined error objects should be DontDelete
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 201989;
    16 var summary = 'Prototype of predefined error objects should be DontDelete';
    17 var status = '';
    18 var statusitems = [];
    19 var actual = '';
    20 var actualvalues = [];
    21 var expect= '';
    22 var expectedvalues = [];
    25 /*
    26  * Tests that |F.prototype| is DontDelete
    27  */
    28 function testDontDelete(F)
    29 {
    30   var e;
    31   var orig = F.prototype;
    32   try
    33   {
    34     delete F.prototype;
    35   }
    36   catch (e)
    37   {
    38   }
    39   return F.prototype === orig;
    40 }
    43 var list = [
    44   "Error",
    45   "ConversionError",
    46   "EvalError",
    47   "RangeError",
    48   "ReferenceError",
    49   "SyntaxError",
    50   "TypeError",
    51   "URIError"
    52   ];
    55 for (i in list)
    56 {
    57   var F = this[list[i]];
    59   // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
    60   if (F)
    61   {
    62     status = 'Testing DontDelete attribute of |' + list[i] + '.prototype|';
    63     actual = testDontDelete(F);
    64     expect = true;
    65     addThis();
    66   }
    67 }
    71 //-----------------------------------------------------------------------------
    72 test();
    73 //-----------------------------------------------------------------------------
    77 function addThis()
    78 {
    79   statusitems[UBound] = status;
    80   actualvalues[UBound] = actual;
    81   expectedvalues[UBound] = expect;
    82   UBound++;
    83 }
    86 function test()
    87 {
    88   enterFunc('test');
    89   printBugNumber(BUGNUMBER);
    90   printStatus(summary);
    92   for (var i=0; i<UBound; i++)
    93   {
    94     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    95   }
    97   exitFunc ('test');
    98 }

mercurial