Diff
Modified: trunk/LayoutTests/ChangeLog (264598 => 264599)
--- trunk/LayoutTests/ChangeLog 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/ChangeLog 2020-07-20 13:51:14 UTC (rev 264599)
@@ -1,3 +1,17 @@
+2020-07-20 Rob Buis <[email protected]>
+
+ Setting URL.hash to '#' should preserve '#'
+ https://bugs.webkit.org/show_bug.cgi?id=214318
+
+ Reviewed by Youenn Fablet.
+
+ Update test expectations to new behavior.
+
+ * fast/dom/DOMURL/set-href-attribute-hash-expected.txt:
+ * fast/dom/DOMURL/set-href-attribute-hash.html:
+ * fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt:
+ * fast/dom/HTMLAnchorElement/set-href-attribute-hash.html:
+
2020-07-20 Philippe Normand <[email protected]>
[GStreamer] Add support for canvas captureStream, tests failing since they were added in r213598
Modified: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt (264598 => 264599)
--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt 2020-07-20 13:51:14 UTC (rev 264599)
@@ -21,7 +21,7 @@
Add hash to file: protocol
PASS a.href is 'file:///some%20path#hash value'
Set hash to '#'
-PASS a.href is 'http://mydomain.com/'
+PASS a.href is 'http://mydomain.com/#'
Add hash to non-standard protocol
PASS a.href is 'foo:bar#hash'
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html (264598 => 264599)
--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html 2020-07-20 13:51:14 UTC (rev 264599)
@@ -62,7 +62,7 @@
debug("Set hash to '#'");
a.href = ""
a.hash = "#";
-shouldBe("a.href", "'http://mydomain.com/'");
+shouldBe("a.href", "'http://mydomain.com/#'");
// Firefox 3.5.2 does not allow setting hash to foo: scheme, and it should.
debug("Add hash to non-standard protocol");
Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt (264598 => 264599)
--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt 2020-07-20 13:51:14 UTC (rev 264599)
@@ -20,7 +20,7 @@
Add hash to file: protocol
PASS a.href is 'file:///some%20path#hash value'
Set hash to '#'
-PASS a.href is 'http://mydomain.com/'
+PASS a.href is 'http://mydomain.com/#'
Add hash to non-standard protocol
PASS a.href is 'foo:bar#hash'
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash.html (264598 => 264599)
--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash.html 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash.html 2020-07-20 13:51:14 UTC (rev 264599)
@@ -59,7 +59,7 @@
debug("Set hash to '#'");
a.href = ""
a.hash = "#";
-shouldBe("a.href", "'http://mydomain.com/'");
+shouldBe("a.href", "'http://mydomain.com/#'");
// Firefox 3.5.2 does not allow setting hash to foo: scheme, and it should.
debug("Add hash to non-standard protocol");
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (264598 => 264599)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-07-20 13:51:14 UTC (rev 264599)
@@ -1,3 +1,14 @@
+2020-07-20 Rob Buis <[email protected]>
+
+ Setting URL.hash to '#' should preserve '#'
+ https://bugs.webkit.org/show_bug.cgi?id=214318
+
+ Reviewed by Youenn Fablet.
+
+ Update improved test expectation.
+
+ * web-platform-tests/url/url-setters-expected.txt:
+
2020-07-18 Chris Dumez <[email protected]>
Resync web-platform-tests/resources from upstream
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt (264598 => 264599)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt 2020-07-20 13:51:14 UTC (rev 264599)
@@ -582,9 +582,9 @@
PASS URL: Setting <https://example.net?lang=en-US#nav>.hash = '#main'
PASS <a>: Setting <https://example.net?lang=en-US#nav>.hash = '#main'
PASS <area>: Setting <https://example.net?lang=en-US#nav>.hash = '#main'
-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"
-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"
-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"
+PASS URL: Setting <https://example.net?lang=en-US#nav>.hash = '#'
+PASS <a>: Setting <https://example.net?lang=en-US#nav>.hash = '#'
+PASS <area>: Setting <https://example.net?lang=en-US#nav>.hash = '#'
PASS URL: Setting <https://example.net?lang=en-US#nav>.hash = ''
PASS <a>: Setting <https://example.net?lang=en-US#nav>.hash = ''
PASS <area>: Setting <https://example.net?lang=en-US#nav>.hash = ''
Modified: trunk/Source/WebCore/ChangeLog (264598 => 264599)
--- trunk/Source/WebCore/ChangeLog 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/Source/WebCore/ChangeLog 2020-07-20 13:51:14 UTC (rev 264599)
@@ -1,3 +1,23 @@
+2020-07-20 Rob Buis <[email protected]>
+
+ Setting URL.hash to '#' should set empty fragment
+ https://bugs.webkit.org/show_bug.cgi?id=214318
+
+ Reviewed by Youenn Fablet.
+
+ Setting URL.hash to '#' should set empty fragment
+ identifier [1], unlike setting it to the empty string
+ which drops the fragment identifier.
+
+ Behavior matches Chrome and Firefox.
+
+ [1] https://html.spec.whatwg.org/#dom-hyperlink-hash
+
+ Test: imported/w3c/web-platform-tests/url/url-setters.html
+
+ * html/URLDecomposition.cpp:
+ (WebCore::URLDecomposition::setHash):
+
2020-07-20 Philippe Normand <[email protected]>
[GStreamer] Add support for canvas captureStream, tests failing since they were added in r213598
Modified: trunk/Source/WebCore/html/URLDecomposition.cpp (264598 => 264599)
--- trunk/Source/WebCore/html/URLDecomposition.cpp 2020-07-20 13:41:52 UTC (rev 264598)
+++ trunk/Source/WebCore/html/URLDecomposition.cpp 2020-07-20 13:51:14 UTC (rev 264599)
@@ -239,11 +239,12 @@
void URLDecomposition::setHash(StringView value)
{
auto fullURL = this->fullURL();
- auto newFragment = value.startsWith('#') ? StringView(value).substring(1) : StringView(value);
- if (newFragment.isEmpty())
+ if (value.isEmpty())
fullURL.removeFragmentIdentifier();
- else
+ else {
+ auto newFragment = value.startsWith('#') ? StringView(value).substring(1) : StringView(value);
fullURL.setFragmentIdentifier(newFragment);
+ }
setFullURL(fullURL);
}