diff options
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 6abf4f7b877..9795b0a9008 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -17,7 +17,7 @@ use dom::bindings::js::{Root}; use dom::bindings::utils::Reflectable; use dom::customevent::CustomEvent; use dom::document::Document; -use dom::element::{ElementTypeId, self}; +use dom::element::{AttributeMutation, ElementTypeId, self}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{Node, NodeTypeId, window_from_node}; @@ -354,16 +354,13 @@ impl VirtualMethods for HTMLIFrameElement { Some(htmlelement as &VirtualMethods) } - fn after_set_attr(&self, attr: &Attr) { - if let Some(ref s) = self.super_type() { - s.after_set_attr(attr); - } - + fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { + self.super_type().unwrap().attribute_mutated(attr, mutation); match attr.local_name() { - &atom!("sandbox") => { - let mut modes = SandboxAllowance::AllowNothing as u8; - if let Some(ref tokens) = attr.value().tokens() { - for token in *tokens { + &atom!(sandbox) => { + self.sandbox.set(mutation.new_value(attr).map(|value| { + let mut modes = SandboxAllowance::AllowNothing as u8; + for token in value.tokens().unwrap() { modes |= match &*token.to_ascii_lowercase() { "allow-same-origin" => SandboxAllowance::AllowSameOrigin, "allow-forms" => SandboxAllowance::AllowForms, @@ -374,16 +371,17 @@ impl VirtualMethods for HTMLIFrameElement { _ => SandboxAllowance::AllowNothing } as u8; } - } - self.sandbox.set(Some(modes)); - } - &atom!("src") => { - let node = NodeCast::from_ref(self); - if node.is_in_doc() { - self.process_the_iframe_attributes() + modes + })); + }, + &atom!(src) => { + if let AttributeMutation::Set(_) = mutation { + if NodeCast::from_ref(self).is_in_doc() { + self.process_the_iframe_attributes(); + } } }, - _ => () + _ => {}, } } @@ -394,17 +392,6 @@ impl VirtualMethods for HTMLIFrameElement { } } - fn before_remove_attr(&self, attr: &Attr) { - if let Some(ref s) = self.super_type() { - s.before_remove_attr(attr); - } - - match attr.local_name() { - &atom!("sandbox") => self.sandbox.set(None), - _ => () - } - } - fn bind_to_tree(&self, tree_in_doc: bool) { if let Some(ref s) = self.super_type() { s.bind_to_tree(tree_in_doc); |