diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 1c58107abe8b..05da515022f6 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -5489,8 +5489,8 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target, return ReconstructImacroPCStack(cx, script, imacstart, target, pcstack); #endif - LOCAL_ASSERT(script->main <= target && target < script->code + script->length); - jsbytecode *pc = script->main; + LOCAL_ASSERT(script->code <= target && target < script->code + script->length); + jsbytecode *pc = script->code; uintN pcdepth = 0; ptrdiff_t oplen; for (; pc < target; pc += oplen) { diff --git a/js/src/tests/ecma_5/Global/adding-global-var-nonextensible-error.js b/js/src/tests/ecma_5/Global/adding-global-var-nonextensible-error.js new file mode 100644 index 000000000000..f4eaf00a293f --- /dev/null +++ b/js/src/tests/ecma_5/Global/adding-global-var-nonextensible-error.js @@ -0,0 +1,35 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 621432; +var summary = + "If a var statement can't create a global property because the global " + + "object isn't extensible, and an error is thrown while decompiling the " + + "global, don't assert"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +var toSource = []; +Object.preventExtensions(this); + +try +{ + eval("var x;"); + throw new Error("no error thrown"); +} +catch (e) +{ + assertEq(e instanceof TypeError, true, "expected TypeError, got: " + e); +} + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("All tests passed!"); diff --git a/js/src/tests/ecma_5/Global/jstests.list b/js/src/tests/ecma_5/Global/jstests.list index 1da36470ae4b..5976eb0a6f99 100644 --- a/js/src/tests/ecma_5/Global/jstests.list +++ b/js/src/tests/ecma_5/Global/jstests.list @@ -1,4 +1,5 @@ url-prefix ../../jsreftest.html?test=ecma_5/Global/ +script adding-global-var-nonextensible-error.js script parseInt-01.js script parseFloat-01.js script eval-01.js