Commit 05c23d5b authored by Jian Li's avatar Jian Li Committed by Commit Bot

Fix the issue that reloading offline page of an URL containing hash

We need to also set PageTransition.FROM_ADDRESS_BAR in order to force
the reload. Otherwise, the loading will not proceed if it is same
document.

Bug: 819359
Change-Id: Ic861c295c1b42fc37f0161b771a1275912b6156e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1674591
Commit-Queue: Jian Li <jianli@chromium.org>
Reviewed-by: default avatarDmitry Titov <dimich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672207}
parent 27321862
......@@ -690,17 +690,23 @@ public class OfflinePageUtils {
* @param tab The tab to be reloaded.
*/
public static void reload(Tab tab) {
// Only the transition type with both RELOAD and FROM_ADDRESS_BAR set will force the
// navigation to be treated as reload (see ShouldTreatNavigationAsReload()). Without this,
// reloading an URL containing a hash will be treated as same document load and thus
// no loading is triggered.
int transitionTypeForReload = PageTransition.RELOAD | PageTransition.FROM_ADDRESS_BAR;
OfflinePageItem offlinePage = getOfflinePage(tab);
if (isShowingTrustedOfflinePage(tab) || offlinePage == null) {
// If current page is an offline page, reload it with custom behavior defined in extra
// header respected.
LoadUrlParams params = new LoadUrlParams(tab.getOriginalUrl(), PageTransition.RELOAD);
LoadUrlParams params = new LoadUrlParams(tab.getOriginalUrl(), transitionTypeForReload);
params.setVerbatimHeaders(getOfflinePageHeaderForReload(tab));
tab.loadUrl(params);
return;
}
LoadUrlParams params = new LoadUrlParams(offlinePage.getUrl(), PageTransition.RELOAD);
LoadUrlParams params = new LoadUrlParams(offlinePage.getUrl(), transitionTypeForReload);
tab.loadUrl(params);
}
......
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