Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

Commit

Permalink
[ES6 modules] ModulatorImpl::ExecuteModule should report error acquir…
Browse files Browse the repository at this point in the history
…ed via GetError

Before this CL, ExecuteModule reported error acquired via
ModuleScript::GetErrorInternal. This is not always correct after
40485cc. ModuleScript::GetErrorInternal only
refers to preinstantiation errors, and we may have errors stored inside
module records as [[ErrorCompletion]] field's [[Value]].

This CL corrects ExecuteModule to report the appropriate error by using error
acquired by ModulatorImpl::GetError, which correctly implements the
"#concept-module-script-error" spec concept.

This is tested by wpt/html/semantics/scripting-1/the-script-element/module/evaluation-error-*.html.
However the wpt tests don't pass until we have updated

Bug: 594639, 727299, whatwg/html#2674 , tc39/ecma262#916
Change-Id: I97de9762bfad58e1f1b71bedf524761e53d43158
Reviewed-on: https://chromium-review.googlesource.com/558725
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#483908}
  • Loading branch information
nyaxt authored and Commit Bot committed Jul 1, 2017
1 parent a2fd00a commit 6614832
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions third_party/WebKit/Source/core/dom/ModulatorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ void ModulatorImpl::ExecuteModule(const ModuleScript* module_script) {
// Step 3. "If s is errored, then report the exception given by s's error for
// s and abort these steps." [spec text]
if (module_script->IsErrored()) {
v8::Isolate* isolate = script_state_->GetIsolate();
ScriptModule::ReportException(
script_state_.Get(), module_script->CreateErrorInternal(isolate),
module_script->BaseURL().GetString(), module_script->StartPosition());
ScriptValue error = GetError(module_script);
ScriptModule::ReportException(script_state_.Get(), error.V8Value(),
module_script->BaseURL().GetString(),
module_script->StartPosition());
return;
}

Expand Down

0 comments on commit 6614832

Please sign in to comment.