Title: [284478] trunk
Revision
284478
Author
commit-qu...@webkit.org
Date
2021-10-19 12:28:40 -0700 (Tue, 19 Oct 2021)

Log Message

Origin of opaque blob: URLs ends up as empty string
https://bugs.webkit.org/show_bug.cgi?id=231942

Patch by Alex Christensen <achristen...@webkit.org> on 2021-10-19
Reviewed by Tim Horton.

LayoutTests/imported/w3c:

* web-platform-tests/url/a-element-expected.txt:
* web-platform-tests/url/a-element-origin-expected.txt:
* web-platform-tests/url/a-element-origin-xhtml-expected.txt:
* web-platform-tests/url/a-element-xhtml-expected.txt:
* web-platform-tests/url/resources/urltestdata.json:
* web-platform-tests/url/url-constructor.any-expected.txt:
* web-platform-tests/url/url-constructor.any.worker-expected.txt:
* web-platform-tests/url/url-origin.any-expected.txt:
* web-platform-tests/url/url-origin.any.worker-expected.txt:

Source/WebCore:

It should be "null" instead of "".
This matches Chrome and Firefox.
Covered by a PR to WPT included in this patch.

* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsUniqueOrigin):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-19 19:28:40 UTC (rev 284478)
@@ -1,3 +1,20 @@
+2021-10-19  Alex Christensen  <achristen...@webkit.org>
+
+        Origin of opaque blob: URLs ends up as empty string
+        https://bugs.webkit.org/show_bug.cgi?id=231942
+
+        Reviewed by Tim Horton.
+
+        * web-platform-tests/url/a-element-expected.txt:
+        * web-platform-tests/url/a-element-origin-expected.txt:
+        * web-platform-tests/url/a-element-origin-xhtml-expected.txt:
+        * web-platform-tests/url/a-element-xhtml-expected.txt:
+        * web-platform-tests/url/resources/urltestdata.json:
+        * web-platform-tests/url/url-constructor.any-expected.txt:
+        * web-platform-tests/url/url-constructor.any.worker-expected.txt:
+        * web-platform-tests/url/url-origin.any-expected.txt:
+        * web-platform-tests/url/url-origin.any.worker-expected.txt:
+
 2021-10-19  Chris Dumez  <cdu...@apple.com>
 
         Resync web-platform-tests/reporting from upstream

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -591,6 +591,7 @@
 PASS Parsing: <non-special://[:80/> against <about:blank>
 PASS Parsing: <blob:https://example.com:443/> against <about:blank>
 PASS Parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Parsing: <blob:> against <about:blank>
 PASS Parsing: <http://0x7f.0.0.0x7g> against <about:blank>
 PASS Parsing: <http://0X7F.0.0.0X7G> against <about:blank>
 PASS Parsing: <http://[::127.0.0.0.1]> against <about:blank>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -320,6 +320,9 @@
 PASS Parsing origin: <git+https://github.com/foo/bar> against <about:blank>
 PASS Parsing origin: <urn:ietf:rfc:2648> against <about:blank>
 PASS Parsing origin: <tag:j...@example.org,2001:foo/bar> against <about:blank>
+PASS Parsing origin: <blob:https://example.com:443/> against <about:blank>
+PASS Parsing origin: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Parsing origin: <blob:> against <about:blank>
 PASS Parsing origin: <non-special:cannot-be-a-base-url-\0~€> against <about:blank>
 PASS Parsing origin: <https://www.example.com/path{path.html?query'=query#fragment<fragment> against <about:blank>
 PASS Parsing origin: <https://user:pass[@foo/bar> against <http://example.org>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-xhtml-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-xhtml-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-xhtml-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -320,6 +320,9 @@
 PASS Parsing origin: <git+https://github.com/foo/bar> against <about:blank>
 PASS Parsing origin: <urn:ietf:rfc:2648> against <about:blank>
 PASS Parsing origin: <tag:j...@example.org,2001:foo/bar> against <about:blank>
+PASS Parsing origin: <blob:https://example.com:443/> against <about:blank>
+PASS Parsing origin: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Parsing origin: <blob:> against <about:blank>
 PASS Parsing origin: <non-special:cannot-be-a-base-url-\0~€> against <about:blank>
 PASS Parsing origin: <https://www.example.com/path{path.html?query'=query#fragment<fragment> against <about:blank>
 PASS Parsing origin: <https://user:pass[@foo/bar> against <http://example.org>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -591,6 +591,7 @@
 PASS Parsing: <non-special://[:80/> against <about:blank>
 PASS Parsing: <blob:https://example.com:443/> against <about:blank>
 PASS Parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Parsing: <blob:> against <about:blank>
 PASS Parsing: <http://0x7f.0.0.0x7g> against <about:blank>
 PASS Parsing: <http://0X7F.0.0.0X7G> against <about:blank>
 PASS Parsing: <http://[::127.0.0.0.1]> against <about:blank>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json	2021-10-19 19:28:40 UTC (rev 284478)
@@ -7303,6 +7303,7 @@
     "input": "blob:https://example.com:443/",
     "base": "about:blank",
     "href": "blob:https://example.com:443/",
+    "origin": "https://example.com",
     "protocol": "blob:",
     "username": "",
     "password": "",
