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 "core/dom/ModuleScript.h" | 5 #include "core/dom/ModuleScript.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 void ModuleScript::setInstantiationError(v8::Isolate* isolate, | 9 void ModuleScript::setInstantiationError(v8::Isolate* isolate, |
10 v8::Local<v8::Value> error) { | 10 v8::Local<v8::Value> error) { |
11 DCHECK_EQ(m_instantiationState, ModuleInstantiationState::Uninstantiated); | 11 DCHECK_EQ(m_instantiationState, ModuleInstantiationState::Uninstantiated); |
12 m_instantiationState = ModuleInstantiationState::Errored; | 12 m_instantiationState = ModuleInstantiationState::Errored; |
13 | 13 |
14 DCHECK(!error.IsEmpty()); | 14 DCHECK(!error.IsEmpty()); |
15 m_instantiationError.set(isolate, error); | 15 m_instantiationError.set(isolate, error); |
16 } | 16 } |
17 | 17 |
18 void ModuleScript::setInstantiationSuccess() { | 18 void ModuleScript::setInstantiationSuccess() { |
19 DCHECK_EQ(m_instantiationState, ModuleInstantiationState::Uninstantiated); | 19 DCHECK_EQ(m_instantiationState, ModuleInstantiationState::Uninstantiated); |
20 m_instantiationState = ModuleInstantiationState::Instantiated; | 20 m_instantiationState = ModuleInstantiationState::Instantiated; |
21 } | 21 } |
22 | 22 |
23 DEFINE_TRACE(ModuleScript) {} | 23 DEFINE_TRACE(ModuleScript) { |
| 24 Script::trace(visitor); |
| 25 } |
24 DEFINE_TRACE_WRAPPERS(ModuleScript) { | 26 DEFINE_TRACE_WRAPPERS(ModuleScript) { |
25 visitor->traceWrappers(m_instantiationError); | 27 visitor->traceWrappers(m_instantiationError); |
26 } | 28 } |
27 | 29 |
| 30 bool ModuleScript::isEmpty() const { |
| 31 return false; |
| 32 } |
| 33 |
| 34 bool ModuleScript::checkMIMETypeBeforeRunScript(Document* contextDocument, |
| 35 const SecurityOrigin*) const { |
| 36 // We don't check MIME type here because we check the MIME type in |
| 37 // ModuleScriptLoader::wasModuleLoadSuccessful(). |
| 38 return true; |
| 39 } |
| 40 |
| 41 void ModuleScript::runScript(LocalFrame* frame, const SecurityOrigin*) const { |
| 42 // TODO(hiroshige): Implement this once Modulator::executeModule() is landed. |
| 43 NOTREACHED(); |
| 44 } |
| 45 |
| 46 String ModuleScript::inlineSourceTextForCSP() const { |
| 47 // Currently we don't support inline module scripts. |
| 48 // TODO(hiroshige): Implement this. |
| 49 NOTREACHED(); |
| 50 return String(); |
| 51 } |
| 52 |
28 } // namespace blink | 53 } // namespace blink |
OLD | NEW |