From 8c8cf22b2aab5442ff3218268a58fd7ac1d9e3ec Mon Sep 17 00:00:00 2001 From: "ted.mielczarek%gmail.com" Date: Fri, 20 Oct 2006 19:15:00 +0000 Subject: [PATCH] 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 --- content/base/src/nsDocument.cpp | 17 +++++++++-------- dom/locales/en-US/chrome/dom/dom.properties | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 3bc0451be68..6c3d0b0ce67 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -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 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; diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index 2b6ae86f6e9..51972c316d3 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -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().