@@ -7317,6 +7318,7 @@
     "input": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf",
     "base": "about:blank",
     "href": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf",
+    "origin": "null",
     "protocol": "blob:",
     "username": "",
     "password": "",
@@ -7327,6 +7329,21 @@
     "search": "",
     "hash": ""
   },
+  {
+    "input": "blob:",
+    "base": "about:blank",
+    "href": "blob:",
+    "origin": "null",
+    "protocol": "blob:",
+    "username": "",
+    "password": "",
+    "host": "",
+    "hostname": "",
+    "port": "",
+    "pathname": "",
+    "search": "",
+    "hash": ""
+  },
   "Invalid IPv4 radix digits",
   {
     "input": "http://0x7f.0.0.0x7g",

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -590,6 +590,7 @@
 PASS Parsing: <non-special://[:80/> against <about:blank>
 PASS Parsing: <blob:https://example.com:443/> against <about:blank>
 PASS Parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Parsing: <blob:> against <about:blank>
 PASS Parsing: <http://0x7f.0.0.0x7g> against <about:blank>
 PASS Parsing: <http://0X7F.0.0.0X7G> against <about:blank>
 PASS Parsing: <http://[::127.0.0.0.1]> against <about:blank>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -590,6 +590,7 @@
 PASS Parsing: <non-special://[:80/> against <about:blank>
 PASS Parsing: <blob:https://example.com:443/> against <about:blank>
 PASS Parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Parsing: <blob:> against <about:blank>
 PASS Parsing: <http://0x7f.0.0.0x7g> against <about:blank>
 PASS Parsing: <http://0X7F.0.0.0X7G> against <about:blank>
 PASS Parsing: <http://[::127.0.0.0.1]> against <about:blank>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -319,6 +319,9 @@
 PASS Origin parsing: <git+https://github.com/foo/bar> against <about:blank>
 PASS Origin parsing: <urn:ietf:rfc:2648> against <about:blank>
 PASS Origin parsing: <tag:j...@example.org,2001:foo/bar> against <about:blank>
+PASS Origin parsing: <blob:https://example.com:443/> against <about:blank>
+PASS Origin parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Origin parsing: <blob:> against <about:blank>
 PASS Origin parsing: <non-special:cannot-be-a-base-url-\0~€> against <about:blank>
 PASS Origin parsing: <https://www.example.com/path{path.html?query'=query#fragment<fragment> against <about:blank>
 PASS Origin parsing: <https://user:pass[@foo/bar> against <http://example.org>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.worker-expected.txt (284477 => 284478)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.worker-expected.txt	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.worker-expected.txt	2021-10-19 19:28:40 UTC (rev 284478)
@@ -319,6 +319,9 @@
 PASS Origin parsing: <git+https://github.com/foo/bar> against <about:blank>
 PASS Origin parsing: <urn:ietf:rfc:2648> against <about:blank>
 PASS Origin parsing: <tag:j...@example.org,2001:foo/bar> against <about:blank>
+PASS Origin parsing: <blob:https://example.com:443/> against <about:blank>
+PASS Origin parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank>
+PASS Origin parsing: <blob:> against <about:blank>
 PASS Origin parsing: <non-special:cannot-be-a-base-url-\0~€> against <about:blank>
 PASS Origin parsing: <https://www.example.com/path{path.html?query'=query#fragment<fragment> against <about:blank>
 PASS Origin parsing: <https://user:pass[@foo/bar> against <http://example.org>

Modified: trunk/Source/WebCore/ChangeLog (284477 => 284478)


--- trunk/Source/WebCore/ChangeLog	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/Source/WebCore/ChangeLog	2021-10-19 19:28:40 UTC (rev 284478)
@@ -1,3 +1,17 @@
+2021-10-19  Alex Christensen  <achristen...@webkit.org>
+
+        Origin of opaque blob: URLs ends up as empty string
+        https://bugs.webkit.org/show_bug.cgi?id=231942
+
+        Reviewed by Tim Horton.
+
+        It should be "null" instead of "".
+        This matches Chrome and Firefox.
+        Covered by a PR to WPT included in this patch.
+
+        * page/SecurityOrigin.cpp:
+        (WebCore::shouldTreatAsUniqueOrigin):
+
 2021-10-19  Youenn Fablet  <you...@apple.com>
 
         Guarantee order of WebSocket events in case of being resumed

Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (284477 => 284478)


--- trunk/Source/WebCore/page/SecurityOrigin.cpp	2021-10-19 19:16:51 UTC (rev 284477)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp	2021-10-19 19:28:40 UTC (rev 284478)
@@ -98,9 +98,9 @@
 
     // FIXME: Do we need to unwrap the URL further?
     URL innerURL = SecurityOrigin::shouldUseInnerURL(url) ? SecurityOrigin::extractInnerURL(url) : url;
+    if (!innerURL.isValid())
+        return true;
 
-    // FIXME: Check whether innerURL is valid.
-
     // For edge case URLs that were probably misparsed, make sure that the origin is unique.
     // This is an additional safety net against bugs in URL parsing, and for network back-ends that parse URLs differently,
     // and could misinterpret another component for hostname.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to