diff options
author | John Reck <jreck@google.com> | 2011-06-20 18:30:26 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-06-20 18:31:24 -0700 |
commit | afa4ab1e4c1d645e34bd408ce04cadfd2e5dae1e (patch) | |
tree | de7be980882d4644bffee972afe46ef3bf7da693 | |
parent | b9f31c6bdc9fb20c88b8f6cf4a39f627fa228a83 (diff) | |
download | packages_apps_Browser-afa4ab1e4c1d645e34bd408ce04cadfd2e5dae1e.zip packages_apps_Browser-afa4ab1e4c1d645e34bd408ce04cadfd2e5dae1e.tar.gz packages_apps_Browser-afa4ab1e4c1d645e34bd408ce04cadfd2e5dae1e.tar.bz2 |
DO NOT MERGE Security fix
Bug: 4742007
Change-Id: I187ce151078795ad9b566e9dfbfe69c38d15b478
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 793a43c..50521a9 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -1785,33 +1785,30 @@ public class BrowserActivity extends Activity // url isn't null, it will load the given url. /* package */Tab openTabAndShow(UrlData urlData, boolean closeOnExit, String appId) { - final Tab currentTab = mTabControl.getCurrentTab(); - if (mTabControl.canCreateNewTab()) { - final Tab tab = mTabControl.createNewTab(closeOnExit, appId, - urlData.mUrl); - WebView webview = tab.getWebView(); - // If the last tab was removed from the active tabs page, currentTab - // will be null. - if (currentTab != null) { - removeTabFromContentView(currentTab); - } - // We must set the new tab as the current tab to reflect the old - // animation behavior. - mTabControl.setCurrentTab(tab); - attachTabToContentView(tab); - if (!urlData.isEmpty()) { - loadUrlDataIn(tab, urlData); - } - return tab; - } else { - // Get rid of the subwindow if it exists - dismissSubWindow(currentTab); - if (!urlData.isEmpty()) { - // Load the given url. - loadUrlDataIn(currentTab, urlData); - } - return currentTab; + Tab currentTab = mTabControl.getCurrentTab(); + if (!mTabControl.canCreateNewTab()) { + Tab closeTab = mTabControl.getTab(0); + closeTab(closeTab); + if (closeTab == currentTab) { + currentTab = null; + } + } + final Tab tab = mTabControl.createNewTab(closeOnExit, appId, + urlData.mUrl); + WebView webview = tab.getWebView(); + // If the last tab was removed from the active tabs page, currentTab + // will be null. + if (currentTab != null) { + removeTabFromContentView(currentTab); + } + // We must set the new tab as the current tab to reflect the old + // animation behavior. + mTabControl.setCurrentTab(tab); + attachTabToContentView(tab); + if (!urlData.isEmpty()) { + loadUrlDataIn(tab, urlData); } + return tab; } private Tab openTab(String url) { |