| 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 33362773ea16c138c8d30fc7a425043ad4fda375..51f492a00337f8e95532c364e3590ae0b0a45f40 100644
|
| --- a/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp
|
| @@ -134,6 +134,33 @@ Vector<String> ModulatorImpl::ModuleRequestsFromScriptModule(
|
| return script_module.ModuleRequests(script_state_.Get());
|
| }
|
|
|
| +void ModulatorImpl::ExecuteModule(const ModuleScript* module_script) {
|
| + // https://html.spec.whatwg.org/#run-a-module-script
|
| + ScriptState::Scope scope(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));
|
| + 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) {
|
| Modulator::Trace(visitor);
|
| visitor->Trace(execution_context_);
|
|
|