Bug 904695 - #include fewer headers in nsContentUtils.h; r=jst

This commit is contained in:
Ehsan Akhgari 2013-08-21 15:28:26 -04:00
parent a9e9e27117
commit f9b077c0c8
39 changed files with 167 additions and 134 deletions

View File

@ -0,0 +1,14 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef HTMLSplitOnSpacesTokenizer_h
#define HTMLSplitOnSpacesTokenizer_h
#include "nsCharSeparatedTokenizer.h"
typedef nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
HTMLSplitOnSpacesTokenizer;
#endif

View File

@ -34,11 +34,13 @@ XPIDL_MODULE = 'content_base'
MODULE = 'content'
EXPORTS += [
'HTMLSplitOnSpacesTokenizer.h',
'mozFlushType.h',
'nsCaseTreatment.h',
'nsContentCID.h',
'nsContentCreatorFunctions.h',
'nsContentPolicyUtils.h',
'nsContentTypeParser.h',
'nsContentUtils.h',
'nsCopySupport.h',
'nsDOMFile.h',

View File

@ -0,0 +1,30 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsContentTypeParser_h
#define nsContentTypeParser_h
#include "nsAString.h"
class nsIMIMEHeaderParam;
class nsContentTypeParser {
public:
nsContentTypeParser(const nsAString& aString);
~nsContentTypeParser();
nsresult GetParameter(const char* aParameterName, nsAString& aResult);
nsresult GetType(nsAString& aResult)
{
return GetParameter(nullptr, aResult);
}
private:
NS_ConvertUTF16toUTF8 mString;
nsIMIMEHeaderParam* mService;
};
#endif

View File

@ -22,11 +22,8 @@
#include "mozilla/Assertions.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/TimeStamp.h"
#include "nsAString.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentListDeclarations.h"
#include "nsMathUtils.h"
#include "nsReadableUtils.h"
class imgICache;
class imgIContainer;
@ -66,7 +63,6 @@ class nsIInterfaceRequestor;
class nsIIOService;
class nsIJSRuntimeService;
class nsILineBreaker;
class nsIMIMEHeaderParam;
class nsINameSpaceManager;
class nsINodeInfo;
class nsIObserver;
@ -106,6 +102,7 @@ template<class E> class nsCOMArray;
template<class E> class nsTArray;
template<class K, class V> class nsDataHashtable;
template<class K, class V> class nsRefPtrHashtable;
template<class T> class nsReadingIterator;
namespace JS {
class Value;
@ -143,6 +140,11 @@ class nsIBidiKeyboard;
extern const char kLoadAsData[];
// Stolen from nsReadableUtils, but that's OK, since we can declare the same
// name multiple times.
const nsAFlatString& EmptyString();
const nsAFlatCString& EmptyCString();
enum EventNameType {
EventNameType_None = 0x0000,
EventNameType_HTML = 0x0001,
@ -811,26 +813,6 @@ public:
= EmptyString(),
uint32_t aLineNumber = 0,
uint32_t aColumnNumber = 0);
// This overload allows passing a literal string for aCategory.
template<uint32_t N>
static nsresult ReportToConsole(uint32_t aErrorFlags,
const char (&aCategory)[N],
nsIDocument* aDocument,
PropertiesFile aFile,
const char *aMessageName,
const PRUnichar **aParams = nullptr,
uint32_t aParamsLength = 0,
nsIURI* aURI = nullptr,
const nsAFlatString& aSourceLine
= EmptyString(),
uint32_t aLineNumber = 0,
uint32_t aColumnNumber = 0)
{
nsDependentCString category(aCategory, N - 1);
return ReportToConsole(aErrorFlags, category, aDocument, aFile,
aMessageName, aParams, aParamsLength, aURI,
aSourceLine, aLineNumber, aColumnNumber);
}
/**
* Get the localized string named |aKey| in properties file |aFile|.
@ -1241,11 +1223,7 @@ public:
* @param aResult the result. Out param.
*/
static void GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult)
{
aResult.Truncate();
AppendNodeTextContent(aNode, aDeep, aResult);
}
nsAString& aResult);
/**
* Same as GetNodeTextContents but appends the result rather than sets it.
@ -1264,13 +1242,7 @@ public:
/**
* Delete strings allocated for nsContentList matches
*/
static void DestroyMatchString(void* aData)
{
if (aData) {
nsString* matchString = static_cast<nsString*>(aData);
delete matchString;
}
}
static void DestroyMatchString(void* aData);
/**
* Unbinds the content from the tree and nulls it out if it's not null.
@ -1340,7 +1312,7 @@ public:
bool aAllowData,
uint32_t aContentPolicyType,
nsISupports* aContext,
const nsACString& aMimeGuess = EmptyCString(),
const nsAFlatCString& aMimeGuess = EmptyCString(),
nsISupports* aExtra = nullptr);
/**
@ -2052,37 +2024,7 @@ public:
*/
static JSVersion ParseJavascriptVersion(const nsAString& aVersionStr);
static bool IsJavascriptMIMEType(const nsAString& aMIMEType)
{
// Table ordered from most to least likely JS MIME types.
static const char* jsTypes[] = {
"text/javascript",
"text/ecmascript",
"application/javascript",
"application/ecmascript",
"application/x-javascript",
"application/x-ecmascript",
"text/javascript1.0",
"text/javascript1.1",
"text/javascript1.2",
"text/javascript1.3",
"text/javascript1.4",
"text/javascript1.5",
"text/jscript",
"text/livescript",
"text/x-ecmascript",
"text/x-javascript",
nullptr
};
for (uint32_t i = 0; jsTypes[i]; ++i) {
if (aMIMEType.LowerCaseEqualsASCII(jsTypes[i])) {
return true;
}
}
return false;
}
static bool IsJavascriptMIMEType(const nsAString& aMIMEType);
static void SplitMimeType(const nsAString& aValue, nsString& aType,
nsString& aParams);
@ -2265,9 +2207,6 @@ private:
#endif
};
typedef nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
HTMLSplitOnSpacesTokenizer;
#define NS_HOLD_JS_OBJECTS(obj, clazz) \
nsContentUtils::HoldJSObjects(NS_CYCLE_COLLECTION_UPCAST(obj, clazz), \
NS_CYCLE_COLLECTION_PARTICIPANT(clazz))
@ -2369,20 +2308,4 @@ public:
} \
}
class nsContentTypeParser {
public:
nsContentTypeParser(const nsAString& aString);
~nsContentTypeParser();
nsresult GetParameter(const char* aParameterName, nsAString& aResult);
nsresult GetType(nsAString& aResult)
{
return GetParameter(nullptr, aResult);
}
private:
NS_ConvertUTF16toUTF8 mString;
nsIMIMEHeaderParam* mService;
};
#endif /* nsContentUtils_h___ */

