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

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

Issue 2819733002: Implement ModuleScript::RunScript() (Closed)
Patch Set: 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 "bindings/core/v8/ScriptModule.h" 5 #include "bindings/core/v8/ScriptModule.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool success = module_->NewLocal(script_state->GetIsolate()) 48 bool success = module_->NewLocal(script_state->GetIsolate())
49 ->Instantiate(context, &ResolveModuleCallback); 49 ->Instantiate(context, &ResolveModuleCallback);
50 if (!success) { 50 if (!success) {
51 DCHECK(try_catch.HasCaught()); 51 DCHECK(try_catch.HasCaught());
52 return ScriptValue(script_state, try_catch.Exception()); 52 return ScriptValue(script_state, try_catch.Exception());
53 } 53 }
54 DCHECK(!try_catch.HasCaught()); 54 DCHECK(!try_catch.HasCaught());
55 return ScriptValue(); 55 return ScriptValue();
56 } 56 }
57 57
58 void ScriptModule::Evaluate(ScriptState* script_state) { 58 void ScriptModule::Evaluate(ScriptState* script_state) const {
59 v8::Isolate* isolate = script_state->GetIsolate(); 59 v8::Isolate* isolate = script_state->GetIsolate();
60 v8::TryCatch try_catch(isolate); 60 v8::TryCatch try_catch(isolate);
61 try_catch.SetVerbose(true); 61 try_catch.SetVerbose(true);
62 v8::Local<v8::Value> result; 62 v8::Local<v8::Value> result;
63 if (!V8Call( 63 if (!V8Call(
64 V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate), 64 V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate),
65 script_state->GetContext(), isolate), 65 script_state->GetContext(), isolate),
66 result, try_catch)) { 66 result, try_catch)) {
67 // TODO(adamk): report error 67 // TODO(adamk): report error
68 } 68 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (resolved.IsNull()) { 101 if (resolved.IsNull()) {
102 DCHECK(exception_state.HadException()); 102 DCHECK(exception_state.HadException());
103 return v8::MaybeLocal<v8::Module>(); 103 return v8::MaybeLocal<v8::Module>();
104 } 104 }
105 105
106 DCHECK(!exception_state.HadException()); 106 DCHECK(!exception_state.HadException());
107 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate)); 107 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate));
108 } 108 }
109 109
110 } // namespace blink 110 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698