Bug 492802 - library details pane is refreshed on focus even when contents haven't changed, r=mak77
authorDietrich Ayala <dietrich@mozilla.com>
Tue, 19 May 2009 01:07:01 +0200
changeset 28518 652accbde6833fbc99b908c726edc8eb5c7a23e5
parent 28517 95e15728ccae554eb1a21accef61105f5ff3f6ca
child 28519 a1b982e50678461c7d955aaecfd340600aef1cd5
push id7104
push usermak77@bonardo.net
push dateMon, 18 May 2009 23:07:39 +0000
treeherdermozilla-central@652accbde683 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak77
bugs492802
milestone1.9.2a1pre
Bug 492802 - library details pane is refreshed on focus even when contents haven't changed, r=mak77
browser/components/places/content/editBookmarkOverlay.js
browser/components/places/content/places.js
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -58,16 +58,20 @@ var gEditItemOverlay = {
   // the first field which was edited after this panel was initialized for
   // a certain item
   _firstEditedField: "",
 
   get itemId() {
     return this._itemId;
   },
 
+  get uri() {
+    return this._uri;
+  },
+
   get multiEdit() {
     return this._multiEdit;
   },
 
   /**
    * Determines the initial data for the item edited or added by this dialog
    */
   _determineInfo: function EIO__determineInfo(aInfo) {
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -662,19 +662,26 @@ var PlacesOrganizer = {
       var focusedElement = document.commandDispatcher.focusedElement;
       if ((focusedElement instanceof HTMLInputElement ||
            focusedElement instanceof HTMLTextAreaElement) &&
           /^editBMPanel.*/.test(focusedElement.parentNode.parentNode.id))
         focusedElement.blur();
 
       // don't update the panel if we are already editing this node unless we're
       // in multi-edit mode
-      if (aSelectedNode && gEditItemOverlay.itemId == aSelectedNode.itemId &&
-          detailsDeck.selectedIndex == 1 && !gEditItemOverlay.multiEdit)
-        return;
+      if (aSelectedNode) {
+        var concreteId = PlacesUtils.getConcreteItemId(aSelectedNode);
+        var nodeIsSame = gEditItemOverlay.itemId == aSelectedNode.itemId ||
+                         gEditItemOverlay.itemId == concreteId ||
+                         (aSelectedNode.itemId == -1 && gEditItemOverlay.uri &&
+                          gEditItemOverlay.uri == aSelectedNode.uri);
+        if (nodeIsSame && detailsDeck.selectedIndex == 1 &&
+            !gEditItemOverlay.multiEdit)
+          return;
+      }
     }
 
     // Clean up the panel before initing it again.
     gEditItemOverlay.uninitPanel(false);
 
     if (aSelectedNode && !PlacesUtils.nodeIsSeparator(aSelectedNode)) {
       detailsDeck.selectedIndex = 1;
       // Using the concrete itemId is arguably wrong.  The bookmarks API