View File

@ -1133,7 +1133,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
// The element being removed is an ancestor of the full-screen element,
// exit full-screen state.
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", OwnerDoc(),
NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
"RemovedFullScreenElement");
// Fully exit full-screen.
@ -2432,7 +2432,7 @@ Element::MozRequestFullScreen()
const char* error = GetFullScreenError(OwnerDoc());
if (error) {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", OwnerDoc(),
NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
error);
nsRefPtr<nsAsyncDOMEvent> e =

View File

@ -299,7 +299,7 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel,
const PRUnichar *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() };
if (NS_SUCCEEDED(rv)) {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"Redirect Error", nullptr,
NS_LITERAL_CSTRING("Redirect Error"), nullptr,
nsContentUtils::eDOM_PROPERTIES,
"InvalidRedirectChannelWarning",
formatParams, 1);

View File

@ -8,7 +8,7 @@
#include <stdint.h>
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsStringFwd.h"
class nsContentList;
class nsIAtom;

View File

@ -168,6 +168,8 @@
#include "nsWrapperCacheInlines.h"
#include "nsXULPopupManager.h"
#include "xpcprivate.h" // nsXPConnect
#include "HTMLSplitOnSpacesTokenizer.h"
#include "nsContentTypeParser.h"
#ifdef IBMBIDI
#include "nsIBidiKeyboard.h"
@ -4352,7 +4354,7 @@ nsContentUtils::CheckSecurityBeforeLoad(nsIURI* aURIToLoad,
bool aAllowData,
uint32_t aContentPolicyType,
nsISupports* aContext,
const nsACString& aMimeGuess,
const nsAFlatCString& aMimeGuess,
nsISupports* aExtra)
{
NS_PRECONDITION(aLoadingPrincipal, "Must have a loading principal here");
@ -6492,3 +6494,52 @@ nsContentUtils::DOMWindowDumpEnabled()
return true;
#endif
}
void
nsContentUtils::GetNodeTextContent(nsINode* aNode, bool aDeep, nsAString& aResult)
{
aResult.Truncate();
AppendNodeTextContent(aNode, aDeep, aResult);
}
void
nsContentUtils::DestroyMatchString(void* aData)
{
if (aData) {
nsString* matchString = static_cast<nsString*>(aData);
delete matchString;
}
}
bool
nsContentUtils::IsJavascriptMIMEType(const nsAString& aMIMEType)
{
// Table ordered from most to least likely JS MIME types.
static const char* jsTypes[] = {
"text/javascript",
"text/ecmascript",
"application/javascript",
"application/ecmascript",
"application/x-javascript",
"application/x-ecmascript",
"text/javascript1.0",
"text/javascript1.1",
"text/javascript1.2",
"text/javascript1.3",
"text/javascript1.4",
"text/javascript1.5",
"text/jscript",
"text/livescript",
"text/x-ecmascript",
"text/x-javascript",
nullptr
};
for (uint32_t i = 0; jsTypes[i]; ++i) {
if (aMIMEType.LowerCaseEqualsASCII(jsTypes[i])) {
return true;
}
}
return false;
}

