Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Issue 2447293002: Don't call lower() on KURL protocol/host (Closed)

Created:
4 years, 1 month ago by Charlie Harrison
Modified:
4 years, 1 month ago
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Don't call lower() on KURL protocol/host KURL should already canonicalize the scheme and host. This is just needless work and causes confusion to readers who may get the wrong impression about code invariants. Additionally, calling lower() on the host is a bug, because we canonicalize escape characters to uppercase, but lower() reverts that and brings them back to lowercase, effecively rendering the host not canonical anymore! This is a pre-req for removing CaseFoldingHash from SchemeRegistry. BUG=659550, 348655 Committed: https://crrev.com/2874fa423262879ed27036f716f3e96a5f8e863f Cr-Commit-Position: refs/heads/master@{#428762}

Patch Set 1 #

Patch Set 2 : dont call protocol() / host() twice in SecurityOrigin constructor #

Total comments: 2

Patch Set 3 : Remove host().lower(), which is buggy and causes uncanonicalization!! #

Patch Set 4 : fix up OriginAccessEntry #

Total comments: 2

Patch Set 5 : add canonicalizeHost() as static method on SecurityOrigin and call from Document::setDomain #

Total comments: 1

Patch Set 6 : Add failure cases to document-domain-invalid.html #

Patch Set 7 : add canonicalization layout test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -17 lines) Patch
M content/child/blink_platform_impl_unittest.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/document-domain-canonicalizes.html View 1 2 3 4 5 6 1 chunk +23 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/document-domain-invalid.html View 1 2 3 4 5 1 chunk +17 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 2 chunks +9 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KURL.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KURLTest.cpp View 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KnownPorts.cpp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/weborigin/OriginAccessEntry.cpp View 1 2 3 3 chunks +2 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp View 1 2 3 4 5 6 chunks +25 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp View 1 2 3 4 5 1 chunk +26 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 56 (34 generated)
Charlie Harrison
Brett, PTAL. Did KURL used to not do this canonicalization?
4 years, 1 month ago (2016-10-26 01:24:03 UTC) #10
brettw
LGTM https://codereview.chromium.org/2447293002/diff/20001/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp File third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp (right): https://codereview.chromium.org/2447293002/diff/20001/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp#newcode115 third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp:115: m_host(url.host().lower()), Since you're here, you can delete this ...
4 years, 1 month ago (2016-10-26 01:54:27 UTC) #11
Charlie Harrison
https://codereview.chromium.org/2447293002/diff/20001/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp File third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp (right): https://codereview.chromium.org/2447293002/diff/20001/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp#newcode115 third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp:115: m_host(url.host().lower()), On 2016/10/26 01:54:27, brettw (ping on IM after ...
4 years, 1 month ago (2016-10-26 01:58:32 UTC) #12
brettw
On 2016/10/26 01:58:32, Charlie Harrison wrote: > https://codereview.chromium.org/2447293002/diff/20001/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp > File third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp (right): > > https://codereview.chromium.org/2447293002/diff/20001/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp#newcode115 ...
4 years, 1 month ago (2016-10-26 05:14:32 UTC) #15
Charlie Harrison
Ah, so actually calling lower() on a host from KURL doesn't really make sense as ...
4 years, 1 month ago (2016-10-26 11:56:37 UTC) #16
Charlie Harrison
Looks like I was right about host().lower() being buggy :) Feel free to take another ...
4 years, 1 month ago (2016-10-26 17:40:27 UTC) #23
brettw
The canonicalzation works the same between GURL and KURL (this being consistent is entirely the ...
4 years, 1 month ago (2016-10-26 17:51:46 UTC) #26
Charlie Harrison
https://codereview.chromium.org/2447293002/diff/60001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2447293002/diff/60001/third_party/WebKit/Source/core/dom/Document.cpp#newcode4406 third_party/WebKit/Source/core/dom/Document.cpp:4406: // TODO(csharrison): Should probably ensure newDomain is canonical rather ...
4 years, 1 month ago (2016-10-26 18:10:59 UTC) #27
Charlie Harrison
also adding mkwst, who might be an expert on setting the domain on a document.
4 years, 1 month ago (2016-10-26 18:16:12 UTC) #29
brettw
On 2016/10/26 18:10:59, Charlie Harrison wrote: > https://codereview.chromium.org/2447293002/diff/60001/third_party/WebKit/Source/core/dom/Document.cpp > File third_party/WebKit/Source/core/dom/Document.cpp (right): > > https://codereview.chromium.org/2447293002/diff/60001/third_party/WebKit/Source/core/dom/Document.cpp#newcode4406 ...
4 years, 1 month ago (2016-10-26 19:41:05 UTC) #30
Charlie Harrison
Let me throw up a dependent patch which adds a step to canonicalize the host ...
4 years, 1 month ago (2016-10-26 20:09:23 UTC) #31
Charlie Harrison
On 2016/10/26 20:09:23, Charlie Harrison wrote: > Let me throw up a dependent patch which ...
4 years, 1 month ago (2016-10-26 20:10:50 UTC) #32
Charlie Harrison
I've added `String SecurityOrigin::canonicalizeHost(const String&)` with some tests. This should be ready for another review. ...
4 years, 1 month ago (2016-10-26 22:23:59 UTC) #35
Mike West
Canonicalizing the input to `document.domain` makes sense to me. I think layout tests covering the ...
4 years, 1 month ago (2016-10-27 07:30:35 UTC) #38
Mike West
(The general approach LGTM; if you add tests, I'm happy.)
4 years, 1 month ago (2016-10-27 07:30:53 UTC) #39
jochen (gone - plz use gerrit)
(I think Brett and Mike cover everything here)
4 years, 1 month ago (2016-10-27 07:45:20 UTC) #40
Charlie Harrison
Added some layout tests. Brett, would you mind double checking the host canonicalization code in ...
4 years, 1 month ago (2016-10-27 15:31:04 UTC) #47
brettw
The canonicalizeHost function looks right to me. I'm not aulified to say anything about whether ...
4 years, 1 month ago (2016-10-31 16:55:25 UTC) #48
Charlie Harrison
Thanks Brett, I'll go ahead and land this with the assumption that Mike's l-g-t-m covers ...
4 years, 1 month ago (2016-10-31 17:00:19 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2447293002/120001
4 years, 1 month ago (2016-10-31 17:01:16 UTC) #52
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 1 month ago (2016-10-31 18:52:29 UTC) #54
commit-bot: I haz the power
4 years, 1 month ago (2016-10-31 19:18:52 UTC) #56
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/2874fa423262879ed27036f716f3e96a5f8e863f
Cr-Commit-Position: refs/heads/master@{#428762}

Powered by Google App Engine
This is Rietveld 408576698