Merge change 8035

* changes:
  Prevent stale data exception.
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index da950ed..d148c0a 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -1553,7 +1553,7 @@
     @Override
     public boolean onSearchRequested() {
         String url = getTopWindow().getUrl();
-        startSearch(mSettings.getHomePage().equals(url) ? null : url, false,
+        startSearch(mSettings.getHomePage().equals(url) ? null : url, true,
                 createGoogleSearchSourceBundle(GOOGLE_SEARCH_SOURCE_SEARCHKEY), false);
         return true;
     }
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 4d10fe2..479c0a3 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -342,6 +342,8 @@
         showConsole = p.getBoolean("javascript_console", showConsole);
         mTabControl.getBrowserActivity().setShouldShowErrorConsole(
                 showDebugSettings && showConsole);
+
+        update();
     }
 
     public String getPluginsPath() {
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index b818dd2..f534a03 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -39,6 +39,7 @@
     private ImageView       mFavicon;
     private ImageView       mLockIcon;
     private boolean         mInLoad;
+    private boolean         mTitleSet;
 
     public TitleBar(Context context) {
         this(context, null);
@@ -112,6 +113,11 @@
             mRtButton.setVisibility(View.VISIBLE);
             mLftButton.setImageDrawable(mBookmarkDrawable);
             mInLoad = false;
+            if (!mTitleSet) {
+                mTitle.setText(mUrl.getText());
+                mUrl.setText(null);
+                mTitleSet = true;
+            }
         } else {
             mCircularProgress.setProgress(newProgress);
             mHorizontalProgress.setProgress(newProgress);
@@ -132,14 +138,25 @@
     }
 
     /* package */ void setTitleAndUrl(CharSequence title, CharSequence url) {
-        if (null == title) {
-            mTitle.setText(R.string.title_bar_loading);
-        } else {
-            mTitle.setText(title);
-        }
         if (url != null) {
             url = BrowserActivity.buildTitleUrl(url.toString());
         }
+        if (null == title) {
+            if (mInLoad) {
+                mTitleSet = false;
+                mTitle.setText(R.string.title_bar_loading);
+            } else {
+                // If the page has no title, put the url in the title space
+                // and leave the url blank.
+                mTitle.setText(url);
+                mUrl.setText(null);
+                mTitleSet = true;
+                return;
+            }
+        } else {
+            mTitle.setText(title);
+            mTitleSet = true;
+        }
         mUrl.setText(url);
     }