View File

@ -210,6 +210,7 @@
#include "mozilla/css/Rule.h"
#include "nsIHttpChannelInternal.h"
#include "nsISecurityConsoleMessage.h"
#include "nsCharSeparatedTokenizer.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2463,7 +2464,7 @@ CSPErrorQueue::Flush(nsIDocument* aDocument)
{
for (uint32_t i = 0; i < mErrors.Length(); i++) {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"CSP", aDocument,
NS_LITERAL_CSTRING("CSP"), aDocument,
nsContentUtils::eSECURITY_PROPERTIES,
mErrors[i]);
}
@ -4496,7 +4497,7 @@ void
nsDocument::ReportEmptyGetElementByIdArg()
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", this,
NS_LITERAL_CSTRING("DOM"), this,
nsContentUtils::eDOM_PROPERTIES,
"EmptyGetElementByIdParam");
}
@ -6151,7 +6152,7 @@ nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
if (!mHasWarnedAboutBoxObjects && !aElement->IsXUL()) {
mHasWarnedAboutBoxObjects = true;
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"BoxObjects", this,
NS_LITERAL_CSTRING("BoxObjects"), this,
nsContentUtils::eDOM_PROPERTIES,
"UseOfGetBoxObjectForWarning");
}
@ -9048,7 +9049,7 @@ nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation,
uint32_t flags = asError ? nsIScriptError::errorFlag
: nsIScriptError::warningFlag;
nsContentUtils::ReportToConsole(flags,
"DOM Core", this,
NS_LITERAL_CSTRING("DOM Core"), this,
nsContentUtils::eDOM_PROPERTIES,
kWarnings[aOperation]);
}
@ -10032,7 +10033,7 @@ LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
false);
e->PostDOMEvent();
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", aDoc,
NS_LITERAL_CSTRING("DOM"), aDoc,
nsContentUtils::eDOM_PROPERTIES,
aMessage);
}

