Changeset 264599 in webkit
- Timestamp:
- Jul 20, 2020, 6:51:14 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r264596 r264599 1 2020-07-20 Rob Buis <rbuis@igalia.com> 2 3 Setting URL.hash to '#' should preserve '#' 4 https://bugs.webkit.org/show_bug.cgi?id=214318 5 6 Reviewed by Youenn Fablet. 7 8 Update test expectations to new behavior. 9 10 * fast/dom/DOMURL/set-href-attribute-hash-expected.txt: 11 * fast/dom/DOMURL/set-href-attribute-hash.html: 12 * fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt: 13 * fast/dom/HTMLAnchorElement/set-href-attribute-hash.html: 14 1 15 2020-07-20 Philippe Normand <pnormand@igalia.com> 2 16 -
trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt
r208096 r264599 22 22 PASS a.href is 'file:///some%20path#hash value' 23 23 Set hash to '#' 24 PASS a.href is 'http://mydomain.com/ '24 PASS a.href is 'http://mydomain.com/#' 25 25 Add hash to non-standard protocol 26 26 PASS a.href is 'foo:bar#hash' -
trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html
r208096 r264599 63 63 a.href = "http://mydomain.com#middle"; 64 64 a.hash = "#"; 65 shouldBe("a.href", "'http://mydomain.com/ '");65 shouldBe("a.href", "'http://mydomain.com/#'"); 66 66 67 67 // Firefox 3.5.2 does not allow setting hash to foo: scheme, and it should. -
trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt
r207162 r264599 21 21 PASS a.href is 'file:///some%20path#hash value' 22 22 Set hash to '#' 23 PASS a.href is 'http://mydomain.com/ '23 PASS a.href is 'http://mydomain.com/#' 24 24 Add hash to non-standard protocol 25 25 PASS a.href is 'foo:bar#hash' -
trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash.html
r217390 r264599 60 60 a.href = "http://mydomain.com#middle"; 61 61 a.hash = "#"; 62 shouldBe("a.href", "'http://mydomain.com/ '");62 shouldBe("a.href", "'http://mydomain.com/#'"); 63 63 64 64 // Firefox 3.5.2 does not allow setting hash to foo: scheme, and it should. -
trunk/LayoutTests/imported/w3c/ChangeLog
r264573 r264599 1 2020-07-20 Rob Buis <rbuis@igalia.com> 2 3 Setting URL.hash to '#' should preserve '#' 4 https://bugs.webkit.org/show_bug.cgi?id=214318 5 6 Reviewed by Youenn Fablet. 7 8 Update improved test expectation. 9 10 * web-platform-tests/url/url-setters-expected.txt: 11 1 12 2020-07-18 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt
r264516 r264599 583 583 PASS <a>: Setting <https://example.net?lang=en-US#nav>.hash = '#main' 584 584 PASS <area>: Setting <https://example.net?lang=en-US#nav>.hash = '#main' 585 FAIL URL: Setting <https://example.net?lang=en-US#nav>.hash = '#' assert_equals: expected "https://example.net/?lang=en-US#" but got "https://example.net/?lang=en-US" 586 FAIL <a>: Setting <https://example.net?lang=en-US#nav>.hash = '#' assert_equals: expected "https://example.net/?lang=en-US#" but got "https://example.net/?lang=en-US" 587 FAIL <area>: Setting <https://example.net?lang=en-US#nav>.hash = '#' assert_equals: expected "https://example.net/?lang=en-US#" but got "https://example.net/?lang=en-US" 585 PASS URL: Setting <https://example.net?lang=en-US#nav>.hash = '#' 586 PASS <a>: Setting <https://example.net?lang=en-US#nav>.hash = '#' 587 PASS <area>: Setting <https://example.net?lang=en-US#nav>.hash = '#' 588 588 PASS URL: Setting <https://example.net?lang=en-US#nav>.hash = '' 589 589 PASS <a>: Setting <https://example.net?lang=en-US#nav>.hash = '' -
trunk/Source/WebCore/ChangeLog
r264596 r264599 1 2020-07-20 Rob Buis <rbuis@igalia.com> 2 3 Setting URL.hash to '#' should set empty fragment 4 https://bugs.webkit.org/show_bug.cgi?id=214318 5 6 Reviewed by Youenn Fablet. 7 8 Setting URL.hash to '#' should set empty fragment 9 identifier [1], unlike setting it to the empty string 10 which drops the fragment identifier. 11 12 Behavior matches Chrome and Firefox. 13 14 [1] https://html.spec.whatwg.org/#dom-hyperlink-hash 15 16 Test: imported/w3c/web-platform-tests/url/url-setters.html 17 18 * html/URLDecomposition.cpp: 19 (WebCore::URLDecomposition::setHash): 20 1 21 2020-07-20 Philippe Normand <pnormand@igalia.com> 2 22 -
trunk/Source/WebCore/html/URLDecomposition.cpp
r264516 r264599 240 240 { 241 241 auto fullURL = this->fullURL(); 242 auto newFragment = value.startsWith('#') ? StringView(value).substring(1) : StringView(value); 243 if (newFragment.isEmpty()) 242 if (value.isEmpty()) 244 243 fullURL.removeFragmentIdentifier(); 245 else 244 else { 245 auto newFragment = value.startsWith('#') ? StringView(value).substring(1) : StringView(value); 246 246 fullURL.setFragmentIdentifier(newFragment); 247 setFullURL(fullURL); 248 } 249 250 } 247 } 248 setFullURL(fullURL); 249 } 250 251 }
Note:
See TracChangeset
for help on using the changeset viewer.