mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1237564 - Fix minor bug with a lexical declaration shadowing a non-configurable global. r=shu
This commit is contained in:
parent
5a56ed2e29
commit
43adf056d6
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