View File

@ -158,7 +158,7 @@ LogBlockingMixedContent(MixedContentTypes classification,
const PRUnichar* strings[] = { locationSpecUTF16.get() };
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"Mixed Content Blocker",
NS_LITERAL_CSTRING("Mixed Content Blocker"),
aRootDoc,
nsContentUtils::eSECURITY_PROPERTIES,
classification == eMixedDisplay ? "BlockMixedDisplayContent" : "BlockMixedActiveContent",

View File

@ -45,6 +45,7 @@
#include "mozilla/dom/Element.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsSandboxFlags.h"
#include "nsContentTypeParser.h"
#include "mozilla/CORSMode.h"
#include "mozilla/Attributes.h"

View File

@ -583,7 +583,7 @@ static void LogMessage(const char* aWarning, nsPIDOMWindow* aWindow)
doc = aWindow->GetExtantDoc();
}
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM", doc,
NS_LITERAL_CSTRING("DOM"), doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}

View File

@ -98,6 +98,7 @@
#include "nsIColorPicker.h"
#include "nsIStringEnumerator.h"
#include "HTMLSplitOnSpacesTokenizer.h"
// input type=date
#include "js/Date.h"

View File

@ -95,6 +95,7 @@ static PRLogModuleInfo* gMediaElementEventsLog;
#include "mozilla/Preferences.h"
#include "nsIPermissionManager.h"
#include "nsContentTypeParser.h"
using namespace mozilla::layers;
using mozilla::net::nsMediaFragmentURIParser;
@ -277,7 +278,7 @@ void HTMLMediaElement::ReportLoadError(const char* aMsg,
uint32_t aParamCount)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"Media",
NS_LITERAL_CSTRING("Media"),
OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
aMsg,

View File

@ -51,7 +51,7 @@ SendJSWarning(nsIDocument* aDocument,
const PRUnichar** aWarningArgs, uint32_t aWarningArgsLen)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"HTML", aDocument,
NS_LITERAL_CSTRING("HTML"), aDocument,
nsContentUtils::eFORMS_PROPERTIES,
aWarningName,
aWarningArgs, aWarningArgsLen);

View File

@ -149,7 +149,7 @@ static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", aDoc,
NS_LITERAL_CSTRING("DOM Events"), aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
@ -1866,7 +1866,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
if (mExternalScriptsBeingEvaluated) {
// Instead of implying a call to document.open(), ignore the call.
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", this,
NS_LITERAL_CSTRING("DOM Events"), this,
nsContentUtils::eDOM_PROPERTIES,
"DocumentWriteIgnored",
nullptr, 0,
@ -1881,7 +1881,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
if (mExternalScriptsBeingEvaluated) {
// Instead of implying a call to document.open(), ignore the call.
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", this,
NS_LITERAL_CSTRING("DOM Events"), this,
nsContentUtils::eDOM_PROPERTIES,
"DocumentWriteIgnored",
nullptr, 0,

View File

@ -39,7 +39,8 @@ WarnDeprecated(const PRUnichar* aDeprecatedAttribute,
const PRUnichar *argv[] =
{ aDeprecatedAttribute, aFavoredAttribute };
return nsContentUtils::
ReportToConsole(nsIScriptError::warningFlag, "MathML", aDocument,
ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("MathML"), aDocument,
nsContentUtils::eMATHML_PROPERTIES,
"DeprecatedSupersededBy", argv, 2);
}
@ -49,7 +50,8 @@ ReportLengthParseError(const nsString& aValue, nsIDocument* aDocument)
{
const PRUnichar *arg = aValue.get();
return nsContentUtils::
ReportToConsole(nsIScriptError::errorFlag, "MathML", aDocument,
ReportToConsole(nsIScriptError::errorFlag,
NS_LITERAL_CSTRING("MathML"), aDocument,
nsContentUtils::eMATHML_PROPERTIES,
"LengthParsingError", &arg, 1);
}
@ -62,7 +64,8 @@ ReportParseErrorNoTag(const nsString& aValue,
const PRUnichar *argv[] =
{ aValue.get(), aAtom->GetUTF16String() };
return nsContentUtils::
ReportToConsole(nsIScriptError::errorFlag, "MathML", aDocument,
ReportToConsole(nsIScriptError::errorFlag,
NS_LITERAL_CSTRING("MathML"), aDocument,
nsContentUtils::eMATHML_PROPERTIES,
"AttributeParsingErrorNoTag", argv, 2);
}
@ -419,7 +422,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
// no explicit unit, this is a number that will act as a multiplier
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"MathML", aDocument,
NS_LITERAL_CSTRING("MathML"), aDocument,
nsContentUtils::eMATHML_PROPERTIES,
"UnitlessValuesAreDeprecated");
}

View File

@ -10,6 +10,7 @@
#include "MediaSourceInputAdapter.h"
#include "SourceBuffer.h"
#include "SourceBufferList.h"
#include "nsContentTypeParser.h"
#ifdef PR_LOGGING
PRLogModuleInfo* gMediaSourceLog;

View File

@ -902,7 +902,7 @@ WebAudioDecodeJob::OnFailure(ErrorCode aErrorCode)
doc = pWindow->GetExtantDoc();
}
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"Media",
NS_LITERAL_CSTRING("Media"),
doc,
nsContentUtils::eDOM_PROPERTIES,
errorMessage);

