Backout Bug 1352852 due to windows non-e10s test_drag_empty.html timeouts, a=backout

This commit is contained in:
Michael Layzell 2017-04-27 15:17:18 -04:00
Родитель 0504ed64c3
Коммит 109b94bc7f
6 изменённых файлов: 0 добавлений и 131 удалений

Просмотреть файл

@ -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<nsVariantCC> variant = new nsVariantCC();
variant->SetAsAString(EmptyString());
ErrorResult rv;
RefPtr<DataTransferItem> 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

Просмотреть файл

@ -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
{

Просмотреть файл

@ -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<nsIDOMHTMLElement> htmlDragTarget = do_QueryInterface(targetContent);
bool draggable = false;
if (htmlDragTarget &&
NS_SUCCEEDED(htmlDragTarget->GetDraggable(&draggable)) &&
draggable) {
dataTransfer->AddDummyHiddenData();
}
}
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
// Emit observer event to allow addons to modify the DataTransfer object.

Просмотреть файл

@ -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]

Просмотреть файл

@ -1,78 +0,0 @@
<html>
<head>
<title>Tests for the dragstart event</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<!--
This test checks the behaviour of the dragstart event when no data is added to the DataTransfer.
-->
<style>
#droptarget { width: 100px; height: 100px; background-color: #550000; }
</style>
<div id="draggable" draggable="true" ondragstart="onDragStart(event)">This is a bit of text.</div>
<div id="droptarget" ondragover="onDragOver(event)" ondrop="onDrop(event)">THIS IS A DROP TARGET?!?!?</div>
<script>
let dragStartFired = false;
function onDragStart(event) {
dragStartFired = true;
info("dragstart fired");
}
let dragOverFired = false;
function onDragOver(event) {
dragOverFired = true;
event.preventDefault();
info("dragover fired");
}
let dropFired = false;
function onDrop(event) {
dropFired = true;
is(event.dataTransfer.types.length, 0,
"There shouldn't be any data on the DataTransfer");
info("drop fired");
}
let loaded = new Promise(resolve => document.body.onload = resolve);
add_task(function*() {
var ds = SpecialPowers.Cc["@mozilla.org/widget/dragservice;1"].
getService(SpecialPowers.Ci.nsIDragService);
ok(!ds.getCurrentSession(), "There should be no drag session in progress");
// XXX: Make sure that we've finished loading the document before we start
// trying to do work with drag events.
yield loaded;
var draggable = $("draggable");
var droptarget = $("droptarget");
// Fire the dragstart event - this should start a drag session
synthesizeMouse(draggable, 6, 6, { type: "mousedown" });
synthesizeMouse(draggable, 14, 14, { type: "mousemove" });
// drags are asynchronous on Linux, so this extra event is needed to make
// sure the drag gets processed
synthesizeMouse(draggable, 15, 15, { type: "mousemove" });
ok(dragStartFired, "dragstart should have fired");
ok(ds.getCurrentSession(), "The drag session should have started");
// Synthesize the dragover and drop events on the target node.
var [result, dataTransfer] = synthesizeDragOver(draggable, droptarget);
synthesizeDropAfterDragOver(result, dataTransfer, droptarget);
ds.endDragSession(true);
ok(dropFired, "drop should have been fired");
ok(dragOverFired, "dragover should have been fired");
ok(!ds.getCurrentSession(), "The drag session should have ended");
});
</script>
</body>
</html>

Просмотреть файл

@ -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"
%}