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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp

Issue 2819733002: Implement ModuleScript::RunScript() (Closed)
Patch Set: Rebase 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // TODO(kouhei): We currently don't have a code-path which use return value of 68 // TODO(kouhei): We currently don't have a code-path which use return value of
69 // EvaluateModule. Stop ignoring result once we have such path. 69 // EvaluateModule. Stop ignoring result once we have such path.
70 v8::Local<v8::Value> result; 70 v8::Local<v8::Value> result;
71 if (!V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate), 71 if (!V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate),
72 script_state->GetContext(), isolate) 72 script_state->GetContext(), isolate)
73 .ToLocal(&result)) { 73 .ToLocal(&result)) {
74 return; 74 return;
75 } 75 }
76 } 76 }
77 77
78 void ScriptModule::ReportException(ScriptState* script_state,
79 v8::Local<v8::Value> exception,
80 const String& file_name) {
81 v8::Isolate* isolate = script_state->GetIsolate();
82
83 v8::TryCatch try_catch(isolate);
84 try_catch.SetVerbose(true);
85
86 V8ScriptRunner::ReportExceptionForModule(isolate, exception, file_name);
87 }
88
78 Vector<String> ScriptModule::ModuleRequests(ScriptState* script_state) { 89 Vector<String> ScriptModule::ModuleRequests(ScriptState* script_state) {
79 if (IsNull()) 90 if (IsNull())
80 return Vector<String>(); 91 return Vector<String>();
81 92
82 v8::Local<v8::Module> module = module_->NewLocal(script_state->GetIsolate()); 93 v8::Local<v8::Module> module = module_->NewLocal(script_state->GetIsolate());
83 94
84 Vector<String> ret; 95 Vector<String> ret;
85 96
86 int length = module->GetModuleRequestsLength(); 97 int length = module->GetModuleRequestsLength();
87 ret.ReserveInitialCapacity(length); 98 ret.ReserveInitialCapacity(length);
(...skipping 20 matching lines...) Expand all
108 if (resolved.IsNull()) { 119 if (resolved.IsNull()) {
109 DCHECK(exception_state.HadException()); 120 DCHECK(exception_state.HadException());
110 return v8::MaybeLocal<v8::Module>(); 121 return v8::MaybeLocal<v8::Module>();
111 } 122 }
112 123
113 DCHECK(!exception_state.HadException()); 124 DCHECK(!exception_state.HadException());
114 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate)); 125 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate));
115 } 126 }
116 127
117 } // namespace blink 128 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698