View File

@ -141,7 +141,7 @@ SVGContentUtils::ReportToConsole(nsIDocument* doc,
uint32_t aParamsLength)
{
return nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"SVG", doc,
NS_LITERAL_CSTRING("SVG"), doc,
nsContentUtils::eSVG_PROPERTIES,
aWarning,
aParams, aParamsLength);

View File

@ -9,6 +9,7 @@
#include "mozilla/dom/SVGViewElement.h"
#include "nsContentUtils.h" // for nsCharSeparatedTokenizerTemplate
#include "nsSVGAnimatedTransformList.h"
#include "nsCharSeparatedTokenizer.h"
using namespace mozilla;

View File

@ -213,7 +213,7 @@ nsXBLContentSink::ReportUnexpectedElement(nsIAtom* aElementName,
const PRUnichar* params[] = { elementName.get() };
return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL Content Sink",
NS_LITERAL_CSTRING("XBL Content Sink"),
mDocument,
nsContentUtils::eXBL_PROPERTIES,
"UnexpectedElement",
@ -556,7 +556,7 @@ nsXBLContentSink::ConstructBinding(uint32_t aLineNumber)
}
} else {
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL Content Sink", nullptr,
NS_LITERAL_CSTRING("XBL Content Sink"), nullptr,
nsContentUtils::eXBL_PROPERTIES,
"MissingIdAttr", nullptr, 0,
mDocumentURI,
@ -645,7 +645,7 @@ nsXBLContentSink::ConstructHandler(const PRUnichar **aAtts, uint32_t aLineNumber
// shorthand syntax.
mState = eXBL_Error;
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL Content Sink",
NS_LITERAL_CSTRING("XBL Content Sink"),
mDocument,
nsContentUtils::eXBL_PROPERTIES,
"CommandNotInChrome", nullptr, 0,

View File

@ -1621,7 +1621,7 @@ nsXBLPrototypeBinding::ResolveBaseBinding()
if (!CheckTagNameWhiteList(nameSpaceID, tagName)) {
const PRUnichar* params[] = { display.get() };
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"XBL", nullptr,
NS_LITERAL_CSTRING("XBL"), nullptr,
nsContentUtils::eXBL_PROPERTIES,
"InvalidExtendsBinding",
params, ArrayLength(params),

View File

@ -902,7 +902,7 @@ nsXBLPrototypeHandler::ReportKeyConflict(const PRUnichar* aKey, const PRUnichar*
const PRUnichar* params[] = { aKey, aModifiers };
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL Prototype Handler", doc,
NS_LITERAL_CSTRING("XBL Prototype Handler"), doc,
nsContentUtils::eXBL_PROPERTIES,
aMessageName,
params, ArrayLength(params),

View File

@ -90,7 +90,7 @@ IsAncestorBinding(nsIDocument* aDocument,
NS_ConvertUTF8toUTF16 bindingURI(spec);
const PRUnichar* params[] = { bindingURI.get() };
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL", aDocument,
NS_LITERAL_CSTRING("XBL"), aDocument,
nsContentUtils::eXBL_PROPERTIES,
"TooDeepBindingRecursion",
params, ArrayLength(params));
@ -331,7 +331,7 @@ nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent)
NS_WARNING("An XBL file is malformed. Did you forget the XBL namespace on the bindings tag?");
}
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL", nullptr,
NS_LITERAL_CSTRING("XBL"), nullptr,
nsContentUtils::eXBL_PROPERTIES,
"MalformedXBL",
nullptr, 0, documentURI);
@ -763,7 +763,7 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
NS_ConvertUTF8toUTF16 baseSpecUTF16(basespec);
const PRUnichar* params[] = { protoSpec.get(), baseSpecUTF16.get() };
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XBL", nullptr,
NS_LITERAL_CSTRING("XBL"), nullptr,
nsContentUtils::eXBL_PROPERTIES,
"CircularExtendsBinding",
params, ArrayLength(params),

View File

@ -279,7 +279,7 @@ static void
ReportUseOfDeprecatedMethod(nsIDocument *aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM3 Load", aDoc,
NS_LITERAL_CSTRING("DOM3 Load"), aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}

View File

@ -3076,7 +3076,7 @@ XULDocument::ResumeWalk()
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag,
"XUL Document", nullptr,
NS_LITERAL_CSTRING("XUL Document"), nullptr,
nsContentUtils::eXUL_PROPERTIES,
"PINotInProlog",
params, ArrayLength(params),
@ -3369,7 +3369,7 @@ XULDocument::ReportMissingOverlay(nsIURI* aURI)
NS_ConvertUTF8toUTF16 utfSpec(spec);
const PRUnichar* params[] = { utfSpec.get() };
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"XUL Document", this,
NS_LITERAL_CSTRING("XUL Document"), this,
nsContentUtils::eXUL_PROPERTIES,
"MissingOverlay",
params, ArrayLength(params));

