зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c9b71d1747ea (bug 1552814) for assertion failures on nsBaseDragService.cpp CLOSED TREE
--HG-- extra : rebase_source : 4a3e9922237c8638c9b2edd45cc2309094f3d352 extra : amend_source : 1629bf05b705065193ec1ee3e17086db3efd254e
This commit is contained in:
Родитель
562194ec83
Коммит
cfbd01b5d9
|
@ -1692,10 +1692,9 @@ void EventStateManager::StopTrackingDragGesture(bool aClearInChildProcesses) {
|
|||
mGestureDownFrameOwner = nullptr;
|
||||
mGestureDownDragStartData = nullptr;
|
||||
|
||||
// If a content process starts a drag but the mouse is released before the
|
||||
// parent starts the actual drag, the content process will think a drag is
|
||||
// still happening. Inform any child processes with active drags that the drag
|
||||
// should be stopped.
|
||||
// If a content process starts a drag but the mouse is released before the parent
|
||||
// starts the actual drag, the content process will think a drag is still happening.
|
||||
// Inform any child processes with active drags that the drag should be stopped.
|
||||
if (aClearInChildProcesses) {
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
|
@ -1855,7 +1854,6 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
nsCOMPtr<nsIContent> eventContent, targetContent;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
bool allowEmptyDataTransfer = false;
|
||||
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(eventContent));
|
||||
if (eventContent) {
|
||||
// If the content is a text node in a password field, we shouldn't
|
||||
|
@ -1877,10 +1875,9 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
DetermineDragTargetAndDefaultData(
|
||||
window, eventContent, dataTransfer, &allowEmptyDataTransfer,
|
||||
getter_AddRefs(selection), getter_AddRefs(remoteDragStartData),
|
||||
getter_AddRefs(targetContent), getter_AddRefs(principal),
|
||||
getter_AddRefs(csp));
|
||||
window, eventContent, dataTransfer, getter_AddRefs(selection),
|
||||
getter_AddRefs(remoteDragStartData), getter_AddRefs(targetContent),
|
||||
getter_AddRefs(principal), getter_AddRefs(csp));
|
||||
}
|
||||
|
||||
// Stop tracking the drag gesture now. This should stop us from
|
||||
|
@ -1945,9 +1942,9 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
if (status != nsEventStatus_eConsumeNoDefault) {
|
||||
bool dragStarted = DoDefaultDragStart(
|
||||
aPresContext, event, dataTransfer, allowEmptyDataTransfer,
|
||||
targetContent, selection, remoteDragStartData, principal, csp);
|
||||
bool dragStarted =
|
||||
DoDefaultDragStart(aPresContext, event, dataTransfer, targetContent,
|
||||
selection, remoteDragStartData, principal, csp);
|
||||
if (dragStarted) {
|
||||
sActiveESM = nullptr;
|
||||
MaybeFirePointerCancel(aEvent);
|
||||
|
@ -1965,12 +1962,11 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
|
||||
void EventStateManager::DetermineDragTargetAndDefaultData(
|
||||
nsPIDOMWindowOuter* aWindow, nsIContent* aSelectionTarget,
|
||||
DataTransfer* aDataTransfer, bool* aAllowEmptyDataTransfer,
|
||||
Selection** aSelection, RemoteDragStartData** aRemoteDragStartData,
|
||||
nsIContent** aTargetNode, nsIPrincipal** aPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp) {
|
||||
DataTransfer* aDataTransfer, Selection** aSelection,
|
||||
RemoteDragStartData** aRemoteDragStartData, nsIContent** aTargetNode,
|
||||
nsIPrincipal** aPrincipal, nsIContentSecurityPolicy** aCsp) {
|
||||
*aTargetNode = nullptr;
|
||||
*aAllowEmptyDataTransfer = false;
|
||||
|
||||
nsCOMPtr<nsIContent> dragDataNode;
|
||||
|
||||
nsIContent* editingElement = aSelectionTarget->IsEditable()
|
||||
|
@ -1986,7 +1982,6 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
mGestureDownDragStartData->AddInitialDnDDataTo(aDataTransfer, aPrincipal,
|
||||
aCsp);
|
||||
mGestureDownDragStartData.forget(aRemoteDragStartData);
|
||||
*aAllowEmptyDataTransfer = true;
|
||||
}
|
||||
} else {
|
||||
mGestureDownDragStartData = nullptr;
|
||||
|
@ -2026,9 +2021,6 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
while (dragContent) {
|
||||
if (auto htmlElement = nsGenericHTMLElement::FromNode(dragContent)) {
|
||||
if (htmlElement->Draggable()) {
|
||||
// We let draggable elements to trigger dnd even if there is no data
|
||||
// in the DataTransfer.
|
||||
*aAllowEmptyDataTransfer = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -2065,8 +2057,7 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
|
||||
bool EventStateManager::DoDefaultDragStart(
|
||||
nsPresContext* aPresContext, WidgetDragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer, bool aAllowEmptyDataTransfer,
|
||||
nsIContent* aDragTarget, Selection* aSelection,
|
||||
DataTransfer* aDataTransfer, nsIContent* aDragTarget, Selection* aSelection,
|
||||
RemoteDragStartData* aDragStartData, nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp) {
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
|
@ -2090,7 +2081,7 @@ bool EventStateManager::DoDefaultDragStart(
|
|||
if (aDataTransfer) {
|
||||
count = aDataTransfer->MozItemCount();
|
||||
}
|
||||
if (!aAllowEmptyDataTransfer && !count) {
|
||||
if (!count) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1046,8 +1046,6 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
*
|
||||
* aSelectionTarget - target to check for selection
|
||||
* aDataTransfer - data transfer object that will contain the data to drag
|
||||
* aAllowEmptyDataTransfer - [out] set to true, if dnd operation can be
|
||||
* started even if DataTransfer is empty
|
||||
* aSelection - [out] set to the selection to be dragged
|
||||
* aTargetNode - [out] the draggable node, or null if there isn't one
|
||||
* aPrincipal - [out] set to the triggering principal of the drag, or null
|
||||
|
@ -1055,8 +1053,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
*/
|
||||
void DetermineDragTargetAndDefaultData(
|
||||
nsPIDOMWindowOuter* aWindow, nsIContent* aSelectionTarget,
|
||||
dom::DataTransfer* aDataTransfer, bool* aAllowEmptyDataTransfer,
|
||||
dom::Selection** aSelection,
|
||||
dom::DataTransfer* aDataTransfer, dom::Selection** aSelection,
|
||||
dom::RemoteDragStartData** aRemoteDragStartData, nsIContent** aTargetNode,
|
||||
nsIPrincipal** aPrincipal, nsIContentSecurityPolicy** aCsp);
|
||||
|
||||
|
@ -1067,8 +1064,6 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
*
|
||||
* aDragEvent - the dragstart event
|
||||
* aDataTransfer - the data transfer that holds the data to be dragged
|
||||
* aAllowEmptyDataTransfer - if true, dnd can be started even if there is no
|
||||
* data to drag
|
||||
* aDragTarget - the target of the drag
|
||||
* aSelection - the selection to be dragged
|
||||
* aData - information pertaining to a drag started in a child process
|
||||
|
@ -1079,7 +1074,6 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
bool DoDefaultDragStart(nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aDragEvent,
|
||||
dom::DataTransfer* aDataTransfer,
|
||||
bool aAllowEmptyDataTransfer,
|
||||
nsIContent* aDragTarget, dom::Selection* aSelection,
|
||||
dom::RemoteDragStartData* aDragStartData,
|
||||
nsIPrincipal* aPrincipal,
|
||||
|
|
|
@ -1244,9 +1244,6 @@ GtkTargetList* nsDragService::GetSourceList(void) {
|
|||
g_free(thisTarget);
|
||||
}
|
||||
g_free(targets);
|
||||
} else {
|
||||
// We need to create a dummy target list to be able initialize dnd.
|
||||
targetList = gtk_target_list_new(nullptr, 0);
|
||||
}
|
||||
return targetList;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "mozilla/Unused.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "BrowserParent.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include <algorithm>
|
||||
|
@ -253,28 +253,12 @@ nsBaseDragService::InvokeDragSession(
|
|||
|
||||
uint32_t length = 0;
|
||||
mozilla::Unused << aTransferableArray->GetLength(&length);
|
||||
if (!length) {
|
||||
nsCOMPtr<nsIMutableArray> mutableArray =
|
||||
do_QueryInterface(aTransferableArray);
|
||||
if (mutableArray) {
|
||||
// In order to be able trigger dnd, we need to have some transferable
|
||||
// object.
|
||||
nsCOMPtr<nsITransferable> trans =
|
||||
do_CreateInstance("@mozilla.org/widget/transferable;1");
|
||||
trans->Init(nullptr);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsITransferable> trans = do_QueryElementAt(aTransferableArray, i);
|
||||
if (trans) {
|
||||
// Set the requestingPrincipal on the transferable.
|
||||
trans->SetRequestingPrincipal(mSourceNode->NodePrincipal());
|
||||
trans->SetContentPolicyType(mContentPolicyType);
|
||||
mutableArray->AppendElement(trans);
|
||||
}
|
||||
} else {
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsITransferable> trans =
|
||||
do_QueryElementAt(aTransferableArray, i);
|
||||
if (trans) {
|
||||
// Set the requestingPrincipal on the transferable.
|
||||
trans->SetRequestingPrincipal(mSourceNode->NodePrincipal());
|
||||
trans->SetContentPolicyType(mContentPolicyType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -880,8 +864,9 @@ bool nsBaseDragService::MaybeAddChildProcess(
|
|||
bool nsBaseDragService::RemoveAllChildProcesses() {
|
||||
for (uint32_t c = 0; c < mChildProcesses.Length(); c++) {
|
||||
mozilla::Unused << mChildProcesses[c]->SendEndDragSession(
|
||||
true, false, LayoutDeviceIntPoint(), 0);
|
||||
true, false, LayoutDeviceIntPoint(), 0);
|
||||
}
|
||||
mChildProcesses.Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче