1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_8/extensions/regress-476414-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +// |reftest| skip-if(!xulRuntime.shell) slow 1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +//----------------------------------------------------------------------------- 1.11 +var BUGNUMBER = 476414; 1.12 +var summary = 'Do not crash @ GetGCThingFlags'; 1.13 +var actual = ''; 1.14 +var expect = ''; 1.15 + 1.16 +printBugNumber(BUGNUMBER); 1.17 +printStatus (summary); 1.18 + 1.19 +function whatToTestSpidermonkeyTrunk(code) 1.20 +{ 1.21 + return { 1.22 + allowExec: true 1.23 + }; 1.24 +} 1.25 +whatToTest = whatToTestSpidermonkeyTrunk; 1.26 +function tryItOut(code) 1.27 +{ 1.28 + var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); 1.29 + var f = new Function(code); 1.30 + if (wtt.allowExec && f) { 1.31 + rv = tryRunning(f, code); 1.32 + } 1.33 +} 1.34 +function tryRunning(f, code) 1.35 +{ 1.36 + try { 1.37 + var rv = f(); 1.38 + } catch(runError) {} 1.39 +} 1.40 +var realFunction = Function; 1.41 +var realUneval = uneval; 1.42 +var realToString = toString; 1.43 +var realToSource = toSource; 1.44 +function tryEnsureSanity() 1.45 +{ 1.46 + delete Function; 1.47 + delete uneval; 1.48 + delete toSource; 1.49 + delete toString; 1.50 + Function = realFunction; 1.51 + uneval = realUneval; 1.52 + toSource = realToSource; 1.53 + toString = realToString; 1.54 +} 1.55 +for (let iters = 0; iters < 2000; ++iters) { 1.56 + count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); 1.57 + tryEnsureSanity(); 1.58 + count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); 1.59 + tryEnsureSanity(); 1.60 + count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); 1.61 + tryEnsureSanity(); 1.62 + count=45197; tryItOut("M:with((p={}, (p.z = <x/> === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); 1.63 + tryEnsureSanity(); 1.64 + gc(); 1.65 + tryEnsureSanity(); 1.66 + count=45254; tryItOut("for each (NaN in this);"); 1.67 + tryEnsureSanity(); 1.68 +} 1.69 + 1.70 +reportCompare(expect, actual, summary);