Bug 675416 - Disable recent bookmarks cache in beta, since it's bogus.
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 04 Aug 2011 01:06:35 +0200
changeset 70597 6eafc1d64af99113395f386468155027ad17572b
parent 70596 7062bb1f249d5d537b9e3ab38912015a04b0894b
child 70598 f8583ac431a637c5622c7b25e27be58c959f87cc
push id145
push usermak77@bonardo.net
push dateWed, 03 Aug 2011 23:07:30 +0000
treeherdermozilla-beta@6eafc1d64af9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs675416
milestone6.0
Bug 675416 - Disable recent bookmarks cache in beta, since it's bogus. r=dietrich a=LegNeato
toolkit/components/places/nsNavBookmarks.cpp
toolkit/components/places/tests/bookmarks/test_675416.js
toolkit/components/places/tests/bookmarks/xpcshell.ini
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -1859,25 +1859,29 @@ nsNavBookmarks::FetchItemInfo(PRInt64 aI
     rv = stmt->GetInt64(kGetItemPropertiesIndex_GrandParentId,
                         &_bookmark.grandParentId);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else {
     _bookmark.grandParentId = -1;
   }
 
+#if 0
+  // The cache is temporarily disabled due to bug 675416.
   if (!aInvalidateCache) {
     // Make space for the new entry.
     ExpireNonrecentBookmarks(&mRecentBookmarksCache);
     // Update the recent bookmarks cache.
     BookmarkKeyClass* key = mRecentBookmarksCache.PutEntry(aItemId);
     if (key) {
       key->bookmark = _bookmark;
     }
   }
+#endif
+
   return NS_OK;
 }
 
 nsresult
 nsNavBookmarks::SetItemDateInternal(mozIStorageStatement* aStatement,
                                     PRInt64 aItemId,
                                     PRTime aValue)
 {
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/bookmarks/test_675416.js
@@ -0,0 +1,57 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function run_test() {
+  /**
+   * Requests information to the service, so that bookmark's data is cached.
+   * @param aItemId
+   *        Id of the bookmark to be cached.
+   */
+  function forceBookmarkCaching(aItemId) {
+    PlacesUtils.bookmarks.getFolderIdForItem(aItemId);
+  }
+
+  let observer = {
+    onBeginUpdateBatch: function() forceBookmarkCaching(itemId1),
+    onEndUpdateBatch: function() forceBookmarkCaching(itemId1),
+    onItemAdded: forceBookmarkCaching,
+    onItemChanged: forceBookmarkCaching,
+    onItemMoved: forceBookmarkCaching,
+    onBeforeItemRemoved: forceBookmarkCaching,
+    onItemRemoved: function(id) {
+      try {
+        forceBookmarkCaching(id);
+        do_throw("trying to fetch a removed bookmark should throw");
+      } catch (ex) {}
+    },
+    onItemVisited: forceBookmarkCaching,
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
+  };
+  PlacesUtils.bookmarks.addObserver(observer, false);
+
+  let folderId1 = PlacesUtils.bookmarks
+                             .createFolder(PlacesUtils.bookmarksMenuFolderId,
+                                           "Bookmarks",
+                                           PlacesUtils.bookmarks.DEFAULT_INDEX);
+  let itemId1 = PlacesUtils.bookmarks
+                           .insertBookmark(folderId1,
+                                           NetUtil.newURI("http:/www.wired.com/wiredscience"),
+                                           PlacesUtils.bookmarks.DEFAULT_INDEX,
+                                           "Wired Science");
+
+  PlacesUtils.bookmarks.removeItem(folderId1);
+
+  let folderId2 = PlacesUtils.bookmarks
+                             .createFolder(PlacesUtils.bookmarksMenuFolderId,
+                                           "Science",
+                                           PlacesUtils.bookmarks.DEFAULT_INDEX);
+  let folderId3 = PlacesUtils.bookmarks
+                             .createFolder(folderId2,
+                                           "Blogs",
+                                           PlacesUtils.bookmarks.DEFAULT_INDEX);
+  // Check title is correctly reported.
+  do_check_eq(PlacesUtils.bookmarks.getItemTitle(folderId3), "Blogs");
+  do_check_eq(PlacesUtils.bookmarks.getItemTitle(folderId2), "Science");
+
+  PlacesUtils.bookmarks.removeObserver(observer, false);
+}
--- a/toolkit/components/places/tests/bookmarks/xpcshell.ini
+++ b/toolkit/components/places/tests/bookmarks/xpcshell.ini
@@ -26,9 +26,9 @@ tail =
 [test_getBookmarkedURIFor.js]
 [test_keywords.js]
 [test_livemarks.js]
 [test_nsINavBookmarkObserver.js]
 [test_onBeforeItemRemoved_observer.js]
 [test_removeItem.js]
 [test_restore_guids.js]
 [test_savedsearches.js]
-
+[test_675416.js]