diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-03-28 10:17:56 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-05-03 14:18:30 -0400 |
commit | ffdc3f5b32a345b88eed774848924e862d47c093 (patch) | |
tree | 047371062d728fecca45229a3e2cf87407410ba0 /src/components/script/dom/domparser.rs | |
parent | 4051a8096d7ba7e7f9c86e76d0b4bffd83e85805 (diff) | |
download | servo-ffdc3f5b32a345b88eed774848924e862d47c093.tar.gz servo-ffdc3f5b32a345b88eed774848924e862d47c093.zip |
Turn on GC all the time. Fix rooting errors during parsing and storing timers. Fix borrow errors during tracing.
Diffstat (limited to 'src/components/script/dom/domparser.rs')
-rw-r--r-- | src/components/script/dom/domparser.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/components/script/dom/domparser.rs b/src/components/script/dom/domparser.rs index 1961c8d4661..d11c7270057 100644 --- a/src/components/script/dom/domparser.rs +++ b/src/components/script/dom/domparser.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::BindingDeclarations::DOMParserBinding; use dom::bindings::codegen::BindingDeclarations::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml}; -use dom::bindings::js::JS; +use dom::bindings::js::{JS, JSRef, RootCollection}; use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object}; use dom::bindings::error::{Fallible, FailureUnknown}; use dom::document::{Document, HTMLDocument, NonHTMLDocument}; @@ -25,12 +25,12 @@ impl DOMParser { } } - pub fn new(owner: &JS<Window>) -> JS<DOMParser> { - reflect_dom_object(~DOMParser::new_inherited(owner.clone()), owner, + pub fn new(owner: &JSRef<Window>) -> JS<DOMParser> { + reflect_dom_object(~DOMParser::new_inherited(owner.unrooted()), owner, DOMParserBinding::Wrap) } - pub fn Constructor(owner: &JS<Window>) -> Fallible<JS<DOMParser>> { + pub fn Constructor(owner: &JSRef<Window>) -> Fallible<JS<DOMParser>> { Ok(DOMParser::new(owner)) } @@ -38,12 +38,14 @@ impl DOMParser { _s: DOMString, ty: DOMParserBinding::SupportedType) -> Fallible<JS<Document>> { + let roots = RootCollection::new(); + let owner = self.owner.root(&roots); match ty { Text_html => { - Ok(Document::new(&self.owner, None, HTMLDocument, Some(~"text/html"))) + Ok(Document::new(&owner.root_ref(), None, HTMLDocument, Some(~"text/html"))) } Text_xml => { - Ok(Document::new(&self.owner, None, NonHTMLDocument, Some(~"text/xml"))) + Ok(Document::new(&owner.root_ref(), None, NonHTMLDocument, Some(~"text/xml"))) } _ => { Err(FailureUnknown) |