Bug 1499140 - Add OOM tests for shell dynamic module import and fix bugs r=jandem

This commit is contained in:
Jon Coppeard 2018-10-22 11:28:17 +01:00
Родитель 7901f411b6
Коммит 0df5d53830
2 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -299,16 +299,17 @@ function ModuleInstantiate()
} catch (error) {
for (let i = 0; i < stack.length; i++) {
let m = stack[i];
assert(m.status === MODULE_STATUS_INSTANTIATING,
"Expected instantiating status during failed instantiation");
HandleModuleInstantiationFailure(m);
if (m.status === MODULE_STATUS_INSTANTIATING) {
HandleModuleInstantiationFailure(m);
}
}
// Handle OOM when appending to the stack or over-recursion errors.
if (stack.length === 0)
if (stack.length === 0 && module.status === MODULE_STATUS_INSTANTIATING) {
HandleModuleInstantiationFailure(module);
}
assert(module.status === MODULE_STATUS_UNINSTANTIATED,
assert(module.status !== MODULE_STATUS_INSTANTIATING,
"Expected uninstantiated status after failed instantiation");
throw error;

Просмотреть файл

@ -0,0 +1,4 @@
// |jit-test| skip-if: !('oomTest' in this)
oomTest(() => import("module1.js"));
oomTest(() => import("cyclicImport1.js"));