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/ScriptModuleResolverImpl.h" | 5 #include "core/dom/ScriptModuleResolverImpl.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptModule.h" | 7 #include "bindings/core/v8/ScriptModule.h" |
8 #include "core/dom/Modulator.h" | 8 #include "core/dom/Modulator.h" |
9 #include "core/dom/ModuleScript.h" | 9 #include "core/dom/ModuleScript.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Step 5. If resolved module script's instantiation state is "errored", then | 67 // Step 5. If resolved module script's instantiation state is "errored", then |
68 // throw resolved module script's instantiation error. | 68 // throw resolved module script's instantiation error. |
69 if (module_script->InstantiationState() == | 69 if (module_script->InstantiationState() == |
70 ModuleInstantiationState::kErrored) { | 70 ModuleInstantiationState::kErrored) { |
71 ScriptValue error = modulator_->GetInstantiationError(module_script); | 71 ScriptValue error = modulator_->GetInstantiationError(module_script); |
72 exception_state.RethrowV8Exception(error.V8Value()); | 72 exception_state.RethrowV8Exception(error.V8Value()); |
73 return ScriptModule(); | 73 return ScriptModule(); |
74 } | 74 } |
75 | 75 |
76 // Step 6. Assert: resolved module script's instantiation state is | 76 // Step 6. Assert: resolved module script's module record is not null. |
77 // "instantiated" (and thus its module record is not null). | |
78 CHECK_EQ(module_script->InstantiationState(), | |
79 ModuleInstantiationState::kInstantiated); | |
80 ScriptModule record = module_script->Record(); | 77 ScriptModule record = module_script->Record(); |
81 CHECK(!record.IsNull()); | 78 CHECK(!record.IsNull()); |
82 | 79 |
83 // Step 7. Return resolved module script's module record. | 80 // Step 7. Return resolved module script's module record. |
84 return record; | 81 return record; |
85 } | 82 } |
86 | 83 |
87 DEFINE_TRACE(ScriptModuleResolverImpl) { | 84 DEFINE_TRACE(ScriptModuleResolverImpl) { |
88 ScriptModuleResolver::Trace(visitor); | 85 ScriptModuleResolver::Trace(visitor); |
89 visitor->Trace(record_to_module_script_map_); | 86 visitor->Trace(record_to_module_script_map_); |
90 visitor->Trace(modulator_); | 87 visitor->Trace(modulator_); |
91 } | 88 } |
92 | 89 |
93 } // namespace blink | 90 } // namespace blink |
OLD | NEW |