View File

@ -56,6 +56,7 @@
#include "nsXMLContentSink.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsContentTypeParser.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;

View File

@ -2565,7 +2565,7 @@ nsDOMWindowUtils::GetOuterWindowWithId(uint64_t aWindowID,
// XXX This method is deprecated. See bug 865664.
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM",
NS_LITERAL_CSTRING("DOM"),
nsContentUtils::GetDocumentFromCaller(),
nsContentUtils::eDOM_PROPERTIES,
"GetWindowWithOuterIdWarning");

View File

@ -1158,7 +1158,7 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags,
(fullscreenAncestor = nsContentUtils::GetFullscreenAncestor(contentToFocus->OwnerDoc())) &&
nsContentUtils::HasPluginWithUncontrolledEventDispatch(contentToFocus)) {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM",
NS_LITERAL_CSTRING("DOM"),
contentToFocus->OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
"FocusedWindowedPluginWhileFullScreen");

View File

@ -1534,7 +1534,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
if (!sWarnedAboutWindowInternal) {
sWarnedAboutWindowInternal = true;
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"Extensions", mDoc,
NS_LITERAL_CSTRING("Extensions"), mDoc,
nsContentUtils::eDOM_PROPERTIES,
"nsIDOMWindowInternalWarning");
}
@ -6204,7 +6204,7 @@ ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
{
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", doc,
NS_LITERAL_CSTRING("DOM Events"), doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
@ -7087,7 +7087,7 @@ nsGlobalWindow::Close()
// report localized error msg in JS console
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag,
"DOM Window", mDoc, // Better name for the category?
NS_LITERAL_CSTRING("DOM Window"), mDoc, // Better name for the category?
nsContentUtils::eDOM_PROPERTIES,
"WindowCloseBlockedWarning");

