diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-03-31 18:41:28 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-05-03 14:18:30 -0400 |
commit | d7b96db33ca8f2b8a162df38e0f00e95f5ea6fa1 (patch) | |
tree | efd1e7f7ec1dd30467c2a67306e1a639837abead /src/components/script/dom/htmloutputelement.rs | |
parent | ffdc3f5b32a345b88eed774848924e862d47c093 (diff) | |
download | servo-d7b96db33ca8f2b8a162df38e0f00e95f5ea6fa1.tar.gz servo-d7b96db33ca8f2b8a162df38e0f00e95f5ea6fa1.zip |
Implement safe rooting strategy via Unrooted, Root, JSRef, and JS.
Diffstat (limited to 'src/components/script/dom/htmloutputelement.rs')
-rw-r--r-- | src/components/script/dom/htmloutputelement.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/components/script/dom/htmloutputelement.rs b/src/components/script/dom/htmloutputelement.rs index 4f5dae6d8c0..a72d9410d20 100644 --- a/src/components/script/dom/htmloutputelement.rs +++ b/src/components/script/dom/htmloutputelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::BindingDeclarations::HTMLOutputElementBinding; use dom::bindings::codegen::InheritTypes::HTMLOutputElementDerived; -use dom::bindings::js::{JS, JSRef, RootCollection}; +use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::error::ErrorResult; use dom::document::Document; use dom::element::HTMLOutputElementTypeId; @@ -36,14 +36,14 @@ impl HTMLOutputElement { } } - pub fn new(localName: DOMString, document: &JSRef<Document>) -> JS<HTMLOutputElement> { + pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLOutputElement> { let element = HTMLOutputElement::new_inherited(localName, document.unrooted()); Node::reflect_node(~element, document, HTMLOutputElementBinding::Wrap) } } impl HTMLOutputElement { - pub fn GetForm(&self) -> Option<JS<HTMLFormElement>> { + pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { None } @@ -82,12 +82,11 @@ impl HTMLOutputElement { pub fn SetWillValidate(&mut self, _will_validate: bool) { } - pub fn Validity(&self) -> JS<ValidityState> { + pub fn Validity(&self) -> Unrooted<ValidityState> { let roots = RootCollection::new(); - let doc = self.htmlelement.element.node.owner_doc(); - let doc = doc.get(); - let window = doc.window.root(&roots); - ValidityState::new(&window.root_ref()) + let doc = self.htmlelement.element.node.owner_doc().root(&roots); + let window = doc.deref().window.root(&roots); + ValidityState::new(&*window) } pub fn SetValidity(&mut self, _validity: JS<ValidityState>) { |