From 109b94bc7f0c05c96a9d4d2efa1e661e151ca1d8 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Thu, 27 Apr 2017 15:17:18 -0400 Subject: [PATCH] Backout Bug 1352852 due to windows non-e10s test_drag_empty.html timeouts, a=backout --- dom/events/DataTransfer.cpp | 24 --------- dom/events/DataTransfer.h | 4 -- dom/events/EventStateManager.cpp | 17 ------ dom/events/test/mochitest.ini | 1 - dom/events/test/test_drag_empty.html | 78 ---------------------------- widget/nsITransferable.idl | 7 --- 6 files changed, 131 deletions(-) delete mode 100644 dom/events/test/test_drag_empty.html diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index 538adb003e52..e739f0606da9 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -38,7 +38,6 @@ #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/OSFileSystem.h" #include "mozilla/dom/Promise.h" -#include "mozilla/storage/Variant.h" #include "nsNetUtil.h" namespace mozilla { @@ -1574,28 +1573,5 @@ DataTransfer::FillInExternalCustomTypes(nsIVariant* aData, uint32_t aIndex, } while (type != eCustomClipboardTypeId_None); } -void -DataTransfer::AddDummyHiddenData() -{ - RefPtr variant = new nsVariantCC(); - variant->SetAsAString(EmptyString()); - - ErrorResult rv; - RefPtr item = - mItems->SetDataWithPrincipal(NS_LITERAL_STRING(kDummyTypeMime), - variant, - /* aIndex = */ 0, - nsContentUtils::GetSystemPrincipal(), - /* aInsertOnly = */ true, - /* aHidden = */ true, - rv); - MOZ_ASSERT(item->ChromeOnly()); - - // We might have gotten a NS_ERROR_DOM_NOT_SUPPORTED_ERROR because we've - // already added an application/x-moz-dummy-data. We want to ignore that - // error. - rv.SuppressException(); -} - } // namespace dom } // namespace mozilla diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index e291ccb5f1da..729b23feb371 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -270,10 +270,6 @@ public: nsIPrincipal* aPrincipal, bool aHidden); - // Adds a dummy type to the DataTransfer which is hidden from the user to - // allow the drag to run. This type is not visible to content code. - void AddDummyHiddenData(); - // returns a weak reference to the drag image Element* GetDragImage(int32_t* aX, int32_t* aY) const { diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 33248d20011c..e8896c513398 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -1798,23 +1798,6 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext, WidgetDragEvent* event = &startEvent; - // If we didn't get any data in the dataTransfer, yet the targetContent is - // a draggable HTML element draggable, we need to fire the drag event - // anyway. We'll add a custom dummy data type to the DataTransfer to make - // this possible. This data type will be marked as hidden so that content - // can't see it. This does not apply to non-HTML elements. - uint32_t count = 0; - dataTransfer->GetMozItemCount(&count); - if (count == 0) { - nsCOMPtr htmlDragTarget = do_QueryInterface(targetContent); - bool draggable = false; - if (htmlDragTarget && - NS_SUCCEEDED(htmlDragTarget->GetDraggable(&draggable)) && - draggable) { - dataTransfer->AddDummyHiddenData(); - } - } - nsCOMPtr observerService = mozilla::services::GetObserverService(); // Emit observer event to allow addons to modify the DataTransfer object. diff --git a/dom/events/test/mochitest.ini b/dom/events/test/mochitest.ini index 5b4f7d187bf6..4169cef30c6f 100644 --- a/dom/events/test/mochitest.ini +++ b/dom/events/test/mochitest.ini @@ -177,4 +177,3 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM [test_bug1332699.html] [test_bug1339758.html] [test_dnd_with_modifiers.html] -[test_drag_empty.html] diff --git a/dom/events/test/test_drag_empty.html b/dom/events/test/test_drag_empty.html deleted file mode 100644 index 21db8c5db1c5..000000000000 --- a/dom/events/test/test_drag_empty.html +++ /dev/null @@ -1,78 +0,0 @@ - - - Tests for the dragstart event - - - - - - - - - - -
This is a bit of text.
- -
THIS IS A DROP TARGET?!?!?
- - - - diff --git a/widget/nsITransferable.idl b/widget/nsITransferable.idl index b808319ed7c3..b128586dd1ea 100644 --- a/widget/nsITransferable.idl +++ b/widget/nsITransferable.idl @@ -50,15 +50,8 @@ interface nsIPrincipal; // a synthetic flavor, put into the transferable once we know the destination directory of a file drag #define kFilePromiseDirectoryMime "application/x-moz-file-promise-dir" -// A custom data type used by DataTransfer for securely transferring arbitrary -// data through the drag or clipboard object without allowing websites to set -// arbitrary data types. #define kCustomTypesMime "application/x-moz-custom-clipdata" -// A custom data type used during drag events to allow them to occur even when -// no data has been attached to the drag event's Transferrable. -#define kDummyTypeMime "application/x-moz-dummy-data" - %}