diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 269ef0c509b..acf077c777b 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -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|. diff --git a/content/base/src/nsCSPService.cpp b/content/base/src/nsCSPService.cpp index 249610126f8..c5a1dfcc200 100644 --- a/content/base/src/nsCSPService.cpp +++ b/content/base/src/nsCSPService.cpp @@ -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; diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 91f299b62cf..80a2dc10efa 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -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 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) { diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 3a5845047dc..54d3a2851ac 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -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 diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index af9afb335ad..2c01c58d096 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -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); } diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 5b3f496aeb1..8b7134e4051 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -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; */ diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 18a4eeeab90..77a17c772a0 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -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; } diff --git a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp index 7a980334a9b..239325aeabf 100644 --- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp @@ -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; } diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 45bd898ffe9..bab9365ec8f 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -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 diff --git a/content/html/content/src/nsFormSubmission.cpp b/content/html/content/src/nsFormSubmission.cpp index e7bb0c57e4d..e5eadbdb2ff 100644 --- a/content/html/content/src/nsFormSubmission.cpp +++ b/content/html/content/src/nsFormSubmission.cpp @@ -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); } // -------------------------------------------------------------------------- diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index b1acd0f8b75..f802bf7a010 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -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 e = new nsPLDOMEvent(OwnerDoc(), NS_LITERAL_STRING("mozfullscreenerror"), diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index be29a4b477f..c25d8b4486d 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -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; diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 7e75a3c390e..d7b842bd594 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -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 ignored; diff --git a/content/xbl/src/nsXBLContentSink.cpp b/content/xbl/src/nsXBLContentSink.cpp index d692cbde7e8..3013460fca3 100644 --- a/content/xbl/src/nsXBLContentSink.cpp +++ b/content/xbl/src/nsXBLContentSink.cpp @@ -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. } diff --git a/content/xbl/src/nsXBLPrototypeBinding.cpp b/content/xbl/src/nsXBLPrototypeBinding.cpp index 57b5a015f4f..574798807fa 100644 --- a/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -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; diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 0814b99c672..c076f42b870 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -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 diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index 5dbc4312a28..dc6694f4f4f 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -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; } } diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index 537f5559f2b..8de14c889ed 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -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 diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index a05dce4f6b1..480969fafd2 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -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 diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 8c96b2e5c68..384ef939336 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1376,11 +1376,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow) foundInterface = static_cast(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 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; } diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 5edd7c5df89..d2556edcf3f 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -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 diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 5cf2dbd15e9..8553b94e0f8 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -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 blockSC = mPresShell->StyleSet()-> ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozXULAnonymousBlock, diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp index 252d5567a08..cf1a31f8b66 100644 --- a/layout/generic/nsImageMap.cpp +++ b/layout/generic/nsImageMap.cpp @@ -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) diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index cc0c47c3d78..01c56a520fe 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -969,11 +969,12 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader, const PRUnichar *strings[] = { specUTF16.get(), ctypeUTF16.get() }; nsCOMPtr 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", diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 77da907a625..15b8bed2fe0 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -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 diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp index 86a0d812c2f..f4e131544ff 100644 --- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -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) {