| 1 | 03/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | var gTestfile = 'regress-452498-117.js'; |
| 7 | //----------------------------------------------------------------------------- |
| 8 | var BUGNUMBER = 452498; |
| 9 | var summary = 'TM: upvar2 regression tests'; |
| 10 | var actual = ''; |
| 11 | var expect = ''; |
| 12 | |
| 13 | |
| 14 | //----------------------------------------------------------------------------- |
| 15 | test(); |
| 16 | //----------------------------------------------------------------------------- |
| 17 | |
| 18 | function test() |
| 19 | { |
| 20 | enterFunc ('test'); |
| 21 | printBugNumber(BUGNUMBER); |
| 22 | printStatus (summary); |
| 23 | |
| 24 | // ------- Comment #117 From Gary Kwong [:nth10sd] |
| 25 | |
| 26 | // The following all do not require -j. |
| 27 | |
| 28 | // ===== |
| 29 | |
| 30 | try |
| 31 | { |
| 32 | eval('x; function x(){}; const x;'); |
| 33 | } |
| 34 | catch(ex) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | // Assertion failure: !pn->isPlaceholder(), at ../jsparse.cpp:4876 |
| 39 | // ===== |
| 40 | (function(){ var x; eval("var x; x = null"); })() |
| 41 | |
| 42 | // Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2984 |
| 43 | // ===== |
| 44 | function this ({x}) { function x(){} } |
| 45 | |
| 46 | // Assertion failure: cg->stackDepth == stackDepth, at ../jsemit.cpp:3664 |
| 47 | // ===== |
| 48 | for(let x = [ "" for (y in /x/g ) if (x)] in ("")); |
| 49 | |
| 50 | // Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818 |
| 51 | // ===== |
| 52 | (function(){const x = 0, y = delete x;})() |
| 53 | |
| 54 | // Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710 |
| 55 | // ===== |
| 56 | try |
| 57 | { |
| 58 | (function(){(yield []) (function(){with({}){x} }); const x;})(); |
| 59 | } |
| 60 | catch(ex) |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | // Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:2022 |
| 65 | // ===== |
| 66 | try |
| 67 | { |
| 68 | (function(){([]) ((function(q) { return q; })for (each in *))})(); |
| 69 | } |
| 70 | catch(ex) |
| 71 | { |
| 72 | } |
| 73 | // Assertion failure: lexdep->frameLevel() <= funbox->level, at ../jsparse.cpp:1782 |
| 74 | // Opt crash [@ JSCompiler::setFunctionKinds] near null |
| 75 | // ===== |
| 76 | |
| 77 | try |
| 78 | { |
| 79 | eval("((x1) > [(x)(function() { x;}) for each (x in x)])()"); |
| 80 | } |
| 81 | catch(ex) |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | // Assertion failure: pnu->pn_lexdef == dn, at ../jsemit.cpp:1817 |
| 86 | // ===== |
| 87 | uneval(function(){for(var [arguments] = ({ get y(){} }) in y ) (x);}); |
| 88 | |
| 89 | // Assertion failure: slot < StackDepth(jp->script), at ../jsopcode.cpp:1318 |
| 90 | // ===== |
| 91 | uneval(function(){([] for ([,,]in <><y/></>));}); |
| 92 | |
| 93 | // Assertion failure: n != 0, at ../jsfun.cpp:2689 |
| 94 | // ===== |
| 95 | try |
| 96 | { |
| 97 | eval('(function(){{for(c in (function (){ for(x in (x1))window} )()) {const x;} }})();'); |
| 98 | } |
| 99 | catch(ex) |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | // Assertion failure: op == JSOP_GETLOCAL, at ../jsemit.cpp:4557 |
| 104 | // ===== |
| 105 | try |
| 106 | { |
| 107 | (eval("(function(){let x , x = (x for (x in null))});"))(); |
| 108 | } |
| 109 | catch(ex) |
| 110 | { |
| 111 | } |
| 112 | |
| 113 | // Assertion failure: (fun->u.i.script)->upvarsOffset != 0, at ../jsfun.cpp:1537 |
| 114 | // Opt crash [@ js_NewFlatClosure] near null |
| 115 | // ===== |
| 116 | "" + function(){for(var [x] in x1) ([]); function x(){}} |
| 117 | |
| 118 | // Assertion failure: cg->stackDepth == stackDepth, at ../jsemit.cpp:3664 |
| 119 | // Opt crash [@ JS_ArenaRealloc] near null |
| 120 | // ===== |
| 121 | try |
| 122 | { |
| 123 | eval( |
| 124 | "for (a in (function(){" + |
| 125 | " for each (let x in ['']) { return new function x1 (\u3056) { yield x } ();" + |
| 126 | " }})())" + |
| 127 | " function(){}" |
| 128 | ); |
| 129 | } |
| 130 | catch(ex) |
| 131 | { |
| 132 | } |
| 133 | // Crash [@ js_Interpret] near null |
| 134 | // ===== |
| 135 | |
| 136 | reportCompare(expect, actual, summary); |
| 137 | |
| 138 | exitFunc ('test'); |
| 139 | } |