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 = 452498; michael@0: var summary = 'TM: upvar2 regression tests'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: function test() michael@0: { michael@0: enterFunc ('test'); michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: // ------- Comment #82 From Gary Kwong [:nth10sd] michael@0: michael@0: // ===== michael@0: michael@0: (function(){function x(){} {let x = [] }}); michael@0: michael@0: // ===== michael@0: michael@0: var f = new Function("new function x(){ return x |= function(){} } ([], function(){})"); michael@0: "" + f; michael@0: michael@0: // ===== michael@0: michael@0: uneval(function(){[y] = [x];}); michael@0: michael@0: // ===== michael@0: michael@0: function g(code) michael@0: { michael@0: var f = new Function(code); michael@0: f(); michael@0: } michael@0: g("for (var x = 0; x < 3; ++x)(new (function(){})());"); michael@0: michael@0: // ===== michael@0: michael@0: try michael@0: { michael@0: (function(){new (function ({}, x) { yield (x(1e-81) for (x4 in undefined)) })()})(); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: // ===== michael@0: michael@0: try michael@0: { michael@0: (function(){[(function ([y]) { })() for each (x in [])];})(); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: // ===== michael@0: michael@0: try michael@0: { michael@0: eval('(function(){for(var x2 = [function(id) { return id } for each (x in []) if ([])] in functional) function(){};})();'); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: michael@0: // ===== michael@0: michael@0: if (typeof window == 'undefined') michael@0: global = this; michael@0: else michael@0: global = window; michael@0: michael@0: try michael@0: { michael@0: eval('(function(){with(global){1e-81; }for(let [x, x3] = global -= x in []) function(){}})();'); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: michael@0: // ===== michael@0: try michael@0: { michael@0: eval( michael@0: 'for(let [\n' + michael@0: 'function x () { M:if([1,,]) }\n' michael@0: ); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: michael@0: // ===== michael@0: michael@0: try michael@0: { michael@0: function foo(code) michael@0: { michael@0: var c; michael@0: eval("const c, x5 = c;"); michael@0: } michael@0: foo(); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: michael@0: // ===== michael@0: michael@0: var f = new Function("try { with({}) x = x; } catch(\u3056 if (function(){x = x2;})()) { let([] = [1.2e3.valueOf(\"number\")]) ((function(){})()); } "); michael@0: "" + f; michael@0: michael@0: // ===== michael@0: michael@0: var f = new Function("[] = [( '' )()];"); michael@0: "" + f; michael@0: michael@0: // ===== michael@0: michael@0: try michael@0: { michael@0: eval( michael@0: 'for(let x;' + michael@0: ' ([,,,]' + michael@0: ' .toExponential(new Function(), (function(){}))); [] = {})' + michael@0: ' for(var [x, x] = * in this.__defineSetter__("", function(){}));' michael@0: ); michael@0: } michael@0: catch(ex) michael@0: { michael@0: } michael@0: michael@0: // ===== michael@0: michael@0: reportCompare(expect, actual, summary); michael@0: michael@0: exitFunc ('test'); michael@0: }