Bug 704820 - Simplify nsContentUtils::ReportToConsole. r=smaug

This commit is contained in:
Masatoshi Kimura 2011-12-15 14:47:03 +00:00
parent c42faab598
commit 26a3901298
26 changed files with 182 additions and 296 deletions

View File

@ -739,19 +739,22 @@ public:
/**
* Report a localized error message to the error console.
* @param aFile Properties file containing localized message.
* @param aMessageName Name of localized message.
* @param aParams Parameters to be substituted into localized message.
* @param aParamsLength Length of aParams.
* @param aURI URI of resource containing error (may be null).
* @param aSourceLine The text of the line that contains the error (may be
empty).
* @param aLineNumber Line number within resource containing error.
* @param aColumnNumber Column number within resource containing error.
* @param aErrorFlags See nsIScriptError.
* @param aCategory Name of module reporting error.
* @param [aInnerWindowId=0] (Optional) The window ID of the inner window
* the message originates from.
* @param aDocument Reference to the document which triggered the message.
* @param aFile Properties file containing localized message.
* @param aMessageName Name of localized message.
* @param [aParams=nsnull] (Optional) Parameters to be substituted into
localized message.
* @param [aParamsLength=0] (Optional) Length of aParams.
* @param [aURI=nsnull] (Optional) URI of resource containing error.
* @param [aSourceLine=EmptyString()] (Optional) The text of the line that
contains the error (may be empty).
* @param [aLineNumber=0] (Optional) Line number within resource
containing error.
* @param [aColumnNumber=0] (Optional) Column number within resource
containing error.
If aURI is null, then aDocument->GetDocumentURI() is used.
*/
enum PropertiesFile {
eCSS_PROPERTIES,
@ -767,45 +770,18 @@ public:
eCOMMON_DIALOG_PROPERTIES,
PropertiesFile_COUNT
};
static nsresult ReportToConsole(PropertiesFile aFile,
const char *aMessageName,
const PRUnichar **aParams,
PRUint32 aParamsLength,
nsIURI* aURI,
const nsAFlatString& aSourceLine,
PRUint32 aLineNumber,
PRUint32 aColumnNumber,
PRUint32 aErrorFlags,
static nsresult ReportToConsole(PRUint32 aErrorFlags,
const char *aCategory,
PRUint64 aInnerWindowId = 0);
/**
* Report a localized error message to the error console.
* @param aFile Properties file containing localized message.
* @param aMessageName Name of localized message.
* @param aParams Parameters to be substituted into localized message.
* @param aParamsLength Length of aParams.
* @param aURI URI of resource containing error (may be null).
* @param aSourceLine The text of the line that contains the error (may be
empty).
* @param aLineNumber Line number within resource containing error.
* @param aColumnNumber Column number within resource containing error.
* @param aErrorFlags See nsIScriptError.
* @param aCategory Name of module reporting error.
* @param aDocument Reference to the document which triggered the message.
If aURI is null, then aDocument->GetDocumentURI() is used.
*/
static nsresult ReportToConsole(PropertiesFile aFile,
nsIDocument* aDocument,
PropertiesFile aFile,
const char *aMessageName,
const PRUnichar **aParams,
PRUint32 aParamsLength,
nsIURI* aURI,
const nsAFlatString& aSourceLine,
PRUint32 aLineNumber,
PRUint32 aColumnNumber,
PRUint32 aErrorFlags,
const char *aCategory,
nsIDocument* aDocument);
const PRUnichar **aParams = nsnull,
PRUint32 aParamsLength = 0,
nsIURI* aURI = nsnull,
const nsAFlatString& aSourceLine
= EmptyString(),
PRUint32 aLineNumber = 0,
PRUint32 aColumnNumber = 0);
/**
* Get the localized string named |aKey| in properties file |aFile|.

View File

@ -301,11 +301,11 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel,
newUri->GetSpec(newUriSpec);
const PRUnichar *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() };
if (NS_SUCCEEDED(rv)) {
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"InvalidRedirectChannelWarning",
formatParams, 1, nsnull, EmptyString(),
0, 0, nsIScriptError::warningFlag,
"Redirect Error");
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"Redirect Error", nsnull,
nsContentUtils::eDOM_PROPERTIES,
"InvalidRedirectChannelWarning",
formatParams, 1);
}
return NS_BINDING_FAILED;

View File

@ -2785,22 +2785,30 @@ nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
}
/* static */ nsresult
nsContentUtils::ReportToConsole(PropertiesFile aFile,
nsContentUtils::ReportToConsole(PRUint32 aErrorFlags,
const char *aCategory,
nsIDocument* aDocument,
PropertiesFile aFile,
const char *aMessageName,
const PRUnichar **aParams,
PRUint32 aParamsLength,
nsIURI* aURI,
const nsAFlatString& aSourceLine,
PRUint32 aLineNumber,
PRUint32 aColumnNumber,
PRUint32 aErrorFlags,
const char *aCategory,
PRUint64 aInnerWindowId)
PRUint32 aColumnNumber)
{
NS_ASSERTION((aParams && aParamsLength) || (!aParams && !aParamsLength),
"Supply either both parameters and their number or no"
"parameters and 0.");
PRUint64 innerWindowID = 0;
if (aDocument) {
if (!aURI) {
aURI = aDocument->GetDocumentURI();
}
innerWindowID = aDocument->InnerWindowID();
}
nsresult rv;
if (!sConsoleService) { // only need to bother null-checking here
rv = CallGetService(NS_CONSOLESERVICE_CONTRACTID, &sConsoleService);
@ -2830,40 +2838,13 @@ nsContentUtils::ReportToConsole(PropertiesFile aFile,
aSourceLine.get(),
aLineNumber, aColumnNumber,
aErrorFlags, aCategory,
aInnerWindowId);
innerWindowID);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errorObject);
return sConsoleService->LogMessage(logError);
}
/* static */ nsresult
nsContentUtils::ReportToConsole(PropertiesFile aFile,
const char *aMessageName,
const PRUnichar **aParams,
PRUint32 aParamsLength,
nsIURI* aURI,
const nsAFlatString& aSourceLine,
PRUint32 aLineNumber,
PRUint32 aColumnNumber,
PRUint32 aErrorFlags,
const char *aCategory,
nsIDocument* aDocument)
{
nsIURI* uri = aURI;
PRUint64 innerWindowID = 0;
if (aDocument) {
if (!uri) {
uri = aDocument->GetDocumentURI();
}
innerWindowID = aDocument->InnerWindowID();
}
return ReportToConsole(aFile, aMessageName, aParams, aParamsLength, uri,
aSourceLine, aLineNumber, aColumnNumber, aErrorFlags,
aCategory, innerWindowID);
}
bool
nsContentUtils::IsChromeDoc(nsIDocument *aDocument)
{

View File

@ -4018,13 +4018,10 @@ nsDocument::BeginLoad()
void
nsDocument::ReportEmptyGetElementByIdArg()
{
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"EmptyGetElementByIdParam",
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", this);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", this,
nsContentUtils::eDOM_PROPERTIES,
"EmptyGetElementByIdParam");
}
Element*
@ -5307,13 +5304,10 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
if (!mHasWarnedAboutBoxObjects && !content->IsXUL()) {
mHasWarnedAboutBoxObjects = true;
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"UseOfGetBoxObjectForWarning",
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"BoxObjects", this);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"BoxObjects", this,
nsContentUtils::eDOM_PROPERTIES,
"UseOfGetBoxObjectForWarning");
}
*aResult = nsnull;
@ -8197,13 +8191,10 @@ nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation)
return;
}
mWarnedAbout |= (1 << aOperation);
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
kWarnings[aOperation],
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Core", this);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Core", this,
nsContentUtils::eDOM_PROPERTIES,
kWarnings[aOperation]);
}
nsresult
@ -8717,12 +8708,10 @@ LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
true,
false);
e->PostDOMEvent();
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aMessage,
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", aDoc);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", aDoc,
nsContentUtils::eDOM_PROPERTIES,
aMessage);
}
void