View File

@ -45,6 +45,7 @@
#include "ipc/IndexedDBParent.h"
#include "IndexedDatabaseInlines.h"
#include "nsCharSeparatedTokenizer.h"
#define FILE_COPY_BUFFER_SIZE 32768

View File

@ -49,7 +49,7 @@ static nsresult
WarnDeprecatedMethod(DeprecationWarning warning)
{
return nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Core", nullptr,
NS_LITERAL_CSTRING("DOM Core"), nullptr,
nsContentUtils::eDOM_PROPERTIES,
warning == EncodeWarning
? "nsIJSONEncodeDeprecatedWarning"

View File

@ -9169,7 +9169,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
(display->mDisplay == NS_STYLE_DISPLAY_INLINE_BOX)
? "NeededToWrapXULInlineBox" : "NeededToWrapXUL";
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"FrameConstructor", mDocument,
NS_LITERAL_CSTRING("FrameConstructor"),
mDocument,
nsContentUtils::eXUL_PROPERTIES,
message,
params, ArrayLength(params));

View File

@ -91,7 +91,7 @@ static void logMessage(nsIContent* aContent,
nsIDocument* doc = aContent->OwnerDoc();
nsContentUtils::ReportToConsole(
aFlags, "ImageMap", doc,
aFlags, NS_LITERAL_CSTRING("ImageMap"), doc,
nsContentUtils::eLAYOUT_PROPERTIES,
aMessageName,
nullptr, /* params */

View File

@ -1523,7 +1523,7 @@ nsMathMLContainerFrame::ReportErrorToConsole(const char* errorMsgId,
uint32_t aParamCount)
{
return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"MathML", mContent->OwnerDoc(),
NS_LITERAL_CSTRING("MathML"), mContent->OwnerDoc(),
nsContentUtils::eMATHML_PROPERTIES,
errorMsgId, aParams, aParamCount);
}

View File

@ -916,7 +916,8 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader,
nsCOMPtr<nsIURI> referrer = GetReferrerURI();
nsContentUtils::ReportToConsole(errorFlag,
"CSS Loader", mLoader->mDocument,
NS_LITERAL_CSTRING("CSS Loader"),
mLoader->mDocument,
nsContentUtils::eCSS_PROPERTIES,
errorMessage,
strings, ArrayLength(strings),

View File

@ -1494,7 +1494,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer,
mTokenizer->setLineNumber(speculation->GetStartLineNumber());
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events",
NS_LITERAL_CSTRING("DOM Events"),
mExecutor->GetDocument(),
nsContentUtils::eDOM_PROPERTIES,
"SpeculationFailed",

View File

@ -887,7 +887,7 @@ nsHtml5TreeOpExecutor::MaybeComplainAboutCharset(const char* aMsgId,
mAlreadyComplainedAboutCharset = true;
nsContentUtils::ReportToConsole(aError ? nsIScriptError::errorFlag
: nsIScriptError::warningFlag,
"HTML parser",
NS_LITERAL_CSTRING("HTML parser"),
mDocument,
nsContentUtils::eHTMLPARSER_PROPERTIES,
aMsgId,
@ -905,7 +905,7 @@ nsHtml5TreeOpExecutor::ComplainAboutBogusProtocolCharset(nsIDocument* aDoc)
"How come we already managed to complain?");
mAlreadyComplainedAboutCharset = true;
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"HTML parser",
NS_LITERAL_CSTRING("HTML parser"),
aDoc,
nsContentUtils::eHTMLPARSER_PROPERTIES,
"EncProtocolUnsupported");