Commit 16fe72de authored by Livvie Lin's avatar Livvie Lin Committed by Commit Bot

Reload interstitials on iOS to ensure not loaded from cache

When navigating to an error page and then to an error page, going
backwards to the first error page does not trigger
ErrorRetryStateMachine::DidFailProvisionalNavigation, which
breaks the page functionality. This likely occurs since the page
is getting loaded from cache, so prevent the breakage by reloading.

Bug: 1044768
Change-Id: If1ac325a175fc529086490f3064ec5199cc4ee38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032185
Commit-Queue: Livvie Lin <livvielin@chromium.org>
Reviewed-by: default avatarCarlos IL <carlosil@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738760}
parent 69ad6dee
...@@ -134,3 +134,26 @@ function preventDefaultOnPoundLinkClicks() { ...@@ -134,3 +134,26 @@ function preventDefaultOnPoundLinkClicks() {
} }
}); });
} }
/**
* Ensures interstitial pages on iOS aren't loaded from cache, which breaks
* the commands due to ErrorRetryStateMachine::DidFailProvisionalNavigation
* not getting triggered.
*/
function setupIosRefresh() {
if (!loadTimeData.getBoolean('committed_interstitials_enabled')) {
return;
}
const params = new URLSearchParams(window.location.search.substring(1));
const failedUrl = decodeURIComponent(params.get('url') || '');
const load = () => {
window.location.replace(failedUrl);
};
window.addEventListener('pageshow', function(e) {
window.onpageshow = load;
}, {once: true});
}
// <if expr="is_ios">
document.addEventListener('DOMContentLoaded', setupIosRefresh);
// </if>
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