Fixing bug 153830. Making alert(null) display "null" in the alert, in stead of nothing at all. r=caillon@aillon.org, sr=peterv@propagandism.org, a=asa@mozilla.org

This commit is contained in:
jst%mozilla.jstenback.com 2004-04-08 01:53:40 +00:00
Родитель ef5a38702a
Коммит 14b9ad2f10
1 изменённых файлов: 8 добавлений и 5 удалений

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

@ -2294,11 +2294,12 @@ GlobalWindowImpl::Alert(const nsAString& aString)
{
NS_ENSURE_STATE(mDocShell);
nsAutoString str;
// Special handling for alert(null) in JS for backwards
// compatibility.
str.Assign(aString);
NS_NAMED_LITERAL_STRING(null_str, "null");
// XXX: Concatenation of optional args?
const nsAString *str = DOMStringIsNull(aString) ? &null_str : &aString;
nsCOMPtr<nsIPrompt> prompter(do_GetInterface(mDocShell));
NS_ENSURE_TRUE(prompter, NS_ERROR_FAILURE);
@ -2312,13 +2313,15 @@ GlobalWindowImpl::Alert(const nsAString& aString)
MakeScriptDialogTitle(EmptyString(), newTitle);
title = newTitle.get();
}
NS_WARN_IF_FALSE(!isChrome, "chrome shouldn't be calling alert(), use the prompt service");
NS_WARN_IF_FALSE(!isChrome,
"chrome shouldn't be calling alert(), use the prompt "
"service");
// Before bringing up the window, unsuppress painting and flush
// pending reflows.
EnsureReflowFlushAndPaint();
return prompter->Alert(title, str.get());
return prompter->Alert(title, PromiseFlatString(*str).get());
}
NS_IMETHODIMP