From 5f3e3b1642d0bde48c0bd8dfda8732b0fe3fd181 Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Mon, 16 Apr 2012 11:56:56 -0700 Subject: [PATCH] Bug 742771 - Fix last title after OOM. r=blassey --- mobile/android/base/GeckoApp.java | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index dcca32756dd..318bc9573cc 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -141,7 +141,6 @@ abstract public class GeckoApp private AboutHomeContent mAboutHomeContent; private static AbsoluteLayout mPluginContainer; - public String mLastTitle; private boolean mRestoreSession = false; private boolean mInitialized = false; @@ -531,7 +530,9 @@ abstract public class GeckoApp if (outState == null) outState = new Bundle(); - outState.putString(SAVED_STATE_TITLE, mLastTitle); + Tab tab = Tabs.getInstance().getSelectedTab(); + if (tab != null) + outState.putString(SAVED_STATE_TITLE, tab.getDisplayTitle()); outState.putBoolean(SAVED_STATE_SESSION, true); } @@ -1579,10 +1580,6 @@ abstract public class GeckoApp GeckoAppShell.loadMozGlue(); mMainHandler = new Handler(); Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - onCreate"); - if (savedInstanceState != null) { - mLastTitle = savedInstanceState.getString(SAVED_STATE_TITLE); - mRestoreSession = savedInstanceState.getBoolean(SAVED_STATE_SESSION); - } LayoutInflater.from(this).setFactory(GeckoViewsFactory.getInstance()); @@ -1606,6 +1603,11 @@ abstract public class GeckoApp mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout); mMainLayout = (LinearLayout) findViewById(R.id.main_layout); + if (savedInstanceState != null) { + mBrowserToolbar.setTitle(savedInstanceState.getString(SAVED_STATE_TITLE)); + mRestoreSession = savedInstanceState.getBoolean(SAVED_STATE_SESSION); + } + ((GeckoApplication) getApplication()).addApplicationLifecycleCallbacks(this); } @@ -1620,7 +1622,7 @@ abstract public class GeckoApp Matcher m = p.matcher(args); if (m.find()) { mProfile = GeckoProfile.get(this, m.group(1)); - mLastTitle = null; + mBrowserToolbar.setTitle(null); } } @@ -1629,12 +1631,12 @@ abstract public class GeckoApp checkAndLaunchUpdate(); } - mBrowserToolbar.setTitle(mLastTitle); - String passedUri = null; String uri = getURIFromIntent(intent); - if (uri != null && uri.length() > 0) - passedUri = mLastTitle = uri; + if (uri != null && uri.length() > 0) { + passedUri = uri; + mBrowserToolbar.setTitle(uri); + } mRestoreSession |= getProfile().shouldRestoreSession(); if (passedUri == null || passedUri.equals("about:home")) { @@ -1854,7 +1856,6 @@ abstract public class GeckoApp !"about".equals(data.getScheme()) && !"chrome".equals(data.getScheme())) { mIntent.setData(data); - mLastTitle = location; } else { mIntent.putExtra("prefetched", 1); }