Bug 1355352 - Reject unicode-range descriptor when its value contains invalid part. r=jfkthame

MozReview-Commit-ID: 1ZcFCPsIMtx

--HG--
extra : rebase_source : 33dbc661a27efdc4b6363c6a3468750f0f546308
This commit is contained in:
Xidorn Quan 2017-05-16 10:15:18 +10:00
Родитель 78e3ce7db1
Коммит 6abba8238f
4 изменённых файлов: 14 добавлений и 28 удалений

Просмотреть файл

@ -15076,17 +15076,14 @@ CSSParserImpl::ParseFontRanges(nsCSSValue& aValue)
uint32_t low = mToken.mInteger;
uint32_t high = mToken.mInteger2;
// A range that descends, or a range that is entirely outside the
// current range of Unicode (U+0-10FFFF) is ignored, but does not
// invalidate the descriptor. A range that straddles the high end
// is clipped.
if (low <= 0x10FFFF && low <= high) {
if (high > 0x10FFFF)
high = 0x10FFFF;
ranges.AppendElement(low);
ranges.AppendElement(high);
// A range that descends, or high end exceeds the current range of
// Unicode (U+0-10FFFF) invalidates the descriptor.
if (low > high || high > 0x10FFFF) {
return false;
}
ranges.AppendElement(low);
ranges.AppendElement(high);
if (!ExpectSymbol(',', true))
break;
}

Просмотреть файл

@ -61,8 +61,8 @@ var gCSSFontFaceDescriptors = {
},
"unicode-range": {
domProp: null,
values: [ "U+0-10FFFF", "U+3-7B3", "U+3??", "U+6A", "U+3????", "U+???", "U+302-302", "U+0-7,U+A-C", "U+100-17F,U+200-17F", "U+3??, U+500-513 ,U+612 , U+4????", "U+1FFF,U+200-27F" ],
invalid_values: [ "U+1????-2????", "U+0-7,A-C", "U+100-17F,200-17F", "U+6A!important", "U+6A)" ]
values: [ "U+0-10FFFF", "U+3-7B3", "U+3??", "U+6A", "U+3????", "U+???", "U+302-302", "U+0-7,U+A-C", "U+3??, U+500-513 ,U+612 , U+4????", "U+1FFF,U+200-27F" ],
invalid_values: [ "U+1????-2????", "U+0-7,A-C", "U+100-17F,U+200-17F", "U+100-17F,200-27F", "U+6A!important", "U+6A)" ]
},
"font-display": {
domProp: null,

Просмотреть файл

@ -201,12 +201,6 @@ to mochitest command.
* Servo is correct but Gecko is wrong
* flex-basis should be 0px when omitted in flex shorthand bug 1331530
* test_flexbox_flex_shorthand.html `flex-basis` [10]
* should reject whole value bug 1355352
* test_descriptor_storage.html `unicode-range` [1]
* test_font_face_parser.html `U+A5` [4]
* Gecko clamps rather than rejects invalid unicode range bug 1355356
* test_font_face_parser.html `U+??????` [2]
* ... `12FFFF` [2]
* Gecko rejects calc() in -webkit-gradient bug 1363349
* test_property_syntax_errors.html `-webkit-gradient` [20]
* test_property_syntax_errors.html `linear-gradient(0,`: unitless zero as degree [10]

Просмотреть файл

@ -182,12 +182,8 @@ function runTest() {
d: { "unicode-range" : "U+0-FF" }, noncanonical: true },
{ rule: _("unicode-range: U+?"),
d: { "unicode-range" : "U+0-F" }, noncanonical: true },
{ rule: _("unicode-range: U+??????"),
d: { "unicode-range" : "U+0-10FFFF" }, noncanonical: true },
{ rule: _("unicode-range: U+590-5ff;"),
d: { "unicode-range" : "U+590-5FF" }, noncanonical: true },
{ rule: _("unicode-range: U+A0000-12FFFF"),
d: { "unicode-range" : "U+A0000-10FFFF" }, noncanonical: true },
{ rule: _("unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F;"),
d: { "unicode-range" : "U+A5, U+4E00-9FFF, U+3000-30FF, U+FF00-FF9F" },
@ -229,6 +225,8 @@ function runTest() {
{ rule: _("unicode-range: U+0121 -1023"), d: {} },
{ rule: _("unicode-range: U+012 ?"), d: {} },
{ rule: _("unicode-range: U+01 2?"), d: {} },
{ rule: _("unicode-range: U+A0000-12FFFF"), d: {} },
{ rule: _("unicode-range: U+??????"), d: {} },
// Thorough test of seven-digit rejection: all these are syntax errors
{ rule: _("unicode-range: U+1034560, U+A5"), d: {} },
@ -247,12 +245,9 @@ function runTest() {
{ rule: _("unicode-range: U+A5, U+0?F"), d: {} },
{ rule: _("unicode-range: U+A5, U+0F?-E00"), d: {} },
// Descending ranges and ranges outside 0-10FFFF are ignored
// but do not invalidate the descriptor
{ rule: _("unicode-range: U+A5, U+90-30"),
d: { "unicode-range" : "U+A5" }, noncanonical: true },
{ rule: _("unicode-range: U+A5, U+220043"),
d: { "unicode-range" : "U+A5" }, noncanonical: true },
// Descending ranges and ranges outside 0-10FFFF are invalid
{ rule: _("unicode-range: U+A5, U+90-30"), d: {} },
{ rule: _("unicode-range: U+A5, U+220043"), d: {} },
// font-feature-settings
{ rule: _("font-feature-settings: normal;"),