diff options
author | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-06-01 17:29:58 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-06-02 00:38:57 +0900 |
commit | a0a0e07f71e5718dfc4e4d75c67982c33dd65417 (patch) | |
tree | 53286b1b06f18bedc081447add9dc6cda71f4804 /src/components/script/dom/document.rs | |
parent | 93f8ae4cf0325eff01885731f1b9cbc52e17ff38 (diff) | |
download | servo-a0a0e07f71e5718dfc4e4d75c67982c33dd65417.tar.gz servo-a0a0e07f71e5718dfc4e4d75c67982c33dd65417.zip |
Make Document.implementation be in a Cell.
Diffstat (limited to 'src/components/script/dom/document.rs')
-rw-r--r-- | src/components/script/dom/document.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs index f6f67f93747..db176993db9 100644 --- a/src/components/script/dom/document.rs +++ b/src/components/script/dom/document.rs @@ -48,6 +48,7 @@ use servo_util::str::{DOMString, null_str_as_empty_ref}; use collections::hashmap::HashMap; use js::jsapi::JSContext; use std::ascii::StrAsciiExt; +use std::cell::Cell; use url::{Url, from_str}; #[deriving(Eq,Encodable)] @@ -62,7 +63,7 @@ pub struct Document { pub reflector_: Reflector, pub window: JS<Window>, pub idmap: HashMap<DOMString, Vec<JS<Element>>>, - pub implementation: Option<JS<DOMImplementation>>, + pub implementation: Cell<Option<JS<DOMImplementation>>>, pub content_type: DOMString, pub encoding_name: DOMString, pub is_html_document: bool, @@ -213,7 +214,7 @@ impl Document { reflector_: Reflector::new(), window: window.unrooted(), idmap: HashMap::new(), - implementation: None, + implementation: Cell::new(None), content_type: match content_type { Some(string) => string.clone(), None => match is_html_document { @@ -334,11 +335,11 @@ pub trait DocumentMethods { impl<'a> DocumentMethods for JSRef<'a, Document> { // http://dom.spec.whatwg.org/#dom-document-implementation fn Implementation(&mut self) -> Temporary<DOMImplementation> { - if self.implementation.is_none() { + if self.implementation.get().is_none() { let window = self.window.root(); self.implementation.assign(Some(DOMImplementation::new(&*window))); } - Temporary::new(self.implementation.get_ref().clone()) + Temporary::new(self.implementation.get().get_ref().clone()) } // http://dom.spec.whatwg.org/#dom-document-url |