Bug 633154. When alerts/prompts/confirms are suppressed, just return silently instead of throwing. r=sicking

This commit is contained in:
Boris Zbarsky 2015-09-08 21:23:55 -04:00
Родитель b1fba4f566
Коммит 169e4d2bc6
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -6918,7 +6918,9 @@ nsGlobalWindow::AlertOrConfirm(bool aAlert,
MOZ_ASSERT(IsOuterWindow());
if (!AreDialogsEnabled()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
// Just silently return. In the case of alert(), the return value is
// ignored. In the case of confirm(), returning false is the same thing as
// would happen if the user cancels.
return false;
}
@ -7058,7 +7060,7 @@ nsGlobalWindow::PromptOuter(const nsAString& aMessage, const nsAString& aInitial
SetDOMStringToNull(aReturn);
if (!AreDialogsEnabled()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
// Return null, as if the user just canceled the prompt.
return;
}
@ -7496,6 +7498,8 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError)
}
if (!AreDialogsEnabled()) {
// We probably want to keep throwing here; silently doing nothing is a bit
// weird given the typical use cases of print().
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return;
}
@ -9553,6 +9557,8 @@ nsGlobalWindow::ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgumen
EnsureReflowFlushAndPaint();
if (!AreDialogsEnabled()) {
// We probably want to keep throwing here; silently doing nothing is a bit
// weird given the typical use cases of showModalDialog().
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}