From 1009aff2d6d032b8a819b48409ffcea6f089323d Mon Sep 17 00:00:00 2001 From: Kouhei Ueno Date: Wed, 11 Oct 2017 04:17:37 +0000 Subject: [PATCH] [ES6 modules] HRIM may return errored module until V8 forgets instantiation 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] https://github.com/whatwg/html/pull/2991 [2] https://github.com/tc39/ecma262/pull/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 Reviewed-on: https://chromium-review.googlesource.com/708078 Reviewed-by: Yutaka Hirano Reviewed-by: Kinuko Yasuda Commit-Queue: Kouhei Ueno Cr-Commit-Position: refs/heads/master@{#507888} --- .../module/instantiation-error-8.html | 27 +++++++++++++++++++ .../core/dom/ScriptModuleResolverImpl.cpp | 6 +++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/instantiation-error-8.html diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/instantiation-error-8.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/instantiation-error-8.html new file mode 100644 index 0000000000000..f84e325daa005 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/instantiation-error-8.html @@ -0,0 +1,27 @@ + +Handling of instantiation errors, 8 + + + + + diff --git a/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp b/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp index fa8413c1327b9..bd6ba69485a0b 100644 --- a/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp @@ -73,9 +73,11 @@ ScriptModule ScriptModuleResolverImpl::Resolve( // Step 6. Assert: resolved module script is a module script (i.e., is not // null or "fetching"). - // Step 7. Assert: resolved module script is not errored. DCHECK(module_script); - CHECK(!module_script->IsErrored()); + // Step 7. Assert: resolved module script is not errored. + // The below CHECK doesn't hold until V8 forgets about instantiation errors. + // TODO(hiroshige,kouhei): Re-introduce the below CHECK once V8 is updated. + // CHECK(!module_script->IsErrored()); // Step 8. Return resolved module script's module record. return module_script->Record();