diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-11-21 13:33:35 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-11-21 14:26:16 +0100 |
commit | 8de554f33456d3bf06fdec812d024ed35a7d28bd (patch) | |
tree | 883c1383d01367fb52e3a9476dde614745298718 /components/script/dom/cssstyledeclaration.rs | |
parent | 5905f8d3eab42ce759c9802699ee5bd50498dd59 (diff) | |
download | servo-8de554f33456d3bf06fdec812d024ed35a7d28bd.tar.gz servo-8de554f33456d3bf06fdec812d024ed35a7d28bd.zip |
style: Move property allowance tests to PropertyId::parse_into.
It's not only more consistent (since we have a proper ParserContext there), but
also fixes a bunch of bugs where Gecko accidentally exposes and allows setting
internal state because of conversions from nsCSSPropertyID to PropertyId.
This adds the extra complexity of caring about aliases for longer, but that's
probably not a big deal in practice, since we also have PropertyDeclarationId.
MozReview-Commit-ID: C2Js8PfloxQ
Diffstat (limited to 'components/script/dom/cssstyledeclaration.rs')
-rw-r--r-- | components/script/dom/cssstyledeclaration.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 797fc013434..b9bf61c1924 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -299,7 +299,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue fn GetPropertyValue(&self, property: DOMString) -> DOMString { - let id = if let Ok(id) = PropertyId::parse(&property, None) { + let id = if let Ok(id) = PropertyId::parse(&property) { id } else { // Unkwown property @@ -310,7 +310,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority fn GetPropertyPriority(&self, property: DOMString) -> DOMString { - let id = if let Ok(id) = PropertyId::parse(&property, None) { + let id = if let Ok(id) = PropertyId::parse(&property) { id } else { // Unkwown property @@ -334,7 +334,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { priority: DOMString) -> ErrorResult { // Step 3 - let id = if let Ok(id) = PropertyId::parse(&property, None) { + let id = if let Ok(id) = PropertyId::parse(&property) { id } else { // Unknown property @@ -351,7 +351,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { } // Step 2 & 3 - let id = match PropertyId::parse(&property, None) { + let id = match PropertyId::parse(&property) { Ok(id) => id, Err(..) => return Ok(()), // Unkwown property }; @@ -383,7 +383,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { return Err(Error::NoModificationAllowed); } - let id = if let Ok(id) = PropertyId::parse(&property, None) { + let id = if let Ok(id) = PropertyId::parse(&property) { id } else { // Unkwown property, cannot be there to remove. |