Webview m40, Release 2 - 40 (1768274)
Back-port: "[Android WebView] Synthesize a fake page loading event on page source modification (Re-land)"
Back-port of https://codereview.chromium.org/970883002/ for m40.
Original description:
[Android WebView] Synthesize a fake page loading event on page source modification (Re-land)
When a script modifies page source of a non-committed page, we need to
notify clients, so they can update the URL bar to avoid confusion.
New logic since the last attempt (https://codereview.chromium.org/924833003/):
distinguish between a "vanilla" WebView state (basically, a newly created
WebView, where no loading attempts have been made) and an "attempted to
navigate" state. In the "vanilla" state, don't fire synthesized page loading
events to avoid confusing clients. This is safe, as WebView is guaranteed to be
on a blank page.
Implementation note: we detect navigation attempts using
didStartProvisionalLoadForFrame WebContentsObserver event on the Java side. As
for popups AwWebContentsObserver gets re-attached from the original popup
WebView to the one provided by the client, notifications issued inbetween can be
missed on the Java side. To work around this, we assume that WebViews opened as
popups can never be in "vanilla" state (as they are anyway opened as a result of
navigation).
BUG=458569, 462213
TBR=davidben@chromium.org,tedchoc@chromium.org
Bug: 19325392
Change-Id: I3df0484f00d2b816cb0293bec432b2fa6ac5e05b
55 files changed