View File

@ -3081,12 +3081,10 @@ nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
if (IsFullScreenAncestor()) {
// The element being removed is an ancestor of the full-screen element,
// exit full-screen state.
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"RemovedFullScreenElement",
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", OwnerDoc());
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
"RemovedFullScreenElement");
// Fully exit full-screen.
nsIDocument::ExitFullScreen(false);
}

View File

@ -707,17 +707,10 @@ static void LogMessage(const char* aWarning, nsPIDOMWindow* aWindow)
if (aWindow) {
doc = do_QueryInterface(aWindow->GetExtantDocument());
}
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull,
0,
nsnull, // Response URL not kept around
EmptyString(),
0,
0,
nsIScriptError::warningFlag,
"DOM",
doc);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
/* readonly attribute nsIDOMDocument responseXML; */

View File

@ -906,14 +906,11 @@ nsCanvasRenderingContext2D::SetStyleFromStringOrInterface(const nsAString& aStr,
}
nsContentUtils::ReportToConsole(
nsContentUtils::eDOM_PROPERTIES,
"UnexpectedCanvasVariantStyle",
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"Canvas",
mCanvasElement ? HTMLCanvasElement()->OwnerDoc() : nsnull);
mCanvasElement ? HTMLCanvasElement()->OwnerDoc() : nsnull,
nsContentUtils::eDOM_PROPERTIES,
"UnexpectedCanvasVariantStyle");
return NS_OK;
}

