Commit 094023a4 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPK] Preserve history state when relaunching WebAPK

This CL reverts https://crbug.com/307333 for WebAPKs but not webapps.
That CL made webapps reload when a user:
- navigated back to a webapp via Android Recents
AND
- the webapp had been killed (which means that it is likely that a
  long time elapsed since the webapp was launched has passed)

A WebAPK user is using window.history.pushState() to cache that a web page
was reached by launching a WebAPK instead of by navigating on the web.
The behaviour introduced in https://crbug.com/307333 was preventing the
history state from getting restored when the user navigates back to the
WebAPK via Android recents and Chrome has been killed.

The rationale for reverting the behaviour for WebAPKs but not webapps is
that WebAPKs are supposed to be sophisticated apps. Reloading the page
takes control away from web developers.

BUG=888100

Change-Id: Icb4803b0ee8b3444e0aade2acc2473b8ce1c23b7
Reviewed-on: https://chromium-review.googlesource.com/c/1275290
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601405}
parent 57df0676
......@@ -220,7 +220,9 @@ public class WebappActivity extends SingleTabActivity {
LoadUrlParams params = createLoadUrlParams(mWebappInfo, getIntent());
tab.loadUrl(params);
} else {
if (NetworkChangeNotifier.isOnline()) tab.reloadIgnoringCache();
if (getActivityType() != ActivityType.WEBAPK && NetworkChangeNotifier.isOnline()) {
tab.reloadIgnoringCache();
}
}
tab.addObserver(createTabObserver());
}
......
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