Commit 102aa7a5 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

ios: Block universal links during restore.

Webkit indirectly forces a user gesture on the final restore
navigations because _crFinishSessionRestoration is called from native
code via ExecuteJavaScript. This has unintended consequences (such as
triggering universal app links). Instead, use setInterval() to discard
the gesture after the first interval callback.

NOTRY=True
# The chromium_presubmit bot seems to not be running atm, skipping.
NOPRESUBMIT=True

Bug: 1129875, 1132099
Change-Id: I4ee26947ac383d35b7c2175c8cc60ee48dd11cf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432053
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810823}
parent a60ef35d
......@@ -109,7 +109,17 @@
* go backwards.
*/
function _crFinishSessionRestoration(offset) {
// Webkit indirectly forces a user gesture on the final restore
// navigations because this method is called from native code via
// ExecuteJavaScript. This has unintended consequences (such as triggering
// universal app links). Instead, discard the gesture by calling the same
// setInterval twice as WebKit won't propagate the gesture the second
// time.
var skipped_first_interval = false;
var finalizeInterval = setInterval(() => {
if (skipped_first_interval) {
try {
window.clearInterval(finalizeInterval);
history.go(offset);
// Queue a reload to redirect to the target URL after history.go
// is processed.
......@@ -120,6 +130,9 @@
handleError(e.name + ": " + e.message + " offset: " + offset);
}
}
skipped_first_interval = true;
}, 0)
}
/**
* Redirects to a target URL.
......
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