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

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

Issue 2885203006: [DevTools] inline modules should have correct text offset (Closed)
Patch Set: a Created 3 years, 7 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/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/dom/ModuleMap.h" 8 #include "core/dom/ModuleMap.h"
9 #include "core/dom/ModuleScript.h" 9 #include "core/dom/ModuleScript.h"
10 #include "core/dom/ScriptModuleResolverImpl.h" 10 #include "core/dom/ScriptModuleResolverImpl.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return map_->GetFetchedModuleScript(url); 111 return map_->GetFetchedModuleScript(url);
112 } 112 }
113 113
114 bool ModulatorImpl::HasValidContext() { 114 bool ModulatorImpl::HasValidContext() {
115 return script_state_->ContextIsValid(); 115 return script_state_->ContextIsValid();
116 } 116 }
117 117
118 ScriptModule ModulatorImpl::CompileModule( 118 ScriptModule ModulatorImpl::CompileModule(
119 const String& provided_source, 119 const String& provided_source,
120 const String& url_str, 120 const String& url_str,
121 AccessControlStatus access_control_status) { 121 AccessControlStatus access_control_status,
122 const TextPosition& position) {
122 // Implements Steps 3-6 of 123 // Implements Steps 3-6 of
123 // https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-module-sc ript 124 // https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-module-sc ript
124 125
125 // Step 3. Let realm be the provided environment settings object's Realm. 126 // Step 3. Let realm be the provided environment settings object's Realm.
126 // Note: Realm is v8::Context. 127 // Note: Realm is v8::Context.
127 128
128 // Step 4. If scripting is disabled for the given environment settings 129 // Step 4. If scripting is disabled for the given environment settings
129 // object's responsible browsing context, then let script source be the empty 130 // object's responsible browsing context, then let script source be the empty
130 // string. Otherwise, let script source be the provided script source. 131 // string. Otherwise, let script source be the provided script source.
131 String script_source; 132 String script_source;
132 if (GetExecutionContext()->CanExecuteScripts(kAboutToExecuteScript)) 133 if (GetExecutionContext()->CanExecuteScripts(kAboutToExecuteScript))
133 script_source = provided_source; 134 script_source = provided_source;
134 135
135 // Step 5. Let result be ParseModule(script source, realm, script). 136 // Step 5. Let result be ParseModule(script source, realm, script).
136 // Step 6. If result is a List of errors, report the exception given by the 137 // Step 6. If result is a List of errors, report the exception given by the
137 // first element of result for script, return null, and abort these steps. 138 // first element of result for script, return null, and abort these steps.
138 // Note: reporting is routed via V8Initializer::messageHandlerInMainThread. 139 // Note: reporting is routed via V8Initializer::messageHandlerInMainThread.
139 ScriptState::Scope scope(script_state_.Get()); 140 ScriptState::Scope scope(script_state_.Get());
140 return ScriptModule::Compile(script_state_->GetIsolate(), script_source, 141 return ScriptModule::Compile(script_state_->GetIsolate(), script_source,
141 url_str, access_control_status); 142 url_str, access_control_status, position);
142 } 143 }
143 144
144 ScriptValue ModulatorImpl::InstantiateModule(ScriptModule script_module) { 145 ScriptValue ModulatorImpl::InstantiateModule(ScriptModule script_module) {
145 ScriptState::Scope scope(script_state_.Get()); 146 ScriptState::Scope scope(script_state_.Get());
146 return script_module.Instantiate(script_state_.Get()); 147 return script_module.Instantiate(script_state_.Get());
147 } 148 }
148 149
149 ScriptValue ModulatorImpl::GetInstantiationError( 150 ScriptValue ModulatorImpl::GetInstantiationError(
150 const ModuleScript* module_script) { 151 const ModuleScript* module_script) {
151 ScriptState::Scope scope(script_state_.Get()); 152 ScriptState::Scope scope(script_state_.Get());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 visitor->Trace(loader_registry_); 219 visitor->Trace(loader_registry_);
219 visitor->Trace(tree_linker_registry_); 220 visitor->Trace(tree_linker_registry_);
220 visitor->Trace(script_module_resolver_); 221 visitor->Trace(script_module_resolver_);
221 } 222 }
222 223
223 DEFINE_TRACE_WRAPPERS(ModulatorImpl) { 224 DEFINE_TRACE_WRAPPERS(ModulatorImpl) {
224 visitor->TraceWrappers(map_); 225 visitor->TraceWrappers(map_);
225 } 226 }
226 227
227 } // namespace blink 228 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModulatorImpl.h ('k') | third_party/WebKit/Source/core/dom/ModuleScript.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698