Commit 8b801ede authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

[Origin] Use the normal expectation for the 'file:' Origin.

'file:' is special, because it produces a non opaque origin, uses
port= = 0, and the conversion from/blink blink preserves port == 0.

Previous patch:
https://chromium.googlesource.com/chromium/src/+/a444094dd1d17b48a5a93629ac864a5c43671287
provided a different expectations for origins with (port == 0).

When this happens, blink replace zero by
DefaultPortForPrototocol(scheme):
- http  => 80
- https => 443
- ws    => 80
- wss   => 443
- ftp   => 21
- ftps  => 990
- _     => 0

So when the scheme is "file", zero is replaced by zero and the
transformation can be reversed.

Fixed: 1143052
Bug: 1144091
Change-Id: I8368cba6fa341a67b579ccfd9c972aace9e1e2b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510052
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825279}
parent 11961f2e
...@@ -33,7 +33,9 @@ void RoundTripFromContent(const GURL& input) { ...@@ -33,7 +33,9 @@ void RoundTripFromContent(const GURL& input) {
url::Origin origin_2 = web_security_origin_2; url::Origin origin_2 = web_security_origin_2;
// The notion of unspecified port and port zero doesn't match in between // The notion of unspecified port and port zero doesn't match in between
// url::Origin and blink::SecurityOrigin. This cause some conversion problems. // url::Origin and blink::SecurityOrigin. This cause some conversion problems
// when the scheme is a standard one and the unspecified port can be converted
// to the default one.
// ┌──────────────────┬───────────┐ // ┌──────────────────┬───────────┐
// │ port unspecified │ port zero │ // │ port unspecified │ port zero │
// ┌─────────────────────┼──────────────────┼───────────┤ // ┌─────────────────────┼──────────────────┼───────────┤
...@@ -42,7 +44,9 @@ void RoundTripFromContent(const GURL& input) { ...@@ -42,7 +44,9 @@ void RoundTripFromContent(const GURL& input) {
// │blink::SecurityOrigin│ 0 │ 0 │ // │blink::SecurityOrigin│ 0 │ 0 │
// └─────────────────────┴──────────────────┴───────────┘ // └─────────────────────┴──────────────────┴───────────┘
// TODO(https://crbug.com/1136678): Remove this, once fixed. // TODO(https://crbug.com/1136678): Remove this, once fixed.
if (!origin_1.opaque() && origin_1.port() == 0) { if (!origin_1.opaque() && origin_1.port() == 0 &&
url::DefaultPortForScheme(origin_1.scheme().data(),
origin_1.scheme().size()) != -1) {
CHECK_NE(origin_1, origin_2); CHECK_NE(origin_1, origin_2);
CHECK_EQ(url::DefaultPortForScheme(origin_2.scheme().data(), CHECK_EQ(url::DefaultPortForScheme(origin_2.scheme().data(),
origin_2.scheme().size()), origin_2.scheme().size()),
......
...@@ -408,8 +408,25 @@ ...@@ -408,8 +408,25 @@
"file:///.//" "file:///.//"
"file:////" "file:////"
# Special scheme not mentionned above. # string declared from url/url_constants.cc
"://"
"about"
"about:blank"
"about:srcdoc"
"blank"
"blob" "blob"
"cid"
"content"
"data"
"file"
"filesystem" "filesystem"
"ftp"
"http"
"https"
"javascript" "javascript"
"about" "mailto"
"quic-transport"
"srcdoc"
"tel"
"ws"
"wss"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment