diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index fe79972b337..98d9d717de1 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -44,9 +44,9 @@ impl Crypto { impl CryptoMethods for Crypto { /// - fn Subtle(&self) -> DomRoot { + fn Subtle(&self, can_gc: CanGc) -> DomRoot { self.subtle - .or_init(|| SubtleCrypto::new(&self.global(), CanGc::note())) + .or_init(|| SubtleCrypto::new(&self.global(), can_gc)) } #[allow(unsafe_code)] diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index 2070754d309..7006b7d03b5 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -39,14 +39,14 @@ impl CSSGroupingRule { } } - fn rulelist(&self) -> DomRoot { + fn rulelist(&self, can_gc: CanGc) -> DomRoot { let parent_stylesheet = self.upcast::().parent_stylesheet(); self.rulelist.or_init(|| { CSSRuleList::new( self.global().as_window(), parent_stylesheet, RulesSource::Rules(self.rules.clone()), - CanGc::note(), + can_gc, ) }) } @@ -62,13 +62,13 @@ impl CSSGroupingRule { impl CSSGroupingRuleMethods for CSSGroupingRule { // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-cssrules - fn CssRules(&self) -> DomRoot { + fn CssRules(&self, can_gc: CanGc) -> DomRoot { // XXXManishearth check origin clean flag - self.rulelist() + self.rulelist(can_gc) } // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-insertrule - fn InsertRule(&self, rule: DOMString, index: u32) -> Fallible { + fn InsertRule(&self, rule: DOMString, index: u32, can_gc: CanGc) -> Fallible { // TODO: this should accumulate the rule types of all ancestors. let rule_type = self.cssrule.as_specific().ty(); let containing_rule_types = CssRuleTypes::from(rule_type); @@ -76,17 +76,17 @@ impl CSSGroupingRuleMethods for CSSGroupingRule { CssRuleType::Style | CssRuleType::Scope => Some(rule_type), _ => None, }; - self.rulelist().insert_rule( + self.rulelist(can_gc).insert_rule( &rule, index, containing_rule_types, parse_relative_rule_type, - CanGc::note(), + can_gc, ) } // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-deleterule - fn DeleteRule(&self, index: u32) -> ErrorResult { - self.rulelist().remove_rule(index) + fn DeleteRule(&self, index: u32, can_gc: CanGc) -> ErrorResult { + self.rulelist(can_gc).remove_rule(index) } } diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index ded87c0b9be..4475d6042e7 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -61,14 +61,14 @@ impl CSSKeyframesRule { ) } - fn rulelist(&self) -> DomRoot { + fn rulelist(&self, can_gc: CanGc) -> DomRoot { self.rulelist.or_init(|| { let parent_stylesheet = &self.upcast::().parent_stylesheet(); CSSRuleList::new( self.global().as_window(), parent_stylesheet, RulesSource::Keyframes(self.keyframesrule.clone()), - CanGc::note(), + can_gc, ) }) } @@ -94,12 +94,12 @@ impl CSSKeyframesRule { impl CSSKeyframesRuleMethods for CSSKeyframesRule { // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-cssrules - fn CssRules(&self) -> DomRoot { - self.rulelist() + fn CssRules(&self, can_gc: CanGc) -> DomRoot { + self.rulelist(can_gc) } // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-appendrule - fn AppendRule(&self, rule: DOMString) { + fn AppendRule(&self, rule: DOMString, can_gc: CanGc) { let style_stylesheet = self.cssrule.parent_stylesheet().style_stylesheet(); let rule = Keyframe::parse( &rule, @@ -113,21 +113,21 @@ impl CSSKeyframesRuleMethods for CSSKeyframesRule { .write_with(&mut guard) .keyframes .push(rule); - self.rulelist().append_lazy_dom_rule(); + self.rulelist(can_gc).append_lazy_dom_rule(); } } // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-deleterule - fn DeleteRule(&self, selector: DOMString) { + fn DeleteRule(&self, selector: DOMString, can_gc: CanGc) { if let Some(idx) = self.find_rule(&selector) { - let _ = self.rulelist().remove_rule(idx as u32); + let _ = self.rulelist(can_gc).remove_rule(idx as u32); } } // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-findrule - fn FindRule(&self, selector: DOMString) -> Option> { + fn FindRule(&self, selector: DOMString, can_gc: CanGc) -> Option> { self.find_rule(&selector) - .and_then(|idx| self.rulelist().item(idx as u32)) + .and_then(|idx| self.rulelist(can_gc).item(idx as u32)) .and_then(DomRoot::downcast) } diff --git a/components/script_bindings/codegen/Bindings.conf b/components/script_bindings/codegen/Bindings.conf index 45055c4c4fb..81295dc8aa8 100644 --- a/components/script_bindings/codegen/Bindings.conf +++ b/components/script_bindings/codegen/Bindings.conf @@ -87,6 +87,18 @@ DOMInterfaces = { 'canGc': ['GetSize'], }, +'CSSGroupingRule': { + 'canGc': ['CssRules', 'DeleteRule', 'InsertRule'], +}, + +'CSSKeyframesRule': { + 'canGc': ['AppendRule', 'CssRules', 'DeleteRule', 'FindRule'], +}, + +'Crypto': { + 'canGc': ['Subtle'], +}, + 'CSSStyleDeclaration': { 'canGc': ['RemoveProperty', 'SetCssText', 'GetPropertyValue', 'SetProperty', 'CssFloat', 'SetCssFloat'] },