michael@0: // |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * michael@0: * Date: 30 October 2001 michael@0: * SUMMARY: Regression test for bug 108440 michael@0: * See http://bugzilla.mozilla.org/show_bug.cgi?id=108440 michael@0: * michael@0: * We shouldn't crash trying to add an array as an element of itself (!) michael@0: * michael@0: * Brendan: "...it appears that Array.prototype.toString is unsafe, michael@0: * and what's more, ECMA-262 Edition 3 has no helpful words about michael@0: * avoiding recursive death on a cycle." michael@0: */ michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 108440; michael@0: var summary = "Shouldn't crash trying to add an array as an element of itself"; michael@0: var self = this; michael@0: var temp = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus(summary); michael@0: michael@0: /* michael@0: * Explicit test: michael@0: */ michael@0: var a=[]; michael@0: temp = (a[a.length]=a); michael@0: michael@0: /* michael@0: * Implicit test (one of the properties of |self| is |a|) michael@0: */ michael@0: a=[]; michael@0: for(var prop in self) michael@0: { michael@0: temp = prop; michael@0: temp = (a[a.length] = self[prop]); michael@0: } michael@0: michael@0: /* michael@0: * Stressful explicit test michael@0: */ michael@0: a=[]; michael@0: for (var i=0; i<10; i++) michael@0: { michael@0: a[a.length] = a; michael@0: } michael@0: michael@0: /* michael@0: * Test toString() michael@0: */ michael@0: a=[]; michael@0: for (var i=0; i<10; i++) michael@0: { michael@0: a[a.length] = a.toString(); michael@0: } michael@0: michael@0: /* michael@0: * Test toSource() - but Rhino doesn't have this, so try...catch it michael@0: */ michael@0: a=[]; michael@0: try michael@0: { michael@0: for (var i=0; i<10; i++) michael@0: { michael@0: a[a.length] = a.toSource(); michael@0: } michael@0: } michael@0: catch(e) michael@0: { michael@0: } michael@0: michael@0: reportCompare('No Crash', 'No Crash', '');