mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1211479 - Errors when parsing substituting variables should include the generated string to help diagnose the issue. r=bz
This commit is contained in:
parent
8bedf1ee9a
commit
e3eeae22d0
@ -160,7 +160,9 @@ PEExpectedNonnegativeNP=Expected non-negative number or percentage.
|
||||
PEFilterFunctionArgumentsParsingError=Error in parsing arguments for filter function.
|
||||
PEVariableEOF=variable
|
||||
PEVariableEmpty=Expected variable value but found '%1$S'.
|
||||
PEValueWithVariablesParsingError=Error in parsing value for '%1$S' after substituting variables.
|
||||
# LOCALIZATION NOTE(PEValueWithVariablesParsingErrorInValue): %1$S is replaced
|
||||
# with the property name and %2$S is replaced with the property value.
|
||||
PEValueWithVariablesParsingErrorInValue=Error in parsing value for '%1$S' after substituting variables. Generated value was '%2$S'.
|
||||
PEValueWithVariablesFallbackInherit=Falling back to 'inherit'.
|
||||
PEValueWithVariablesFallbackInitial=Falling back to 'initial'.
|
||||
PEInvalidVariableReference=Property contained reference to invalid variable.
|
||||
|
@ -321,6 +321,24 @@ ErrorReporter::ReportUnexpected(const char *aMessage,
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorReporter::ReportUnexpected(const char *aMessage,
|
||||
const nsString &aParam,
|
||||
const nsString &aValue)
|
||||
{
|
||||
if (!ShouldReportErrors()) return;
|
||||
|
||||
nsAutoString qparam;
|
||||
nsStyleUtil::AppendEscapedCSSIdent(aParam, qparam);
|
||||
const char16_t *params[2] = { qparam.get(), aValue.get() };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorReporter::ReportUnexpectedEOF(const char *aMessage)
|
||||
{
|
||||
|
@ -53,6 +53,9 @@ public:
|
||||
// two parameters, a token and a character, in that order
|
||||
void ReportUnexpected(const char *aMessage, const nsCSSToken& aToken,
|
||||
char16_t aChar);
|
||||
// two parameters, a param and a value
|
||||
void ReportUnexpected(const char *aMessage, const nsString& aParam,
|
||||
const nsString& aValue);
|
||||
|
||||
// for ReportUnexpectedEOF, aExpected can be either a stringbundle
|
||||
// name or a single character. In the former case there may not be
|
||||
@ -95,6 +98,8 @@ inline void ErrorReporter::ReportUnexpected(const char *, const nsString &) {}
|
||||
inline void ErrorReporter::ReportUnexpected(const char *, const nsCSSToken &) {}
|
||||
inline void ErrorReporter::ReportUnexpected(const char *, const nsCSSToken &,
|
||||
char16_t) {}
|
||||
inline void ErrorReporter::ReportUnexpected(const char *, const nsString &,
|
||||
const nsString &) {}
|
||||
|
||||
inline void ErrorReporter::ReportUnexpectedEOF(const char *) {}
|
||||
inline void ErrorReporter::ReportUnexpectedEOF(char16_t) {}
|
||||
|
@ -1304,6 +1304,9 @@ static void AppendRuleToSheet(css::Rule* aRule, void* aParser)
|
||||
#define REPORT_UNEXPECTED_P(msg_, param_) \
|
||||
{ if (!mSuppressErrors) mReporter->ReportUnexpected(#msg_, param_); }
|
||||
|
||||
#define REPORT_UNEXPECTED_P_V(msg_, param_, value_) \
|
||||
{ if (!mSuppressErrors) mReporter->ReportUnexpected(#msg_, param_, value_); }
|
||||
|
||||
#define REPORT_UNEXPECTED_TOKEN(msg_) \
|
||||
{ if (!mSuppressErrors) mReporter->ReportUnexpected(#msg_, mToken); }
|
||||
|
||||
@ -2690,7 +2693,8 @@ CSSParserImpl::ParsePropertyWithVariableReferences(
|
||||
if (!valid) {
|
||||
NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(
|
||||
propertyToParse));
|
||||
REPORT_UNEXPECTED_P(PEValueWithVariablesParsingError, propName);
|
||||
REPORT_UNEXPECTED_P_V(PEValueWithVariablesParsingErrorInValue,
|
||||
propName, expandedValue);
|
||||
if (nsCSSProps::IsInherited(aPropertyID)) {
|
||||
REPORT_UNEXPECTED(PEValueWithVariablesFallbackInherit);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user