View File

@ -1096,14 +1096,11 @@ nsCanvasRenderingContext2DAzure::SetStyleFromStringOrInterface(const nsAString&
}
nsContentUtils::ReportToConsole(
nsContentUtils::eDOM_PROPERTIES,
"UnexpectedCanvasVariantStyle",
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"Canvas",
mCanvasElement ? HTMLCanvasElement()->OwnerDoc() : nsnull);
mCanvasElement ? HTMLCanvasElement()->OwnerDoc() : nsnull,
nsContentUtils::eDOM_PROPERTIES,
"UnexpectedCanvasVariantStyle");
return NS_OK;
}

View File

@ -519,13 +519,11 @@ ReportUseOfDeprecatedMethod(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsAutoString type;
aDOMEvent->GetType(type);
const PRUnichar *strings[] = { type.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning,
strings, ArrayLength(strings),
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events", doc);
strings, ArrayLength(strings));
}
NS_IMETHODIMP

View File

@ -80,13 +80,11 @@ SendJSWarning(nsIDocument* aDocument,
const char* aWarningName,
const PRUnichar** aWarningArgs, PRUint32 aWarningArgsLen)
{
nsContentUtils::ReportToConsole(nsContentUtils::eFORMS_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"HTML", aDocument,
nsContentUtils::eFORMS_PROPERTIES,
aWarningName,
aWarningArgs, aWarningArgsLen,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"HTML", aDocument);
aWarningArgs, aWarningArgsLen);
}
// --------------------------------------------------------------------------

View File

@ -3470,12 +3470,10 @@ nsresult nsGenericHTMLElement::MozRequestFullScreen()
// and it also makes it harder for bad guys' script to go full-screen and
// spoof the browser chrome/window and phish logins etc.
if (!nsContentUtils::IsRequestFullScreenAllowed()) {
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"FullScreenDeniedNotInputDriven",
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", OwnerDoc());
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
"FullScreenDeniedNotInputDriven");
nsRefPtr<nsPLDOMEvent> e =
new nsPLDOMEvent(OwnerDoc(),
NS_LITERAL_STRING("mozfullscreenerror"),

View File

@ -298,12 +298,10 @@ nsHTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
// event dispatch, and we're in full-screen mode. Exit full-screen mode
// to prevent phishing attacks.
nsIDocument::ExitFullScreen(true);
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"AddedWindowedPluginWhileFullScreen",
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", aDocument);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", aDocument,
nsContentUtils::eDOM_PROPERTIES,
"AddedWindowedPluginWhileFullScreen");
}
#endif
return NS_OK;

View File

