Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ModulatorImpl.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp b/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp |
| index e958a6c8683d2c388cc49d05e9c593f9df2b1bf1..51f492a00337f8e95532c364e3590ae0b0a45f40 100644 |
| --- a/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp |
| +++ b/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp |
| @@ -134,9 +134,31 @@ Vector<String> ModulatorImpl::ModuleRequestsFromScriptModule( |
| return script_module.ModuleRequests(script_state_.Get()); |
| } |
| -void ModulatorImpl::ExecuteModule(ScriptModule script_module) { |
| +void ModulatorImpl::ExecuteModule(const ModuleScript* module_script) { |
| + // https://html.spec.whatwg.org/#run-a-module-script |
|
hiroshige
2017/04/13 23:55:19
TODO: Add a comment for Step 1:
"Let settings be t
kouhei (in TOK)
2017/04/17 07:31:53
We need to check https://cs.chromium.org/chromium/
hiroshige
2017/04/26 00:50:03
Done.
|
| ScriptState::Scope scope(script_state_.Get()); |
| - script_module.Evaluate(script_state_.Get()); |
| + |
| + // 3. "If s's instantiation state is "errored", then report the exception |
| + // given by s's instantiation error for s and abort these steps." |
| + if (module_script->InstantiationState() == |
| + ModuleInstantiationState::kErrored) { |
| + v8::Isolate* isolate = script_state_->GetIsolate(); |
| + V8ThrowException::ThrowException( |
| + isolate, module_script->CreateInstantiationError(isolate)); |
|
hiroshige
2017/04/13 23:55:19
Note: this code path is totally not tested and thu
hiroshige
2017/04/26 00:50:03
Is tested with a layout test errored.html in
https
|
| + return; |
| + } |
| + |
| + // 4. "Assert: s's instantiation state is "instantiated" (and thus its |
| + // module record is not null)." |
| + CHECK_EQ(module_script->InstantiationState(), |
| + ModuleInstantiationState::kInstantiated); |
| + |
| + // 5. "Let record be s's module record." |
| + const ScriptModule& record = module_script->Record(); |
| + CHECK(!record.IsNull()); |
| + |
| + // 6.--9.? |
| + record.Evaluate(script_state_.Get()); |
| } |
| DEFINE_TRACE(ModulatorImpl) { |