Bug 1189964 - Fix a crash handling drags on dying windows. r=smaug
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 31 Jul 2015 17:03:37 -0700
changeset 287421 388cee5d9c5d461e8c55b75af225997172e71bff
parent 287420 d8c8695f0d5419831ad4e5fc31ae8eb83b6b6fa3
child 287422 9d754f7e1cb938fd1a3cc13f1407ec806a558c8e
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1189964
milestone42.0a1
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
Bug 1189964 - Fix a crash handling drags on dying windows. r=smaug
dom/ipc/TabParent.cpp
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3232,19 +3232,25 @@ bool
 TabParent::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
                                  const uint32_t& aAction,
                                  const nsCString& aVisualDnDData,
                                  const uint32_t& aWidth, const uint32_t& aHeight,
                                  const uint32_t& aStride, const uint8_t& aFormat,
                                  const int32_t& aDragAreaX, const int32_t& aDragAreaY)
 {
   mInitialDataTransferItems.Clear();
-  nsPresContext* pc = mFrameElement->OwnerDoc()->GetShell()->GetPresContext();
-  EventStateManager* esm = pc->EventStateManager();
-
+  nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell();
+  if (!shell) {
+    if (Manager()->IsContentParent()) {
+      Manager()->AsContentParent()->SendEndDragSession(true, true);
+    }
+    return true;
+  }
+
+  EventStateManager* esm = shell->GetPresContext()->EventStateManager();
   for (uint32_t i = 0; i < aTransfers.Length(); ++i) {
     auto& items = aTransfers[i].items();
     nsTArray<DataTransferItem>* itemArray = mInitialDataTransferItems.AppendElement();
     for (uint32_t j = 0; j < items.Length(); ++j) {
       const IPCDataTransferItem& item = items[j];
       DataTransferItem* localItem = itemArray->AppendElement();
       localItem->mFlavor = item.flavor();
       if (item.data().type() == IPCDataTransferData::TnsString) {