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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptModule.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 "bindings/core/v8/ScriptModule.h" 5 #include "bindings/core/v8/ScriptModule.h"
6 6
7 #include "bindings/core/v8/V8BindingForCore.h" 7 #include "bindings/core/v8/V8BindingForCore.h"
8 #include "core/dom/Modulator.h" 8 #include "core/dom/Modulator.h"
9 #include "core/dom/ScriptModuleResolver.h" 9 #include "core/dom/ScriptModuleResolver.h"
10 10
(...skipping 20 matching lines...) Expand all
31 CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); 31 CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
32 32
33 DCHECK(!module_->IsEmpty()); 33 DCHECK(!module_->IsEmpty());
34 } 34 }
35 35
36 ScriptModule::~ScriptModule() {} 36 ScriptModule::~ScriptModule() {}
37 37
38 ScriptModule ScriptModule::Compile(v8::Isolate* isolate, 38 ScriptModule ScriptModule::Compile(v8::Isolate* isolate,
39 const String& source, 39 const String& source,
40 const String& file_name, 40 const String& file_name,
41 AccessControlStatus access_control_status) { 41 AccessControlStatus access_control_status,
42 const TextPosition& start_position) {
42 // We ensure module-related code is not executed without the flag. 43 // We ensure module-related code is not executed without the flag.
43 // https://crbug.com/715376 44 // https://crbug.com/715376
44 CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); 45 CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
45 46
46 v8::TryCatch try_catch(isolate); 47 v8::TryCatch try_catch(isolate);
47 try_catch.SetVerbose(true); 48 try_catch.SetVerbose(true);
48 v8::Local<v8::Module> module; 49 v8::Local<v8::Module> module;
49 if (!V8ScriptRunner::CompileModule(isolate, source, file_name, 50 if (!V8ScriptRunner::CompileModule(isolate, source, file_name,
50 access_control_status) 51 access_control_status, start_position)
51 .ToLocal(&module)) { 52 .ToLocal(&module)) {
52 // Compilation error is not used in Blink implementaion logic. 53 // Compilation error is not used in Blink implementaion logic.
53 // Note: Error message is delivered to user (e.g. console) by message 54 // Note: Error message is delivered to user (e.g. console) by message
54 // listeners set on v8::Isolate. See V8Initializer::initalizeMainThread(). 55 // listeners set on v8::Isolate. See V8Initializer::initalizeMainThread().
55 // TODO(nhiroki): Revisit this when supporting modules on worker threads. 56 // TODO(nhiroki): Revisit this when supporting modules on worker threads.
56 DCHECK(try_catch.HasCaught()); 57 DCHECK(try_catch.HasCaught());
57 return ScriptModule(); 58 return ScriptModule();
58 } 59 }
59 DCHECK(!try_catch.HasCaught()); 60 DCHECK(!try_catch.HasCaught());
60 return ScriptModule(isolate, module); 61 return ScriptModule(isolate, module);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (resolved.IsNull()) { 149 if (resolved.IsNull()) {
149 DCHECK(exception_state.HadException()); 150 DCHECK(exception_state.HadException());
150 return v8::MaybeLocal<v8::Module>(); 151 return v8::MaybeLocal<v8::Module>();
151 } 152 }
152 153
153 DCHECK(!exception_state.HadException()); 154 DCHECK(!exception_state.HadException());
154 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate)); 155 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate));
155 } 156 }
156 157
157 } // namespace blink 158 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptModule.h ('k') | third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698