Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp

Issue 2837253002: [ES6 modules] Rethrow instantiation error when attempt to resolve instantiation failed module. (Closed)
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 CHECK_EQ(module_script->InstantiationState(),
80 // https://codereview.chromium.org/2782403002/ landed. 79 ModuleInstantiationState::kInstantiated);
81 // CHECK_EQ(moduleScript->instantiationState(), 80 ScriptModule record = module_script->Record();
82 // ModuleInstantiationState::Instantiated); 81 CHECK(!record.IsNull());
83 82
84 // Step 7. Return resolved module script's module record. 83 // Step 7. Return resolved module script's module record.
85 return module_script->Record(); 84 return record;
86 } 85 }
87 86
88 DEFINE_TRACE(ScriptModuleResolverImpl) { 87 DEFINE_TRACE(ScriptModuleResolverImpl) {
89 ScriptModuleResolver::Trace(visitor); 88 ScriptModuleResolver::Trace(visitor);
90 visitor->Trace(record_to_module_script_map_); 89 visitor->Trace(record_to_module_script_map_);
91 visitor->Trace(modulator_); 90 visitor->Trace(modulator_);
92 } 91 }
93 92
94 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleScript.h ('k') | third_party/WebKit/Source/core/dom/ScriptModuleResolverImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698