Bug 977950. Fix dragging of text to work again. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 28 Feb 2014 08:57:13 -0500
changeset 171254 b87877dfeb496b3839685ca8016069a293c38cf3
parent 171253 54bf6247cc5f68821f48470cbd9538c4d7cb2b4a
child 171255 d0b0dca8f79266b3c759e69d807f1c7913df2e05
push id5371
push userryanvm@gmail.com
push dateFri, 28 Feb 2014 21:09:59 +0000
treeherderfx-team@472fd46c20fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs977950
milestone30.0a1
Bug 977950. Fix dragging of text to work again. r=smaug
dom/events/DataTransfer.cpp
dom/events/DragEvent.cpp
dom/events/nsEventStateManager.cpp
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -315,17 +315,17 @@ DataTransfer::GetFiles(ErrorResult& aRv)
 
   return mFiles;
 }
 
 NS_IMETHODIMP
 DataTransfer::GetFiles(nsIDOMFileList** aFileList)
 {
   ErrorResult rv;
-  *aFileList = GetFiles(rv);
+  NS_IF_ADDREF(*aFileList = GetFiles(rv));
   return rv.ErrorCode();
 }
 
 already_AddRefed<DOMStringList>
 DataTransfer::Types()
 {
   nsRefPtr<DOMStringList> types = new DOMStringList();
   if (mItems.Length()) {
--- a/dom/events/DragEvent.cpp
+++ b/dom/events/DragEvent.cpp
@@ -82,17 +82,16 @@ DragEvent::InitDragEvent(const nsAString
                          bool aAltKey,
                          bool aShiftKey,
                          bool aMetaKey,
                          uint16_t aButton,
                          nsIDOMEventTarget* aRelatedTarget,
                          nsIDOMDataTransfer* aDataTransfer)
 {
   nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer);
-  NS_ENSURE_ARG(dataTransfer);
 
   nsresult rv =
     MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
                                aScreenX, aScreenY, aClientX, aClientY,
                                aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
                                aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/events/nsEventStateManager.cpp
+++ b/dom/events/nsEventStateManager.cpp
@@ -2332,19 +2332,19 @@ nsEventStateManager::DoDefaultDragStart(
     aDataTransfer->GetMozItemCount(&count);
   if (!count)
     return false;
 
   // Get the target being dragged, which may not be the same as the
   // target of the mouse event. If one wasn't set in the
   // aDataTransfer during the event handler, just use the original
   // target instead.
-  nsCOMPtr<Element> dragTarget = aDataTransfer->GetDragTarget();
+  nsCOMPtr<nsIContent> dragTarget = aDataTransfer->GetDragTarget();
   if (!dragTarget) {
-    dragTarget = do_QueryInterface(aDragTarget);
+    dragTarget = aDragTarget;
     if (!dragTarget)
       return false;
   }
 
   // check which drag effect should initially be used. If the effect was not
   // set, just use all actions, otherwise Windows won't allow a drop.
   uint32_t action;
   aDataTransfer->GetEffectAllowedInt(&action);