@ -209,13 +209,10 @@ MyPrefChangedCallback(const char*aPrefName, void* instance_data)
static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events", aDoc);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
static nsresult
@ -1917,13 +1914,12 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
(mParser && !mParser->IsInsertionPointDefined())) {
if (mExternalScriptsBeingEvaluated) {
// Instead of implying a call to document.open(), ignore the call.
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", this,
nsContentUtils::eDOM_PROPERTIES,
"DocumentWriteIgnored",
nsnull, 0,
mDocumentURI,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events", this);
mDocumentURI);
return NS_OK;
}
mWriteState = eDocumentClosed;
@ -1934,13 +1930,12 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
if (!mParser) {
if (mExternalScriptsBeingEvaluated) {
// Instead of implying a call to document.open(), ignore the call.
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", this,
nsContentUtils::eDOM_PROPERTIES,
"DocumentWriteIgnored",
nsnull, 0,
mDocumentURI,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events", this);
mDocumentURI);
return NS_OK;
}
nsCOMPtr<nsISupports> ignored;

View File

@ -247,15 +247,15 @@ nsXBLContentSink::ReportUnexpectedElement(nsIAtom* aElementName,
const PRUnichar* params[] = { elementName.get() };
return nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL Content Sink",
mDocument,
nsContentUtils::eXBL_PROPERTIES,
"UnexpectedElement",
params, ArrayLength(params),
nsnull,
EmptyString() /* source line */,
aLineNumber, 0 /* column number */,
nsIScriptError::errorFlag,
"XBL Content Sink",
mDocument);
aLineNumber);
}
void
@ -587,13 +587,13 @@ nsXBLContentSink::ConstructBinding(PRUint32 aLineNumber)
mBinding = nsnull;
}
} else {
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL Content Sink", nsnull,
nsContentUtils::eXBL_PROPERTIES,
"MissingIdAttr", nsnull, 0,
mDocumentURI,
EmptyString(),
aLineNumber, 0,
nsIScriptError::errorFlag,
"XBL Content Sink");
aLineNumber);
}
return rv;
@ -676,14 +676,14 @@ nsXBLContentSink::ConstructHandler(const PRUnichar **aAtts, PRUint32 aLineNumber
// Make sure the XBL doc is chrome or resource if we have a command
// shorthand syntax.
mState = eXBL_Error;
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL Content Sink",
mDocument,
nsContentUtils::eXBL_PROPERTIES,
"CommandNotInChrome", nsnull, 0,
nsnull,
EmptyString() /* source line */,
aLineNumber, 0 /* column number */,
nsIScriptError::errorFlag,
"XBL Content Sink",
mDocument);
aLineNumber);
return; // Don't even make this handler.
}

View File

@ -2355,13 +2355,12 @@ nsXBLPrototypeBinding::ResolveBaseBinding()
// Check the white list
if (!CheckTagNameWhiteList(nameSpaceID, tagName)) {
const PRUnichar* params[] = { display.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL", nsnull,
nsContentUtils::eXBL_PROPERTIES,
"InvalidExtendsBinding",
params, NS_ARRAY_LENGTH(params),
doc->GetDocumentURI(),
EmptyString(), 0, 0,
nsIScriptError::errorFlag,
"XBL");
params, ArrayLength(params),
doc->GetDocumentURI());
NS_ASSERTION(!nsXBLService::IsChromeOrResourceURI(doc->GetDocumentURI()),
"Invalid extends value");
return NS_ERROR_ILLEGAL_VALUE;

View File

@ -992,12 +992,12 @@ nsXBLPrototypeHandler::ReportKeyConflict(const PRUnichar* aKey, const PRUnichar*
}
const PRUnichar* params[] = { aKey, aModifiers };
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL Prototype Handler", doc,
nsContentUtils::eXBL_PROPERTIES,
aMessageName,
params, ArrayLength(params),
nsnull, EmptyString(), mLineNumber, 0,
nsIScriptError::warningFlag,
"XBL Prototype Handler", doc);
nsnull, EmptyString(), mLineNumber);
}
bool

View File

