Bug 1595399 - Prevent EndDragSession from being called recursively. r=smaug

nsGlobalWindowOuter::EnterModalState will try to end the current drag
session, so we need to keep track if we're entering modal state from
an event firing from ending the drag session.

Differential Revision: https://phabricator.services.mozilla.com/D53934

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Farre 2019-11-26 23:28:37 +00:00
Родитель 9c48606bb3
Коммит 2add364824
2 изменённых файлов: 8 добавлений и 1 удалений

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

@ -62,6 +62,7 @@ nsBaseDragService::nsBaseDragService()
: mCanDrop(false),
mOnlyChromeDrop(false),
mDoingDrag(false),
mEndingSession(false),
mHasImage(false),
mUserCancelled(false),
mDragEventDispatchedToChildProcess(false),
@ -453,10 +454,12 @@ int32_t nsBaseDragService::TakeChildProcessDragAction() {
//-------------------------------------------------------------------------
NS_IMETHODIMP
nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) {
if (!mDoingDrag) {
if (!mDoingDrag || mEndingSession) {
return NS_ERROR_FAILURE;
}
mEndingSession = true;
if (aDoneDrag && !mSuppressLevel) {
FireDragEventAtSource(eDragEnd, aKeyModifiers);
}
@ -485,6 +488,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) {
}
mDoingDrag = false;
mEndingSession = false;
mCanDrop = false;
// release the source we've been holding on to.

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

@ -149,6 +149,9 @@ class nsBaseDragService : public nsIDragService, public nsIDragSession {
bool mCanDrop;
bool mOnlyChromeDrop;
bool mDoingDrag;
// true if in EndDragSession
bool mEndingSession;
// true if mImage should be used to set a drag image
bool mHasImage;
// true if the user cancelled the drag operation