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.

michael@0 1 // |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android
michael@0 2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 /*
michael@0 8 *
michael@0 9 * Date: 30 October 2001
michael@0 10 * SUMMARY: Regression test for bug 108440
michael@0 11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=108440
michael@0 12 *
michael@0 13 * We shouldn't crash trying to add an array as an element of itself (!)
michael@0 14 *
michael@0 15 * Brendan: "...it appears that Array.prototype.toString is unsafe,
michael@0 16 * and what's more, ECMA-262 Edition 3 has no helpful words about
michael@0 17 * avoiding recursive death on a cycle."
michael@0 18 */
michael@0 19 //-----------------------------------------------------------------------------
michael@0 20 var BUGNUMBER = 108440;
michael@0 21 var summary = "Shouldn't crash trying to add an array as an element of itself";
michael@0 22 var self = this;
michael@0 23 var temp = '';
michael@0 24
michael@0 25 printBugNumber(BUGNUMBER);
michael@0 26 printStatus(summary);
michael@0 27
michael@0 28 /*
michael@0 29 * Explicit test:
michael@0 30 */
michael@0 31 var a=[];
michael@0 32 temp = (a[a.length]=a);
michael@0 33
michael@0 34 /*
michael@0 35 * Implicit test (one of the properties of |self| is |a|)
michael@0 36 */
michael@0 37 a=[];
michael@0 38 for(var prop in self)
michael@0 39 {
michael@0 40 temp = prop;
michael@0 41 temp = (a[a.length] = self[prop]);
michael@0 42 }
michael@0 43
michael@0 44 /*
michael@0 45 * Stressful explicit test
michael@0 46 */
michael@0 47 a=[];
michael@0 48 for (var i=0; i<10; i++)
michael@0 49 {
michael@0 50 a[a.length] = a;
michael@0 51 }
michael@0 52
michael@0 53 /*
michael@0 54 * Test toString()
michael@0 55 */
michael@0 56 a=[];
michael@0 57 for (var i=0; i<10; i++)
michael@0 58 {
michael@0 59 a[a.length] = a.toString();
michael@0 60 }
michael@0 61
michael@0 62 /*
michael@0 63 * Test toSource() - but Rhino doesn't have this, so try...catch it
michael@0 64 */
michael@0 65 a=[];
michael@0 66 try
michael@0 67 {
michael@0 68 for (var i=0; i<10; i++)
michael@0 69 {
michael@0 70 a[a.length] = a.toSource();
michael@0 71 }
michael@0 72 }
michael@0 73 catch(e)
michael@0 74 {
michael@0 75 }
michael@0 76
michael@0 77 reportCompare('No Crash', 'No Crash', '');

mercurial