зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1406452 - Check for errored modules in builtin testing functions r=evilpie
This commit is contained in:
Родитель
3c1db04027
Коммит
a830e07d00
|
@ -4241,10 +4241,8 @@ SetRNGState(JSContext* cx, unsigned argc, Value* vp)
|
|||
#endif
|
||||
|
||||
static ModuleEnvironmentObject*
|
||||
GetModuleEnvironment(JSContext* cx, HandleValue moduleValue)
|
||||
GetModuleEnvironment(JSContext* cx, HandleModuleObject module)
|
||||
{
|
||||
RootedModuleObject module(cx, &moduleValue.toObject().as<ModuleObject>());
|
||||
|
||||
// Use the initial environment so that tests can check bindings exists
|
||||
// before they have been instantiated.
|
||||
RootedModuleEnvironmentObject env(cx, &module->initialEnvironment());
|
||||
|
@ -4268,7 +4266,13 @@ GetModuleEnvironmentNames(JSContext* cx, unsigned argc, Value* vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
RootedModuleEnvironmentObject env(cx, GetModuleEnvironment(cx, args[0]));
|
||||
RootedModuleObject module(cx, &args[0].toObject().as<ModuleObject>());
|
||||
if (module->status() == MODULE_STATUS_ERRORED) {
|
||||
JS_ReportErrorASCII(cx, "Module environment unavailable");
|
||||
return false;
|
||||
}
|
||||
|
||||
RootedModuleEnvironmentObject env(cx, GetModuleEnvironment(cx, module));
|
||||
Rooted<IdVector> ids(cx, IdVector(cx));
|
||||
if (!JS_Enumerate(cx, env, &ids))
|
||||
return false;
|
||||
|
@ -4305,7 +4309,13 @@ GetModuleEnvironmentValue(JSContext* cx, unsigned argc, Value* vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
RootedModuleEnvironmentObject env(cx, GetModuleEnvironment(cx, args[0]));
|
||||
RootedModuleObject module(cx, &args[0].toObject().as<ModuleObject>());
|
||||
if (module->status() == MODULE_STATUS_ERRORED) {
|
||||
JS_ReportErrorASCII(cx, "Module environment unavailable");
|
||||
return false;
|
||||
}
|
||||
|
||||
RootedModuleEnvironmentObject env(cx, GetModuleEnvironment(cx, module));
|
||||
RootedString name(cx, args[1].toString());
|
||||
RootedId id(cx);
|
||||
if (!JS_StringToId(cx, name, &id))
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// |jit-test| error: Error
|
||||
let m = parseModule(`for (var x of iterator) {}`);
|
||||
m.declarationInstantiation();
|
||||
try { m.evaluation(); } catch (e) {}
|
||||
getModuleEnvironmentValue(m, "r");
|
Загрузка…
Ссылка в новой задаче