Skip to content

Commit b4de322

Browse files
Eugene ButEugene But
authored andcommitted
Do not induce kCrashOnUnexpectedURLChange if previous hostname is empty.
URLDidChangeWithoutDocumentChange should not be called if previous document hostname is empty. This state is a bug, but there is no value in crashing. [email protected] (cherry picked from commit c984463) Bug: 845933 Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet Change-Id: I83ddc62ebc4211aa14f7819f8ea9a6d80d1b7e25 Reviewed-on: https://chromium-review.googlesource.com/1079368 Reviewed-by: Danyao Wang <[email protected]> Reviewed-by: Rohit Rao <[email protected]> Commit-Queue: Eugene But <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#562941} Reviewed-on: https://chromium-review.googlesource.com/1079816 Reviewed-by: Eugene But <[email protected]> Cr-Commit-Position: refs/branch-heads/3440@{#50} Cr-Branched-From: 010ddcf-refs/heads/master@{#561733}
1 parent 8e9c95f commit b4de322

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ios/web/web_state/ui/crw_web_controller.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5273,12 +5273,14 @@ - (BOOL)isKVOChangePotentialSameDocumentNavigationToURL:(const GURL&)newURL {
52735273

52745274
- (void)URLDidChangeWithoutDocumentChange:(const GURL&)newURL {
52755275
DCHECK(newURL == net::GURLWithNSURL([_webView URL]));
5276+
DCHECK(!_documentURL.host().empty() || _documentURL.SchemeIsFile());
52765277

52775278
if (base::FeatureList::IsEnabled(
52785279
web::features::kCrashOnUnexpectedURLChange)) {
52795280
if (_documentURL.GetOrigin() != newURL.GetOrigin()) {
5280-
if (newURL.username().find(_documentURL.host()) != std::string::npos ||
5281-
newURL.password().find(_documentURL.host()) != std::string::npos) {
5281+
if (!_documentURL.host().empty() &&
5282+
(newURL.username().find(_documentURL.host()) != std::string::npos ||
5283+
newURL.password().find(_documentURL.host()) != std::string::npos)) {
52825284
CHECK(false);
52835285
}
52845286
}

0 commit comments

Comments
 (0)