Backed out changeset fec92924befb (bug 1250203) for bc leaks
authorWes Kocher <wkocher@mozilla.com>
Fri, 15 Apr 2016 12:19:44 -0700
changeset 331321 355e9b83a662dd7e90a73b7c9cd556372c063ae9
parent 331320 009d7df1ba6d97a5abd2ed417a3464a8e948742c
child 331322 898a9b29cadbf098059bc7574fe0206989a03766
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1250203
milestone48.0a1
backs outfec92924befbea7a0ee52c4cedd531a67b61f2fb
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset fec92924befb (bug 1250203) for bc leaks MozReview-Commit-ID: BMq0vBarOQZ
browser/base/content/browser-places.js
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -1358,90 +1358,60 @@ var BookmarkingUI = {
         entry: "subviewbutton",
         footer: "panel-subview-footer"
       },
       insertionPoint: ".panel-subview-footer"
     });
   },
 
   _updateRecentBookmarks: function(aHeaderItem, extraCSSClass = "") {
-    let repopulate = function () {
-      const kMaxResults = 5;
-
-      let options = PlacesUtils.history.getNewQueryOptions();
-      options.excludeQueries = true;
-      options.queryType = options.QUERY_TYPE_BOOKMARKS;
-      options.sortingMode = options.SORT_BY_DATEADDED_DESCENDING;
-      options.maxResults = kMaxResults;
-      let query = PlacesUtils.history.getNewQuery();
+    const kMaxResults = 5;
 
-      while (aHeaderItem.nextSibling &&
-             aHeaderItem.nextSibling.localName == "menuitem") {
-        aHeaderItem.nextSibling.remove();
-      }
-
-      let onItemCommand = function (aEvent) {
-        let item = aEvent.target;
-        openUILink(item.getAttribute("targetURI"), aEvent);
-        CustomizableUI.hidePanelForNode(item);
-      };
+    let options = PlacesUtils.history.getNewQueryOptions();
+    options.excludeQueries = true;
+    options.queryType = options.QUERY_TYPE_BOOKMARKS;
+    options.sortingMode = options.SORT_BY_DATEADDED_DESCENDING;
+    options.maxResults = kMaxResults;
+    let query = PlacesUtils.history.getNewQuery();
 
-      let fragment = document.createDocumentFragment();
-      let root = PlacesUtils.history.executeQuery(query, options).root;
-      root.containerOpen = true;
-      for (let i = 0; i < root.childCount; i++) {
-        let node = root.getChild(i);
-        let uri = node.uri;
-        let title = node.title;
-        let icon = node.icon;
+    while (aHeaderItem.nextSibling &&
+           aHeaderItem.nextSibling.localName == "menuitem") {
+      aHeaderItem.nextSibling.remove();
+    }
 
-        let item =
-          document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
-                                   "menuitem");
-        item.setAttribute("label", title || uri);
-        item.setAttribute("targetURI", uri);
-        item.setAttribute("class", "menuitem-iconic menuitem-with-favicon bookmark-item " +
-                                   extraCSSClass);
-        item.addEventListener("command", onItemCommand);
-        if (icon) {
-          item.setAttribute("image", icon);
-        }
-        fragment.appendChild(item);
-      }
-      root.containerOpen = false;
-      aHeaderItem.parentNode.insertBefore(fragment, aHeaderItem.nextSibling);
+    let onItemCommand = function (aEvent) {
+      let item = aEvent.target;
+      openUILink(item.getAttribute("targetURI"), aEvent);
+      CustomizableUI.hidePanelForNode(item);
     };
 
-    repopulate();
+    let fragment = document.createDocumentFragment();
+    let root = PlacesUtils.history.executeQuery(query, options).root;
+    root.containerOpen = true;
+    for (let i = 0; i < root.childCount; i++) {
+      let node = root.getChild(i);
+      let uri = node.uri;
+      let title = node.title;
+      let icon = node.icon;
 
-    // Update the menu when a bookmark is being removed.
-    // The native menubar on Mac doesn't support live update, so this won't
-    // work there.
-    let observer = {
-      onItemAdded() {},
-      onBeginUpdateBatch() {},
-      onEndUpdateBatch() {},
-      onItemRemoved() {
-        repopulate();
-      },
-      onItemChanged() {},
-      onItemVisited() {},
-      onItemMoved() {}
-    };
-    PlacesUtils.bookmarks.addObserver(observer, false);
-
-    let popup = aHeaderItem.parentNode;
-    let removeObserver = function (event) {
-      if (event && event.target != popup) {
-        return;
+      let item =
+        document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+                                 "menuitem");
+      item.setAttribute("label", title || uri);
+      item.setAttribute("targetURI", uri);
+      item.setAttribute("class", "menuitem-iconic menuitem-with-favicon bookmark-item " +
+                                 extraCSSClass);
+      item.addEventListener("command", onItemCommand);
+      if (icon) {
+        item.setAttribute("image", icon);
       }
-      PlacesUtils.bookmarks.removeObserver(observer);
-      popup.removeEventListener("popuphidden", removeObserver);
-    };
-    popup.addEventListener("popuphidden", removeObserver);
+      fragment.appendChild(item);
+    }
+    root.containerOpen = false;
+    aHeaderItem.parentNode.insertBefore(fragment, aHeaderItem.nextSibling);
   },
 
   /**
    * Handles star styling based on page proxy state changes.
    */
   onPageProxyStateChanged: function BUI_onPageProxyStateChanged(aState) {
     if (!this._shouldUpdateStarState() || !this.star) {
       return;