@ -126,13 +126,11 @@ IsAncestorBinding(nsIDocument* aDocument,
aChildBindingURI->GetSpec(spec);
NS_ConvertUTF8toUTF16 bindingURI(spec);
const PRUnichar* params[] = { bindingURI.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL", aDocument,
nsContentUtils::eXBL_PROPERTIES,
"TooDeepBindingRecursion",
params, ArrayLength(params),
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"XBL", aDocument);
params, ArrayLength(params));
return true;
}
}
@ -419,12 +417,11 @@ nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent)
if (nsXBLService::IsChromeOrResourceURI(documentURI)) {
NS_WARNING("An XBL file is malformed. Did you forget the XBL namespace on the bindings tag?");
}
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL", nsnull,
nsContentUtils::eXBL_PROPERTIES,
"MalformedXBL",
nsnull, 0, documentURI,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"XBL");
nsnull, 0, documentURI);
return NS_ERROR_FAILURE;
}
@ -887,13 +884,12 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
baseBindingURI->GetSpec(basespec);
NS_ConvertUTF8toUTF16 baseSpecUTF16(basespec);
const PRUnichar* params[] = { protoSpec.get(), baseSpecUTF16.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL", nsnull,
nsContentUtils::eXBL_PROPERTIES,
"CircularExtendsBinding",
params, NS_ARRAY_LENGTH(params),
boundDocument->GetDocumentURI(),
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"XBL");
params, ArrayLength(params),
boundDocument->GetDocumentURI());
return NS_ERROR_ILLEGAL_VALUE;
}
}

View File

@ -323,13 +323,10 @@ nsXMLDocument::SetAsync(bool aAsync)
static void
ReportUseOfDeprecatedMethod(nsIDocument *aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM3 Load", aDoc);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM3 Load", aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
NS_IMETHODIMP

View File

@ -3035,15 +3035,12 @@ nsXULDocument::ResumeWalk()
const PRUnichar* params[] = { piProto->mTarget.get() };
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag,
"XUL Document", nsnull,
nsContentUtils::eXUL_PROPERTIES,
"PINotInProlog",
params, ArrayLength(params),
overlayURI,
EmptyString(), /* source line */
0, /* line number */
0, /* column number */
nsIScriptError::warningFlag,
"XUL Document");
overlayURI);
}
nsIContent* parent = processingOverlayHookupNodes ?
@ -3332,15 +3329,11 @@ nsXULDocument::ReportMissingOverlay(nsIURI* aURI)
NS_ConvertUTF8toUTF16 utfSpec(spec);
const PRUnichar* params[] = { utfSpec.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eXUL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XUL Document", this,
nsContentUtils::eXUL_PROPERTIES,
"MissingOverlay",
params, ArrayLength(params),
nsnull,
EmptyString(), /* source line */
0, /* line number */
0, /* column number */
nsIScriptError::warningFlag,
"XUL Document", this);
params, ArrayLength(params));
}
nsresult

View File

@ -1376,11 +1376,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
foundInterface = static_cast<nsIDOMWindowInternal*>(this);
if (!sWarnedAboutWindowInternal) {
sWarnedAboutWindowInternal = true;
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"nsIDOMWindowInternalWarning",
nsnull, 0, nsnull, EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"Extensions", mWindowID);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"Extensions", mDoc,
nsContentUtils::eDOM_PROPERTIES,
"nsIDOMWindowInternalWarning");
}
} else
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
@ -5544,13 +5543,10 @@ static void
ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
{
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aWindow->GetExtantDocument());
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events", doc);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
NS_IMETHODIMP
@ -6402,13 +6398,10 @@ nsGlobalWindow::Close()
// We're blocking the close operation
// report localized error msg in JS console
nsContentUtils::ReportToConsole(
nsContentUtils::eDOM_PROPERTIES,
"WindowCloseBlockedWarning",
nsnull, 0, // No params
nsnull,
EmptyString(), 0, 0, // No source, or column/line number
nsIScriptError::warningFlag,
"DOM Window", mDoc); // Better name for the category?
"DOM Window", mDoc, // Better name for the category?
nsContentUtils::eDOM_PROPERTIES,
"WindowCloseBlockedWarning");
return NS_OK;
}

