summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authortobiasjs <tobiasjs@chromium.org>2015-04-27 10:04:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-27 17:05:19 +0000
commit46473984c6887c2a7b5a8602ef5526e6d16b06ec (patch)
tree4bc50a302524d3e254063f55f781b2ad6d4d2176 /android_webview
parent14bad6085f9499ee8568617cdba884daaf489caf (diff)
downloadchromium_src-46473984c6887c2a7b5a8602ef5526e6d16b06ec.zip
chromium_src-46473984c6887c2a7b5a8602ef5526e6d16b06ec.tar.gz
chromium_src-46473984c6887c2a7b5a8602ef5526e6d16b06ec.tar.bz2
Check for destroyed WebView before adding a callback in didNavigateMainFrame
Check to make sure at the time that didNavigateMainFrame occurs that the WebView is not destroyed (in which case skip registering the visual state listener callback for onPageCommitVisible). BUG=481534 Review URL: https://codereview.chromium.org/1109833002 Cr-Commit-Position: refs/heads/master@{#327062}
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwContents.java7
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java17
2 files changed, 16 insertions, 8 deletions
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 59ede16..0a0e853 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -2628,6 +2628,13 @@ public class AwContents implements SmartClipProvider,
});
}
+ protected void insertVisualStateCallbackIfNotDestroyed(
+ long requestId, VisualStateCallback callback) {
+ if (TRACE) Log.d(TAG, "insertVisualStateCallbackIfNotDestroyed");
+ if (isDestroyed()) return;
+ nativeInsertVisualStateCallback(mNativeAwContents, requestId, callback);
+ }
+
// --------------------------------------------------------------------------------------------
// This is the AwViewMethods implementation that does real work. The AwViewMethodsImpl is
// hooked up to the WebView in embedded mode and to the FullScreenView in fullscreen mode,
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
index de5dfb1..ec722f6 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
@@ -68,14 +68,15 @@ public class AwWebContentsObserver extends WebContentsObserver {
public void run() {
AwContents awContents = mAwContents.get();
if (awContents != null) {
- awContents.insertVisualStateCallback(0, new VisualStateCallback() {
- @Override
- public void onComplete(long requestId) {
- AwContentsClient client = mAwContentsClient.get();
- if (client == null) return;
- client.onPageCommitVisible(url);
- }
- });
+ awContents.insertVisualStateCallbackIfNotDestroyed(
+ 0, new VisualStateCallback() {
+ @Override
+ public void onComplete(long requestId) {
+ AwContentsClient client = mAwContentsClient.get();
+ if (client == null) return;
+ client.onPageCommitVisible(url);
+ }
+ });
}
}
});