bug 296237, remove assert in getElementById, use the console service to provide feedback, make the message localizable, v1.1 patch. patch by asqueella@gmail.com, r+sr=jst

This commit is contained in:
ted.mielczarek%gmail.com 2006-10-20 19:15:00 +00:00
Родитель da451f7820
Коммит 8c8cf22b2a
2 изменённых файлов: 10 добавлений и 8 удалений

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

@ -99,7 +99,7 @@
#include "nsIMultiPartChannel.h"
#include "nsIRefreshURI.h"
#include "nsIWebNavigation.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsNetUtil.h" // for NS_MakeAbsoluteURI
@ -2306,13 +2306,14 @@ PRBool
nsDocument::CheckGetElementByIdArg(const nsAString& aId)
{
if (aId.IsEmpty()) {
nsCOMPtr<nsIConsoleService> consoleService
(do_GetService("@mozilla.org/consoleservice;1"));
if (consoleService) {
consoleService->LogStringMessage(NS_LITERAL_STRING(
"Empty string passed to getElementById().").get());
}
nsContentUtils::ReportToConsole(
nsContentUtils::eDOM_PROPERTIES,
"EmptyGetElementByIdParam",
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM");
return PR_FALSE;
}
return PR_TRUE;

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

@ -17,3 +17,4 @@ UseOfRouteEventWarning=Use of routeEvent() is deprecated, see bug 330494.
UseOfPreventBubbleWarning=Event=%S, use of preventBubble() is deprecated. Use W3C standard stopPropagation() instead.
UseOfPreventCaptureWarning=Event=%S, use of preventCapture() is deprecated. Use W3C standard stopPropagation() instead.
UnexpectedCanvasVariantStyle=canvas: an attempt to set strokeStyle or fillStyle to a value that is neither a string, a CanvasGradient, or a CanvasPattern was ignored.
EmptyGetElementByIdParam=Empty string passed to getElementById().