View File

@ -82,15 +82,12 @@ enum DeprecationWarning { EncodeWarning, DecodeWarning };
static nsresult
WarnDeprecatedMethod(DeprecationWarning warning)
{
return nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
return nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Core", nsnull,
nsContentUtils::eDOM_PROPERTIES,
warning == EncodeWarning
? "nsIJSONEncodeDeprecatedWarning"
: "nsIJSONDecodeDeprecatedWarning",
nsnull, 0,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Core");
: "nsIJSONDecodeDeprecatedWarning");
}
NS_IMETHODIMP

View File

@ -9654,13 +9654,11 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
const char *message =
(display->mDisplay == NS_STYLE_DISPLAY_INLINE_BOX)
? "NeededToWrapXULInlineBox" : "NeededToWrapXUL";
nsContentUtils::ReportToConsole(nsContentUtils::eXUL_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"FrameConstructor", mDocument,
nsContentUtils::eXUL_PROPERTIES,
message,
params, ArrayLength(params),
nsnull,
EmptyString(), 0, 0, // not useful
nsIScriptError::warningFlag,
"FrameConstructor", mDocument);
params, ArrayLength(params));
nsRefPtr<nsStyleContext> blockSC = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozXULAnonymousBlock,

View File

@ -121,6 +121,7 @@ static void logMessage(nsIContent* aContent,
nsIDocument* doc = aContent->OwnerDoc();
nsContentUtils::ReportToConsole(
aFlags, "ImageMap", doc,
nsContentUtils::eLAYOUT_PROPERTIES,
aMessageName,
nsnull, /* params */
@ -128,11 +129,7 @@ static void logMessage(nsIContent* aContent,
nsnull,
PromiseFlatString(NS_LITERAL_STRING("coords=\"") +
aCoordsSpec +
NS_LITERAL_STRING("\"")), /* source line */
0, /* line number */
0, /* column number */
aFlags,
"ImageMap", doc);
NS_LITERAL_STRING("\""))); /* source line */
}
void Area::ParseCoords(const nsAString& aSpec)

View File

@ -969,11 +969,12 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader,
const PRUnichar *strings[] = { specUTF16.get(), ctypeUTF16.get() };
nsCOMPtr<nsIURI> referrer = GetReferrerURI();
nsContentUtils::ReportToConsole(nsContentUtils::eCSS_PROPERTIES,
nsContentUtils::ReportToConsole(errorFlag,
"CSS Loader", mLoader->mDocument,
nsContentUtils::eCSS_PROPERTIES,
errorMessage,
strings, ArrayLength(strings),
referrer, EmptyString(), 0, 0, errorFlag,
"CSS Loader", mLoader->mDocument);
referrer);
if (errorFlag == nsIScriptError::errorFlag) {
LOG_WARN((" Ignoring sheet with improper MIME type %s",

View File

@ -390,13 +390,11 @@ nsSVGUtils::ReportToConsole(nsIDocument* doc,
const PRUnichar **aParams,
PRUint32 aParamsLength)
{
return nsContentUtils::ReportToConsole(nsContentUtils::eSVG_PROPERTIES,
return nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"SVG", doc,
nsContentUtils::eSVG_PROPERTIES,
aWarning,
aParams, aParamsLength,
nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"SVG", doc);
aParams, aParamsLength);
}
float

View File

@ -1440,16 +1440,15 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer,
mFirstBuffer->setStart(speculation->GetStart());
mTokenizer->setLineNumber(speculation->GetStartLineNumber());
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events",
mExecutor->GetDocument(),
nsContentUtils::eDOM_PROPERTIES,
"SpeculationFailed",
nsnull, 0,
nsnull,
EmptyString(),
speculation->GetStartLineNumber(),
0,
nsIScriptError::warningFlag,
"DOM Events",
mExecutor->GetDocument());
speculation->GetStartLineNumber());
nsHtml5OwningUTF16Buffer* buffer = mFirstBuffer->next;
while (buffer) {