Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 exception_state.ThrowTypeError( | 61 exception_state.ThrowTypeError( |
| 62 "Failed to load module script for module specifier '" + specifier + | 62 "Failed to load module script for module specifier '" + specifier + |
| 63 "'"); | 63 "'"); |
| 64 return ScriptModule(); | 64 return ScriptModule(); |
| 65 } | 65 } |
| 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 // TODO(kouhei): Implement this path once | 71 ScriptValue error = modulator_->GetInstantiationError(module_script); |
| 72 // https://codereview.chromium.org/2782403002/ landed. | 72 exception_state.RethrowV8Exception(error.V8Value()); |
| 73 NOTIMPLEMENTED(); | |
| 74 return ScriptModule(); | 73 return ScriptModule(); |
| 75 } | 74 } |
| 76 | 75 |
| 77 // Step 6. Assert: resolved module script's instantiation state is | 76 // Step 6. Assert: resolved module script's instantiation state is |
| 78 // "instantiated" (and thus its module record is not null). | 77 // "instantiated" (and thus its module record is not null). |
| 79 // TODO(kouhei): Enable below check once once | 78 /* |
| 80 // https://codereview.chromium.org/2782403002/ landed. | 79 CHECK_EQ(module_script->InstantiationState(), |
| 81 // CHECK_EQ(moduleScript->instantiationState(), | 80 ModuleInstantiationState::kInstantiated) << "maybe cycles: " << modul e_script->BaseURL().GetString() << "referrer module " << referrer_module->BaseUR L().GetString(); |
|
kouhei (in TOK)
2017/04/26 13:03:44
As discussed in hangout, this assert doesn't hold
| |
| 82 // ModuleInstantiationState::Instantiated); | 81 */ |
| 82 ScriptModule record = module_script->Record(); | |
| 83 CHECK(!record.IsNull()); | |
| 83 | 84 |
| 84 // Step 7. Return resolved module script's module record. | 85 // Step 7. Return resolved module script's module record. |
| 85 return module_script->Record(); | 86 return record; |
| 86 } | 87 } |
| 87 | 88 |
| 88 DEFINE_TRACE(ScriptModuleResolverImpl) { | 89 DEFINE_TRACE(ScriptModuleResolverImpl) { |
| 89 ScriptModuleResolver::Trace(visitor); | 90 ScriptModuleResolver::Trace(visitor); |
| 90 visitor->Trace(record_to_module_script_map_); | 91 visitor->Trace(record_to_module_script_map_); |
| 91 visitor->Trace(modulator_); | 92 visitor->Trace(modulator_); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |