 Chromium Code Reviews
 Chromium Code Reviews Issue 2823803003:
  [ES6 modules] Introduce ModuleTreeLinker  (Closed)
    
  
    Issue 2823803003:
  [ES6 modules] Introduce ModuleTreeLinker  (Closed) 
  | Index: third_party/WebKit/Source/core/dom/ModuleScript.cpp | 
| diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.cpp b/third_party/WebKit/Source/core/dom/ModuleScript.cpp | 
| index f175cd9c670962af74f915049f637d9ce2e2ef89..7a6c6846746589e37bac6eb4235085e589b2f089 100644 | 
| --- a/third_party/WebKit/Source/core/dom/ModuleScript.cpp | 
| +++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp | 
| @@ -4,18 +4,34 @@ | 
| #include "core/dom/ModuleScript.h" | 
| +#include "bindings/core/v8/ScriptState.h" | 
| + | 
| namespace blink { | 
| -void ModuleScript::SetInstantiationError(v8::Isolate* isolate, | 
| - v8::Local<v8::Value> error) { | 
| +void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) { | 
| + // Implements Step 7.1 of: | 
| + // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure | 
| + | 
| + // "set script's instantiation state to "errored", ..." | 
| DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); | 
| instantiation_state_ = ModuleInstantiationState::kErrored; | 
| + // "its instantiation error to instantiationStatus.[[Value]], and ..." | 
| DCHECK(!error.IsEmpty()); | 
| - instantiation_error_.Set(isolate, error); | 
| + { | 
| + ScriptState::Scope scope(error.GetScriptState()); | 
| 
yhirano
2017/04/18 04:17:48
Is this ScriptState::Scope really needed? Is just
 
kouhei (in TOK)
2017/04/18 06:20:09
Done.
 | 
| + instantiation_error_.Set(error.GetIsolate(), error.V8Value()); | 
| + } | 
| + | 
| + // "its module record to null." | 
| + record_ = ScriptModule(); | 
| } | 
| void ModuleScript::SetInstantiationSuccess() { | 
| + // Implements Step 7.2 of: | 
| + // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure | 
| + | 
| + // "set script's instantiation state to "instantiated"." | 
| DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); | 
| instantiation_state_ = ModuleInstantiationState::kInstantiated; | 
| } |