| 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/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ret.push_back(toCoreString(v8Name)); | 77 ret.push_back(toCoreString(v8Name)); |
| 78 } | 78 } |
| 79 return ret; | 79 return ret; |
| 80 } | 80 } |
| 81 | 81 |
| 82 v8::MaybeLocal<v8::Module> ScriptModule::resolveModuleCallback( | 82 v8::MaybeLocal<v8::Module> ScriptModule::resolveModuleCallback( |
| 83 v8::Local<v8::Context> context, | 83 v8::Local<v8::Context> context, |
| 84 v8::Local<v8::String> specifier, | 84 v8::Local<v8::String> specifier, |
| 85 v8::Local<v8::Module> referrer) { | 85 v8::Local<v8::Module> referrer) { |
| 86 v8::Isolate* isolate = context->GetIsolate(); | 86 v8::Isolate* isolate = context->GetIsolate(); |
| 87 Modulator* modulator = V8PerContextData::from(context)->modulator(); | 87 Modulator* modulator = Modulator::from(V8PerContextData::from(context)); |
| 88 DCHECK(modulator); | 88 DCHECK(modulator); |
| 89 | 89 |
| 90 ScriptModule referrerRecord(isolate, referrer); | 90 ScriptModule referrerRecord(isolate, referrer); |
| 91 ExceptionState exceptionState(isolate, ExceptionState::ExecutionContext, | 91 ExceptionState exceptionState(isolate, ExceptionState::ExecutionContext, |
| 92 "ScriptModule", "resolveModuleCallback"); | 92 "ScriptModule", "resolveModuleCallback"); |
| 93 ScriptModule resolved = modulator->scriptModuleResolver()->resolve( | 93 ScriptModule resolved = modulator->scriptModuleResolver()->resolve( |
| 94 toCoreStringWithNullCheck(specifier), referrerRecord, exceptionState); | 94 toCoreStringWithNullCheck(specifier), referrerRecord, exceptionState); |
| 95 if (resolved.isNull()) { | 95 if (resolved.isNull()) { |
| 96 DCHECK(exceptionState.hadException()); | 96 DCHECK(exceptionState.hadException()); |
| 97 return v8::MaybeLocal<v8::Module>(); | 97 return v8::MaybeLocal<v8::Module>(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 DCHECK(!exceptionState.hadException()); | 100 DCHECK(!exceptionState.hadException()); |
| 101 return v8::MaybeLocal<v8::Module>(resolved.m_module->newLocal(isolate)); | 101 return v8::MaybeLocal<v8::Module>(resolved.m_module->newLocal(isolate)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |