Bug 471850 - more than one 'Most Visisted' tabs in toolbar when importing bookmarks.html created by autoExportHTML, r=dietrich
authorMarco Bonardo <mak77@bonardo.net>
Tue, 13 Jan 2009 11:48:28 +0100
changeset 23594 ccd12ae3f34d6c36f595f68f5ee68ce262125dc4
parent 23593 6ddb1b2244aa314c5cbdd8a26190e93c64030594
child 23595 5b18412c4c4dc90f37d1d5fbce30633e1600152e
push id4625
push usermak77@bonardo.net
push dateTue, 13 Jan 2009 11:44:36 +0000
treeherdermozilla-central@5b18412c4c4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdietrich
bugs471850
milestone1.9.2a1pre
Bug 471850 - more than one 'Most Visisted' tabs in toolbar when importing bookmarks.html created by autoExportHTML, r=dietrich
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -561,17 +561,28 @@ BrowserGlue.prototype = {
 
     if (!importBookmarks) {
       // Call it here for Fx3 profiles created before the Places folder
       // has been added, otherwise it's called during import.
       this.ensurePlacesDefaultQueriesInitialized();
     }
     else {
       // ensurePlacesDefaultQueriesInitialized() is called by import.
-      this._prefs.setIntPref("browser.places.smartBookmarksVersion", 0);
+      // Don't try to recreate smart bookmarks if autoExportHTML is true or
+      // smart bookmarks are disabled.
+      var autoExportHTML = false;
+      try {
+        autoExportHTML = this._prefs.getBoolPref("browser.bookmarks.autoExportHTML");
+      } catch(ex) {}
+      var smartBookmarksVersion = 0;
+      try {
+        smartBookmarksVersion = this._prefs.getIntPref("browser.places.smartBookmarksVersion");
+      } catch(ex) {}
+      if (!autoExportHTML && smartBookmarksVersion != -1)
+        this._prefs.setIntPref("browser.places.smartBookmarksVersion", 0);
 
       // Get bookmarks.html file location
       var dirService = Cc["@mozilla.org/file/directory_service;1"].
                        getService(Ci.nsIProperties);
 
       var bookmarksFile = null;
       if (restoreDefaultBookmarks) {
         // User wants to restore bookmarks.html file from default profile folder