Skip to content

Commit

Permalink
[ES6 modules] HRIM may return errored module until V8 forgets instant…
Browse files Browse the repository at this point in the history
…iation errors

Today, we are in somewhat stale state where new module tree fetching algorithm
[1][2] is partially applied. This CL (temporarily) disables an assert which
exists in the final algorithm, but doesn't hold today.

Specifically, the assert in HostResolveImportedModule (HRIM [3]) Step 7 currently
doesn't hold, as the instantiation may have failed for a module script node,
and current V8 implementation records the instantiation error as an error.
See the attached test case for an example.

[1] whatwg/html#2991
[2] tc39/ecma262#1006
[3] https://html.spec.whatwg.org/multipage/webappapis.html#hostresolveimportedmodule(referencingscriptormodule,-specifier)

Test: external/wpt/html/semantics/scripting-1/the-script-element/module/instantiation-error-8.html
Bug: 772750, 763597
Change-Id: Ida600598b658c74cdbda5937219f1e62a41f2a16
  • Loading branch information
nyaxt authored and chromium-wpt-export-bot committed Oct 11, 2017
1 parent dca46a0 commit f77d458
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<title>Handling of instantiation errors, 8</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- The below module tree should fail to instantiate, since it references undefined identifier. -->
<script type="module" src="instantiation-error-1.js"></script>
<script>
setup({allow_uncaught_exception: true});

promise_test(t => {
return new Promise(resolve => {
window.addEventListener("error", e => {
assert_equals(e.message, "Uncaught SyntaxError: The requested module does not provide an export named 'default'");
resolve();
}, { once: true });
}).then(() => new Promise(resolve => {
window.addEventListener("error", e => {
assert_equals(e.message, "Uncaught SyntaxError: The requested module does not provide an export named 'default'");
resolve();
}, { once: true });
// Load another module tree w/ previously instantiate-failed tree as its sub-tree.
document.head.appendChild(Object.assign(
document.createElement('script'),
{ type: 'module', innerText: 'import "./instantiation-error-1.js"'}));
}));
}, "Instantiate attempt on a tree w/ previously instantiate-failed tree as a sub-tree shouldn't crash.");
</script>

0 comments on commit f77d458

Please sign in to comment.