| 1 |
// |reftest| skip-if(!xulRuntime.shell) slow |
| 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/. */ |
| 6 |
|
| 7 |
//----------------------------------------------------------------------------- |
| 8 |
var BUGNUMBER = 476414; |
| 9 |
var summary = 'Do not crash @ GetGCThingFlags'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
function whatToTestSpidermonkeyTrunk(code) |
| 17 |
{ |
| 18 |
return { |
| 19 |
allowExec: true |
| 20 |
}; |
| 21 |
} |
| 22 |
whatToTest = whatToTestSpidermonkeyTrunk; |
| 23 |
function tryItOut(code) |
| 24 |
{ |
| 25 |
var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); |
| 26 |
var f = new Function(code); |
| 27 |
if (wtt.allowExec && f) { |
| 28 |
rv = tryRunning(f, code); |
| 29 |
} |
| 30 |
} |
| 31 |
function tryRunning(f, code) |
| 32 |
{ |
| 33 |
try { |
| 34 |
var rv = f(); |
| 35 |
} catch(runError) {} |
| 36 |
} |
| 37 |
var realFunction = Function; |
| 38 |
var realToString = toString; |
| 39 |
function tryEnsureSanity() |
| 40 |
{ |
| 41 |
delete Function; |
| 42 |
delete toString; |
| 43 |
Function = realFunction; |
| 44 |
toString = realToString; |
| 45 |
} |
| 46 |
for (let iters = 0; iters < 2000; ++iters) { |
| 47 |
count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); |
| 48 |
tryEnsureSanity(); |
| 49 |
count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function* () { yield \"\" } ): break; }"); |
| 50 |
tryEnsureSanity(); |
| 51 |
count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y){ return this; })); } "); |
| 52 |
tryEnsureSanity(); |
| 53 |
count=45197; tryItOut("M:with((p={}, (p.z = false )()))/*TUUL*/for (let y of [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); |
| 54 |
tryEnsureSanity(); |
| 55 |
gc(); |
| 56 |
tryEnsureSanity(); |
| 57 |
count=45254; tryItOut("for (NaN in this);"); |
| 58 |
tryEnsureSanity(); |
| 59 |
} |
| 60 |
|
| 61 |
reportCompare(expect, actual, summary); |