| Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| index 644076bc9977db203ebaa500e39095e265f64354..b91a3651167abb307fa9cf78fe89c70ecb7e92ee 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| @@ -289,10 +289,6 @@ public class AwContents implements SmartClipProvider,
|
|
|
| private PostMessageSender mPostMessageSender;
|
|
|
| - // This flag indicates that ShouldOverrideUrlNavigation should be posted
|
| - // through the resourcethrottle. This is only used for popup windows.
|
| - private boolean mDeferredShouldOverrideUrlLoadingIsPendingForPopup;
|
| -
|
| // This is a workaround for some qualcomm devices discarding buffer on
|
| // Activity restore.
|
| private boolean mInvalidateRootViewOnNextDraw;
|
| @@ -502,23 +498,38 @@ public class AwContents implements SmartClipProvider,
|
| @Override
|
| public boolean shouldIgnoreNavigation(NavigationParams navigationParams) {
|
| final String url = navigationParams.url;
|
| +
|
| + final int transitionType = navigationParams.pageTransitionType;
|
| + final boolean isLoadUrl = (transitionType & PageTransition.FROM_API) != 0;
|
| + final boolean isBackForward = (transitionType & PageTransition.FORWARD_BACK) != 0;
|
| + final boolean isReload =
|
| + (transitionType & PageTransition.CORE_MASK) == PageTransition.RELOAD;
|
| + final boolean isRedirect = navigationParams.isRedirect;
|
| +
|
| boolean ignoreNavigation = false;
|
| - if (mDeferredShouldOverrideUrlLoadingIsPendingForPopup) {
|
| - mDeferredShouldOverrideUrlLoadingIsPendingForPopup = false;
|
| - // If this is used for all navigations in future, cases for application initiated
|
| - // load, redirect and backforward should also be filtered out.
|
| - if (!navigationParams.isPost) {
|
| - ignoreNavigation = mContentsClient.shouldIgnoreNavigation(
|
| - mContext, url, navigationParams.isMainFrame,
|
| - navigationParams.hasUserGesture
|
| - || navigationParams.hasUserGestureCarryover,
|
| - navigationParams.isRedirect);
|
| - }
|
| + // Any navigation from loadUrl, goBack/Forward, or reload, are considered application
|
| + // initiated and hence will not yield a shouldOverrideUrlLoading() callback.
|
| + if ((!isLoadUrl || isRedirect) && !isBackForward && !isReload
|
| + && !navigationParams.isPost) {
|
| + ignoreNavigation = mContentsClient.shouldIgnoreNavigation(mContext, url,
|
| + navigationParams.isMainFrame,
|
| + navigationParams.hasUserGesture || navigationParams.hasUserGestureCarryover,
|
| + navigationParams.isRedirect);
|
| }
|
| +
|
| // The shouldOverrideUrlLoading call might have resulted in posting messages to the
|
| // UI thread. Using sendMessage here (instead of calling onPageStarted directly)
|
| // will allow those to run in order.
|
| - if (!ignoreNavigation) {
|
| + if (isRedirect) {
|
| + mContentsClient.getCallbackHelper().postOnPageStarted(url);
|
| + // We can post onPageFinished here since we know that the navigation will fail.
|
| + // Also AwWebContentsObserver.didFail does not call OnPageFinished when the
|
| + // navigation is overridden because we don't want an onPageFinished for such a
|
| + // navigation unless it is a redirect.
|
| + if (ignoreNavigation) {
|
| + mContentsClient.getCallbackHelper().postOnPageFinished(url);
|
| + }
|
| + } else if (!ignoreNavigation) {
|
| mContentsClient.getCallbackHelper().postOnPageStarted(url);
|
| }
|
| return ignoreNavigation;
|
| @@ -1007,7 +1018,6 @@ public class AwContents implements SmartClipProvider,
|
| // Recap: supplyContentsForPopup() is called on the parent window's content, this method is
|
| // called on the popup window's content.
|
| private void receivePopupContents(long popupNativeAwContents) {
|
| - mDeferredShouldOverrideUrlLoadingIsPendingForPopup = true;
|
| // Save existing view state.
|
| final boolean wasAttached = mIsAttachedToWindow;
|
| final boolean wasViewVisible = mIsViewVisible;
|
|
|