js/src/tests/js1_5/Array/regress-108440.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(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android
     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  *
     9  * Date: 30 October 2001
    10  * SUMMARY: Regression test for bug 108440
    11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=108440
    12  *
    13  * We shouldn't crash trying to add an array as an element of itself (!)
    14  *
    15  * Brendan: "...it appears that Array.prototype.toString is unsafe,
    16  * and what's more, ECMA-262 Edition 3 has no helpful words about
    17  * avoiding recursive death on a cycle."
    18  */
    19 //-----------------------------------------------------------------------------
    20 var BUGNUMBER = 108440;
    21 var summary = "Shouldn't crash trying to add an array as an element of itself";
    22 var self = this;
    23 var temp = '';
    25 printBugNumber(BUGNUMBER);
    26 printStatus(summary);
    28 /*
    29  * Explicit test:
    30  */
    31 var a=[];
    32 temp = (a[a.length]=a);
    34 /*
    35  * Implicit test (one of the properties of |self| is |a|)
    36  */
    37 a=[];
    38 for(var prop in self)
    39 {
    40   temp = prop;
    41   temp = (a[a.length] = self[prop]);
    42 }
    44 /*
    45  * Stressful explicit test
    46  */
    47 a=[];
    48 for (var i=0; i<10; i++)
    49 {
    50   a[a.length] = a;
    51 }
    53 /*
    54  * Test toString()
    55  */
    56 a=[];
    57 for (var i=0; i<10; i++)
    58 {
    59   a[a.length] = a.toString();
    60 }
    62 /*
    63  * Test toSource() - but Rhino doesn't have this, so try...catch it
    64  */
    65 a=[];
    66 try
    67 {
    68   for (var i=0; i<10; i++)
    69   {
    70     a[a.length] = a.toSource();
    71   }
    72 }
    73 catch(e)
    74 {
    75 }
    77 reportCompare('No Crash', 'No Crash', '');

mercurial