Bug 700080: don't show prompts for tabs that are closing, r=jst

This commit is contained in:
Gavin Sharp 2011-11-30 13:17:21 -08:00
parent f92f919db2
commit 8a9208c6c6
4 changed files with 16 additions and 4 deletions

View File

@ -1599,6 +1599,11 @@
evt.initUIEvent("TabClose", true, false, window, aTabWillBeMoved ? 1 : 0);
aTab.dispatchEvent(evt);
// Prevent this tab from showing further dialogs, since we're closing it
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
windowUtils.preventFurtherDialogs();
// Remove the tab's filter and progress listener.
const filter = this.mTabFilters[aTab._tPos];
#ifdef MOZ_E10S_COMPAT

View File

@ -1936,3 +1936,8 @@ nsDOMWindowUtils::CheckAndClearPaintedState(nsIDOMElement* aElement, bool* aResu
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::PreventFurtherDialogs() {
mWindow->PreventFurtherDialogs();
return NS_OK;
}

View File

@ -2627,10 +2627,7 @@ nsGlobalWindow::AreDialogsBlocked()
topWindow = topWindow->GetCurrentInnerWindowInternal();
return !topWindow ||
(topWindow->mDialogDisabled &&
(topWindow->GetPopupControlState() > openAllowed ||
topWindow->mDialogAbuseCount >= MAX_DIALOG_COUNT));
return !topWindow || topWindow->mDialogDisabled;
}
bool

View File

@ -926,4 +926,9 @@ interface nsIDOMWindowUtils : nsISupports {
*/
boolean checkAndClearPaintedState(in nsIDOMElement aElement);
/**
* Prevent this window (and any child windows) from displaying any further
* dialogs (e.g. window.alert()).
*/
void preventFurtherDialogs();
};