Bug 748254. When we encounter an unexpected '}' terminating a font-face descriptor's value, correctly close the font-face rule instead of eating the rest of the stylesheet. r=dbaron
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-parsing/invalid-font-face-descriptor-1-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<style>
+ body { color: green! important; }
+</style>
+There should be no red
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-parsing/invalid-font-face-descriptor-1.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+ body { color: red; }
+ @font-face {
+ src: url(bbb),
+ }
+
+ body { color: green! important; }
+</style>
+There should be no red
--- a/layout/reftests/css-parsing/reftest.list
+++ b/layout/reftests/css-parsing/reftest.list
@@ -1,6 +1,7 @@
== at-rule-013.html at-rule-013-ref.html
== invalid-url-handling.xhtml invalid-url-handling-ref.xhtml
== pseudo-elements-1.html pseudo-elements-1-ref.html
== invalid-attr-1.html invalid-attr-1-ref.html
== at-rule-error-handling-import-1.html at-rule-error-handling-ref.html
== at-rule-error-handling-media-1.html at-rule-error-handling-ref.html
+== invalid-font-face-descriptor-1.html invalid-font-face-descriptor-1-ref.html
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -8212,16 +8212,18 @@ CSSParserImpl::ParseFontSrc(nsCSSValue&
font.EnumerateFamilies(ExtractFirstFamily, (void*) &dat);
if (!dat.mGood)
return false;
cur.SetStringValue(dat.mFamilyName, eCSSUnit_Local_Font);
values.AppendElement(cur);
} else {
+ // We don't know what to do with this token; unget it and error out
+ UngetToken();
return false;
}
if (!ExpectSymbol(',', true))
break;
}
if (values.Length() == 0)