Bug 1463373 - Throw rather than assert if buggy module resolve hook returns a module we didn't expect r=anba

This commit is contained in:
Jon Coppeard 2018-05-25 11:42:32 +01:00
parent 3659b3ea86
commit b95fd0ded3
2 changed files with 13 additions and 2 deletions

View File

@ -350,8 +350,8 @@ function InnerModuleInstantiation(module, stack, index)
}
// Step 3
assert(module.status === MODULE_STATUS_UNINSTANTIATED,
"Bad module status in ModuleDeclarationInstantiation");
if (module.status !== MODULE_STATUS_UNINSTANTIATED)
ThrowInternalError(JSMSG_BAD_MODULE_STATUS);
// Steps 4
ModuleSetStatus(module, MODULE_STATUS_INSTANTIATING);

View File

@ -0,0 +1,11 @@
// |jit-test| error: InternalError
let m = parseModule(`
let c = parseModule(\`
import "a";
\`);
c.declarationInstantiation();
`);
setModuleResolveHook(function(module, specifier) { return m; });
m.declarationInstantiation();
m.evaluation();