Commit d87e0e18 authored by eugenebut's avatar eugenebut Committed by Commit bot

Mark pending item as created from hash change if necessary.

This is needed because window.hashchange message may not arrive on time
and navigation will not be marked as "IsCreatedFromHashChange". This
will result in going through "loadURL" flow for the same document
navigaitons, which is not correct.

BUG=None

Review-Url: https://codereview.chromium.org/2898633003
Cr-Commit-Position: refs/heads/master@{#473729}
parent 0417cd2f
......@@ -1862,6 +1862,18 @@ registerLoadRequestForURL:(const GURL&)requestURL
params.url, params.referrer, params.transition_type,
navigationInitiationType, params.user_agent_override_option);
// Mark pending item as created from hash change if necessary. This is needed
// because window.hashchange message may not arrive on time.
web::NavigationItemImpl* pendingItem = self.sessionController.pendingItem;
if (pendingItem) {
GURL lastCommittedURL = _webStateImpl->GetLastCommittedURL();
GURL pendingURL = pendingItem->GetURL();
if (lastCommittedURL != pendingURL &&
lastCommittedURL.EqualsIgnoringRef(pendingURL)) {
pendingItem->SetIsCreatedFromHashChange(true);
}
}
web::NavigationItemImpl* addedItem = self.currentNavItem;
DCHECK(addedItem);
if (params.extra_headers)
......
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