Bug 1381143 - Report specific error for invalid CSS colors. r=heycam a=bustage
authorJosh Matthews <josh@joshmatthews.net>
Mon, 31 Jul 2017 15:40:47 -0700
changeset 420805 2c6f632e13263b78cae4e6822acf4e48e6a054c2
parent 420804 14ca55749ce4f71c56c9b2214d582cc5b3e16542
child 420806 59765ae0aee3463c30018ff329527f6eb7ff3dad
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam, bustage
bugs1381143
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1381143 - Report specific error for invalid CSS colors. r=heycam a=bustage MozReview-Commit-ID: FIFjld3wi82
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -2725,26 +2725,38 @@ Gecko_DestroyCSSErrorReporter(ErrorRepor
   delete reporter;
 }
 
 void
 Gecko_ReportUnexpectedCSSError(ErrorReporter* reporter,
                                const char* message,
                                const char* param,
                                uint32_t paramLen,
+                               const char* prefix,
+                               const char* prefixParam,
+                               uint32_t prefixParamLen,
+                               const char* suffix,
                                const char* source,
                                uint32_t sourceLen,
                                uint32_t lineNumber,
-                               uint32_t colNumber,
-                               nsIURI* uri,
-                               const char* followup)
+                               uint32_t colNumber)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
+  if (prefix) {
+    if (prefixParam) {
+      nsDependentCSubstring paramValue(prefixParam, prefixParamLen);
+      nsAutoString wideParam = NS_ConvertUTF8toUTF16(paramValue);
+      reporter->ReportUnexpectedUnescaped(prefix, wideParam);
+    } else {
+      reporter->ReportUnexpected(prefix);
+    }
+  }
+
   nsDependentCSubstring paramValue(param, paramLen);
   nsAutoString wideParam = NS_ConvertUTF8toUTF16(paramValue);
   reporter->ReportUnexpectedUnescaped(message, wideParam);
-  if (followup) {
-    reporter->ReportUnexpected(followup);
+  if (suffix) {
+    reporter->ReportUnexpected(suffix);
   }
   nsDependentCSubstring sourceValue(source, sourceLen);
   reporter->OutputError(lineNumber, colNumber, sourceValue);
 }
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -675,18 +675,20 @@ void Gecko_SetJemallocThreadLocalArena(b
 mozilla::css::ErrorReporter* Gecko_CreateCSSErrorReporter(mozilla::ServoStyleSheet* sheet,
                                                           mozilla::css::Loader* loader,
                                                           nsIURI* uri);
 void Gecko_DestroyCSSErrorReporter(mozilla::css::ErrorReporter* reporter);
 void Gecko_ReportUnexpectedCSSError(mozilla::css::ErrorReporter* reporter,
                                     const char* message,
                                     const char* param,
                                     uint32_t paramLen,
+                                    const char* prefix,
+                                    const char* prefixParam,
+                                    uint32_t prefixParamLen,
+                                    const char* suffix,
                                     const char* source,
                                     uint32_t sourceLen,
                                     uint32_t lineNumber,
-                                    uint32_t colNumber,
-                                    nsIURI* aURI,
-                                    const char* followup);
+                                    uint32_t colNumber);
 
 } // extern "C"
 
 #endif // mozilla_ServoBindings_h