mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1237564 - Fix minor bug with a lexical declaration shadowing a non-configurable global. r=shu
--HG-- extra : rebase_source : d8c67ef94022fb06870f18e605c841f3447105f2
This commit is contained in:
parent
8c665083ad
commit
4c87c378bb
8
js/src/jit-test/tests/basic/bug1237564.js
Normal file
8
js/src/jit-test/tests/basic/bug1237564.js
Normal file
@ -0,0 +1,8 @@
|
||||
// |jit-test| error:ReferenceError: can't access lexical
|
||||
try {
|
||||
evaluate("let x = (() => { throw 3 })();");
|
||||
} catch(e) {
|
||||
assertEq(e, 3);
|
||||
}
|
||||
Object.defineProperty(this, "x", {});
|
||||
(function() { x = 3; })();
|
@ -2242,11 +2242,11 @@ BaselineCompiler::emit_JSOP_BINDGNAME()
|
||||
frame.push(ObjectValue(*globalLexical));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// We can bind name to the global object if the property exists on the
|
||||
// global and is non-configurable, as then it cannot be shadowed.
|
||||
if (Shape* shape = script->global().lookup(cx, name)) {
|
||||
} else if (Shape* shape = script->global().lookup(cx, name)) {
|
||||
// If the property does not currently exist on the global lexical
|
||||
// scope, we can bind name to the global object if the property
|
||||
// exists on the global and is non-configurable, as then it cannot
|
||||
// be shadowed.
|
||||
if (!shape->configurable()) {
|
||||
frame.push(ObjectValue(script->global()));
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user