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

Side by Side Diff: third_party/WebKit/Source/core/dom/ModuleScript.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/ModuleScript.h" 5 #include "core/dom/ModuleScript.h"
6 6
7 #include "bindings/core/v8/ScriptValue.h" 7 #include "bindings/core/v8/ScriptValue.h"
8 #include "core/dom/ScriptModuleResolver.h" 8 #include "core/dom/ScriptModuleResolver.h"
9 #include "platform/bindings/ScriptState.h" 9 #include "platform/bindings/ScriptState.h"
10 #include "v8/include/v8.h" 10 #include "v8/include/v8.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 ModuleScript* ModuleScript::Create( 14 ModuleScript* ModuleScript::Create(
15 const String& source_text, 15 const String& source_text,
16 Modulator* modulator, 16 Modulator* modulator,
17 const KURL& base_url, 17 const KURL& base_url,
18 const String& nonce, 18 const String& nonce,
19 ParserDisposition parser_state, 19 ParserDisposition parser_state,
20 WebURLRequest::FetchCredentialsMode credentials_mode, 20 WebURLRequest::FetchCredentialsMode credentials_mode,
21 AccessControlStatus access_control_status) { 21 AccessControlStatus access_control_status,
22 const TextPosition& start_position) {
22 // https://html.spec.whatwg.org/#creating-a-module-script 23 // https://html.spec.whatwg.org/#creating-a-module-script
23 // Step 1. Let script be a new module script that this algorithm will 24 // Step 1. Let script be a new module script that this algorithm will
24 // subsequently initialize. 25 // subsequently initialize.
25 // Step 2. Set script's settings object to the environment settings object 26 // Step 2. Set script's settings object to the environment settings object
26 // provided. 27 // provided.
27 // Note: "script's settings object" will be "modulator". 28 // Note: "script's settings object" will be "modulator".
28 29
29 // Delegate to Modulator::compileModule to process Steps 3-6. 30 // Delegate to Modulator::compileModule to process Steps 3-6.
30 ScriptModule result = modulator->CompileModule( 31 ScriptModule result = modulator->CompileModule(
31 source_text, base_url.GetString(), access_control_status); 32 source_text, base_url.GetString(), access_control_status, start_position);
32 // Step 6: "...return null, and abort these steps." 33 // Step 6: "...return null, and abort these steps."
33 if (result.IsNull()) 34 if (result.IsNull())
34 return nullptr; 35 return nullptr;
35 36
36 return CreateInternal(source_text, modulator, result, base_url, nonce, 37 return CreateInternal(source_text, modulator, result, base_url, nonce,
37 parser_state, credentials_mode); 38 parser_state, credentials_mode);
38 } 39 }
39 40
40 ModuleScript* ModuleScript::CreateInternal( 41 ModuleScript* ModuleScript::CreateInternal(
41 const String& source_text, 42 const String& source_text,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 127
127 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const { 128 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const {
128 settings_object_->ExecuteModule(this); 129 settings_object_->ExecuteModule(this);
129 } 130 }
130 131
131 String ModuleScript::InlineSourceTextForCSP() const { 132 String ModuleScript::InlineSourceTextForCSP() const {
132 return source_text_; 133 return source_text_;
133 } 134 }
134 135
135 } // namespace blink 136 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleScript.h ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698