| OLD | NEW |
| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (!V8Call( | 71 if (!V8Call( |
| 72 V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate), | 72 V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate), |
| 73 script_state->GetContext(), isolate), | 73 script_state->GetContext(), isolate), |
| 74 result, try_catch)) { | 74 result, try_catch)) { |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ScriptModule::ReportException(ScriptState* script_state, |
| 80 v8::Local<v8::Value> exception, |
| 81 const String& file_name) { |
| 82 v8::Isolate* isolate = script_state->GetIsolate(); |
| 83 |
| 84 v8::TryCatch try_catch(isolate); |
| 85 try_catch.SetVerbose(true); |
| 86 |
| 87 V8ScriptRunner::ReportExceptionForModule(isolate, exception, file_name); |
| 88 } |
| 89 |
| 79 Vector<String> ScriptModule::ModuleRequests(ScriptState* script_state) { | 90 Vector<String> ScriptModule::ModuleRequests(ScriptState* script_state) { |
| 80 if (IsNull()) | 91 if (IsNull()) |
| 81 return Vector<String>(); | 92 return Vector<String>(); |
| 82 | 93 |
| 83 v8::Local<v8::Module> module = module_->NewLocal(script_state->GetIsolate()); | 94 v8::Local<v8::Module> module = module_->NewLocal(script_state->GetIsolate()); |
| 84 | 95 |
| 85 Vector<String> ret; | 96 Vector<String> ret; |
| 86 | 97 |
| 87 int length = module->GetModuleRequestsLength(); | 98 int length = module->GetModuleRequestsLength(); |
| 88 ret.ReserveInitialCapacity(length); | 99 ret.ReserveInitialCapacity(length); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 109 if (resolved.IsNull()) { | 120 if (resolved.IsNull()) { |
| 110 DCHECK(exception_state.HadException()); | 121 DCHECK(exception_state.HadException()); |
| 111 return v8::MaybeLocal<v8::Module>(); | 122 return v8::MaybeLocal<v8::Module>(); |
| 112 } | 123 } |
| 113 | 124 |
| 114 DCHECK(!exception_state.HadException()); | 125 DCHECK(!exception_state.HadException()); |
| 115 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate)); | 126 return v8::MaybeLocal<v8::Module>(resolved.module_->NewLocal(isolate)); |
| 116 } | 127 } |
| 117 | 128 |
| 118 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |