Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/WebKit/Source/core/dom/ModulatorImpl.cpp

Issue 2781713003: Enable module scripts in ScriptLoader (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/ModulatorImpl.h" 5 #include "core/dom/ModulatorImpl.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/ModuleMap.h" 9 #include "core/dom/ModuleMap.h"
10 #include "core/dom/ModuleScript.h" 10 #include "core/dom/ModuleScript.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ScriptState::Scope scope(script_state_.Get()); 152 ScriptState::Scope scope(script_state_.Get());
153 153
154 // 3. "If s's instantiation state is "errored", then report the exception 154 // 3. "If s's instantiation state is "errored", then report the exception
155 // given by s's instantiation error for s and abort these steps." 155 // given by s's instantiation error for s and abort these steps."
156 ModuleInstantiationState instantiationState = 156 ModuleInstantiationState instantiationState =
157 module_script->InstantiationState(); 157 module_script->InstantiationState();
158 if (instantiationState == ModuleInstantiationState::kErrored) { 158 if (instantiationState == ModuleInstantiationState::kErrored) {
159 v8::Isolate* isolate = script_state_->GetIsolate(); 159 v8::Isolate* isolate = script_state_->GetIsolate();
160 ScriptModule::ReportException( 160 ScriptModule::ReportException(
161 script_state_.Get(), module_script->CreateInstantiationError(isolate), 161 script_state_.Get(), module_script->CreateInstantiationError(isolate),
162 "FOXME.js"); 162 module_script->BaseURL().GetString());
163 return; 163 return;
164 } 164 }
165 165
166 // 4. "Assert: s's instantiation state is "instantiated" (and thus its 166 // 4. "Assert: s's instantiation state is "instantiated" (and thus its
167 // module record is not null)." 167 // module record is not null)."
168 CHECK_EQ(instantiationState, ModuleInstantiationState::kInstantiated); 168 CHECK_EQ(instantiationState, ModuleInstantiationState::kInstantiated);
169 169
170 // 5. "Let record be s's module record." 170 // 5. "Let record be s's module record."
171 const ScriptModule& record = module_script->Record(); 171 const ScriptModule& record = module_script->Record();
172 CHECK(!record.IsNull()); 172 CHECK(!record.IsNull());
173 173
174 // 6.--9.? 174 // 6.--9.?
175 record.Evaluate(script_state_.Get()); 175 record.Evaluate(script_state_.Get());
176 } 176 }
177 177
178 DEFINE_TRACE(ModulatorImpl) { 178 DEFINE_TRACE(ModulatorImpl) {
179 Modulator::Trace(visitor); 179 Modulator::Trace(visitor);
180 visitor->Trace(fetcher_); 180 visitor->Trace(fetcher_);
181 visitor->Trace(map_); 181 visitor->Trace(map_);
182 visitor->Trace(loader_registry_); 182 visitor->Trace(loader_registry_);
183 visitor->Trace(tree_linker_registry_); 183 visitor->Trace(tree_linker_registry_);
184 visitor->Trace(script_module_resolver_); 184 visitor->Trace(script_module_resolver_);
185 } 185 }
186 186
187 DEFINE_TRACE_WRAPPERS(ModulatorImpl) { 187 DEFINE_TRACE_WRAPPERS(ModulatorImpl) {
188 visitor->TraceWrappers(map_); 188 visitor->TraceWrappers(map_);
189 } 189 }
190 190
191 } // namespace blink 191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698