Commit 386114b5 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Call WebStateObserver::PageLoaded after loading placeholder URL.

Before this CL PageLoaded was called right from
didFailProvisionalNavigation:, where URL may still represent the
previous page.

Bug: 903497
Change-Id: I712dd120340353f37d2fe739c5b05e843cb11d7a
Reviewed-on: https://chromium-review.googlesource.com/c/1327608Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606855}
parent 9773a841
......@@ -1601,6 +1601,8 @@ registerLoadRequestForURL:(const GURL&)requestURL
// session history and UI.
if (!targetURL.is_valid()) {
[self didFinishWithURL:targetURL loadSuccess:NO context:nullptr];
_webStateImpl->SetIsLoading(false);
_webStateImpl->OnPageLoaded(targetURL, NO);
return;
}
......@@ -1787,6 +1789,8 @@ registerLoadRequestForURL:(const GURL&)requestURL
context->SetUrl(item->GetURL());
}
[self loadNativeViewWithSuccess:NO navigationContext:context];
_webStateImpl->SetIsLoading(false);
_webStateImpl->OnPageLoaded(currentURL, NO);
}
// Loads the current URL in a native controller if using the legacy navigation
......@@ -2176,17 +2180,29 @@ registerLoadRequestForURL:(const GURL&)requestURL
}
[self restoreStateFromHistory];
// Placeholder and restore session URLs are implementation details so should
// not notify WebStateObservers. If |context| is nullptr, don't skip
// placeholder URLs because this may be the only opportunity to update
// |isLoading| for native view reload.
if ((context && !IsWKInternalUrl(context->GetUrl())) ||
(!context && !IsRestoreSessionUrl(net::GURLWithNSURL(_webView.URL)))) {
_webStateImpl->SetIsLoading(false);
if (!context || !context->IsLoadingErrorPage()) {
_webStateImpl->OnPageLoaded(currentURL, loadSuccess);
}
if (context && IsWKInternalUrl(context->GetUrl()))
return;
if (IsRestoreSessionUrl(net::GURLWithNSURL(_webView.URL)))
return;
if (context && context->IsLoadingErrorPage())
return;
if (!loadSuccess) {
// WebStateObserver callbacks will be called for load failure after
// loading placeholder URL.
return;
}
_webStateImpl->SetIsLoading(false);
_webStateImpl->OnPageLoaded(currentURL, YES);
}
- (void)rendererInitiatedGoDelta:(int)delta
......
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