зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1911486: Leave DragSession connected to BrowserChild while sending dragend r=win-reviewers,gstoll
During EndDragSession and the dispatch of the dragend event in a content process (e.g. in an extension), accessing the event's dataTransfer didn't work because the session was already disconnected from the BrowserChild. This broke things like tab dragging from web-extension-based tabbars. This leaves the drag session in place until after EndDragSession is done. It also makes the reciprocal change to InvokeDragSession. Differential Revision: https://phabricator.services.mozilla.com/D218667
This commit is contained in:
Родитель
2ddad4db70
Коммит
5899e85856
|
@ -43,14 +43,12 @@ nsresult nsDragSessionProxy::InvokeDragSession(
|
|||
[[maybe_unused]] RefPtr<nsIDragSession> sourceSession =
|
||||
sourceBrowser->GetDragSession();
|
||||
MOZ_ASSERT(!sourceSession);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
sourceBrowser->GetWeakReference(getter_AddRefs(mSourceBrowser)));
|
||||
sourceBrowser->SetDragSession(this);
|
||||
nsresult rv = nsBaseDragSession::InvokeDragSession(
|
||||
aWidget, aDOMNode, aPrincipal, aCsp, aCookieJarSettings,
|
||||
aTransferableArray, aActionType, aContentPolicyType);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
sourceBrowser->GetWeakReference(getter_AddRefs(mSourceBrowser)));
|
||||
sourceBrowser->SetDragSession(this);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -179,6 +177,10 @@ void nsDragSessionProxy::SetDragTarget(BrowserChild* aTarget) {
|
|||
|
||||
nsresult nsDragSessionProxy::EndDragSessionImpl(bool aDoneDrag,
|
||||
uint32_t aKeyModifiers) {
|
||||
// End the drag session before removing it from its BrowserChild(s). This
|
||||
// leaves the drag session in place while EndDragSessionImpl sends dragend.
|
||||
nsresult rv = nsBaseDragSession::EndDragSessionImpl(aDoneDrag, aKeyModifiers);
|
||||
|
||||
if (mSourceBrowser) {
|
||||
nsCOMPtr<BrowserChild> sourceBC = do_QueryReferent(mSourceBrowser);
|
||||
MOZ_ASSERT(sourceBC);
|
||||
|
@ -199,5 +201,5 @@ nsresult nsDragSessionProxy::EndDragSessionImpl(bool aDoneDrag,
|
|||
mTargetBrowser = nullptr;
|
||||
}
|
||||
|
||||
return nsBaseDragSession::EndDragSessionImpl(aDoneDrag, aKeyModifiers);
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче