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

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.

Differential Revision: https://phabricator.services.mozilla.com/D222389
This commit is contained in:
David Parks
2024-09-19 16:17:21 +00:00
parent 795dad3b68
commit cdf1ecf510
2 changed files with 1 additions and 19 deletions

View File

@@ -1939,15 +1939,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvRealDragEvent(
} }
DispatchWidgetEventViaAPZ(localEvent); 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(); return IPC_OK();
} }

View File

@@ -191,15 +191,6 @@ nsresult nsDragSessionProxy::EndDragSessionImpl(bool aDoneDrag,
mSourceBrowser = nullptr; mSourceBrowser = nullptr;
} }
if (mTargetBrowser) { SetDragTarget(nullptr);
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;
}
return rv; return rv;
} }