| Index: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
|
| diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
|
| index baceb7eedd23f10e52a9ea52e7ffd19e0cf300e0..8a904b112ea8bc0ad2af6e157ad7480fd26cb69c 100644
|
| --- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
|
| @@ -265,12 +265,23 @@ void ModuleTreeLinker::FetchDescendants() {
|
| return;
|
| }
|
|
|
| - // Step 4.3. Otherwise, if ancestor list does not contain url, append url to
|
| - // urls.
|
| -
|
| // Modulator::resolveModuleSpecifier() impl must return either a valid url
|
| // or null.
|
| CHECK(url.IsValid());
|
| +
|
| + // [nospec, optimization]
|
| + // If we can already resolve the descendant module script from
|
| + // the module map at this point, we can skip "internal module script
|
| + // graph fetching procedure" for the descendant.
|
| + if (ModuleScript* script = modulator_->GetFetchedModuleScript(url)) {
|
| + if (script->InstantiationState() ==
|
| + ModuleInstantiationState::kInstantiated)
|
| + continue;
|
| + }
|
| +
|
| + // Step 4.3. Otherwise, if ancestor list does not contain url, append url to
|
| + // urls.
|
| +
|
| if (!ancestor_list_with_url_.Contains(url))
|
| urls.push_back(url);
|
| }
|
|
|