Bug 1918907: Don't clear drag session target BrowserChild on eDragLeave/eDragExit a=diannaS

The BrowserChild should only be cleared on EndDragSession, which is sent when
the user finishes or cancels dragging. This is reciprocal to it being set in
StartDragSession.

The change to nsDragSessionProxy::EndDragSessionImpl is non-functional -- it
highlights the BrowserChild symmetry above.

Original Revision: https://phabricator.services.mozilla.com/D222389

Differential Revision: https://phabricator.services.mozilla.com/D222947
This commit is contained in:
David Parks 2024-09-20 23:34:59 +00:00
parent b498abfce3
commit 770ca42976
2 changed files with 1 additions and 19 deletions

View file

@ -1901,15 +1901,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvRealDragEvent(
}
DispatchWidgetEventViaAPZ(localEvent);
if (aEvent.mMessage == eDragLeave || aEvent.mMessage == eDragExit) {
// If session is still active, remove its target.
dragSession = GetDragSession();
if (dragSession) {
static_cast<nsDragSessionProxy*>(dragSession.get())
->SetDragTarget(nullptr);
}
}
return IPC_OK();
}

View file

@ -191,15 +191,6 @@ nsresult nsDragSessionProxy::EndDragSessionImpl(bool aDoneDrag,
mSourceBrowser = nullptr;
}
if (mTargetBrowser) {
nsCOMPtr<BrowserChild> targetBC = do_QueryReferent(mTargetBrowser);
MOZ_ASSERT(targetBC);
[[maybe_unused]] RefPtr<nsIDragSession> session =
targetBC->GetDragSession();
MOZ_ASSERT(session == this);
targetBC->SetDragSession(nullptr);
mTargetBrowser = nullptr;
}
SetDragTarget(nullptr);
return rv;
}