8000 Web Manifest: parsing the id member should strip the hash · marcoscaceres/WebKit@4a635aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a635aa

Browse files
committed
Web Manifest: parsing the id member should strip the hash
rdar://127864531 https://bugs.webkit.org/show_bug.cgi?id=273991 Reviewed by Sihui Liu. Strips the hash from the id member when parsing the Web Manifest. Part of w3c/manifest#1122 * Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp: (WebCore::ApplicationManifestParser::parseId): * Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp: (TEST_F): Canonical link: https://commits.webkit.org/278724@main
1 parent 2dad7c4 commit 4a635aa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ URL ApplicationManifestParser::parseId(const JSON::Object& manifest, const URL&
448448
if (!protocolHostAndPortAreEqual(idURL, startURL))
449449
return startURL;
450450

451+
idURL.removeFragmentIdentifier();
452+
451453
return idURL;
452454
}
453455

Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,12 @@ TEST_F(ApplicationManifestParserTest, Id)
380380
testId("./foo"_s, m_startURL, "https://example.com/foo"_s);
381381
testId("foo/"_s, m_startURL, "https://example.com/foo/"_s);
382382
testId("../../foo/bar"_s, m_startURL, "https://example.com/foo/bar"_s);
383-
testId("../../foo/bar?query=hi#hi"_s, m_startURL, "https://example.com/foo/bar?query=hi#hi"_s);
383+
testId("../../foo/bar?query=hi#fragment"_s, m_startURL, "https://example.com/foo/bar?query=hi"_s);
384+
testId("../../foo/bar?query=hi#"_s, m_startURL, "https://example.com/foo/bar?query=hi"_s);
384385

385386
testId("https://example.com/foo"_s, m_startURL, "https://example.com/foo"_s);
387+
testId("https://example.com/foo#"_s, m_startURL, "https://example.com/foo"_s);
388+
testId("https://example.com/foo#fragment"_s, m_startURL, "https://example.com/foo"_s);
386389
testId("https://anothersite.com/foo"_s, m_startURL, m_startURL.string());
387390
testId("https://invalid.com:a"_s, m_startURL, m_startURL.string());
388391
}

0 commit comments

Comments
 (0)
0