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