bug 864247. If PermitUnload is called while another PermitUnload is being processed, simply allow the unload to happen. r=roc

This commit is contained in:
Tim Abraldes 2013-08-05 23:29:55 -07:00
Родитель 939ef51c8a
Коммит cc4c6104ab
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -428,6 +428,7 @@ protected:
// may consider splitting these out into a subclass
unsigned mIsSticky : 1;
unsigned mInPermitUnload : 1;
unsigned mInPermitUnloadPrompt: 1;
#ifdef NS_PRINTING
unsigned mClosingWhilePrinting : 1;
@ -1090,7 +1091,10 @@ nsDocumentViewer::PermitUnload(bool aCallerClosesWindow, bool *aPermitUnload)
{
*aPermitUnload = true;
if (!mDocument || mInPermitUnload || mCallerIsClosingWindow) {
if (!mDocument
|| mInPermitUnload
|| mCallerIsClosingWindow
|| mInPermitUnloadPrompt) {
return NS_OK;
}
@ -1183,9 +1187,11 @@ nsDocumentViewer::PermitUnload(bool aCallerClosesWindow, bool *aPermitUnload)
(nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_1));
nsAutoSyncOperation sync(mDocument);
mInPermitUnloadPrompt = true;
rv = prompt->ConfirmEx(title, message, buttonFlags,
leaveLabel, stayLabel, nullptr, nullptr,
&dummy, &buttonPressed);
mInPermitUnloadPrompt = false;
NS_ENSURE_SUCCESS(rv, rv);
// Button 0 == leave, button 1 == stay