Bug 1396664 - re-enable bad-string subtests in test_parser_diagnostics_unprintables.html r=emilio

… and update cssparser to 0.20.1

MozReview-Commit-ID: 8SiFIGk1jtb

--HG--
extra : rebase_source : 9d817fba90c38a7148166392e3412cfaf1538785
This commit is contained in:
Simon Sapin 2017-09-05 15:40:57 +02:00
Родитель 54ce4c11b5
Коммит 0ef497bfee
9 изменённых файлов: 78 добавлений и 52 удалений

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

@ -44,8 +44,7 @@ let patterns = [
{ i: "x{ '<t>'}" , o: isStylo ? 'declaration but found \u2018"<s>"\u2019.'
: "declaration but found \u2018'<s>'\u2019." },
// _Bad_String
// FIXME: temporarily disabled https://bugzilla.mozilla.org/show_bug.cgi?id=1396664
{ i: "x{ '<t>\n}", o: isStylo ? "declaration but found \u2018\"<bad string>\n\u2019."
{ i: "x{ '<t>\n}", o: isStylo ? 'declaration but found \u2018"<s>\u2019.'
: "declaration but found \u2018'<s>\u2019." },
];

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

@ -1 +1 @@
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"b15b69a36fd6c23052045990fcfe68e8cad505d4d92d568a52eac041982699ee","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"246fa83a3ab97a7bb617c97a976af77136652ce77ba8ccca22e144b213b61310","src/parser.rs":"9f147bc14e25fd4789e390ad0c9d2270188002a3a4785c150f39ef278b291259","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"9e0c821b1ee6d35ca0632f7f01209f7174eef053b69a5c25b7145e1e8e667efe","src/size_of_tests.rs":"a28664d44797519119d659eaf7e84e1789ef97e9e2c2d36630eb9f226c0cc0a6","src/tests.rs":"ff00ab136330a5798d2b28375069f03f6019cdb1c8b38b407d24120e106a9f1e","src/tokenizer.rs":"fb2e3036f9a20969a1feaf2da293de224efb092f7abb4c01e7d5aaf981c29826","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"2334576d63647dd96a6238cc3fb1d51b2aae3eb98872de157ae35c0b2e358fd2"}
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"7715fd1bc21625fb37eb5580edf4abe2b8f093b75c7609dfedeba9866935e692","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"246fa83a3ab97a7bb617c97a976af77136652ce77ba8ccca22e144b213b61310","src/parser.rs":"0353d1cedd7616612fdbef8aac51141f44bb5a6197f35be135e22170ee75bdc2","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"a28664d44797519119d659eaf7e84e1789ef97e9e2c2d36630eb9f226c0cc0a6","src/tests.rs":"fb238e8d6cd7e55e205ed8121a343b3366ef2fcbaf51e566cad75b088717247e","src/tokenizer.rs":"69313044052400c0e444fb1f7e4c0f5578ffa649b153c81b234b899cf1617dc0","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"385e14609d31964e67b4e603b8159d3abe1509f04514db1757605ffc1e8e7af9"}

36
third_party/rust/cssparser/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "cssparser"
version = "0.20.0"
version = "0.20.1"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
build = "build.rs"
exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"]
@ -22,40 +22,40 @@ readme = "README.md"
keywords = ["css", "syntax", "parser"]
license = "MPL-2.0"
repository = "https://github.com/servo/rust-cssparser"
[dependencies.procedural-masquerade]
version = "0.1"
[dependencies.dtoa-short]
version = "0.3"
[dependencies.smallvec]
version = "0.4.3"
[dependencies.phf]
version = "0.7"
[dependencies.itoa]
version = "0.3"
[dependencies.serde]
version = "1.0"
optional = true
[dependencies.cssparser-macros]
version = "0.3"
[dependencies.phf]
version = "0.7"
[dependencies.heapsize]
version = ">= 0.3, < 0.5"
optional = true
[dependencies.procedural-masquerade]
version = "0.1"
[dependencies.itoa]
version = "0.3"
[dependencies.smallvec]
version = "0.4.3"
[dependencies.matches]
version = "0.1"
[dependencies.cssparser-macros]
version = "0.3"
[dev-dependencies.rustc-serialize]
version = "0.3"
[dev-dependencies.encoding_rs]
version = "0.7"
[dev-dependencies.rustc-serialize]
version = "0.3"
[dev-dependencies.difference]
version = "1.0"
[build-dependencies.syn]
@ -65,5 +65,5 @@ version = "0.11"
version = "0.3"
[features]
dummy_match_byte = []
bench = []
dummy_match_byte = []

8
third_party/rust/cssparser/src/parser.rs поставляемый
Просмотреть файл

@ -788,10 +788,10 @@ pub fn parse_until_before<'i: 't, 't, F, T, E>(parser: &mut Parser<'i, 't>,
}
// FIXME: have a special-purpose tokenizer method for this that does less work.
loop {
if delimiters.contains(Delimiters::from_byte((parser.input.tokenizer).next_byte())) {
if delimiters.contains(Delimiters::from_byte(parser.input.tokenizer.next_byte())) {
break
}
if let Ok(token) = (parser.input.tokenizer).next() {
if let Ok(token) = parser.input.tokenizer.next() {
if let Some(block_type) = BlockType::opening(&token) {
consume_until_end_of_block(block_type, &mut parser.input.tokenizer);
}
@ -808,11 +808,11 @@ pub fn parse_until_after<'i: 't, 't, F, T, E>(parser: &mut Parser<'i, 't>,
-> Result <T, ParseError<'i, E>>
where F: for<'tt> FnOnce(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>> {
let result = parser.parse_until_before(delimiters, parse);
let next_byte = (parser.input.tokenizer).next_byte();
let next_byte = parser.input.tokenizer.next_byte();
if next_byte.is_some() && !parser.stop_before.contains(Delimiters::from_byte(next_byte)) {
debug_assert!(delimiters.contains(Delimiters::from_byte(next_byte)));
// We know this byte is ASCII.
(parser.input.tokenizer).advance(1);
parser.input.tokenizer.advance(1);
if next_byte == Some(b'{') {
consume_until_end_of_block(BlockType::CurlyBracket, &mut parser.input.tokenizer);
}

34
third_party/rust/cssparser/src/serializer.rs поставляемый
Просмотреть файл

@ -122,8 +122,20 @@ impl<'a> ToCss for Token<'a> {
Token::SquareBracketBlock => dest.write_str("[")?,
Token::CurlyBracketBlock => dest.write_str("{")?,
Token::BadUrl(_) => dest.write_str("url(<bad url>)")?,
Token::BadString(_) => dest.write_str("\"<bad string>\n")?,
Token::BadUrl(ref contents) => {
dest.write_str("url(")?;
dest.write_str(contents)?;
dest.write_char(')')?;
}
Token::BadString(ref value) => {
// During tokenization, an unescaped newline after a quote causes
// the token to be a BadString instead of a QuotedString.
// The BadString token ends just before the newline
// (which is in a separate WhiteSpace token),
// and therefore does not have a closing quote.
dest.write_char('"')?;
CssStringWriter::new(dest).write_str(value)?;
},
Token::CloseParenthesis => dest.write_str(")")?,
Token::CloseSquareBracket => dest.write_str("]")?,
Token::CloseCurlyBracket => dest.write_str("}")?,
@ -132,23 +144,17 @@ impl<'a> ToCss for Token<'a> {
}
}
fn to_hex_byte(value: u8) -> u8 {
match value {
0...9 => value + b'0',
_ => value - 10 + b'a',
}
}
fn hex_escape<W>(ascii_byte: u8, dest: &mut W) -> fmt::Result where W:fmt::Write {
let high = ascii_byte >> 4;
static HEX_DIGITS: &'static [u8; 16] = b"0123456789abcdef";
let b3;
let b4;
let bytes = if high > 0 {
let low = ascii_byte & 0x0F;
b4 = [b'\\', to_hex_byte(high), to_hex_byte(low), b' '];
let bytes = if ascii_byte > 0x0F {
let high = (ascii_byte >> 4) as usize;
let low = (ascii_byte & 0x0F) as usize;
b4 = [b'\\', HEX_DIGITS[high], HEX_DIGITS[low], b' '];
&b4[..]
} else {
b3 = [b'\\', to_hex_byte(ascii_byte), b' '];
b3 = [b'\\', HEX_DIGITS[ascii_byte as usize], b' '];
&b3[..]
};
dest.write_str(unsafe { str::from_utf8_unchecked(&bytes) })

20
third_party/rust/cssparser/src/tests.rs поставляемый
Просмотреть файл

@ -441,6 +441,26 @@ fn serializer(preserve_comments: bool) {
});
}
#[test]
fn serialize_bad_tokens() {
let mut input = ParserInput::new("url(foo\\) b\\)ar)'ba\\'\"z\n4");
let mut parser = Parser::new(&mut input);
let token = parser.next().unwrap().clone();
assert!(matches!(token, Token::BadUrl(_)));
assert_eq!(token.to_css_string(), "url(foo\\) b\\)ar)");
let token = parser.next().unwrap().clone();
assert!(matches!(token, Token::BadString(_)));
assert_eq!(token.to_css_string(), "\"ba'\\\"z");
let token = parser.next().unwrap().clone();
assert!(matches!(token, Token::Number { .. }));
assert_eq!(token.to_css_string(), "4");
assert!(parser.next().is_err());
}
#[test]
fn serialize_current_color() {
let c = Color::CurrentColor;

3
third_party/rust/cssparser/src/tokenizer.rs поставляемый
Просмотреть файл

@ -1289,8 +1289,9 @@ fn consume_unquoted_url<'a>(tokenizer: &mut Tokenizer<'a>) -> Result<Token<'a>,
while !tokenizer.is_eof() {
match_byte! { tokenizer.next_byte_unchecked(),
b')' => {
let contents = tokenizer.slice_from(start_pos).into();
tokenizer.advance(1);
break
return BadUrl(contents)
}
b'\\' => {
tokenizer.advance(1);

12
toolkit/library/gtest/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -296,7 +296,7 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.20.0"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -548,7 +548,7 @@ name = "geckoservo"
version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1110,7 +1110,7 @@ name = "selectors"
version = "0.19.0"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1212,7 +1212,7 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
@ -1261,7 +1261,7 @@ version = "0.0.1"
dependencies = [
"app_units 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
]
@ -1579,7 +1579,7 @@ dependencies = [
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
"checksum core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9f841e9637adec70838c537cae52cb4c751cc6514ad05669b51d107c2021c79"
"checksum core-text 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ce16d9ed00181016c11ff48e561314bec92bfbce9fe48f319366618d4e5de6"
"checksum cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2334576d63647dd96a6238cc3fb1d51b2aae3eb98872de157ae35c0b2e358fd2"
"checksum cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "385e14609d31964e67b4e603b8159d3abe1509f04514db1757605ffc1e8e7af9"
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"

12
toolkit/library/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -294,7 +294,7 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.20.0"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -546,7 +546,7 @@ name = "geckoservo"
version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1097,7 +1097,7 @@ name = "selectors"
version = "0.19.0"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1199,7 +1199,7 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
@ -1248,7 +1248,7 @@ version = "0.0.1"
dependencies = [
"app_units 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
]
@ -1566,7 +1566,7 @@ dependencies = [
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
"checksum core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9f841e9637adec70838c537cae52cb4c751cc6514ad05669b51d107c2021c79"
"checksum core-text 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ce16d9ed00181016c11ff48e561314bec92bfbce9fe48f319366618d4e5de6"
"checksum cssparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2334576d63647dd96a6238cc3fb1d51b2aae3eb98872de157ae35c0b2e358fd2"
"checksum cssparser 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "385e14609d31964e67b4e603b8159d3abe1509f04514db1757605ffc1e8e7af9"
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"