diff options
author | Patrick Scott <phanna@android.com> | 2010-06-16 12:27:06 -0400 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2010-09-22 09:46:33 -0400 |
commit | b2044da3f9f9ad74f0dffd5ae024e558f8a9a89a (patch) | |
tree | cc8822b8293d72186a96ee034425521dc4480c08 /core | |
parent | dd62a056b8d746c620218a68bb476382f02d8174 (diff) | |
download | frameworks_base-b2044da3f9f9ad74f0dffd5ae024e558f8a9a89a.zip frameworks_base-b2044da3f9f9ad74f0dffd5ae024e558f8a9a89a.tar.gz frameworks_base-b2044da3f9f9ad74f0dffd5ae024e558f8a9a89a.tar.bz2 |
Do not merge: cherry-pick a fix for a npe.
Fix a monkey crash when the new WebView is destroyed.
Grab the WebViewCore immediately so that if the Tab is destroyed, we have the
old WebViewCore object and can return the BrowserFrame.
Bug: 2733004
Change-Id: I8cddf9c9d635fc8b50983e4813eadda26cf23348
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/BrowserFrame.java | 6 | ||||
-rw-r--r-- | core/java/android/webkit/CallbackProxy.java | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 219a469..a2c80f2 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -785,11 +785,7 @@ class BrowserFrame extends Handler { * @return The BrowserFrame object stored in the new WebView. */ private BrowserFrame createWindow(boolean dialog, boolean userGesture) { - WebView w = mCallbackProxy.createWindow(dialog, userGesture); - if (w != null) { - return w.getWebViewCore().getBrowserFrame(); - } - return null; + return mCallbackProxy.createWindow(dialog, userGesture); } /** diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java index 0e0e032..d65c106 100644 --- a/core/java/android/webkit/CallbackProxy.java +++ b/core/java/android/webkit/CallbackProxy.java @@ -1098,7 +1098,7 @@ class CallbackProxy extends Handler { } } - public WebView createWindow(boolean dialog, boolean userGesture) { + public BrowserFrame createWindow(boolean dialog, boolean userGesture) { // Do an unsynchronized quick check to avoid posting if no callback has // been set. if (mWebChromeClient == null) { @@ -1122,9 +1122,15 @@ class CallbackProxy extends Handler { WebView w = transport.getWebView(); if (w != null) { - w.getWebViewCore().initializeSubwindow(); + WebViewCore core = w.getWebViewCore(); + // If WebView.destroy() has been called, core may be null. Skip + // initialization in that case and return null. + if (core != null) { + core.initializeSubwindow(); + return core.getBrowserFrame(); + } } - return w; + return null; } public void onRequestFocus() { |