Bug 1062014 - Add node existence check to CustomizeMode's onDragEnd. r=mconley.
authorRuth <vallensd@gmail.com>
Tue, 14 Oct 2014 20:07:05 -0400
changeset 210416 af04c9b0b7f4448421b991d34424a90f7b4a3d32
parent 210415 8963be45cbf890a7b5896f132e2b3a199eef6b03
child 210417 a974e5f136ac1aa05ce9b516c18c8ce382c062bf
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmconley
bugs1062014
milestone36.0a1
Bug 1062014 - Add node existence check to CustomizeMode's onDragEnd. r=mconley.
browser/components/customizableui/CustomizeMode.jsm
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1900,18 +1900,24 @@ CustomizeMode.prototype = {
     if (!aEvent.dataTransfer.mozTypesAt(0)) {
       return;
     }
 
     let draggedItemId =
       aEvent.dataTransfer.mozGetDataAt(kDragDataTypePrefix + documentId, 0);
 
     let draggedWrapper = document.getElementById("wrapper-" + draggedItemId);
-    draggedWrapper.hidden = false;
-    draggedWrapper.removeAttribute("mousedown");
+
+    // DraggedWrapper might no longer available if a widget node is
+    // destroyed after starting (but before stopping) a drag.
+    if (draggedWrapper) {
+      draggedWrapper.hidden = false;
+      draggedWrapper.removeAttribute("mousedown");
+    }
+
     if (this._dragOverItem) {
       this._cancelDragActive(this._dragOverItem);
       this._dragOverItem = null;
     }
     this._updateToolbarCustomizationOutline(this.window);
     this._showPanelCustomizationPlaceholders();
     DragPositionManager.stop();
   },