| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |