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

Unified Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp

Issue 2852963002: [ES6 modules] ModuleTreeLinker::FetchDescendants should not assume urls isn't empty. (Closed)
Patch Set: commentfix Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp
index 69d39367b10596a01751bfedd3e6b000f2bd6276..72f67ef274c711e31280bbce05005f957065ddee 100644
--- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp
@@ -503,4 +503,32 @@ TEST_F(ModuleTreeLinkerTest, FetchDependencyTree) {
ModuleInstantiationState::kInstantiated);
}
+TEST_F(ModuleTreeLinkerTest, FetchDependencyOfCyclicGraph) {
+ ModuleTreeLinkerRegistry* registry = ModuleTreeLinkerRegistry::Create();
+
+ KURL url(kParsedURLString, "http://example.com/a.js");
+ ModuleScriptFetchRequest module_request(
+ url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit);
+ TestModuleTreeClient* client = new TestModuleTreeClient;
+ registry->Fetch(
+ module_request,
+ AncestorList{KURL(kParsedURLString, "http://example.com/a.js")},
+ ModuleGraphLevel::kDependentModuleFetch, GetModulator(), client);
+
+ EXPECT_FALSE(client->WasNotifyFinished())
+ << "ModuleTreeLinker should always finish asynchronously.";
+ EXPECT_FALSE(client->GetModuleScript());
+
+ GetModulator()->ResolveSingleModuleScriptFetch(
+ url, {"./a.js"}, ModuleInstantiationState::kUninstantiated);
+
+ auto ancestor_list = GetModulator()->GetAncestorListForTreeFetch(url);
+ EXPECT_EQ(0u, ancestor_list.size());
+
+ EXPECT_TRUE(client->WasNotifyFinished());
+ ASSERT_TRUE(client->GetModuleScript());
+ EXPECT_EQ(client->GetModuleScript()->InstantiationState(),
+ ModuleInstantiationState::kInstantiated);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698