mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-29 17:40:42 +00:00
Bug 1394493 - Check for uninitialised lexicals in getModuleEnvironmentValue() r=arai
This commit is contained in:
parent
47659f1db3
commit
f624c0f438
@ -3979,7 +3979,15 @@ GetModuleEnvironmentValue(JSContext* cx, unsigned argc, Value* vp)
|
||||
if (!JS_StringToId(cx, name, &id))
|
||||
return false;
|
||||
|
||||
return GetProperty(cx, env, env, id, args.rval());
|
||||
if (!GetProperty(cx, env, env, id, args.rval()))
|
||||
return false;
|
||||
|
||||
if (args.rval().isMagic(JS_UNINITIALIZED_LEXICAL)) {
|
||||
ReportRuntimeLexicalError(cx, JSMSG_UNINITIALIZED_LEXICAL, id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
4
js/src/jit-test/tests/modules/bug1394493.js
Normal file
4
js/src/jit-test/tests/modules/bug1394493.js
Normal file
@ -0,0 +1,4 @@
|
||||
// |jit-test| error: ReferenceError
|
||||
|
||||
let m = parseModule("export let r = y; y = 4;");
|
||||
getModuleEnvironmentValue(m, "r").toString()
|
Loading…
x
Reference in New Issue
Block a user