From 1c4d7a2adcbf5ab24310fe12a9d2f055e8a181da Mon Sep 17 00:00:00 2001 From: Edward Lee Date: Tue, 15 Dec 2009 14:21:13 -0800 Subject: [PATCH] Bug 534923 - Only show Mobile Bookmarks if there are mobile bookmarks Fix up existing users as well as only creating the place query under AllBookmarks if there are mobile bookmarks. --- services/sync/modules/engines/bookmarks.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js index 4d150718763b..5c63793cce13 100644 --- a/services/sync/modules/engines/bookmarks.js +++ b/services/sync/modules/engines/bookmarks.js @@ -187,6 +187,7 @@ BookmarksEngine.prototype = { _syncFinish: function _syncFinish() { SyncEngine.prototype._syncFinish.call(this); delete this._lazyMap; + this._tracker._ensureMobileQuery(); }, _findDupe: function _findDupe(item) { @@ -1095,11 +1096,17 @@ BookmarksTracker.prototype = { // Disable handling of notifications while changing the mobile query this.ignoreAll = true; - // Make sure we have a mobile bookmarks query let mobile = find("MobileBookmarks"); let queryURI = Utils.makeURI("place:folder=" + kSpecialIds.mobile); let title = Str.sync.get("mobile.label"); - if (mobile.length == 0) { + + // Don't add OR do remove the mobile bookmarks if there's nothing + if (Svc.Bookmark.getIdForItemAt(kSpecialIds.mobile, 0) == -1) { + if (mobile.length != 0) + Svc.Bookmark.removeItem(mobile[0]); + } + // Add the mobile bookmarks query if it doesn't exist + else if (mobile.length == 0) { let query = Svc.Bookmark.insertBookmark(all[0], queryURI, -1, title); Utils.anno(query, anno, "MobileBookmarks"); Utils.anno(query, "places/excludeFromBackup", 1);