michael@0: // |reftest| skip-if(!xulRuntime.shell) slow 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: var BUGNUMBER = 476414; michael@0: var summary = 'Do not crash @ js_NativeSet'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: function whatToTestSpidermonkeyTrunk(code) michael@0: { michael@0: return { michael@0: allowExec: true michael@0: }; michael@0: } michael@0: whatToTest = whatToTestSpidermonkeyTrunk; michael@0: function tryItOut(code) michael@0: { michael@0: var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); michael@0: var f = new Function(code); michael@0: if (wtt.allowExec && f) { michael@0: rv = tryRunning(f, code); michael@0: } michael@0: } michael@0: function tryRunning(f, code) michael@0: { michael@0: try { michael@0: var rv = f(); michael@0: } catch(runError) {} michael@0: } michael@0: var realFunction = Function; michael@0: var realUneval = uneval; michael@0: var realToString = toString; michael@0: var realToSource = toSource; michael@0: function tryEnsureSanity() michael@0: { michael@0: delete Function; michael@0: delete uneval; michael@0: delete toSource; michael@0: delete toString; michael@0: Function = realFunction; michael@0: uneval = realUneval; michael@0: toSource = realToSource; michael@0: toString = realToString; michael@0: } michael@0: for (let iters = 0; iters < 2000; ++iters) { michael@0: count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); michael@0: tryEnsureSanity(); michael@0: count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); michael@0: tryEnsureSanity(); michael@0: count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); michael@0: tryEnsureSanity(); michael@0: count=45197; tryItOut("M:with((p={}, (p.z = === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); michael@0: tryEnsureSanity(); michael@0: gc(); michael@0: tryEnsureSanity(); michael@0: count=45254; tryItOut("for each (NaN in this);"); michael@0: tryEnsureSanity(); michael@0: } michael@0: michael@0: reportCompare(expect, actual, summary);