Bug 1213696 Can't edit livemarks r=Ratty r=IanN a=IanN
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Fri, 04 Dec 2015 00:59:16 +0000
changeset 26473 3c5164cb201316b1f36f0276cdccc5e92cd7e26a
parent 26472 40d81c6e93bbbe41f3a3af0e6a767978a993f30b
child 26474 e39e894b964005e5bdfbdd150154082292cfeff0
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty, IanN, IanN
bugs1213696
Bug 1213696 Can't edit livemarks r=Ratty r=IanN a=IanN
suite/common/bookmarks/bm-props.js
suite/common/bookmarks/editBookmarkOverlay.js
--- a/suite/common/bookmarks/bm-props.js
+++ b/suite/common/bookmarks/bm-props.js
@@ -239,17 +239,27 @@ var BookmarkPropertiesPanel = {
           this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
           // keyword
           this._keyword = PlacesUtils.bookmarks
                                      .getKeywordForBookmark(this._itemId);
           break;
 
         case "folder":
           this._itemType = BOOKMARK_FOLDER;
-          PlacesUtils.livemarks.getLivemark({ id: this._itemId }, this);
+          PlacesUtils.livemarks.getLivemark({ id: this._itemId })
+                               .then(aLivemark => {
+            this._itemType = LIVEMARK_CONTAINER;
+            this._feedURI = aLivemark.feedURI;
+            this._siteURI = aLivemark.siteURI;
+            this._fillEditProperties();
+
+            document.documentElement
+                    .getButton("accept").disabled = !this._inputIsValid();
+            window.outerHeight += this._element("nameRow").boxObject.height * 2;
+          }, () => undefined);
       }
 
       // Description
       if (PlacesUtils.annotations
                      .itemHasAnnotation(this._itemId, PlacesUIUtils.DESCRIPTION_ANNO)) {
         this._description = PlacesUtils.annotations
                                        .getItemAnnotation(this._itemId,
                                                           PlacesUIUtils.DESCRIPTION_ANNO);
@@ -365,30 +375,16 @@ var BookmarkPropertiesPanel = {
           var el = document.getElementById("editBMPanel_" + e + "Row");
           if (el.boxObject.height)
             el.height = el.boxObject.height;
         });
         break;
     }
   },
 
-  // mozILivemarkCallback
-  onCompletion: function BPP_onCompletion(aStatus, aLivemark) {
-    if (Components.isSuccessCode(aStatus)) {
-      this._itemType = LIVEMARK_CONTAINER;
-      this._feedURI = aLivemark.feedURI;
-      this._siteURI = aLivemark.siteURI;
-      this._fillEditProperties();
-
-      document.documentElement
-              .getButton("accept").disabled = !this._inputIsValid();
-      window.outerHeight += this._element("nameRow").boxObject.height * 2;
-    }
-  },
-
   _beginBatch: function BPP__beginBatch() {
     if (this._batching)
       return;
 
     PlacesUtils.transactionManager.beginBatch(null);
     this._batching = true;
   },
 
@@ -417,17 +413,16 @@ var BookmarkPropertiesPanel = {
     var locationField = this._element("locationField");
     if (locationField.value == "about:blank")
       locationField.value = "";
   },
 
   // nsISupports
   QueryInterface: function BPP_QueryInterface(aIID) {
     if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
-        aIID.equals(Components.interfaces.mozILivemarkCallback) ||
         aIID.equals(Components.interfaces.nsISupports))
       return this;
 
     throw Components.results.NS_NOINTERFACE;
   },
 
   _element: function BPP__element(aID) {
     return document.getElementById("editBMPanel_" + aID);
--- a/suite/common/bookmarks/editBookmarkOverlay.js
+++ b/suite/common/bookmarks/editBookmarkOverlay.js
@@ -140,17 +140,24 @@ var gEditItemOverlay = {
         this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
         this._initTextField("keywordField",
                             PlacesUtils.bookmarks
                                        .getKeywordForBookmark(this._itemId));
       }
       else {
         this._uri = null;
         this._isLivemark = false;
-        PlacesUtils.livemarks.getLivemark({ id: this._itemId }, this);
+        PlacesUtils.livemarks.getLivemark({ id: this._itemId })
+                             .then(aLivemark => {
+          this._isLivemark = true;
+          this._initTextField("feedLocationField", aLivemark.feedURI.spec, true);
+          this._initTextField("siteLocationField",
+                              aLivemark.siteURI ? aLivemark.siteURI.spec : "", true);
+          this._showHideRows();
+        }, () => undefined);
       }
 
       // folder picker
       this._initFolderMenuList(containerId);
 
       // description field
       this._initTextField("descriptionField", 
                           PlacesUIUtils.getItemDescription(this._itemId));
@@ -321,17 +328,16 @@ var gEditItemOverlay = {
 
     // Hide the folders-separator if no folder is annotated as recently-used
     this._element("foldersSeparator").hidden = (menupopup.childNodes.length <= 6);
     this._folderMenuList.disabled = this._readOnly;
   },
 
   QueryInterface: function EIO_QueryInterface(aIID) {
     if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
-        aIID.equals(Components.interfaces.mozILivemarkCallback) ||
         aIID.equals(Components.interfaces.nsINavBookmarkObserver) ||
         aIID.equals(Components.interfaces.nsISupports))
       return this;
 
     throw Components.results.NS_ERROR_NO_INTERFACE;
   },
 
   _element: function EIO__element(aID) {
@@ -835,27 +841,16 @@ var gEditItemOverlay = {
       this._updateTags();
       break;
     case "unload":
       this.uninitPanel(false);
       break;
     }
   },
 
-  // mozILivemarkCallback
-  onCompletion: function EIO_onCompletion(aStatus, aLivemark) {
-    if (Components.isSuccessCode(aStatus)) {
-      this._isLivemark = true;
-      this._initTextField("feedLocationField", aLivemark.feedURI.spec, true);
-      this._initTextField("siteLocationField",
-                          aLivemark.siteURI ? aLivemark.siteURI.spec : "", true);
-      this._showHideRows();
-    }
-  },
-
   // nsINavBookmarkObserver
   onItemChanged: function EIO_onItemChanged(aItemId, aProperty,
                                             aIsAnnotationProperty, aValue,
                                             aLastModified, aItemType) {
     if (aProperty == "tags") {
       // Tags case is special, since they should be updated if either:
       // - the notification is for the edited bookmark
       // - the notification is for the edited history entry