Prevent webview reuse
Bug: 4742007
Bug: 4770356
Also pipe all loadUrl's through Tab so that it can immediately
update its internal state. This is necessary as javascript:
uris do not cause onPageStarted/finished callbacks to happen,
thus the url and title of the Tab do not update.
Change-Id: I6d17e8627db505eaa9158339fdfc7afd2c6672a2
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index 4a8fa22..54711d9 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -141,6 +141,12 @@
}
final String appId = intent
.getStringExtra(Browser.EXTRA_APPLICATION_ID);
+ if (!TextUtils.isEmpty(urlData.mUrl) &&
+ urlData.mUrl.startsWith("javascript:")) {
+ // Always open javascript: URIs in new tabs
+ mController.openTab(urlData);
+ return;
+ }
if ((Intent.ACTION_VIEW.equals(action)
// If a voice search has no appId, it means that it came
// from the browser. In that case, reuse the current tab.
@@ -150,7 +156,7 @@
if (activateVoiceSearch) {
Tab appTab = mTabControl.getTabFromAppId(appId);
if (appTab != null) {
- mController.reuseTab(appTab, appId, urlData);
+ mController.reuseTab(appTab, urlData);
return;
} else {
Tab tab = mController.openTab(urlData);
@@ -359,18 +365,6 @@
boolean isEmpty() {
return mVoiceIntent == null && (mUrl == null || mUrl.length() == 0);
}
-
- /**
- * Load this UrlData into the given Tab. Use loadUrlDataIn to update
- * the title bar as well.
- */
- public void loadIn(Tab t) {
- if (mVoiceIntent != null) {
- t.activateVoiceSearchMode(mVoiceIntent);
- } else {
- t.getWebView().loadUrl(mUrl, mHeaders);
- }
- }
}
}