Bug 1789799 - Disallow 'not', 'and', and 'or' from <container-name>. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D156805
This commit is contained in:
Ziran Sun 2022-09-14 11:48:01 +00:00
Родитель 20971e4d83
Коммит 674ee40a3a
3 изменённых файлов: 8 добавлений и 55 удалений

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

@ -1565,9 +1565,10 @@ impl Parse for ContainerName {
if first.eq_ignore_ascii_case("none") {
return Ok(Self::none())
}
idents.push(CustomIdent::from_ident(location, first, &["none"])?);
const DISALLOWED_CONTAINER_NAMES: &'static [&'static str] = &["none", "not", "or", "and"];
idents.push(CustomIdent::from_ident(location, first, DISALLOWED_CONTAINER_NAMES)?);
while let Ok(ident) = input.try_parse(|input| input.expect_ident_cloned()) {
idents.push(CustomIdent::from_ident(location, &ident, &["none"])?);
idents.push(CustomIdent::from_ident(location, &ident, DISALLOWED_CONTAINER_NAMES)?);
}
Ok(ContainerName(idents.into()))
}

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

@ -53,18 +53,6 @@
[(100px : width : 200px)]
expected: FAIL
[screen and (width: 100px)]
expected: FAIL
[screen or (width: 100px)]
expected: FAIL
[not screen and (width: 100px)]
expected: FAIL
[not screen or (width: 100px)]
expected: FAIL
[foo (width: 100px)]
expected: FAIL
@ -98,41 +86,23 @@
[style(style(--foo: bar))]
expected: FAIL
[Container name: foo foo]
expected: FAIL
[Container name: none]
expected: FAIL
[Container name: None]
expected: FAIL
[Container name: normal]
[not (width: 100px)]
expected: FAIL
[Container name: Normal]
[name not (width <= 500px)]
expected: FAIL
[Container name: auto]
[Container name: foo]
expected: FAIL
[Container name: Auto]
[Container name: foo]
expected: FAIL
[Container name: and]
expected: FAIL
[Container name: or]
expected: FAIL
[Container name: not]
expected: FAIL
[Container name: And]
expected: FAIL
[Container name: oR]
expected: FAIL
[Container name: nOt]
[Container name: foo ]
expected: FAIL

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

@ -1,22 +1,4 @@
[container-name-parsing.html]
[e.style['container-name'\] = "not" should not set the property value]
expected: FAIL
[e.style['container-name'\] = "and" should not set the property value]
expected: FAIL
[e.style['container-name'\] = "or" should not set the property value]
expected: FAIL
[e.style['container-name'\] = "Not" should not set the property value]
expected: FAIL
[e.style['container-name'\] = "aNd" should not set the property value]
expected: FAIL
[e.style['container-name'\] = "oR" should not set the property value]
expected: FAIL
[e.style['container-name'\] = "auto" should not set the property value]
expected: FAIL