mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Add pref for CSS error reporting and mark as warnings rather than errors. b=264162 r=shaver sr=bzbarsky
This commit is contained in:
parent
ec92bc29af
commit
eba47946d5
@ -52,6 +52,7 @@
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
// Don't bother collecting whitespace characters in token's mIdent buffer
|
||||
#undef COLLECT_WHITESPACE
|
||||
@ -69,6 +70,7 @@ static PRBool gLexTableSetup = PR_FALSE;
|
||||
PRUint8 nsCSSScanner::gLexTable[256];
|
||||
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
static PRBool gReportErrors = PR_TRUE;
|
||||
static nsIConsoleService *gConsoleService;
|
||||
static nsIFactory *gScriptErrorFactory;
|
||||
static nsIStringBundle *gStringBundle;
|
||||
@ -206,6 +208,16 @@ nsCSSScanner::~nsCSSScanner()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
#define CSS_ERRORS_PREF "layout.css.report_errors"
|
||||
|
||||
PR_STATIC_CALLBACK(int) CSSErrorsPrefChanged(const char *aPref, void *aClosure)
|
||||
{
|
||||
gReportErrors = nsContentUtils::GetBoolPref(CSS_ERRORS_PREF, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ PRBool nsCSSScanner::InitGlobals()
|
||||
{
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
@ -219,6 +231,9 @@ nsCSSScanner::~nsCSSScanner()
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
NS_ASSERTION(gConsoleService && gScriptErrorFactory,
|
||||
"unexpected null pointer without failure");
|
||||
|
||||
nsContentUtils::RegisterPrefCallback(CSS_ERRORS_PREF, CSSErrorsPrefChanged, nsnull);
|
||||
CSSErrorsPrefChanged(CSS_ERRORS_PREF, nsnull);
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -226,6 +241,7 @@ nsCSSScanner::~nsCSSScanner()
|
||||
/* static */ void nsCSSScanner::ReleaseGlobals()
|
||||
{
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
nsContentUtils::UnregisterPrefCallback(CSS_ERRORS_PREF, CSSErrorsPrefChanged, nsnull);
|
||||
NS_IF_RELEASE(gConsoleService);
|
||||
NS_IF_RELEASE(gScriptErrorFactory);
|
||||
NS_IF_RELEASE(gStringBundle);
|
||||
@ -312,7 +328,7 @@ void nsCSSScanner::OutputError()
|
||||
|
||||
// Log it to the JavaScript console
|
||||
|
||||
if (InitGlobals()) {
|
||||
if (InitGlobals() && gReportErrors) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIScriptError> errorObject =
|
||||
do_CreateInstance(gScriptErrorFactory, &rv);
|
||||
@ -322,7 +338,7 @@ void nsCSSScanner::OutputError()
|
||||
EmptyString().get(),
|
||||
mErrorLineNumber,
|
||||
mErrorColNumber,
|
||||
0,
|
||||
nsIScriptError::warningFlag,
|
||||
"CSS Parser");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
gConsoleService->LogMessage(errorObject);
|
||||
|
@ -937,6 +937,9 @@ pref("layout.enable_japanese_specific_transform", false);
|
||||
// pref to force frames to be resizable
|
||||
pref("layout.frames.force_resizability", false);
|
||||
|
||||
// pref to report CSS errors to the error console
|
||||
pref("layout.css.report_errors", true);
|
||||
|
||||
// pref to permit users to make verified SOAP calls by default
|
||||
pref("capability.policy.default.SOAPCall.invokeVerifySourceHeader", "allAccess");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user