s/Unrooted/Temporary/g

This commit is contained in:
Josh Matthews 2014-04-17 17:08:00 -04:00
parent bbfed38168
commit 522d3f167b
104 changed files with 565 additions and 565 deletions

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::AttrBinding; use dom::bindings::codegen::BindingDeclarations::AttrBinding;
use dom::bindings::codegen::InheritTypes::NodeCast; use dom::bindings::codegen::InheritTypes::NodeCast;
use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection}; use dom::bindings::js::{JS, JSRef, Temporary, RootCollection};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::element::Element; use dom::element::Element;
use dom::node::Node; use dom::node::Node;
@ -59,7 +59,7 @@ impl Attr {
pub fn new(window: &JSRef<Window>, local_name: DOMString, value: DOMString, pub fn new(window: &JSRef<Window>, local_name: DOMString, value: DOMString,
name: DOMString, namespace: Namespace, name: DOMString, namespace: Namespace,
prefix: Option<DOMString>, owner: &JSRef<Element>) -> Unrooted<Attr> { prefix: Option<DOMString>, owner: &JSRef<Element>) -> Temporary<Attr> {
let attr = Attr::new_inherited(local_name, value, name, namespace, prefix, owner); let attr = Attr::new_inherited(local_name, value, name, namespace, prefix, owner);
reflect_dom_object(~attr, window, AttrBinding::Wrap) reflect_dom_object(~attr, window, AttrBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::attr::Attr; use dom::attr::Attr;
use dom::bindings::codegen::BindingDeclarations::AttrListBinding; use dom::bindings::codegen::BindingDeclarations::AttrListBinding;
use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection}; use dom::bindings::js::{JS, JSRef, Temporary, RootCollection};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::element::Element; use dom::element::Element;
use dom::window::Window; use dom::window::Window;
@ -25,7 +25,7 @@ impl AttrList {
} }
} }
pub fn new(window: &JSRef<Window>, elem: &JSRef<Element>) -> Unrooted<AttrList> { pub fn new(window: &JSRef<Window>, elem: &JSRef<Element>) -> Temporary<AttrList> {
reflect_dom_object(~AttrList::new_inherited(window.unrooted(), elem.unrooted()), reflect_dom_object(~AttrList::new_inherited(window.unrooted(), elem.unrooted()),
window, AttrListBinding::Wrap) window, AttrListBinding::Wrap)
} }
@ -33,8 +33,8 @@ impl AttrList {
pub trait AttrListMethods { pub trait AttrListMethods {
fn Length(&self) -> u32; fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<Attr>>; fn Item(&self, index: u32) -> Option<Temporary<Attr>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Attr>>; fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Attr>>;
} }
impl<'a> AttrListMethods for JSRef<'a, AttrList> { impl<'a> AttrListMethods for JSRef<'a, AttrList> {
@ -43,12 +43,12 @@ impl<'a> AttrListMethods for JSRef<'a, AttrList> {
self.owner.root(&roots).attrs.len() as u32 self.owner.root(&roots).attrs.len() as u32
} }
fn Item(&self, index: u32) -> Option<Unrooted<Attr>> { fn Item(&self, index: u32) -> Option<Temporary<Attr>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
self.owner.root(&roots).attrs.as_slice().get(index as uint).map(|x| Unrooted::new(x.clone())) self.owner.root(&roots).attrs.as_slice().get(index as uint).map(|x| Temporary::new(x.clone()))
} }
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Attr>> { fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Attr>> {
let item = self.Item(index); let item = self.Item(index);
*found = item.is_some(); *found = item.is_some();
item item

View file

@ -4323,7 +4323,7 @@ class CGBindingRoot(CGThing):
'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}', 'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}',
'dom::types::*', 'dom::types::*',
'dom::bindings', 'dom::bindings',
'dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Unrooted, OptionalRootable}', 'dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Temporary, OptionalRootable}',
'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}', 'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}',
'dom::bindings::utils::{ConstantSpec, cx_for_dom_object, Default}', 'dom::bindings::utils::{ConstantSpec, cx_for_dom_object, Default}',
'dom::bindings::utils::{dom_object_slot, DOM_OBJECT_SLOT, DOMClass}', 'dom::bindings::utils::{dom_object_slot, DOM_OBJECT_SLOT, DOMClass}',
@ -5294,7 +5294,7 @@ class GlobalGenRoots():
descriptors = config.getDescriptors(register=True, hasInterfaceObject=True) descriptors = config.getDescriptors(register=True, hasInterfaceObject=True)
allprotos = [CGGeneric("#![allow(unused_imports)]\n"), allprotos = [CGGeneric("#![allow(unused_imports)]\n"),
CGGeneric("use dom::types::*;\n"), CGGeneric("use dom::types::*;\n"),
CGGeneric("use dom::bindings::js::{JS, JSRef, Unrooted};\n"), CGGeneric("use dom::bindings::js::{JS, JSRef, Temporary};\n"),
CGGeneric("use dom::bindings::trace::JSTraceable;\n"), CGGeneric("use dom::bindings::trace::JSTraceable;\n"),
CGGeneric("use dom::bindings::utils::Reflectable;\n"), CGGeneric("use dom::bindings::utils::Reflectable;\n"),
CGGeneric("use serialize::{Encodable, Encoder};\n"), CGGeneric("use serialize::{Encodable, Encoder};\n"),
@ -5349,7 +5349,7 @@ class GlobalGenRoots():
} }
#[inline(always)] #[inline(always)]
fn from_unrooted<T: ${fromBound}+Reflectable>(derived: Unrooted<T>) -> Unrooted<Self> { fn from_unrooted<T: ${fromBound}+Reflectable>(derived: Temporary<T>) -> Temporary<Self> {
unsafe { derived.transmute() } unsafe { derived.transmute() }
} }
} }

View file

@ -133,7 +133,7 @@ class Descriptor(DescriptorProvider):
else: else:
nativeTypeDefault = 'JS<%s>' % ifaceName nativeTypeDefault = 'JS<%s>' % ifaceName
self.returnType = "Unrooted<%s>" % ifaceName self.returnType = "Temporary<%s>" % ifaceName
self.nativeType = desc.get('nativeType', nativeTypeDefault) self.nativeType = desc.get('nativeType', nativeTypeDefault)
self.concreteType = desc.get('concreteType', ifaceName) self.concreteType = desc.get('concreteType', ifaceName)
self.createGlobal = desc.get('createGlobal', False) self.createGlobal = desc.get('createGlobal', False)

View file

@ -14,27 +14,27 @@ use std::cell::RefCell;
/// Importantly, it requires rooting in order to interact with the value in any way. /// Importantly, it requires rooting in order to interact with the value in any way.
/// Can be assigned into JS-owned member fields (ie. JS<T> types) safely via the /// Can be assigned into JS-owned member fields (ie. JS<T> types) safely via the
/// `JS<T>::assign` method or `OptionalAssignable::assign` (for Option<JS<T>> fields). /// `JS<T>::assign` method or `OptionalAssignable::assign` (for Option<JS<T>> fields).
pub struct Unrooted<T> { pub struct Temporary<T> {
inner: JS<T> inner: JS<T>
} }
impl<T> Eq for Unrooted<T> { impl<T> Eq for Temporary<T> {
fn eq(&self, other: &Unrooted<T>) -> bool { fn eq(&self, other: &Temporary<T>) -> bool {
self.inner == other.inner self.inner == other.inner
} }
} }
impl<T: Reflectable> Unrooted<T> { impl<T: Reflectable> Temporary<T> {
/// Create a new Unrooted value from a JS-owned value. /// Create a new Temporary value from a JS-owned value.
pub fn new(inner: JS<T>) -> Unrooted<T> { pub fn new(inner: JS<T>) -> Temporary<T> {
Unrooted { Temporary {
inner: inner inner: inner
} }
} }
/// Create a new Unrooted value from a rooted value. /// Create a new Temporary value from a rooted value.
pub fn new_rooted<'a>(root: &JSRef<'a, T>) -> Unrooted<T> { pub fn new_rooted<'a>(root: &JSRef<'a, T>) -> Temporary<T> {
Unrooted { Temporary {
inner: root.unrooted() inner: root.unrooted()
} }
} }
@ -49,7 +49,7 @@ impl<T: Reflectable> Unrooted<T> {
} }
//XXXjdm It would be lovely if this could be private. //XXXjdm It would be lovely if this could be private.
pub unsafe fn transmute<To>(self) -> Unrooted<To> { pub unsafe fn transmute<To>(self) -> Temporary<To> {
cast::transmute(self) cast::transmute(self)
} }
} }
@ -75,12 +75,12 @@ impl <T> Clone for JS<T> {
} }
impl<T: Reflectable> JS<T> { impl<T: Reflectable> JS<T> {
/// Create a new JS-reflected DOM object; returns an Unrooted type because the new value /// Create a new JS-reflected DOM object; returns an Temporary type because the new value
/// is not safe to use until it is rooted. /// is not safe to use until it is rooted.
pub fn new(obj: ~T, pub fn new(obj: ~T,
window: &JSRef<Window>, window: &JSRef<Window>,
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~T) -> JS<T>) -> Unrooted<T> { wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~T) -> JS<T>) -> Temporary<T> {
Unrooted::new(wrap_fn(window.get().get_cx(), window, obj)) Temporary::new(wrap_fn(window.get().get_cx(), window, obj))
} }
/// Create a new JS-owned value wrapped from a raw Rust pointer. /// Create a new JS-owned value wrapped from a raw Rust pointer.
@ -132,7 +132,7 @@ impl<T: Reflectable> JS<T> {
/// Store an unrooted value in this field. This is safe under the assumption that JS<T> /// Store an unrooted value in this field. This is safe under the assumption that JS<T>
/// values are only used as fields in DOM types that are reachable in the GC graph, /// values are only used as fields in DOM types that are reachable in the GC graph,
/// so this unrooted value becomes transitively rooted for the lifetime of its new owner. /// so this unrooted value becomes transitively rooted for the lifetime of its new owner.
pub fn assign(&mut self, val: Unrooted<T>) { pub fn assign(&mut self, val: Temporary<T>) {
*self = unsafe { val.inner() }; *self = unsafe { val.inner() };
} }
} }
@ -178,7 +178,7 @@ impl<'a, T> Assignable<T> for JSRef<'a, T> {
// Assignable should not be exposed publically, since it's used to // Assignable should not be exposed publically, since it's used to
// extract unrooted values in a safe way WHEN USED CORRECTLY. // extract unrooted values in a safe way WHEN USED CORRECTLY.
impl<T: Reflectable> Assignable<T> for Unrooted<T> { impl<T: Reflectable> Assignable<T> for Temporary<T> {
fn get_js(&self) -> JS<T> { fn get_js(&self) -> JS<T> {
unsafe { self.inner() } unsafe { self.inner() }
} }
@ -198,7 +198,7 @@ pub trait OptionalRootable<T> {
fn root<'a, 'b>(self, roots: &'a RootCollection) -> Option<Root<'a, 'b, T>>; fn root<'a, 'b>(self, roots: &'a RootCollection) -> Option<Root<'a, 'b, T>>;
} }
impl<T: Reflectable> OptionalRootable<T> for Option<Unrooted<T>> { impl<T: Reflectable> OptionalRootable<T> for Option<Temporary<T>> {
fn root<'a, 'b>(self, roots: &'a RootCollection) -> Option<Root<'a, 'b, T>> { fn root<'a, 'b>(self, roots: &'a RootCollection) -> Option<Root<'a, 'b, T>> {
self.map(|inner| inner.root(roots)) self.map(|inner| inner.root(roots))
} }
@ -218,7 +218,7 @@ pub trait ResultRootable<T,U> {
fn root<'a, 'b>(self, roots: &'a RootCollection) -> Result<Root<'a, 'b, T>, U>; fn root<'a, 'b>(self, roots: &'a RootCollection) -> Result<Root<'a, 'b, T>, U>;
} }
impl<T: Reflectable, U> ResultRootable<T, U> for Result<Unrooted<T>, U> { impl<T: Reflectable, U> ResultRootable<T, U> for Result<Temporary<T>, U> {
fn root<'a, 'b>(self, roots: &'a RootCollection) -> Result<Root<'a, 'b, T>, U> { fn root<'a, 'b>(self, roots: &'a RootCollection) -> Result<Root<'a, 'b, T>, U> {
self.map(|inner| inner.root(roots)) self.map(|inner| inner.root(roots))
} }
@ -227,12 +227,12 @@ impl<T: Reflectable, U> ResultRootable<T, U> for Result<Unrooted<T>, U> {
/// Provides a facility to push unrooted values onto lists of rooted values. This is safe /// Provides a facility to push unrooted values onto lists of rooted values. This is safe
/// under the assumption that said lists are reachable via the GC graph, and therefore the /// under the assumption that said lists are reachable via the GC graph, and therefore the
/// new values are transitively rooted for the lifetime of their new owner. /// new values are transitively rooted for the lifetime of their new owner.
pub trait UnrootedPushable<T> { pub trait TemporaryPushable<T> {
fn push_unrooted(&mut self, val: Unrooted<T>); fn push_unrooted(&mut self, val: Temporary<T>);
} }
impl<T: Reflectable> UnrootedPushable<T> for Vec<JS<T>> { impl<T: Reflectable> TemporaryPushable<T> for Vec<JS<T>> {
fn push_unrooted(&mut self, val: Unrooted<T>) { fn push_unrooted(&mut self, val: Temporary<T>) {
unsafe { self.push(val.inner()) }; unsafe { self.push(val.inner()) };
} }
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::PrototypeList; use dom::bindings::codegen::PrototypeList;
use dom::bindings::codegen::PrototypeList::MAX_PROTO_CHAIN_LENGTH; use dom::bindings::codegen::PrototypeList::MAX_PROTO_CHAIN_LENGTH;
use dom::bindings::conversions::{FromJSValConvertible, IDLInterface}; use dom::bindings::conversions::{FromJSValConvertible, IDLInterface};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted, Root}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary, Root};
use dom::bindings::trace::Untraceable; use dom::bindings::trace::Untraceable;
use dom::browsercontext; use dom::browsercontext;
use dom::window; use dom::window;
@ -391,7 +391,7 @@ pub fn reflect_dom_object<T: Reflectable>
(obj: ~T, (obj: ~T,
window: &JSRef<window::Window>, window: &JSRef<window::Window>,
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<window::Window>, ~T) -> JS<T>) wrap_fn: extern "Rust" fn(*JSContext, &JSRef<window::Window>, ~T) -> JS<T>)
-> Unrooted<T> { -> Temporary<T> {
JS::new(obj, window, wrap_fn) JS::new(obj, window, wrap_fn)
} }
@ -616,12 +616,12 @@ pub extern fn outerize_global(_cx: *JSContext, obj: JSHandleObject) -> *JSObject
} }
/// Returns the global object of the realm that the given JS object was created in. /// Returns the global object of the realm that the given JS object was created in.
pub fn global_object_for_js_object(obj: *JSObject) -> Unrooted<window::Window> { pub fn global_object_for_js_object(obj: *JSObject) -> Temporary<window::Window> {
unsafe { unsafe {
let global = GetGlobalForObjectCrossCompartment(obj); let global = GetGlobalForObjectCrossCompartment(obj);
let clasp = JS_GetClass(global); let clasp = JS_GetClass(global);
assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0); assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0);
Unrooted::new( Temporary::new(
FromJSValConvertible::from_jsval(ptr::null(), ObjectOrNullValue(global), ()) FromJSValConvertible::from_jsval(ptr::null(), ObjectOrNullValue(global), ())
.ok().expect("found DOM global that doesn't unwrap to Window")) .ok().expect("found DOM global that doesn't unwrap to Window"))
} }

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::codegen::BindingDeclarations::BlobBinding; use dom::bindings::codegen::BindingDeclarations::BlobBinding;
@ -23,13 +23,13 @@ impl Blob {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<Blob> { pub fn new(window: &JSRef<Window>) -> Temporary<Blob> {
reflect_dom_object(~Blob::new_inherited(window.unrooted()), reflect_dom_object(~Blob::new_inherited(window.unrooted()),
window, window,
BlobBinding::Wrap) BlobBinding::Wrap)
} }
pub fn Constructor(window: &JSRef<Window>) -> Fallible<Unrooted<Blob>> { pub fn Constructor(window: &JSRef<Window>) -> Fallible<Temporary<Blob>> {
Ok(Blob::new(window)) Ok(Blob::new(window))
} }
} }
@ -37,7 +37,7 @@ impl Blob {
pub trait BlobMethods { pub trait BlobMethods {
fn Size(&self) -> u64; fn Size(&self) -> u64;
fn Type(&self) -> DOMString; fn Type(&self) -> DOMString;
fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Unrooted<Blob>; fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Temporary<Blob>;
fn Close(&self); fn Close(&self);
} }
@ -50,7 +50,7 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
~"" ~""
} }
fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Unrooted<Blob> { fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Temporary<Blob> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
Blob::new(&window.root_ref()) Blob::new(&window.root_ref())

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection}; use dom::bindings::js::{JS, JSRef, Temporary, RootCollection};
use dom::bindings::trace::Traceable; use dom::bindings::trace::Traceable;
use dom::bindings::utils::Reflectable; use dom::bindings::utils::Reflectable;
use dom::document::Document; use dom::document::Document;
@ -32,14 +32,14 @@ impl BrowserContext {
context context
} }
pub fn active_document(&self) -> Unrooted<Document> { pub fn active_document(&self) -> Temporary<Document> {
Unrooted::new(self.history.get(self.active_index).document.clone()) Temporary::new(self.history.get(self.active_index).document.clone())
} }
pub fn active_window(&self) -> Unrooted<Window> { pub fn active_window(&self) -> Temporary<Window> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let doc = self.active_document().root(&roots); let doc = self.active_document().root(&roots);
Unrooted::new(doc.deref().window.clone()) Temporary::new(doc.deref().window.clone())
} }
pub fn window_proxy(&self) -> *JSObject { pub fn window_proxy(&self) -> *JSObject {

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::ClientRectBinding; use dom::bindings::codegen::BindingDeclarations::ClientRectBinding;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::window::Window; use dom::window::Window;
use servo_util::geometry::Au; use servo_util::geometry::Au;
@ -34,7 +34,7 @@ impl ClientRect {
pub fn new(window: &JSRef<Window>, pub fn new(window: &JSRef<Window>,
top: Au, bottom: Au, top: Au, bottom: Au,
left: Au, right: Au) -> Unrooted<ClientRect> { left: Au, right: Au) -> Temporary<ClientRect> {
let rect = ClientRect::new_inherited(window.unrooted(), top, bottom, left, right); let rect = ClientRect::new_inherited(window.unrooted(), top, bottom, left, right);
reflect_dom_object(~rect, window, ClientRectBinding::Wrap) reflect_dom_object(~rect, window, ClientRectBinding::Wrap)
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::ClientRectListBinding; use dom::bindings::codegen::BindingDeclarations::ClientRectListBinding;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::clientrect::ClientRect; use dom::clientrect::ClientRect;
use dom::window::Window; use dom::window::Window;
@ -26,7 +26,7 @@ impl ClientRectList {
} }
pub fn new(window: &JSRef<Window>, pub fn new(window: &JSRef<Window>,
rects: Vec<JSRef<ClientRect>>) -> Unrooted<ClientRectList> { rects: Vec<JSRef<ClientRect>>) -> Temporary<ClientRectList> {
reflect_dom_object(~ClientRectList::new_inherited(window.unrooted(), rects), reflect_dom_object(~ClientRectList::new_inherited(window.unrooted(), rects),
window, ClientRectListBinding::Wrap) window, ClientRectListBinding::Wrap)
} }
@ -34,8 +34,8 @@ impl ClientRectList {
pub trait ClientRectListMethods { pub trait ClientRectListMethods {
fn Length(&self) -> u32; fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<ClientRect>>; fn Item(&self, index: u32) -> Option<Temporary<ClientRect>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<ClientRect>>; fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<ClientRect>>;
} }
impl<'a> ClientRectListMethods for JSRef<'a, ClientRectList> { impl<'a> ClientRectListMethods for JSRef<'a, ClientRectList> {
@ -43,15 +43,15 @@ impl<'a> ClientRectListMethods for JSRef<'a, ClientRectList> {
self.rects.len() as u32 self.rects.len() as u32
} }
fn Item(&self, index: u32) -> Option<Unrooted<ClientRect>> { fn Item(&self, index: u32) -> Option<Temporary<ClientRect>> {
if index < self.rects.len() as u32 { if index < self.rects.len() as u32 {
Some(Unrooted::new(self.rects.get(index as uint).clone())) Some(Temporary::new(self.rects.get(index as uint).clone()))
} else { } else {
None None
} }
} }
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<ClientRect>> { fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<ClientRect>> {
*found = index < self.rects.len() as u32; *found = index < self.rects.len() as u32;
self.Item(index) self.Item(index)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::InheritTypes::CommentDerived; use dom::bindings::codegen::InheritTypes::CommentDerived;
use dom::bindings::codegen::BindingDeclarations::CommentBinding; use dom::bindings::codegen::BindingDeclarations::CommentBinding;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
use dom::document::Document; use dom::document::Document;
@ -35,12 +35,12 @@ impl Comment {
} }
} }
pub fn new(text: DOMString, document: &JSRef<Document>) -> Unrooted<Comment> { pub fn new(text: DOMString, document: &JSRef<Document>) -> Temporary<Comment> {
let node = Comment::new_inherited(text, document.unrooted()); let node = Comment::new_inherited(text, document.unrooted());
Node::reflect_node(~node, document, CommentBinding::Wrap) Node::reflect_node(~node, document, CommentBinding::Wrap)
} }
pub fn Constructor(owner: &JSRef<Window>, data: DOMString) -> Fallible<Unrooted<Comment>> { pub fn Constructor(owner: &JSRef<Window>, data: DOMString) -> Fallible<Temporary<Comment>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let document = owner.Document().root(&roots); let document = owner.Document().root(&roots);
Ok(Comment::new(data, &*document)) Ok(Comment::new(data, &*document))

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::ConsoleBinding; use dom::bindings::codegen::BindingDeclarations::ConsoleBinding;
use dom::bindings::js::{JSRef, Unrooted}; use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::window::Window; use dom::window::Window;
use servo_util::str::DOMString; use servo_util::str::DOMString;
@ -20,7 +20,7 @@ impl Console {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<Console> { pub fn new(window: &JSRef<Window>) -> Temporary<Console> {
reflect_dom_object(~Console::new_inherited(), window, ConsoleBinding::Wrap) reflect_dom_object(~Console::new_inherited(), window, ConsoleBinding::Wrap)
} }
} }

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::InheritTypes::{DocumentDerived, EventCast, HTMLEleme
use dom::bindings::codegen::InheritTypes::{HTMLHeadElementCast, TextCast, ElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLHeadElementCast, TextCast, ElementCast};
use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast};
use dom::bindings::codegen::BindingDeclarations::DocumentBinding; use dom::bindings::codegen::BindingDeclarations::DocumentBinding;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted, OptionalAssignable}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary, OptionalAssignable};
use dom::bindings::js::OptionalRootable; use dom::bindings::js::OptionalRootable;
use dom::bindings::trace::Untraceable; use dom::bindings::trace::Untraceable;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
@ -187,7 +187,7 @@ impl Document {
pub fn reflect_document(document: ~Document, pub fn reflect_document(document: ~Document,
window: &JSRef<Window>, window: &JSRef<Window>,
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~Document) -> JS<Document>) wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~Document) -> JS<Document>)
-> Unrooted<Document> { -> Temporary<Document> {
let roots = RootCollection::new(); let roots = RootCollection::new();
assert!(document.reflector().get_jsobject().is_null()); assert!(document.reflector().get_jsobject().is_null());
let mut raw_doc = reflect_dom_object(document, window, wrap_fn).root(&roots); let mut raw_doc = reflect_dom_object(document, window, wrap_fn).root(&roots);
@ -196,7 +196,7 @@ impl Document {
let mut doc_alias = raw_doc.clone(); let mut doc_alias = raw_doc.clone();
let node: &mut JSRef<Node> = NodeCast::from_mut_ref(&mut doc_alias); let node: &mut JSRef<Node> = NodeCast::from_mut_ref(&mut doc_alias);
node.set_owner_doc(&*raw_doc); node.set_owner_doc(&*raw_doc);
Unrooted::new_rooted(&*raw_doc) Temporary::new_rooted(&*raw_doc)
} }
pub fn new_inherited(window: JS<Window>, pub fn new_inherited(window: JS<Window>,
@ -230,11 +230,11 @@ impl Document {
} }
// http://dom.spec.whatwg.org/#dom-document // http://dom.spec.whatwg.org/#dom-document
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<Document>> { pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Temporary<Document>> {
Ok(Document::new(owner, None, NonHTMLDocument, None)) Ok(Document::new(owner, None, NonHTMLDocument, None))
} }
pub fn new(window: &JSRef<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> Unrooted<Document> { pub fn new(window: &JSRef<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> Temporary<Document> {
let document = Document::new_inherited(window.unrooted(), url, doctype, content_type); let document = Document::new_inherited(window.unrooted(), url, doctype, content_type);
Document::reflect_document(~document, window, DocumentBinding::Wrap) Document::reflect_document(~document, window, DocumentBinding::Wrap)
} }
@ -251,12 +251,12 @@ impl Reflectable for Document {
} }
trait PrivateDocumentHelpers { trait PrivateDocumentHelpers {
fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Unrooted<NodeList>; fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Temporary<NodeList>;
fn get_html_element(&self) -> Option<Unrooted<HTMLHtmlElement>>; fn get_html_element(&self) -> Option<Temporary<HTMLHtmlElement>>;
} }
impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> { impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Unrooted<NodeList> { fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Temporary<NodeList> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -276,65 +276,65 @@ impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
NodeList::new_simple_list(&*window, nodes) NodeList::new_simple_list(&*window, nodes)
} }
fn get_html_element(&self) -> Option<Unrooted<HTMLHtmlElement>> { fn get_html_element(&self) -> Option<Temporary<HTMLHtmlElement>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
self.GetDocumentElement().root(&roots).filtered(|root| { self.GetDocumentElement().root(&roots).filtered(|root| {
root.node.type_id == ElementNodeTypeId(HTMLHtmlElementTypeId) root.node.type_id == ElementNodeTypeId(HTMLHtmlElementTypeId)
}).map(|elem| { }).map(|elem| {
Unrooted::new_rooted(HTMLHtmlElementCast::to_ref(&*elem).unwrap()) Temporary::new_rooted(HTMLHtmlElementCast::to_ref(&*elem).unwrap())
}) })
} }
} }
pub trait DocumentMethods { pub trait DocumentMethods {
fn Implementation(&mut self) -> Unrooted<DOMImplementation>; fn Implementation(&mut self) -> Temporary<DOMImplementation>;
fn URL(&self) -> DOMString; fn URL(&self) -> DOMString;
fn DocumentURI(&self) -> DOMString; fn DocumentURI(&self) -> DOMString;
fn CompatMode(&self) -> DOMString; fn CompatMode(&self) -> DOMString;
fn CharacterSet(&self) -> DOMString; fn CharacterSet(&self) -> DOMString;
fn ContentType(&self) -> DOMString; fn ContentType(&self) -> DOMString;
fn GetDoctype(&self) -> Option<Unrooted<DocumentType>>; fn GetDoctype(&self) -> Option<Temporary<DocumentType>>;
fn GetDocumentElement(&self) -> Option<Unrooted<Element>>; fn GetDocumentElement(&self) -> Option<Temporary<Element>>;
fn GetElementsByTagName(&self, tag_name: DOMString) -> Unrooted<HTMLCollection>; fn GetElementsByTagName(&self, tag_name: DOMString) -> Temporary<HTMLCollection>;
fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Unrooted<HTMLCollection>; fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Temporary<HTMLCollection>;
fn GetElementsByClassName(&self, classes: DOMString) -> Unrooted<HTMLCollection>; fn GetElementsByClassName(&self, classes: DOMString) -> Temporary<HTMLCollection>;
fn GetElementById(&self, id: DOMString) -> Option<Unrooted<Element>>; fn GetElementById(&self, id: DOMString) -> Option<Temporary<Element>>;
fn CreateElement(&self, local_name: DOMString) -> Fallible<Unrooted<Element>>; fn CreateElement(&self, local_name: DOMString) -> Fallible<Temporary<Element>>;
fn CreateElementNS(&self, namespace: Option<DOMString>, qualified_name: DOMString) -> Fallible<Unrooted<Element>>; fn CreateElementNS(&self, namespace: Option<DOMString>, qualified_name: DOMString) -> Fallible<Temporary<Element>>;
fn CreateDocumentFragment(&self) -> Unrooted<DocumentFragment>; fn CreateDocumentFragment(&self) -> Temporary<DocumentFragment>;
fn CreateTextNode(&self, data: DOMString) -> Unrooted<Text>; fn CreateTextNode(&self, data: DOMString) -> Temporary<Text>;
fn CreateComment(&self, data: DOMString) -> Unrooted<Comment>; fn CreateComment(&self, data: DOMString) -> Temporary<Comment>;
fn CreateProcessingInstruction(&self, target: DOMString, data: DOMString) -> Fallible<Unrooted<ProcessingInstruction>>; fn CreateProcessingInstruction(&self, target: DOMString, data: DOMString) -> Fallible<Temporary<ProcessingInstruction>>;
fn ImportNode(&self, node: &JSRef<Node>, deep: bool) -> Fallible<Unrooted<Node>>; fn ImportNode(&self, node: &JSRef<Node>, deep: bool) -> Fallible<Temporary<Node>>;
fn AdoptNode(&self, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>; fn AdoptNode(&self, node: &mut JSRef<Node>) -> Fallible<Temporary<Node>>;
fn CreateEvent(&self, interface: DOMString) -> Fallible<Unrooted<Event>>; fn CreateEvent(&self, interface: DOMString) -> Fallible<Temporary<Event>>;
fn Title(&self) -> DOMString; fn Title(&self) -> DOMString;
fn SetTitle(&self, title: DOMString) -> ErrorResult; fn SetTitle(&self, title: DOMString) -> ErrorResult;
fn GetHead(&self) -> Option<Unrooted<HTMLHeadElement>>; fn GetHead(&self) -> Option<Temporary<HTMLHeadElement>>;
fn GetBody(&self) -> Option<Unrooted<HTMLElement>>; fn GetBody(&self) -> Option<Temporary<HTMLElement>>;
fn SetBody(&self, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult; fn SetBody(&self, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult;
fn GetElementsByName(&self, name: DOMString) -> Unrooted<NodeList>; fn GetElementsByName(&self, name: DOMString) -> Temporary<NodeList>;
fn Images(&self) -> Unrooted<HTMLCollection>; fn Images(&self) -> Temporary<HTMLCollection>;
fn Embeds(&self) -> Unrooted<HTMLCollection>; fn Embeds(&self) -> Temporary<HTMLCollection>;
fn Plugins(&self) -> Unrooted<HTMLCollection>; fn Plugins(&self) -> Temporary<HTMLCollection>;
fn Links(&self) -> Unrooted<HTMLCollection>; fn Links(&self) -> Temporary<HTMLCollection>;
fn Forms(&self) -> Unrooted<HTMLCollection>; fn Forms(&self) -> Temporary<HTMLCollection>;
fn Scripts(&self) -> Unrooted<HTMLCollection>; fn Scripts(&self) -> Temporary<HTMLCollection>;
fn Anchors(&self) -> Unrooted<HTMLCollection>; fn Anchors(&self) -> Temporary<HTMLCollection>;
fn Applets(&self) -> Unrooted<HTMLCollection>; fn Applets(&self) -> Temporary<HTMLCollection>;
fn Location(&mut self) -> Unrooted<Location>; fn Location(&mut self) -> Temporary<Location>;
fn Children(&self) -> Unrooted<HTMLCollection>; fn Children(&self) -> Temporary<HTMLCollection>;
} }
impl<'a> DocumentMethods for JSRef<'a, Document> { impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-document-implementation // http://dom.spec.whatwg.org/#dom-document-implementation
fn Implementation(&mut self) -> Unrooted<DOMImplementation> { fn Implementation(&mut self) -> Temporary<DOMImplementation> {
if self.implementation.is_none() { if self.implementation.is_none() {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
self.implementation.assign(Some(DOMImplementation::new(&*window))); self.implementation.assign(Some(DOMImplementation::new(&*window)));
} }
Unrooted::new(self.implementation.get_ref().clone()) Temporary::new(self.implementation.get_ref().clone())
} }
// http://dom.spec.whatwg.org/#dom-document-url // http://dom.spec.whatwg.org/#dom-document-url
@ -366,31 +366,31 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://dom.spec.whatwg.org/#dom-document-doctype // http://dom.spec.whatwg.org/#dom-document-doctype
fn GetDoctype(&self) -> Option<Unrooted<DocumentType>> { fn GetDoctype(&self) -> Option<Temporary<DocumentType>> {
let node: &JSRef<Node> = NodeCast::from_ref(self); let node: &JSRef<Node> = NodeCast::from_ref(self);
node.children().find(|child| { node.children().find(|child| {
child.is_doctype() child.is_doctype()
}).map(|node| { }).map(|node| {
let doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(&node).unwrap(); let doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(&node).unwrap();
Unrooted::new(doctype.unrooted()) Temporary::new(doctype.unrooted())
}) })
} }
// http://dom.spec.whatwg.org/#dom-document-documentelement // http://dom.spec.whatwg.org/#dom-document-documentelement
fn GetDocumentElement(&self) -> Option<Unrooted<Element>> { fn GetDocumentElement(&self) -> Option<Temporary<Element>> {
let node: &JSRef<Node> = NodeCast::from_ref(self); let node: &JSRef<Node> = NodeCast::from_ref(self);
node.child_elements().next().map(|elem| Unrooted::new_rooted(&elem)) node.child_elements().next().map(|elem| Temporary::new_rooted(&elem))
} }
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagname // http://dom.spec.whatwg.org/#dom-document-getelementsbytagname
fn GetElementsByTagName(&self, tag_name: DOMString) -> Unrooted<HTMLCollection> { fn GetElementsByTagName(&self, tag_name: DOMString) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
HTMLCollection::by_tag_name(&*window, NodeCast::from_ref(self), tag_name) HTMLCollection::by_tag_name(&*window, NodeCast::from_ref(self), tag_name)
} }
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens // http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Unrooted<HTMLCollection> { fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -402,7 +402,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://dom.spec.whatwg.org/#dom-document-getelementsbyclassname // http://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
fn GetElementsByClassName(&self, classes: DOMString) -> Unrooted<HTMLCollection> { fn GetElementsByClassName(&self, classes: DOMString) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -410,15 +410,15 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid // http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(&self, id: DOMString) -> Option<Unrooted<Element>> { fn GetElementById(&self, id: DOMString) -> Option<Temporary<Element>> {
match self.idmap.find_equiv(&id) { match self.idmap.find_equiv(&id) {
None => None, None => None,
Some(ref elements) => Some(Unrooted::new(elements.get(0).clone())), Some(ref elements) => Some(Temporary::new(elements.get(0).clone())),
} }
} }
// http://dom.spec.whatwg.org/#dom-document-createelement // http://dom.spec.whatwg.org/#dom-document-createelement
fn CreateElement(&self, local_name: DOMString) -> Fallible<Unrooted<Element>> { fn CreateElement(&self, local_name: DOMString) -> Fallible<Temporary<Element>> {
if xml_name_type(local_name) == InvalidXMLName { if xml_name_type(local_name) == InvalidXMLName {
debug!("Not a valid element name"); debug!("Not a valid element name");
return Err(InvalidCharacter); return Err(InvalidCharacter);
@ -430,7 +430,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-document-createelementns // http://dom.spec.whatwg.org/#dom-document-createelementns
fn CreateElementNS(&self, fn CreateElementNS(&self,
namespace: Option<DOMString>, namespace: Option<DOMString>,
qualified_name: DOMString) -> Fallible<Unrooted<Element>> { qualified_name: DOMString) -> Fallible<Temporary<Element>> {
let ns = Namespace::from_str(null_str_as_empty_ref(&namespace)); let ns = Namespace::from_str(null_str_as_empty_ref(&namespace));
match xml_name_type(qualified_name) { match xml_name_type(qualified_name) {
InvalidXMLName => { InvalidXMLName => {
@ -474,24 +474,24 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment // http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
fn CreateDocumentFragment(&self) -> Unrooted<DocumentFragment> { fn CreateDocumentFragment(&self) -> Temporary<DocumentFragment> {
DocumentFragment::new(self) DocumentFragment::new(self)
} }
// http://dom.spec.whatwg.org/#dom-document-createtextnode // http://dom.spec.whatwg.org/#dom-document-createtextnode
fn CreateTextNode(&self, data: DOMString) fn CreateTextNode(&self, data: DOMString)
-> Unrooted<Text> { -> Temporary<Text> {
Text::new(data, self) Text::new(data, self)
} }
// http://dom.spec.whatwg.org/#dom-document-createcomment // http://dom.spec.whatwg.org/#dom-document-createcomment
fn CreateComment(&self, data: DOMString) -> Unrooted<Comment> { fn CreateComment(&self, data: DOMString) -> Temporary<Comment> {
Comment::new(data, self) Comment::new(data, self)
} }
// http://dom.spec.whatwg.org/#dom-document-createprocessinginstruction // http://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
fn CreateProcessingInstruction(&self, target: DOMString, fn CreateProcessingInstruction(&self, target: DOMString,
data: DOMString) -> Fallible<Unrooted<ProcessingInstruction>> { data: DOMString) -> Fallible<Temporary<ProcessingInstruction>> {
// Step 1. // Step 1.
if xml_name_type(target) == InvalidXMLName { if xml_name_type(target) == InvalidXMLName {
return Err(InvalidCharacter); return Err(InvalidCharacter);
@ -507,7 +507,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://dom.spec.whatwg.org/#dom-document-importnode // http://dom.spec.whatwg.org/#dom-document-importnode
fn ImportNode(&self, node: &JSRef<Node>, deep: bool) -> Fallible<Unrooted<Node>> { fn ImportNode(&self, node: &JSRef<Node>, deep: bool) -> Fallible<Temporary<Node>> {
// Step 1. // Step 1.
if node.is_document() { if node.is_document() {
return Err(NotSupported); return Err(NotSupported);
@ -523,7 +523,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://dom.spec.whatwg.org/#dom-document-adoptnode // http://dom.spec.whatwg.org/#dom-document-adoptnode
fn AdoptNode(&self, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> { fn AdoptNode(&self, node: &mut JSRef<Node>) -> Fallible<Temporary<Node>> {
// Step 1. // Step 1.
if node.is_document() { if node.is_document() {
return Err(NotSupported); return Err(NotSupported);
@ -533,11 +533,11 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
Node::adopt(node, self); Node::adopt(node, self);
// Step 3. // Step 3.
Ok(Unrooted::new_rooted(node)) Ok(Temporary::new_rooted(node))
} }
// http://dom.spec.whatwg.org/#dom-document-createevent // http://dom.spec.whatwg.org/#dom-document-createevent
fn CreateEvent(&self, interface: DOMString) -> Fallible<Unrooted<Event>> { fn CreateEvent(&self, interface: DOMString) -> Fallible<Temporary<Event>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -611,7 +611,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
fn GetHead(&self) -> Option<Unrooted<HTMLHeadElement>> { fn GetHead(&self) -> Option<Temporary<HTMLHeadElement>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
self.get_html_element().and_then(|root| { self.get_html_element().and_then(|root| {
let root = root.root(&roots); let root = root.root(&roots);
@ -619,13 +619,13 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
node.children().find(|child| { node.children().find(|child| {
child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId) child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId)
}).map(|node| { }).map(|node| {
Unrooted::new_rooted(HTMLHeadElementCast::to_ref(&node).unwrap()) Temporary::new_rooted(HTMLHeadElementCast::to_ref(&node).unwrap())
}) })
}) })
} }
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
fn GetBody(&self) -> Option<Unrooted<HTMLElement>> { fn GetBody(&self) -> Option<Temporary<HTMLElement>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
self.get_html_element().and_then(|root| { self.get_html_element().and_then(|root| {
let root = root.root(&roots); let root = root.root(&roots);
@ -637,7 +637,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
_ => false _ => false
} }
}).map(|node| { }).map(|node| {
Unrooted::new_rooted(HTMLElementCast::to_ref(&node).unwrap()) Temporary::new_rooted(HTMLElementCast::to_ref(&node).unwrap())
}) })
}) })
} }
@ -688,7 +688,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
} }
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
fn GetElementsByName(&self, name: DOMString) -> Unrooted<NodeList> { fn GetElementsByName(&self, name: DOMString) -> Temporary<NodeList> {
let roots = RootCollection::new(); let roots = RootCollection::new();
self.createNodeList(|node| { self.createNodeList(|node| {
@ -703,7 +703,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
}) })
} }
fn Images(&self) -> Unrooted<HTMLCollection> { fn Images(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -718,7 +718,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Embeds(&self) -> Unrooted<HTMLCollection> { fn Embeds(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -733,12 +733,12 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Plugins(&self) -> Unrooted<HTMLCollection> { fn Plugins(&self) -> Temporary<HTMLCollection> {
// FIXME: https://github.com/mozilla/servo/issues/1847 // FIXME: https://github.com/mozilla/servo/issues/1847
self.Embeds() self.Embeds()
} }
fn Links(&self) -> Unrooted<HTMLCollection> { fn Links(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -754,7 +754,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Forms(&self) -> Unrooted<HTMLCollection> { fn Forms(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -769,7 +769,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Scripts(&self) -> Unrooted<HTMLCollection> { fn Scripts(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -784,7 +784,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Anchors(&self) -> Unrooted<HTMLCollection> { fn Anchors(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -799,7 +799,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Applets(&self) -> Unrooted<HTMLCollection> { fn Applets(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
@ -814,13 +814,13 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter) HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
} }
fn Location(&mut self) -> Unrooted<Location> { fn Location(&mut self) -> Temporary<Location> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let mut window = self.window.root(&roots); let mut window = self.window.root(&roots);
window.Location() window.Location()
} }
fn Children(&self) -> Unrooted<HTMLCollection> { fn Children(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
HTMLCollection::children(&*window, NodeCast::from_ref(self)) HTMLCollection::children(&*window, NodeCast::from_ref(self))

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::InheritTypes::{DocumentFragmentDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{DocumentFragmentDerived, NodeCast};
use dom::bindings::codegen::BindingDeclarations::DocumentFragmentBinding; use dom::bindings::codegen::BindingDeclarations::DocumentFragmentBinding;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::document::Document; use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -34,12 +34,12 @@ impl DocumentFragment {
} }
} }
pub fn new(document: &JSRef<Document>) -> Unrooted<DocumentFragment> { pub fn new(document: &JSRef<Document>) -> Temporary<DocumentFragment> {
let node = DocumentFragment::new_inherited(document.unrooted()); let node = DocumentFragment::new_inherited(document.unrooted());
Node::reflect_node(~node, document, DocumentFragmentBinding::Wrap) Node::reflect_node(~node, document, DocumentFragmentBinding::Wrap)
} }
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<DocumentFragment>> { pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Temporary<DocumentFragment>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let document = owner.Document(); let document = owner.Document();
let document = document.root(&roots); let document = document.root(&roots);
@ -49,11 +49,11 @@ impl DocumentFragment {
} }
pub trait DocumentFragmentMethods { pub trait DocumentFragmentMethods {
fn Children(&self) -> Unrooted<HTMLCollection>; fn Children(&self) -> Temporary<HTMLCollection>;
} }
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> { impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
fn Children(&self) -> Unrooted<HTMLCollection> { fn Children(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(self)) HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(self))

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::InheritTypes::DocumentTypeDerived; use dom::bindings::codegen::InheritTypes::DocumentTypeDerived;
use dom::bindings::codegen::BindingDeclarations::DocumentTypeBinding; use dom::bindings::codegen::BindingDeclarations::DocumentTypeBinding;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::node::{Node, DoctypeNodeTypeId}; use dom::node::{Node, DoctypeNodeTypeId};
@ -46,7 +46,7 @@ impl DocumentType {
public_id: Option<DOMString>, public_id: Option<DOMString>,
system_id: Option<DOMString>, system_id: Option<DOMString>,
document: &JSRef<Document>) document: &JSRef<Document>)
-> Unrooted<DocumentType> { -> Temporary<DocumentType> {
let documenttype = DocumentType::new_inherited(name, let documenttype = DocumentType::new_inherited(name,
public_id, public_id,
system_id, system_id,

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::DOMExceptionBinding; use dom::bindings::codegen::BindingDeclarations::DOMExceptionBinding;
use dom::bindings::codegen::BindingDeclarations::DOMExceptionBinding::DOMExceptionConstants; use dom::bindings::codegen::BindingDeclarations::DOMExceptionBinding::DOMExceptionConstants;
use dom::bindings::js::{JSRef, Unrooted}; use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::window::Window; use dom::window::Window;
use servo_util::str::DOMString; use servo_util::str::DOMString;
@ -49,7 +49,7 @@ impl DOMException {
} }
} }
pub fn new(window: &JSRef<Window>, code: DOMErrorName) -> Unrooted<DOMException> { pub fn new(window: &JSRef<Window>, code: DOMErrorName) -> Temporary<DOMException> {
reflect_dom_object(~DOMException::new_inherited(code), window, DOMExceptionBinding::Wrap) reflect_dom_object(~DOMException::new_inherited(code), window, DOMExceptionBinding::Wrap)
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::DOMImplementationBinding; use dom::bindings::codegen::BindingDeclarations::DOMImplementationBinding;
use dom::bindings::codegen::InheritTypes::NodeCast; use dom::bindings::codegen::InheritTypes::NodeCast;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted, OptionalRootable}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary, OptionalRootable};
use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object}; use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
use dom::bindings::error::{Fallible, InvalidCharacter, NamespaceError}; use dom::bindings::error::{Fallible, InvalidCharacter, NamespaceError};
use dom::bindings::utils::{QName, Name, InvalidXMLName, xml_name_type}; use dom::bindings::utils::{QName, Name, InvalidXMLName, xml_name_type};
@ -33,7 +33,7 @@ impl DOMImplementation {
} }
} }
pub fn new(owner: &JSRef<Window>) -> Unrooted<DOMImplementation> { pub fn new(owner: &JSRef<Window>) -> Temporary<DOMImplementation> {
reflect_dom_object(~DOMImplementation::new_inherited(owner.unrooted()), owner, reflect_dom_object(~DOMImplementation::new_inherited(owner.unrooted()), owner,
DOMImplementationBinding::Wrap) DOMImplementationBinding::Wrap)
} }
@ -50,16 +50,16 @@ impl Reflectable for DOMImplementation {
} }
pub trait DOMImplementationMethods { pub trait DOMImplementationMethods {
fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Unrooted<DocumentType>>; fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Temporary<DocumentType>>;
fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString, fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Unrooted<Document>>; mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Temporary<Document>>;
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Unrooted<Document>; fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Temporary<Document>;
} }
// http://dom.spec.whatwg.org/#domimplementation // http://dom.spec.whatwg.org/#domimplementation
impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> { impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype // http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Unrooted<DocumentType>> { fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Temporary<DocumentType>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
match xml_name_type(qname) { match xml_name_type(qname) {
// Step 1. // Step 1.
@ -77,7 +77,7 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocument // http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString, fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Unrooted<Document>> { mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Temporary<Document>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let win = self.owner.root(&roots); let win = self.owner.root(&roots);
@ -117,11 +117,11 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// FIXME: https://github.com/mozilla/servo/issues/1522 // FIXME: https://github.com/mozilla/servo/issues/1522
// Step 7. // Step 7.
Ok(Unrooted::new_rooted(&*doc)) Ok(Temporary::new_rooted(&*doc))
} }
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument // http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Unrooted<Document> { fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Temporary<Document> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let owner = self.owner.root(&roots); let owner = self.owner.root(&roots);
@ -170,6 +170,6 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// FIXME: https://github.com/mozilla/servo/issues/1522 // FIXME: https://github.com/mozilla/servo/issues/1522
// Step 9. // Step 9.
Unrooted::new_rooted(&*doc) Temporary::new_rooted(&*doc)
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::DOMParserBinding; use dom::bindings::codegen::BindingDeclarations::DOMParserBinding;
use dom::bindings::codegen::BindingDeclarations::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml}; use dom::bindings::codegen::BindingDeclarations::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object}; use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
use dom::bindings::error::{Fallible, FailureUnknown}; use dom::bindings::error::{Fallible, FailureUnknown};
use dom::document::{Document, HTMLDocument, NonHTMLDocument}; use dom::document::{Document, HTMLDocument, NonHTMLDocument};
@ -25,25 +25,25 @@ impl DOMParser {
} }
} }
pub fn new(owner: &JSRef<Window>) -> Unrooted<DOMParser> { pub fn new(owner: &JSRef<Window>) -> Temporary<DOMParser> {
reflect_dom_object(~DOMParser::new_inherited(owner.unrooted()), owner, reflect_dom_object(~DOMParser::new_inherited(owner.unrooted()), owner,
DOMParserBinding::Wrap) DOMParserBinding::Wrap)
} }
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<DOMParser>> { pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Temporary<DOMParser>> {
Ok(DOMParser::new(owner)) Ok(DOMParser::new(owner))
} }
} }
pub trait DOMParserMethods { pub trait DOMParserMethods {
fn ParseFromString(&self, _s: DOMString, ty: DOMParserBinding::SupportedType) -> Fallible<Unrooted<Document>>; fn ParseFromString(&self, _s: DOMString, ty: DOMParserBinding::SupportedType) -> Fallible<Temporary<Document>>;
} }
impl<'a> DOMParserMethods for JSRef<'a, DOMParser> { impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
fn ParseFromString(&self, fn ParseFromString(&self,
_s: DOMString, _s: DOMString,
ty: DOMParserBinding::SupportedType) ty: DOMParserBinding::SupportedType)
-> Fallible<Unrooted<Document>> { -> Fallible<Temporary<Document>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let owner = self.owner.root(&roots); let owner = self.owner.root(&roots);
match ty { match ty {

View file

@ -8,7 +8,7 @@ use dom::attr::{Attr, ReplacedAttr, FirstSetAttr, AttrMethods};
use dom::attrlist::AttrList; use dom::attrlist::AttrList;
use dom::bindings::codegen::BindingDeclarations::ElementBinding; use dom::bindings::codegen::BindingDeclarations::ElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{ElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted, UnrootedPushable}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary, TemporaryPushable};
use dom::bindings::js::{OptionalAssignable, OptionalRootable, Root}; use dom::bindings::js::{OptionalAssignable, OptionalRootable, Root};
use dom::bindings::utils::{Reflectable, Reflector}; use dom::bindings::utils::{Reflectable, Reflector};
use dom::bindings::error::{ErrorResult, Fallible, NamespaceError, InvalidCharacter}; use dom::bindings::error::{ErrorResult, Fallible, NamespaceError, InvalidCharacter};
@ -153,7 +153,7 @@ impl Element {
} }
} }
pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: &JSRef<Document>) -> Unrooted<Element> { pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: &JSRef<Document>) -> Temporary<Element> {
let element = Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document.unrooted()); let element = Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document.unrooted());
Node::reflect_node(~element, document, ElementBinding::Wrap) Node::reflect_node(~element, document, ElementBinding::Wrap)
} }
@ -206,7 +206,7 @@ impl<'a> ElementHelpers for JSRef<'a, Element> {
} }
pub trait AttributeHandlers { pub trait AttributeHandlers {
fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<Unrooted<Attr>>; fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<Temporary<Attr>>;
fn set_attr(&mut self, name: DOMString, value: DOMString) -> ErrorResult; fn set_attr(&mut self, name: DOMString, value: DOMString) -> ErrorResult;
fn set_attribute(&mut self, namespace: Namespace, name: DOMString, fn set_attribute(&mut self, namespace: Namespace, name: DOMString,
value: DOMString) -> ErrorResult; value: DOMString) -> ErrorResult;
@ -227,16 +227,16 @@ pub trait AttributeHandlers {
} }
impl<'a> AttributeHandlers for JSRef<'a, Element> { impl<'a> AttributeHandlers for JSRef<'a, Element> {
fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<Unrooted<Attr>> { fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<Temporary<Attr>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
if self.html_element_in_html_document() { if self.html_element_in_html_document() {
self.get().attrs.iter().map(|attr| attr.root(&roots)).find(|attr| { self.get().attrs.iter().map(|attr| attr.root(&roots)).find(|attr| {
name.to_ascii_lower() == attr.local_name && attr.namespace == namespace name.to_ascii_lower() == attr.local_name && attr.namespace == namespace
}).map(|x| Unrooted::new_rooted(&*x)) }).map(|x| Temporary::new_rooted(&*x))
} else { } else {
self.get().attrs.iter().map(|attr| attr.root(&roots)).find(|attr| { self.get().attrs.iter().map(|attr| attr.root(&roots)).find(|attr| {
name == attr.local_name && attr.namespace == namespace name == attr.local_name && attr.namespace == namespace
}).map(|x| Unrooted::new_rooted(&*x)) }).map(|x| Temporary::new_rooted(&*x))
} }
} }
@ -394,7 +394,7 @@ pub trait ElementMethods {
fn SetId(&mut self, id: DOMString); fn SetId(&mut self, id: DOMString);
fn ClassName(&self) -> DOMString; fn ClassName(&self) -> DOMString;
fn SetClassName(&mut self, class: DOMString); fn SetClassName(&mut self, class: DOMString);
fn Attributes(&mut self) -> Unrooted<AttrList>; fn Attributes(&mut self) -> Temporary<AttrList>;
fn GetAttribute(&self, name: DOMString) -> Option<DOMString>; fn GetAttribute(&self, name: DOMString) -> Option<DOMString>;
fn GetAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) -> Option<DOMString>; fn GetAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) -> Option<DOMString>;
fn SetAttribute(&mut self, name: DOMString, value: DOMString) -> ErrorResult; fn SetAttribute(&mut self, name: DOMString, value: DOMString) -> ErrorResult;
@ -403,14 +403,14 @@ pub trait ElementMethods {
fn RemoveAttributeNS(&mut self, namespace: Option<DOMString>, localname: DOMString) -> ErrorResult; fn RemoveAttributeNS(&mut self, namespace: Option<DOMString>, localname: DOMString) -> ErrorResult;
fn HasAttribute(&self, name: DOMString) -> bool; fn HasAttribute(&self, name: DOMString) -> bool;
fn HasAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) -> bool; fn HasAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) -> bool;
fn GetElementsByTagName(&self, localname: DOMString) -> Unrooted<HTMLCollection>; fn GetElementsByTagName(&self, localname: DOMString) -> Temporary<HTMLCollection>;
fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, localname: DOMString) -> Unrooted<HTMLCollection>; fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, localname: DOMString) -> Temporary<HTMLCollection>;
fn GetElementsByClassName(&self, classes: DOMString) -> Unrooted<HTMLCollection>; fn GetElementsByClassName(&self, classes: DOMString) -> Temporary<HTMLCollection>;
fn GetClientRects(&self) -> Unrooted<ClientRectList>; fn GetClientRects(&self) -> Temporary<ClientRectList>;
fn GetBoundingClientRect(&self) -> Unrooted<ClientRect>; fn GetBoundingClientRect(&self) -> Temporary<ClientRect>;
fn GetInnerHTML(&self) -> Fallible<DOMString>; fn GetInnerHTML(&self) -> Fallible<DOMString>;
fn GetOuterHTML(&self) -> Fallible<DOMString>; fn GetOuterHTML(&self) -> Fallible<DOMString>;
fn Children(&self) -> Unrooted<HTMLCollection>; fn Children(&self) -> Temporary<HTMLCollection>;
} }
impl<'a> ElementMethods for JSRef<'a, Element> { impl<'a> ElementMethods for JSRef<'a, Element> {
@ -461,11 +461,11 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
} }
// http://dom.spec.whatwg.org/#dom-element-attributes // http://dom.spec.whatwg.org/#dom-element-attributes
fn Attributes(&mut self) -> Unrooted<AttrList> { fn Attributes(&mut self) -> Temporary<AttrList> {
let roots = RootCollection::new(); let roots = RootCollection::new();
match self.attr_list { match self.attr_list {
None => (), None => (),
Some(ref list) => return Unrooted::new(list.clone()), Some(ref list) => return Temporary::new(list.clone()),
} }
let doc = { let doc = {
@ -475,7 +475,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
let window = doc.deref().window.root(&roots); let window = doc.deref().window.root(&roots);
let list = AttrList::new(&*window, self); let list = AttrList::new(&*window, self);
self.attr_list.assign(Some(list)); self.attr_list.assign(Some(list));
Unrooted::new(self.attr_list.get_ref().clone()) Temporary::new(self.attr_list.get_ref().clone())
} }
// http://dom.spec.whatwg.org/#dom-element-getattribute // http://dom.spec.whatwg.org/#dom-element-getattribute
@ -623,14 +623,14 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
self.GetAttributeNS(namespace, local_name).is_some() self.GetAttributeNS(namespace, local_name).is_some()
} }
fn GetElementsByTagName(&self, localname: DOMString) -> Unrooted<HTMLCollection> { fn GetElementsByTagName(&self, localname: DOMString) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
HTMLCollection::by_tag_name(&*window, NodeCast::from_ref(self), localname) HTMLCollection::by_tag_name(&*window, NodeCast::from_ref(self), localname)
} }
fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>,
localname: DOMString) -> Unrooted<HTMLCollection> { localname: DOMString) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let namespace = match maybe_ns { let namespace = match maybe_ns {
Some(namespace) => Namespace::from_str(namespace), Some(namespace) => Namespace::from_str(namespace),
@ -640,14 +640,14 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
HTMLCollection::by_tag_name_ns(&*window, NodeCast::from_ref(self), localname, namespace) HTMLCollection::by_tag_name_ns(&*window, NodeCast::from_ref(self), localname, namespace)
} }
fn GetElementsByClassName(&self, classes: DOMString) -> Unrooted<HTMLCollection> { fn GetElementsByClassName(&self, classes: DOMString) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
HTMLCollection::by_class_name(&*window, NodeCast::from_ref(self), classes) HTMLCollection::by_class_name(&*window, NodeCast::from_ref(self), classes)
} }
// http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects // http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects
fn GetClientRects(&self) -> Unrooted<ClientRectList> { fn GetClientRects(&self) -> Temporary<ClientRectList> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let win = window_from_node(self).root(&roots); let win = window_from_node(self).root(&roots);
let node: &JSRef<Node> = NodeCast::from_ref(self); let node: &JSRef<Node> = NodeCast::from_ref(self);
@ -665,7 +665,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
} }
// http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect // http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect
fn GetBoundingClientRect(&self) -> Unrooted<ClientRect> { fn GetBoundingClientRect(&self) -> Temporary<ClientRect> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let win = window_from_node(self).root(&roots); let win = window_from_node(self).root(&roots);
let node: &JSRef<Node> = NodeCast::from_ref(self); let node: &JSRef<Node> = NodeCast::from_ref(self);
@ -689,7 +689,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
Ok(serialize(&mut NodeIterator::new(&roots, NodeCast::from_ref(self), true, false))) Ok(serialize(&mut NodeIterator::new(&roots, NodeCast::from_ref(self), true, false)))
} }
fn Children(&self) -> Unrooted<HTMLCollection> { fn Children(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
HTMLCollection::children(&*window, NodeCast::from_ref(self)) HTMLCollection::children(&*window, NodeCast::from_ref(self))

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::EventBinding; use dom::bindings::codegen::BindingDeclarations::EventBinding;
use dom::bindings::codegen::BindingDeclarations::EventBinding::EventConstants; use dom::bindings::codegen::BindingDeclarations::EventBinding::EventConstants;
use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection}; use dom::bindings::js::{JS, JSRef, Temporary, RootCollection};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
@ -80,7 +80,7 @@ impl Event {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<Event> { pub fn new(window: &JSRef<Window>) -> Temporary<Event> {
reflect_dom_object(~Event::new_inherited(HTMLEventTypeId), reflect_dom_object(~Event::new_inherited(HTMLEventTypeId),
window, window,
EventBinding::Wrap) EventBinding::Wrap)
@ -88,19 +88,19 @@ impl Event {
pub fn Constructor(global: &JSRef<Window>, pub fn Constructor(global: &JSRef<Window>,
type_: DOMString, type_: DOMString,
init: &EventBinding::EventInit) -> Fallible<Unrooted<Event>> { init: &EventBinding::EventInit) -> Fallible<Temporary<Event>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let mut ev = Event::new(global).root(&roots); let mut ev = Event::new(global).root(&roots);
ev.InitEvent(type_, init.bubbles, init.cancelable); ev.InitEvent(type_, init.bubbles, init.cancelable);
Ok(Unrooted::new_rooted(&*ev)) Ok(Temporary::new_rooted(&*ev))
} }
} }
pub trait EventMethods { pub trait EventMethods {
fn EventPhase(&self) -> u16; fn EventPhase(&self) -> u16;
fn Type(&self) -> DOMString; fn Type(&self) -> DOMString;
fn GetTarget(&self) -> Option<Unrooted<EventTarget>>; fn GetTarget(&self) -> Option<Temporary<EventTarget>>;
fn GetCurrentTarget(&self) -> Option<Unrooted<EventTarget>>; fn GetCurrentTarget(&self) -> Option<Temporary<EventTarget>>;
fn DefaultPrevented(&self) -> bool; fn DefaultPrevented(&self) -> bool;
fn PreventDefault(&mut self); fn PreventDefault(&mut self);
fn StopPropagation(&mut self); fn StopPropagation(&mut self);
@ -121,12 +121,12 @@ impl<'a> EventMethods for JSRef<'a, Event> {
self.type_.clone() self.type_.clone()
} }
fn GetTarget(&self) -> Option<Unrooted<EventTarget>> { fn GetTarget(&self) -> Option<Temporary<EventTarget>> {
self.target.as_ref().map(|target| Unrooted::new(target.clone())) self.target.as_ref().map(|target| Temporary::new(target.clone()))
} }
fn GetCurrentTarget(&self) -> Option<Unrooted<EventTarget>> { fn GetCurrentTarget(&self) -> Option<Temporary<EventTarget>> {
self.current_target.as_ref().map(|target| Unrooted::new(target.clone())) self.current_target.as_ref().map(|target| Temporary::new(target.clone()))
} }
fn DefaultPrevented(&self) -> bool { fn DefaultPrevented(&self) -> bool {

View file

@ -5,7 +5,7 @@
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::{Fallible}; use dom::bindings::error::{Fallible};
use dom::bindings::codegen::BindingDeclarations::FormDataBinding; use dom::bindings::codegen::BindingDeclarations::FormDataBinding;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::blob::Blob; use dom::blob::Blob;
use dom::htmlformelement::HTMLFormElement; use dom::htmlformelement::HTMLFormElement;
use dom::window::Window; use dom::window::Window;
@ -37,11 +37,11 @@ impl FormData {
} }
} }
pub fn new(form: Option<JSRef<HTMLFormElement>>, window: &JSRef<Window>) -> Unrooted<FormData> { pub fn new(form: Option<JSRef<HTMLFormElement>>, window: &JSRef<Window>) -> Temporary<FormData> {
reflect_dom_object(~FormData::new_inherited(form, window.unrooted()), window, FormDataBinding::Wrap) reflect_dom_object(~FormData::new_inherited(form, window.unrooted()), window, FormDataBinding::Wrap)
} }
pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Unrooted<FormData>> { pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {
Ok(FormData::new(form, window)) Ok(FormData::new(form, window))
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAnchorElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLAnchorElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementDerived; use dom::bindings::codegen::InheritTypes::HTMLAnchorElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLAnchorElementTypeId; use dom::element::HTMLAnchorElementTypeId;
@ -34,7 +34,7 @@ impl HTMLAnchorElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLAnchorElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAnchorElement> {
let element = HTMLAnchorElement::new_inherited(localName, document.unrooted()); let element = HTMLAnchorElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLAnchorElementBinding::Wrap) Node::reflect_node(~element, document, HTMLAnchorElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAppletElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLAppletElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAppletElementDerived; use dom::bindings::codegen::InheritTypes::HTMLAppletElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLAppletElementTypeId; use dom::element::HTMLAppletElementTypeId;
@ -34,7 +34,7 @@ impl HTMLAppletElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLAppletElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAppletElement> {
let element = HTMLAppletElement::new_inherited(localName, document.unrooted()); let element = HTMLAppletElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLAppletElementBinding::Wrap) Node::reflect_node(~element, document, HTMLAppletElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAreaElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLAreaElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAreaElementDerived; use dom::bindings::codegen::InheritTypes::HTMLAreaElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLAreaElementTypeId; use dom::element::HTMLAreaElementTypeId;
@ -34,7 +34,7 @@ impl HTMLAreaElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLAreaElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAreaElement> {
let element = HTMLAreaElement::new_inherited(localName, document.unrooted()); let element = HTMLAreaElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLAreaElementBinding::Wrap) Node::reflect_node(~element, document, HTMLAreaElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAudioElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLAudioElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAudioElementDerived; use dom::bindings::codegen::InheritTypes::HTMLAudioElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLAudioElementTypeId; use dom::element::HTMLAudioElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLAudioElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLAudioElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAudioElement> {
let element = HTMLAudioElement::new_inherited(localName, document.unrooted()); let element = HTMLAudioElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLAudioElementBinding::Wrap) Node::reflect_node(~element, document, HTMLAudioElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLBaseElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLBaseElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBaseElementDerived; use dom::bindings::codegen::InheritTypes::HTMLBaseElementDerived;
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLBaseElementTypeId; use dom::element::HTMLBaseElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -34,7 +34,7 @@ impl HTMLBaseElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLBaseElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBaseElement> {
let element = HTMLBaseElement::new_inherited(localName, document.unrooted()); let element = HTMLBaseElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLBaseElementBinding::Wrap) Node::reflect_node(~element, document, HTMLBaseElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLBodyElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLBodyElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBodyElementDerived; use dom::bindings::codegen::InheritTypes::HTMLBodyElementDerived;
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLBodyElementTypeId; use dom::element::HTMLBodyElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -34,7 +34,7 @@ impl HTMLBodyElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLBodyElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBodyElement> {
let element = HTMLBodyElement::new_inherited(localName, document.unrooted()); let element = HTMLBodyElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLBodyElementBinding::Wrap) Node::reflect_node(~element, document, HTMLBodyElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLBRElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLBRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBRElementDerived; use dom::bindings::codegen::InheritTypes::HTMLBRElementDerived;
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLBRElementTypeId; use dom::element::HTMLBRElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -34,7 +34,7 @@ impl HTMLBRElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLBRElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBRElement> {
let element = HTMLBRElement::new_inherited(localName, document.unrooted()); let element = HTMLBRElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLBRElementBinding::Wrap) Node::reflect_node(~element, document, HTMLBRElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLButtonElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLButtonElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLButtonElementDerived; use dom::bindings::codegen::InheritTypes::HTMLButtonElementDerived;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLButtonElementTypeId; use dom::element::HTMLButtonElementTypeId;
@ -36,7 +36,7 @@ impl HTMLButtonElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLButtonElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLButtonElement> {
let element = HTMLButtonElement::new_inherited(localName, document.unrooted()); let element = HTMLButtonElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLButtonElementBinding::Wrap) Node::reflect_node(~element, document, HTMLButtonElementBinding::Wrap)
} }
@ -47,7 +47,7 @@ pub trait HTMLButtonElementMethods {
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult; fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult;
fn Disabled(&self) -> bool; fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult; fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>; fn GetForm(&self) -> Option<Temporary<HTMLFormElement>>;
fn FormAction(&self) -> DOMString; fn FormAction(&self) -> DOMString;
fn SetFormAction(&mut self, _formaction: DOMString) -> ErrorResult; fn SetFormAction(&mut self, _formaction: DOMString) -> ErrorResult;
fn FormEnctype(&self) -> DOMString; fn FormEnctype(&self) -> DOMString;
@ -66,7 +66,7 @@ pub trait HTMLButtonElementMethods {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult; fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn WillValidate(&self) -> bool; fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool); fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Unrooted<ValidityState>; fn Validity(&self) -> Temporary<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>); fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString; fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult; fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
@ -91,7 +91,7 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
Ok(()) Ok(())
} }
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { fn GetForm(&self) -> Option<Temporary<HTMLFormElement>> {
None None
} }
@ -166,7 +166,7 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
fn SetWillValidate(&mut self, _will_validate: bool) { fn SetWillValidate(&mut self, _will_validate: bool) {
} }
fn Validity(&self) -> Unrooted<ValidityState> { fn Validity(&self) -> Temporary<ValidityState> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
ValidityState::new(&*window) ValidityState::new(&*window)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLCanvasElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLCanvasElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLCanvasElementDerived; use dom::bindings::codegen::InheritTypes::HTMLCanvasElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::{ErrorResult}; use dom::bindings::error::{ErrorResult};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLCanvasElementTypeId; use dom::element::HTMLCanvasElementTypeId;
@ -34,7 +34,7 @@ impl HTMLCanvasElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLCanvasElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLCanvasElement> {
let element = HTMLCanvasElement::new_inherited(localName, document.unrooted()); let element = HTMLCanvasElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLCanvasElementBinding::Wrap) Node::reflect_node(~element, document, HTMLCanvasElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast};
use dom::bindings::codegen::BindingDeclarations::HTMLCollectionBinding; use dom::bindings::codegen::BindingDeclarations::HTMLCollectionBinding;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::element::{Element, AttributeHandlers}; use dom::element::{Element, AttributeHandlers};
use dom::node::{Node, NodeHelpers}; use dom::node::{Node, NodeHelpers};
@ -46,19 +46,19 @@ impl HTMLCollection {
} }
} }
pub fn new(window: &JSRef<Window>, collection: CollectionTypeId) -> Unrooted<HTMLCollection> { pub fn new(window: &JSRef<Window>, collection: CollectionTypeId) -> Temporary<HTMLCollection> {
reflect_dom_object(~HTMLCollection::new_inherited(window.unrooted(), collection), reflect_dom_object(~HTMLCollection::new_inherited(window.unrooted(), collection),
window, HTMLCollectionBinding::Wrap) window, HTMLCollectionBinding::Wrap)
} }
} }
impl HTMLCollection { impl HTMLCollection {
pub fn create(window: &JSRef<Window>, root: &JSRef<Node>, filter: ~CollectionFilter) -> Unrooted<HTMLCollection> { pub fn create(window: &JSRef<Window>, root: &JSRef<Node>, filter: ~CollectionFilter) -> Temporary<HTMLCollection> {
HTMLCollection::new(window, Live(root.unrooted(), filter)) HTMLCollection::new(window, Live(root.unrooted(), filter))
} }
pub fn by_tag_name(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString) pub fn by_tag_name(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString)
-> Unrooted<HTMLCollection> { -> Temporary<HTMLCollection> {
struct TagNameFilter { struct TagNameFilter {
tag: DOMString tag: DOMString
} }
@ -74,7 +74,7 @@ impl HTMLCollection {
} }
pub fn by_tag_name_ns(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString, pub fn by_tag_name_ns(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString,
namespace: Namespace) -> Unrooted<HTMLCollection> { namespace: Namespace) -> Temporary<HTMLCollection> {
struct TagNameNSFilter { struct TagNameNSFilter {
tag: DOMString, tag: DOMString,
namespace: Namespace namespace: Namespace
@ -92,7 +92,7 @@ impl HTMLCollection {
} }
pub fn by_class_name(window: &JSRef<Window>, root: &JSRef<Node>, classes: DOMString) pub fn by_class_name(window: &JSRef<Window>, root: &JSRef<Node>, classes: DOMString)
-> Unrooted<HTMLCollection> { -> Temporary<HTMLCollection> {
struct ClassNameFilter { struct ClassNameFilter {
classes: Vec<DOMString> classes: Vec<DOMString>
} }
@ -107,7 +107,7 @@ impl HTMLCollection {
HTMLCollection::create(window, root, ~filter) HTMLCollection::create(window, root, ~filter)
} }
pub fn children(window: &JSRef<Window>, root: &JSRef<Node>) -> Unrooted<HTMLCollection> { pub fn children(window: &JSRef<Window>, root: &JSRef<Node>) -> Temporary<HTMLCollection> {
struct ElementChildFilter; struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter { impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool { fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool {
@ -120,10 +120,10 @@ impl HTMLCollection {
pub trait HTMLCollectionMethods { pub trait HTMLCollectionMethods {
fn Length(&self) -> u32; fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<Element>>; fn Item(&self, index: u32) -> Option<Temporary<Element>>;
fn NamedItem(&self, key: DOMString) -> Option<Unrooted<Element>>; fn NamedItem(&self, key: DOMString) -> Option<Temporary<Element>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Element>>; fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Element>>;
fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Unrooted<Element>>; fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Temporary<Element>>;
} }
impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> { impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
@ -144,13 +144,13 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
} }
// http://dom.spec.whatwg.org/#dom-htmlcollection-item // http://dom.spec.whatwg.org/#dom-htmlcollection-item
fn Item(&self, index: u32) -> Option<Unrooted<Element>> { fn Item(&self, index: u32) -> Option<Temporary<Element>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
match self.collection { match self.collection {
Static(ref elems) => elems Static(ref elems) => elems
.as_slice() .as_slice()
.get(index as uint) .get(index as uint)
.map(|elem| Unrooted::new(elem.clone())), .map(|elem| Temporary::new(elem.clone())),
Live(ref root, ref filter) => { Live(ref root, ref filter) => {
let root = root.root(&roots); let root = root.root(&roots);
root.deref().traverse_preorder(&roots) root.deref().traverse_preorder(&roots)
@ -161,13 +161,13 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
}) })
.nth(index as uint) .nth(index as uint)
.clone() .clone()
.map(|elem| Unrooted::new_rooted(&elem)) .map(|elem| Temporary::new_rooted(&elem))
} }
} }
} }
// http://dom.spec.whatwg.org/#dom-htmlcollection-nameditem // http://dom.spec.whatwg.org/#dom-htmlcollection-nameditem
fn NamedItem(&self, key: DOMString) -> Option<Unrooted<Element>> { fn NamedItem(&self, key: DOMString) -> Option<Temporary<Element>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
// Step 1. // Step 1.
@ -182,7 +182,7 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
.find(|elem| { .find(|elem| {
elem.get_string_attribute("name") == key || elem.get_string_attribute("name") == key ||
elem.get_string_attribute("id") == key }) elem.get_string_attribute("id") == key })
.map(|maybe_elem| Unrooted::new_rooted(&*maybe_elem)), .map(|maybe_elem| Temporary::new_rooted(&*maybe_elem)),
Live(ref root, ref filter) => { Live(ref root, ref filter) => {
let root = root.root(&roots); let root = root.root(&roots);
root.deref().traverse_preorder(&roots) root.deref().traverse_preorder(&roots)
@ -194,18 +194,18 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
.find(|elem| { .find(|elem| {
elem.get_string_attribute("name") == key || elem.get_string_attribute("name") == key ||
elem.get_string_attribute("id") == key }) elem.get_string_attribute("id") == key })
.map(|maybe_elem| Unrooted::new_rooted(&maybe_elem)) .map(|maybe_elem| Temporary::new_rooted(&maybe_elem))
} }
} }
} }
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Element>> { fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Element>> {
let maybe_elem = self.Item(index); let maybe_elem = self.Item(index);
*found = maybe_elem.is_some(); *found = maybe_elem.is_some();
maybe_elem maybe_elem
} }
fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Unrooted<Element>> { fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Temporary<Element>> {
match maybe_name { match maybe_name {
Some(name) => { Some(name) => {
let maybe_elem = self.NamedItem(name); let maybe_elem = self.NamedItem(name);

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDataElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLDataElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDataElementDerived; use dom::bindings::codegen::InheritTypes::HTMLDataElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLDataElementTypeId; use dom::element::HTMLDataElementTypeId;
@ -34,7 +34,7 @@ impl HTMLDataElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLDataElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataElement> {
let element = HTMLDataElement::new_inherited(localName, document.unrooted()); let element = HTMLDataElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLDataElementBinding::Wrap) Node::reflect_node(~element, document, HTMLDataElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDataListElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLDataListElementBinding;
use dom::bindings::codegen::InheritTypes::{HTMLDataListElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLDataListElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, HTMLDataListElementTypeId}; use dom::element::{Element, HTMLDataListElementTypeId};
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -34,18 +34,18 @@ impl HTMLDataListElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLDataListElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataListElement> {
let element = HTMLDataListElement::new_inherited(localName, document.unrooted()); let element = HTMLDataListElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLDataListElementBinding::Wrap) Node::reflect_node(~element, document, HTMLDataListElementBinding::Wrap)
} }
} }
pub trait HTMLDataListElementMethods { pub trait HTMLDataListElementMethods {
fn Options(&self) -> Unrooted<HTMLCollection>; fn Options(&self) -> Temporary<HTMLCollection>;
} }
impl<'a> HTMLDataListElementMethods for JSRef<'a, HTMLDataListElement> { impl<'a> HTMLDataListElementMethods for JSRef<'a, HTMLDataListElement> {
fn Options(&self) -> Unrooted<HTMLCollection> { fn Options(&self) -> Temporary<HTMLCollection> {
struct HTMLDataListOptionsFilter; struct HTMLDataListOptionsFilter;
impl CollectionFilter for HTMLDataListOptionsFilter { impl CollectionFilter for HTMLDataListOptionsFilter {
fn filter(&self, elem: &JSRef<Element>, _root: &JSRef<Node>) -> bool { fn filter(&self, elem: &JSRef<Element>, _root: &JSRef<Node>) -> bool {

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDirectoryElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLDirectoryElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDirectoryElementDerived; use dom::bindings::codegen::InheritTypes::HTMLDirectoryElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLDirectoryElementTypeId; use dom::element::HTMLDirectoryElementTypeId;
@ -34,7 +34,7 @@ impl HTMLDirectoryElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLDirectoryElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDirectoryElement> {
let element = HTMLDirectoryElement::new_inherited(localName, document.unrooted()); let element = HTMLDirectoryElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLDirectoryElementBinding::Wrap) Node::reflect_node(~element, document, HTMLDirectoryElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDivElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLDivElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDivElementDerived; use dom::bindings::codegen::InheritTypes::HTMLDivElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLDivElementTypeId; use dom::element::HTMLDivElementTypeId;
@ -34,7 +34,7 @@ impl HTMLDivElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLDivElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDivElement> {
let element = HTMLDivElement::new_inherited(localName, document.unrooted()); let element = HTMLDivElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLDivElementBinding::Wrap) Node::reflect_node(~element, document, HTMLDivElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDListElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLDListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDListElementDerived; use dom::bindings::codegen::InheritTypes::HTMLDListElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLDListElementTypeId; use dom::element::HTMLDListElementTypeId;
@ -34,7 +34,7 @@ impl HTMLDListElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLDListElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDListElement> {
let element = HTMLDListElement::new_inherited(localName, document.unrooted()); let element = HTMLDListElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLDListElementBinding::Wrap) Node::reflect_node(~element, document, HTMLDListElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLElementBinding;
use dom::bindings::codegen::InheritTypes::ElementCast; use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::bindings::codegen::InheritTypes::HTMLElementDerived; use dom::bindings::codegen::InheritTypes::HTMLElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, ElementTypeId, HTMLElementTypeId}; use dom::element::{Element, ElementTypeId, HTMLElementTypeId};
@ -39,7 +39,7 @@ impl HTMLElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLElement> {
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, document.unrooted()); let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, document.unrooted());
Node::reflect_node(~element, document, HTMLElementBinding::Wrap) Node::reflect_node(~element, document, HTMLElementBinding::Wrap)
} }
@ -71,7 +71,7 @@ pub trait HTMLElementMethods {
fn IsContentEditable(&self) -> bool; fn IsContentEditable(&self) -> bool;
fn Spellcheck(&self) -> bool; fn Spellcheck(&self) -> bool;
fn SetSpellcheck(&self, _val: bool) -> ErrorResult; fn SetSpellcheck(&self, _val: bool) -> ErrorResult;
fn GetOffsetParent(&self) -> Option<Unrooted<Element>>; fn GetOffsetParent(&self) -> Option<Temporary<Element>>;
fn OffsetTop(&self) -> i32; fn OffsetTop(&self) -> i32;
fn OffsetLeft(&self) -> i32; fn OffsetLeft(&self) -> i32;
fn OffsetWidth(&self) -> i32; fn OffsetWidth(&self) -> i32;
@ -176,7 +176,7 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
Ok(()) Ok(())
} }
fn GetOffsetParent(&self) -> Option<Unrooted<Element>> { fn GetOffsetParent(&self) -> Option<Temporary<Element>> {
None None
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLEmbedElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLEmbedElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLEmbedElementDerived; use dom::bindings::codegen::InheritTypes::HTMLEmbedElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLEmbedElementTypeId; use dom::element::HTMLEmbedElementTypeId;
@ -34,7 +34,7 @@ impl HTMLEmbedElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLEmbedElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLEmbedElement> {
let element = HTMLEmbedElement::new_inherited(localName, document.unrooted()); let element = HTMLEmbedElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLEmbedElementBinding::Wrap) Node::reflect_node(~element, document, HTMLEmbedElementBinding::Wrap)
} }
@ -53,7 +53,7 @@ pub trait HTMLEmbedElementMethods {
fn SetAlign(&mut self, _type: DOMString) -> ErrorResult; fn SetAlign(&mut self, _type: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString; fn Name(&self) -> DOMString;
fn SetName(&mut self, _type: DOMString) -> ErrorResult; fn SetName(&mut self, _type: DOMString) -> ErrorResult;
fn GetSVGDocument(&self) -> Option<Unrooted<Document>>; fn GetSVGDocument(&self) -> Option<Temporary<Document>>;
} }
impl<'a> HTMLEmbedElementMethods for JSRef<'a, HTMLEmbedElement> { impl<'a> HTMLEmbedElementMethods for JSRef<'a, HTMLEmbedElement> {
@ -105,7 +105,7 @@ impl<'a> HTMLEmbedElementMethods for JSRef<'a, HTMLEmbedElement> {
Ok(()) Ok(())
} }
fn GetSVGDocument(&self) -> Option<Unrooted<Document>> { fn GetSVGDocument(&self) -> Option<Temporary<Document>> {
None None
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFieldSetElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLFieldSetElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFieldSetElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFieldSetElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, HTMLFieldSetElementTypeId}; use dom::element::{Element, HTMLFieldSetElementTypeId};
@ -37,7 +37,7 @@ impl HTMLFieldSetElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLFieldSetElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFieldSetElement> {
let element = HTMLFieldSetElement::new_inherited(localName, document.unrooted()); let element = HTMLFieldSetElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLFieldSetElementBinding::Wrap) Node::reflect_node(~element, document, HTMLFieldSetElementBinding::Wrap)
} }
@ -46,13 +46,13 @@ impl HTMLFieldSetElement {
pub trait HTMLFieldSetElementMethods { pub trait HTMLFieldSetElementMethods {
fn Disabled(&self) -> bool; fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult; fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>; fn GetForm(&self) -> Option<Temporary<HTMLFormElement>>;
fn Name(&self) -> DOMString; fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult; fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString; fn Type(&self) -> DOMString;
fn Elements(&self) -> Unrooted<HTMLCollection>; fn Elements(&self) -> Temporary<HTMLCollection>;
fn WillValidate(&self) -> bool; fn WillValidate(&self) -> bool;
fn Validity(&self) -> Unrooted<ValidityState>; fn Validity(&self) -> Temporary<ValidityState>;
fn ValidationMessage(&self) -> DOMString; fn ValidationMessage(&self) -> DOMString;
fn CheckValidity(&self) -> bool; fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString); fn SetCustomValidity(&mut self, _error: DOMString);
@ -67,7 +67,7 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
Ok(()) Ok(())
} }
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { fn GetForm(&self) -> Option<Temporary<HTMLFormElement>> {
None None
} }
@ -84,7 +84,7 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
} }
// http://www.whatwg.org/html/#dom-fieldset-elements // http://www.whatwg.org/html/#dom-fieldset-elements
fn Elements(&self) -> Unrooted<HTMLCollection> { fn Elements(&self) -> Temporary<HTMLCollection> {
struct ElementsFilter; struct ElementsFilter;
impl CollectionFilter for ElementsFilter { impl CollectionFilter for ElementsFilter {
fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool { fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool {
@ -105,7 +105,7 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
false false
} }
fn Validity(&self) -> Unrooted<ValidityState> { fn Validity(&self) -> Temporary<ValidityState> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
ValidityState::new(&*window) ValidityState::new(&*window)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFontElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLFontElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFontElementDerived; use dom::bindings::codegen::InheritTypes::HTMLFontElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLFontElementTypeId; use dom::element::HTMLFontElementTypeId;
@ -34,7 +34,7 @@ impl HTMLFontElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLFontElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFontElement> {
let element = HTMLFontElement::new_inherited(localName, document.unrooted()); let element = HTMLFontElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLFontElementBinding::Wrap) Node::reflect_node(~element, document, HTMLFontElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFormElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLFormElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived; use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, HTMLFormElementTypeId}; use dom::element::{Element, HTMLFormElementTypeId};
@ -35,7 +35,7 @@ impl HTMLFormElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLFormElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFormElement> {
let element = HTMLFormElement::new_inherited(localName, document.unrooted()); let element = HTMLFormElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLFormElementBinding::Wrap) Node::reflect_node(~element, document, HTMLFormElementBinding::Wrap)
} }
@ -60,12 +60,12 @@ pub trait HTMLFormElementMethods {
fn SetNoValidate(&mut self, _no_validate: bool) -> ErrorResult; fn SetNoValidate(&mut self, _no_validate: bool) -> ErrorResult;
fn Target(&self) -> DOMString; fn Target(&self) -> DOMString;
fn SetTarget(&mut self, _target: DOMString) -> ErrorResult; fn SetTarget(&mut self, _target: DOMString) -> ErrorResult;
fn Elements(&self) -> Unrooted<HTMLCollection>; fn Elements(&self) -> Temporary<HTMLCollection>;
fn Length(&self) -> i32; fn Length(&self) -> i32;
fn Submit(&self) -> ErrorResult; fn Submit(&self) -> ErrorResult;
fn Reset(&self); fn Reset(&self);
fn CheckValidity(&self) -> bool; fn CheckValidity(&self) -> bool;
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Unrooted<Element>; fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Temporary<Element>;
} }
impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> { impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
@ -141,7 +141,7 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
Ok(()) Ok(())
} }
fn Elements(&self) -> Unrooted<HTMLCollection> { fn Elements(&self) -> Temporary<HTMLCollection> {
// FIXME: https://github.com/mozilla/servo/issues/1844 // FIXME: https://github.com/mozilla/servo/issues/1844
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
@ -163,7 +163,7 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
false false
} }
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Unrooted<Element> { fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Temporary<Element> {
fail!("Not implemented.") fail!("Not implemented.")
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFrameElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLFrameElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrameElementDerived; use dom::bindings::codegen::InheritTypes::HTMLFrameElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLFrameElementTypeId; use dom::element::HTMLFrameElementTypeId;
@ -35,7 +35,7 @@ impl HTMLFrameElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLFrameElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameElement> {
let element = HTMLFrameElement::new_inherited(localName, document.unrooted()); let element = HTMLFrameElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLFrameElementBinding::Wrap) Node::reflect_node(~element, document, HTMLFrameElementBinding::Wrap)
} }
@ -54,8 +54,8 @@ pub trait HTMLFrameElementMethods {
fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult; fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult;
fn NoResize(&self) -> bool; fn NoResize(&self) -> bool;
fn SetNoResize(&mut self, _no_resize: bool) -> ErrorResult; fn SetNoResize(&mut self, _no_resize: bool) -> ErrorResult;
fn GetContentDocument(&self) -> Option<Unrooted<Document>>; fn GetContentDocument(&self) -> Option<Temporary<Document>>;
fn GetContentWindow(&self) -> Option<Unrooted<Window>>; fn GetContentWindow(&self) -> Option<Temporary<Window>>;
fn MarginHeight(&self) -> DOMString; fn MarginHeight(&self) -> DOMString;
fn SetMarginHeight(&mut self, _height: DOMString) -> ErrorResult; fn SetMarginHeight(&mut self, _height: DOMString) -> ErrorResult;
fn MarginWidth(&self) -> DOMString; fn MarginWidth(&self) -> DOMString;
@ -111,11 +111,11 @@ impl<'a> HTMLFrameElementMethods for JSRef<'a, HTMLFrameElement> {
Ok(()) Ok(())
} }
fn GetContentDocument(&self) -> Option<Unrooted<Document>> { fn GetContentDocument(&self) -> Option<Temporary<Document>> {
None None
} }
fn GetContentWindow(&self) -> Option<Unrooted<Window>> { fn GetContentWindow(&self) -> Option<Temporary<Window>> {
None None
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFrameSetElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLFrameSetElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrameSetElementDerived; use dom::bindings::codegen::InheritTypes::HTMLFrameSetElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLFrameSetElementTypeId; use dom::element::HTMLFrameSetElementTypeId;
@ -34,7 +34,7 @@ impl HTMLFrameSetElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLFrameSetElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameSetElement> {
let element = HTMLFrameSetElement::new_inherited(localName, document.unrooted()); let element = HTMLFrameSetElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLFrameSetElementBinding::Wrap) Node::reflect_node(~element, document, HTMLFrameSetElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHeadElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLHeadElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHeadElementDerived; use dom::bindings::codegen::InheritTypes::HTMLHeadElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLHeadElementTypeId; use dom::element::HTMLHeadElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLHeadElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLHeadElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHeadElement> {
let element = HTMLHeadElement::new_inherited(localName, document.unrooted()); let element = HTMLHeadElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLHeadElementBinding::Wrap) Node::reflect_node(~element, document, HTMLHeadElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHeadingElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLHeadingElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHeadingElementDerived; use dom::bindings::codegen::InheritTypes::HTMLHeadingElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLHeadingElementTypeId; use dom::element::HTMLHeadingElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -45,7 +45,7 @@ impl HTMLHeadingElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>, level: HeadingLevel) -> Unrooted<HTMLHeadingElement> { pub fn new(localName: DOMString, document: &JSRef<Document>, level: HeadingLevel) -> Temporary<HTMLHeadingElement> {
let element = HTMLHeadingElement::new_inherited(localName, document.unrooted(), level); let element = HTMLHeadingElement::new_inherited(localName, document.unrooted(), level);
Node::reflect_node(~element, document, HTMLHeadingElementBinding::Wrap) Node::reflect_node(~element, document, HTMLHeadingElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHRElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLHRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHRElementDerived; use dom::bindings::codegen::InheritTypes::HTMLHRElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLHRElementTypeId; use dom::element::HTMLHRElementTypeId;
@ -34,7 +34,7 @@ impl HTMLHRElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLHRElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHRElement> {
let element = HTMLHRElement::new_inherited(localName, document.unrooted()); let element = HTMLHRElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLHRElementBinding::Wrap) Node::reflect_node(~element, document, HTMLHRElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHtmlElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLHtmlElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHtmlElementDerived; use dom::bindings::codegen::InheritTypes::HTMLHtmlElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLHtmlElementTypeId; use dom::element::HTMLHtmlElementTypeId;
@ -34,7 +34,7 @@ impl HTMLHtmlElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLHtmlElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHtmlElement> {
let element = HTMLHtmlElement::new_inherited(localName, document.unrooted()); let element = HTMLHtmlElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLHtmlElementBinding::Wrap) Node::reflect_node(~element, document, HTMLHtmlElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLIFrameElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLIFrameElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementDerived, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementDerived, HTMLElementCast};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::trace::Untraceable; use dom::bindings::trace::Untraceable;
use dom::document::Document; use dom::document::Document;
use dom::element::{HTMLIFrameElementTypeId, Element}; use dom::element::{HTMLIFrameElementTypeId, Element};
@ -79,7 +79,7 @@ impl HTMLIFrameElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLIFrameElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLIFrameElement> {
let element = HTMLIFrameElement::new_inherited(localName, document.unrooted()); let element = HTMLIFrameElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLIFrameElementBinding::Wrap) Node::reflect_node(~element, document, HTMLIFrameElementBinding::Wrap)
} }
@ -100,8 +100,8 @@ pub trait HTMLIFrameElementMethods {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult; fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString; fn Height(&self) -> DOMString;
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult; fn SetHeight(&mut self, _height: DOMString) -> ErrorResult;
fn GetContentDocument(&self) -> Option<Unrooted<Document>>; fn GetContentDocument(&self) -> Option<Temporary<Document>>;
fn GetContentWindow(&self) -> Option<Unrooted<Window>>; fn GetContentWindow(&self) -> Option<Temporary<Window>>;
fn Align(&self) -> DOMString; fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult; fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Scrolling(&self) -> DOMString; fn Scrolling(&self) -> DOMString;
@ -114,7 +114,7 @@ pub trait HTMLIFrameElementMethods {
fn SetMarginHeight(&mut self, _marginheight: DOMString) -> ErrorResult; fn SetMarginHeight(&mut self, _marginheight: DOMString) -> ErrorResult;
fn MarginWidth(&self) -> DOMString; fn MarginWidth(&self) -> DOMString;
fn SetMarginWidth(&mut self, _marginwidth: DOMString) -> ErrorResult; fn SetMarginWidth(&mut self, _marginwidth: DOMString) -> ErrorResult;
fn GetSVGDocument(&self) -> Option<Unrooted<Document>>; fn GetSVGDocument(&self) -> Option<Temporary<Document>>;
} }
impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> { impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
@ -176,11 +176,11 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
Ok(()) Ok(())
} }
fn GetContentDocument(&self) -> Option<Unrooted<Document>> { fn GetContentDocument(&self) -> Option<Temporary<Document>> {
None None
} }
fn GetContentWindow(&self) -> Option<Unrooted<Window>> { fn GetContentWindow(&self) -> Option<Temporary<Window>> {
None None
} }
@ -232,7 +232,7 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
Ok(()) Ok(())
} }
fn GetSVGDocument(&self) -> Option<Unrooted<Document>> { fn GetSVGDocument(&self) -> Option<Temporary<Document>> {
None None
} }
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLImageElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLImageElementBinding;
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, HTMLElementCast, HTMLImageElementDerived}; use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, HTMLElementCast, HTMLImageElementDerived};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection}; use dom::bindings::js::{JS, JSRef, Temporary, RootCollection};
use dom::bindings::trace::Untraceable; use dom::bindings::trace::Untraceable;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, HTMLImageElementTypeId}; use dom::element::{Element, HTMLImageElementTypeId};
@ -76,7 +76,7 @@ impl HTMLImageElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLImageElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLImageElement> {
let element = HTMLImageElement::new_inherited(localName, document.unrooted()); let element = HTMLImageElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLImageElementBinding::Wrap) Node::reflect_node(~element, document, HTMLImageElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLInputElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLInputElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLInputElementDerived; use dom::bindings::codegen::InheritTypes::HTMLInputElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLInputElementTypeId; use dom::element::HTMLInputElementTypeId;
@ -34,7 +34,7 @@ impl HTMLInputElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLInputElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLInputElement> {
let element = HTMLInputElement::new_inherited(localName, document.unrooted()); let element = HTMLInputElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLInputElementBinding::Wrap) Node::reflect_node(~element, document, HTMLInputElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLabelElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLLabelElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLabelElementDerived; use dom::bindings::codegen::InheritTypes::HTMLLabelElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLLabelElementTypeId; use dom::element::HTMLLabelElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLLabelElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLLabelElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLabelElement> {
let element = HTMLLabelElement::new_inherited(localName, document.unrooted()); let element = HTMLLabelElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLLabelElementBinding::Wrap) Node::reflect_node(~element, document, HTMLLabelElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLegendElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLLegendElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLegendElementDerived; use dom::bindings::codegen::InheritTypes::HTMLLegendElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLLegendElementTypeId; use dom::element::HTMLLegendElementTypeId;
@ -34,7 +34,7 @@ impl HTMLLegendElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLLegendElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLegendElement> {
let element = HTMLLegendElement::new_inherited(localName, document.unrooted()); let element = HTMLLegendElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLLegendElementBinding::Wrap) Node::reflect_node(~element, document, HTMLLegendElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLIElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLLIElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLIElementDerived; use dom::bindings::codegen::InheritTypes::HTMLLIElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLLIElementTypeId; use dom::element::HTMLLIElementTypeId;
@ -34,7 +34,7 @@ impl HTMLLIElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLLIElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLIElement> {
let element = HTMLLIElement::new_inherited(localName, document.unrooted()); let element = HTMLLIElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLLIElementBinding::Wrap) Node::reflect_node(~element, document, HTMLLIElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLinkElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLLinkElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLinkElementDerived; use dom::bindings::codegen::InheritTypes::HTMLLinkElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLLinkElementTypeId; use dom::element::HTMLLinkElementTypeId;
@ -34,7 +34,7 @@ impl HTMLLinkElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLLinkElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLinkElement> {
let element = HTMLLinkElement::new_inherited(localName, document.unrooted()); let element = HTMLLinkElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLLinkElementBinding::Wrap) Node::reflect_node(~element, document, HTMLLinkElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMainElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLMainElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMainElementDerived; use dom::bindings::codegen::InheritTypes::HTMLMainElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLMainElementTypeId; use dom::element::HTMLMainElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLMainElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLMainElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMainElement> {
let element = HTMLMainElement::new_inherited(localName, document.unrooted()); let element = HTMLMainElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLMainElementBinding::Wrap) Node::reflect_node(~element, document, HTMLMainElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMapElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLMapElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMapElementDerived; use dom::bindings::codegen::InheritTypes::HTMLMapElementDerived;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLMapElementTypeId; use dom::element::HTMLMapElementTypeId;
@ -35,7 +35,7 @@ impl HTMLMapElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLMapElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMapElement> {
let element = HTMLMapElement::new_inherited(localName, document.unrooted()); let element = HTMLMapElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLMapElementBinding::Wrap) Node::reflect_node(~element, document, HTMLMapElementBinding::Wrap)
} }
@ -44,7 +44,7 @@ impl HTMLMapElement {
pub trait HTMLMapElementMethods { pub trait HTMLMapElementMethods {
fn Name(&self) -> DOMString; fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult; fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Areas(&self) -> Unrooted<HTMLCollection>; fn Areas(&self) -> Temporary<HTMLCollection>;
} }
impl<'a> HTMLMapElementMethods for JSRef<'a, HTMLMapElement> { impl<'a> HTMLMapElementMethods for JSRef<'a, HTMLMapElement> {
@ -56,7 +56,7 @@ impl<'a> HTMLMapElementMethods for JSRef<'a, HTMLMapElement> {
Ok(()) Ok(())
} }
fn Areas(&self) -> Unrooted<HTMLCollection> { fn Areas(&self) -> Temporary<HTMLCollection> {
let roots = RootCollection::new(); let roots = RootCollection::new();
// FIXME: https://github.com/mozilla/servo/issues/1845 // FIXME: https://github.com/mozilla/servo/issues/1845
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMetaElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLMetaElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMetaElementDerived; use dom::bindings::codegen::InheritTypes::HTMLMetaElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLMetaElementTypeId; use dom::element::HTMLMetaElementTypeId;
@ -34,7 +34,7 @@ impl HTMLMetaElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLMetaElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMetaElement> {
let element = HTMLMetaElement::new_inherited(localName, document.unrooted()); let element = HTMLMetaElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLMetaElementBinding::Wrap) Node::reflect_node(~element, document, HTMLMetaElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMeterElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLMeterElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMeterElementDerived; use dom::bindings::codegen::InheritTypes::HTMLMeterElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLMeterElementTypeId; use dom::element::HTMLMeterElementTypeId;
@ -34,7 +34,7 @@ impl HTMLMeterElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLMeterElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMeterElement> {
let element = HTMLMeterElement::new_inherited(localName, document.unrooted()); let element = HTMLMeterElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLMeterElementBinding::Wrap) Node::reflect_node(~element, document, HTMLMeterElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLModElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLModElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLModElementDerived; use dom::bindings::codegen::InheritTypes::HTMLModElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLModElementTypeId; use dom::element::HTMLModElementTypeId;
@ -34,7 +34,7 @@ impl HTMLModElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLModElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLModElement> {
let element = HTMLModElement::new_inherited(localName, document.unrooted()); let element = HTMLModElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLModElementBinding::Wrap) Node::reflect_node(~element, document, HTMLModElementBinding::Wrap)
} }

View file

@ -6,7 +6,7 @@ use dom::attr::AttrMethods;
use dom::bindings::codegen::BindingDeclarations::HTMLObjectElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLObjectElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLObjectElementDerived; use dom::bindings::codegen::InheritTypes::HTMLObjectElementDerived;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, HTMLObjectElementTypeId}; use dom::element::{Element, HTMLObjectElementTypeId};
@ -48,7 +48,7 @@ impl HTMLObjectElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLObjectElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLObjectElement> {
let element = HTMLObjectElement::new_inherited(localName, document.unrooted()); let element = HTMLObjectElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLObjectElementBinding::Wrap) Node::reflect_node(~element, document, HTMLObjectElementBinding::Wrap)
} }
@ -89,15 +89,15 @@ pub trait HTMLObjectElementMethods {
fn SetName(&mut self, _name: DOMString) -> ErrorResult; fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn UseMap(&self) -> DOMString; fn UseMap(&self) -> DOMString;
fn SetUseMap(&mut self, _use_map: DOMString) -> ErrorResult; fn SetUseMap(&mut self, _use_map: DOMString) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>; fn GetForm(&self) -> Option<Temporary<HTMLFormElement>>;
fn Width(&self) -> DOMString; fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult; fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString; fn Height(&self) -> DOMString;
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult; fn SetHeight(&mut self, _height: DOMString) -> ErrorResult;
fn GetContentDocument(&self) -> Option<Unrooted<Document>>; fn GetContentDocument(&self) -> Option<Temporary<Document>>;
fn GetContentWindow(&self) -> Option<Unrooted<Window>>; fn GetContentWindow(&self) -> Option<Temporary<Window>>;
fn WillValidate(&self) -> bool; fn WillValidate(&self) -> bool;
fn Validity(&self) -> Unrooted<ValidityState>; fn Validity(&self) -> Temporary<ValidityState>;
fn ValidationMessage(&self) -> DOMString; fn ValidationMessage(&self) -> DOMString;
fn CheckValidity(&self) -> bool; fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString); fn SetCustomValidity(&mut self, _error: DOMString);
@ -121,7 +121,7 @@ pub trait HTMLObjectElementMethods {
fn SetCodeType(&mut self, _codetype: DOMString) -> ErrorResult; fn SetCodeType(&mut self, _codetype: DOMString) -> ErrorResult;
fn Border(&self) -> DOMString; fn Border(&self) -> DOMString;
fn SetBorder(&mut self, _border: DOMString) -> ErrorResult; fn SetBorder(&mut self, _border: DOMString) -> ErrorResult;
fn GetSVGDocument(&self) -> Option<Unrooted<Document>>; fn GetSVGDocument(&self) -> Option<Temporary<Document>>;
} }
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> { impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
@ -157,7 +157,7 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
Ok(()) Ok(())
} }
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { fn GetForm(&self) -> Option<Temporary<HTMLFormElement>> {
None None
} }
@ -177,11 +177,11 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
Ok(()) Ok(())
} }
fn GetContentDocument(&self) -> Option<Unrooted<Document>> { fn GetContentDocument(&self) -> Option<Temporary<Document>> {
None None
} }
fn GetContentWindow(&self) -> Option<Unrooted<Window>> { fn GetContentWindow(&self) -> Option<Temporary<Window>> {
None None
} }
@ -189,7 +189,7 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
false false
} }
fn Validity(&self) -> Unrooted<ValidityState> { fn Validity(&self) -> Temporary<ValidityState> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
ValidityState::new(&*window) ValidityState::new(&*window)
@ -286,7 +286,7 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
Ok(()) Ok(())
} }
fn GetSVGDocument(&self) -> Option<Unrooted<Document>> { fn GetSVGDocument(&self) -> Option<Temporary<Document>> {
None None
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOListElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLOListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOListElementDerived; use dom::bindings::codegen::InheritTypes::HTMLOListElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLOListElementTypeId; use dom::element::HTMLOListElementTypeId;
@ -34,7 +34,7 @@ impl HTMLOListElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLOListElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOListElement> {
let element = HTMLOListElement::new_inherited(localName, document.unrooted()); let element = HTMLOListElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLOListElementBinding::Wrap) Node::reflect_node(~element, document, HTMLOListElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOptGroupElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLOptGroupElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOptGroupElementDerived; use dom::bindings::codegen::InheritTypes::HTMLOptGroupElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLOptGroupElementTypeId; use dom::element::HTMLOptGroupElementTypeId;
@ -34,7 +34,7 @@ impl HTMLOptGroupElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLOptGroupElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOptGroupElement> {
let element = HTMLOptGroupElement::new_inherited(localName, document.unrooted()); let element = HTMLOptGroupElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLOptGroupElementBinding::Wrap) Node::reflect_node(~element, document, HTMLOptGroupElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOptionElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLOptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOptionElementDerived; use dom::bindings::codegen::InheritTypes::HTMLOptionElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLOptionElementTypeId; use dom::element::HTMLOptionElementTypeId;
@ -35,7 +35,7 @@ impl HTMLOptionElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLOptionElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOptionElement> {
let element = HTMLOptionElement::new_inherited(localName, document.unrooted()); let element = HTMLOptionElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLOptionElementBinding::Wrap) Node::reflect_node(~element, document, HTMLOptionElementBinding::Wrap)
} }
@ -44,7 +44,7 @@ impl HTMLOptionElement {
pub trait HTMLOptionElementMethods { pub trait HTMLOptionElementMethods {
fn Disabled(&self) -> bool; fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult; fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>; fn GetForm(&self) -> Option<Temporary<HTMLFormElement>>;
fn Label(&self) -> DOMString; fn Label(&self) -> DOMString;
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult; fn SetLabel(&mut self, _label: DOMString) -> ErrorResult;
fn DefaultSelected(&self) -> bool; fn DefaultSelected(&self) -> bool;
@ -67,7 +67,7 @@ impl<'a> HTMLOptionElementMethods for JSRef<'a, HTMLOptionElement> {
Ok(()) Ok(())
} }
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { fn GetForm(&self) -> Option<Temporary<HTMLFormElement>> {
None None
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOutputElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLOutputElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOutputElementDerived; use dom::bindings::codegen::InheritTypes::HTMLOutputElementDerived;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLOutputElementTypeId; use dom::element::HTMLOutputElementTypeId;
@ -36,14 +36,14 @@ impl HTMLOutputElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLOutputElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOutputElement> {
let element = HTMLOutputElement::new_inherited(localName, document.unrooted()); let element = HTMLOutputElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLOutputElementBinding::Wrap) Node::reflect_node(~element, document, HTMLOutputElementBinding::Wrap)
} }
} }
pub trait HTMLOutputElementMethods { pub trait HTMLOutputElementMethods {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>; fn GetForm(&self) -> Option<Temporary<HTMLFormElement>>;
fn Name(&self) -> DOMString; fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult; fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString; fn Type(&self) -> DOMString;
@ -53,7 +53,7 @@ pub trait HTMLOutputElementMethods {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult; fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn WillValidate(&self) -> bool; fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool); fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Unrooted<ValidityState>; fn Validity(&self) -> Temporary<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>); fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString; fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult; fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
@ -62,7 +62,7 @@ pub trait HTMLOutputElementMethods {
} }
impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> { impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { fn GetForm(&self) -> Option<Temporary<HTMLFormElement>> {
None None
} }
@ -101,7 +101,7 @@ impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> {
fn SetWillValidate(&mut self, _will_validate: bool) { fn SetWillValidate(&mut self, _will_validate: bool) {
} }
fn Validity(&self) -> Unrooted<ValidityState> { fn Validity(&self) -> Temporary<ValidityState> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
ValidityState::new(&*window) ValidityState::new(&*window)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLParagraphElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLParagraphElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLParagraphElementDerived; use dom::bindings::codegen::InheritTypes::HTMLParagraphElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLParagraphElementTypeId; use dom::element::HTMLParagraphElementTypeId;
@ -34,7 +34,7 @@ impl HTMLParagraphElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLParagraphElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLParagraphElement> {
let element = HTMLParagraphElement::new_inherited(localName, document.unrooted()); let element = HTMLParagraphElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLParagraphElementBinding::Wrap) Node::reflect_node(~element, document, HTMLParagraphElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLParamElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLParamElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLParamElementDerived; use dom::bindings::codegen::InheritTypes::HTMLParamElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLParamElementTypeId; use dom::element::HTMLParamElementTypeId;
@ -34,7 +34,7 @@ impl HTMLParamElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLParamElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLParamElement> {
let element = HTMLParamElement::new_inherited(localName, document.unrooted()); let element = HTMLParamElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLParamElementBinding::Wrap) Node::reflect_node(~element, document, HTMLParamElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLPreElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLPreElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLPreElementDerived; use dom::bindings::codegen::InheritTypes::HTMLPreElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLPreElementTypeId; use dom::element::HTMLPreElementTypeId;
@ -34,7 +34,7 @@ impl HTMLPreElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLPreElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLPreElement> {
let element = HTMLPreElement::new_inherited(localName, document.unrooted()); let element = HTMLPreElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLPreElementBinding::Wrap) Node::reflect_node(~element, document, HTMLPreElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLProgressElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLProgressElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLProgressElementDerived; use dom::bindings::codegen::InheritTypes::HTMLProgressElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLProgressElementTypeId; use dom::element::HTMLProgressElementTypeId;
@ -34,7 +34,7 @@ impl HTMLProgressElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLProgressElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLProgressElement> {
let element = HTMLProgressElement::new_inherited(localName, document.unrooted()); let element = HTMLProgressElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLProgressElementBinding::Wrap) Node::reflect_node(~element, document, HTMLProgressElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLQuoteElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLQuoteElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLQuoteElementDerived; use dom::bindings::codegen::InheritTypes::HTMLQuoteElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLQuoteElementTypeId; use dom::element::HTMLQuoteElementTypeId;
@ -34,7 +34,7 @@ impl HTMLQuoteElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLQuoteElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLQuoteElement> {
let element = HTMLQuoteElement::new_inherited(localName, document.unrooted()); let element = HTMLQuoteElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLQuoteElementBinding::Wrap) Node::reflect_node(~element, document, HTMLQuoteElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLScriptElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLScriptElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLScriptElementDerived; use dom::bindings::codegen::InheritTypes::HTMLScriptElementDerived;
use dom::bindings::codegen::InheritTypes::ElementCast; use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::{HTMLScriptElementTypeId, Element, AttributeHandlers}; use dom::element::{HTMLScriptElementTypeId, Element, AttributeHandlers};
@ -35,7 +35,7 @@ impl HTMLScriptElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLScriptElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLScriptElement> {
let element = HTMLScriptElement::new_inherited(localName, document.unrooted()); let element = HTMLScriptElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLScriptElementBinding::Wrap) Node::reflect_node(~element, document, HTMLScriptElementBinding::Wrap)
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLSelectElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLSelectElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLSelectElementDerived; use dom::bindings::codegen::InheritTypes::HTMLSelectElementDerived;
use dom::bindings::codegen::UnionTypes::{HTMLElementOrLong, HTMLOptionElementOrHTMLOptGroupElement}; use dom::bindings::codegen::UnionTypes::{HTMLElementOrLong, HTMLOptionElementOrHTMLOptGroupElement};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, HTMLSelectElementTypeId}; use dom::element::{Element, HTMLSelectElementTypeId};
@ -38,7 +38,7 @@ impl HTMLSelectElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLSelectElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLSelectElement> {
let element = HTMLSelectElement::new_inherited(localName, document.unrooted()); let element = HTMLSelectElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLSelectElementBinding::Wrap) Node::reflect_node(~element, document, HTMLSelectElementBinding::Wrap)
} }
@ -49,7 +49,7 @@ pub trait HTMLSelectElementMethods {
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult; fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult;
fn Disabled(&self) -> bool; fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult; fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>; fn GetForm(&self) -> Option<Temporary<HTMLFormElement>>;
fn Multiple(&self) -> bool; fn Multiple(&self) -> bool;
fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult; fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult;
fn Name(&self) -> DOMString; fn Name(&self) -> DOMString;
@ -61,9 +61,9 @@ pub trait HTMLSelectElementMethods {
fn Type(&self) -> DOMString; fn Type(&self) -> DOMString;
fn Length(&self) -> u32; fn Length(&self) -> u32;
fn SetLength(&mut self, _length: u32) -> ErrorResult; fn SetLength(&mut self, _length: u32) -> ErrorResult;
fn Item(&self, _index: u32) -> Option<Unrooted<Element>>; fn Item(&self, _index: u32) -> Option<Temporary<Element>>;
fn NamedItem(&self, _name: DOMString) -> Option<Unrooted<HTMLOptionElement>>; fn NamedItem(&self, _name: DOMString) -> Option<Temporary<HTMLOptionElement>>;
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Unrooted<Element>>; fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Temporary<Element>>;
fn IndexedSetter(&mut self, _index: u32, _option: Option<JSRef<HTMLOptionElement>>) -> ErrorResult; fn IndexedSetter(&mut self, _index: u32, _option: Option<JSRef<HTMLOptionElement>>) -> ErrorResult;
fn Remove_(&self); fn Remove_(&self);
fn Remove(&self, _index: i32); fn Remove(&self, _index: i32);
@ -73,7 +73,7 @@ pub trait HTMLSelectElementMethods {
fn SetValue(&mut self, _value: DOMString); fn SetValue(&mut self, _value: DOMString);
fn WillValidate(&self) -> bool; fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool); fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Unrooted<ValidityState>; fn Validity(&self) -> Temporary<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>); fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString; fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult; fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
@ -99,7 +99,7 @@ impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
Ok(()) Ok(())
} }
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> { fn GetForm(&self) -> Option<Temporary<HTMLFormElement>> {
None None
} }
@ -147,15 +147,15 @@ impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
Ok(()) Ok(())
} }
fn Item(&self, _index: u32) -> Option<Unrooted<Element>> { fn Item(&self, _index: u32) -> Option<Temporary<Element>> {
None None
} }
fn NamedItem(&self, _name: DOMString) -> Option<Unrooted<HTMLOptionElement>> { fn NamedItem(&self, _name: DOMString) -> Option<Temporary<HTMLOptionElement>> {
None None
} }
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Unrooted<Element>> { fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Temporary<Element>> {
None None
} }
@ -191,7 +191,7 @@ impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
fn SetWillValidate(&mut self, _will_validate: bool) { fn SetWillValidate(&mut self, _will_validate: bool) {
} }
fn Validity(&self) -> Unrooted<ValidityState> { fn Validity(&self) -> Temporary<ValidityState> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = window_from_node(self).root(&roots); let window = window_from_node(self).root(&roots);
ValidityState::new(&*window) ValidityState::new(&*window)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLSourceElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLSourceElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLSourceElementDerived; use dom::bindings::codegen::InheritTypes::HTMLSourceElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLSourceElementTypeId; use dom::element::HTMLSourceElementTypeId;
@ -34,7 +34,7 @@ impl HTMLSourceElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLSourceElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLSourceElement> {
let element = HTMLSourceElement::new_inherited(localName, document.unrooted()); let element = HTMLSourceElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLSourceElementBinding::Wrap) Node::reflect_node(~element, document, HTMLSourceElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLSpanElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLSpanElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLSpanElementDerived; use dom::bindings::codegen::InheritTypes::HTMLSpanElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLSpanElementTypeId; use dom::element::HTMLSpanElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLSpanElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLSpanElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLSpanElement> {
let element = HTMLSpanElement::new_inherited(localName, document.unrooted()); let element = HTMLSpanElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLSpanElementBinding::Wrap) Node::reflect_node(~element, document, HTMLSpanElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLStyleElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLStyleElementBinding;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLStyleElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLStyleElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLStyleElementTypeId; use dom::element::HTMLStyleElementTypeId;
@ -37,7 +37,7 @@ impl HTMLStyleElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLStyleElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLStyleElement> {
let element = HTMLStyleElement::new_inherited(localName, document.unrooted()); let element = HTMLStyleElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLStyleElementBinding::Wrap) Node::reflect_node(~element, document, HTMLStyleElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableCaptionElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableCaptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableCaptionElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableCaptionElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableCaptionElementTypeId; use dom::element::HTMLTableCaptionElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTableCaptionElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableCaptionElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableCaptionElement> {
let element = HTMLTableCaptionElement::new_inherited(localName, document.unrooted()); let element = HTMLTableCaptionElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableCaptionElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableCaptionElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableColElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableColElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableColElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableColElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableColElementTypeId; use dom::element::HTMLTableColElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTableColElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableColElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableColElement> {
let element = HTMLTableColElement::new_inherited(localName, document.unrooted()); let element = HTMLTableColElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableColElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableColElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableDataCellElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableDataCellElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableDataCellElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableDataCellElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableDataCellElementTypeId; use dom::element::HTMLTableDataCellElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLTableDataCellElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableDataCellElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableDataCellElement> {
let element = HTMLTableDataCellElement::new_inherited(localName, document.unrooted()); let element = HTMLTableDataCellElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableDataCellElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableDataCellElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableElementTypeId; use dom::element::HTMLTableElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTableElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableElement> {
let element = HTMLTableElement::new_inherited(localName, document.unrooted()); let element = HTMLTableElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableHeaderCellElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableHeaderCellElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableHeaderCellElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableHeaderCellElementTypeId; use dom::element::HTMLTableHeaderCellElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLTableHeaderCellElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableHeaderCellElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableHeaderCellElement> {
let element = HTMLTableHeaderCellElement::new_inherited(localName, document.unrooted()); let element = HTMLTableHeaderCellElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableHeaderCellElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableHeaderCellElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableRowElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableRowElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableRowElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableRowElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableRowElementTypeId; use dom::element::HTMLTableRowElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTableRowElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableRowElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableRowElement> {
let element = HTMLTableRowElement::new_inherited(localName, document.unrooted()); let element = HTMLTableRowElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableRowElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableRowElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableSectionElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTableSectionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableSectionElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTableSectionElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTableSectionElementTypeId; use dom::element::HTMLTableSectionElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTableSectionElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTableSectionElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableSectionElement> {
let element = HTMLTableSectionElement::new_inherited(localName, document.unrooted()); let element = HTMLTableSectionElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTableSectionElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTableSectionElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTemplateElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTemplateElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTemplateElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTemplateElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTemplateElementTypeId; use dom::element::HTMLTemplateElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLTemplateElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTemplateElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTemplateElement> {
let element = HTMLTemplateElement::new_inherited(localName, document.unrooted()); let element = HTMLTemplateElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTemplateElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTemplateElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTextAreaElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTextAreaElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTextAreaElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTextAreaElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTextAreaElementTypeId; use dom::element::HTMLTextAreaElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTextAreaElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTextAreaElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTextAreaElement> {
let element = HTMLTextAreaElement::new_inherited(localName, document.unrooted()); let element = HTMLTextAreaElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTextAreaElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTextAreaElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTimeElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTimeElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTimeElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTimeElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTimeElementTypeId; use dom::element::HTMLTimeElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTimeElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTimeElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTimeElement> {
let element = HTMLTimeElement::new_inherited(localName, document.unrooted()); let element = HTMLTimeElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTimeElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTimeElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTitleElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTitleElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTitleElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTitleElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTitleElementTypeId; use dom::element::HTMLTitleElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTitleElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTitleElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTitleElement> {
let element = HTMLTitleElement::new_inherited(localName, document.unrooted()); let element = HTMLTitleElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTitleElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTitleElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTrackElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLTrackElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTrackElementDerived; use dom::bindings::codegen::InheritTypes::HTMLTrackElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLTrackElementTypeId; use dom::element::HTMLTrackElementTypeId;
@ -34,7 +34,7 @@ impl HTMLTrackElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLTrackElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTrackElement> {
let element = HTMLTrackElement::new_inherited(localName, document.unrooted()); let element = HTMLTrackElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLTrackElementBinding::Wrap) Node::reflect_node(~element, document, HTMLTrackElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLUListElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLUListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLUListElementDerived; use dom::bindings::codegen::InheritTypes::HTMLUListElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLUListElementTypeId; use dom::element::HTMLUListElementTypeId;
@ -34,7 +34,7 @@ impl HTMLUListElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLUListElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLUListElement> {
let element = HTMLUListElement::new_inherited(localName, document.unrooted()); let element = HTMLUListElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLUListElementBinding::Wrap) Node::reflect_node(~element, document, HTMLUListElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLUnknownElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLUnknownElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLUnknownElementDerived; use dom::bindings::codegen::InheritTypes::HTMLUnknownElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLUnknownElementTypeId; use dom::element::HTMLUnknownElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -33,7 +33,7 @@ impl HTMLUnknownElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLUnknownElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLUnknownElement> {
let element = HTMLUnknownElement::new_inherited(localName, document.unrooted()); let element = HTMLUnknownElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLUnknownElementBinding::Wrap) Node::reflect_node(~element, document, HTMLUnknownElementBinding::Wrap)
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLVideoElementBinding; use dom::bindings::codegen::BindingDeclarations::HTMLVideoElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLVideoElementDerived; use dom::bindings::codegen::InheritTypes::HTMLVideoElementDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::document::Document; use dom::document::Document;
use dom::element::HTMLVideoElementTypeId; use dom::element::HTMLVideoElementTypeId;
@ -34,7 +34,7 @@ impl HTMLVideoElement {
} }
} }
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLVideoElement> { pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLVideoElement> {
let element = HTMLVideoElement::new_inherited(localName, document.unrooted()); let element = HTMLVideoElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLVideoElementBinding::Wrap) Node::reflect_node(~element, document, HTMLVideoElementBinding::Wrap)
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::LocationBinding; use dom::bindings::codegen::BindingDeclarations::LocationBinding;
use dom::bindings::js::{JSRef, Unrooted}; use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::window::Window; use dom::window::Window;
@ -29,7 +29,7 @@ impl Location {
} }
} }
pub fn new(window: &JSRef<Window>, page: Rc<Page>) -> Unrooted<Location> { pub fn new(window: &JSRef<Window>, page: Rc<Page>) -> Temporary<Location> {
reflect_dom_object(~Location::new_inherited(page), reflect_dom_object(~Location::new_inherited(page),
window, window,
LocationBinding::Wrap) LocationBinding::Wrap)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::MouseEventBinding; use dom::bindings::codegen::BindingDeclarations::MouseEventBinding;
use dom::bindings::codegen::InheritTypes::{UIEventCast, MouseEventDerived}; use dom::bindings::codegen::InheritTypes::{UIEventCast, MouseEventDerived};
use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Temporary};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, MouseEventTypeId}; use dom::event::{Event, MouseEventTypeId};
@ -51,7 +51,7 @@ impl MouseEvent {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<MouseEvent> { pub fn new(window: &JSRef<Window>) -> Temporary<MouseEvent> {
reflect_dom_object(~MouseEvent::new_inherited(), reflect_dom_object(~MouseEvent::new_inherited(),
window, window,
MouseEventBinding::Wrap) MouseEventBinding::Wrap)
@ -59,7 +59,7 @@ impl MouseEvent {
pub fn Constructor(owner: &JSRef<Window>, pub fn Constructor(owner: &JSRef<Window>,
type_: DOMString, type_: DOMString,
init: &MouseEventBinding::MouseEventInit) -> Fallible<Unrooted<MouseEvent>> { init: &MouseEventBinding::MouseEventInit) -> Fallible<Temporary<MouseEvent>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let mut ev = MouseEvent::new(owner).root(&roots); let mut ev = MouseEvent::new(owner).root(&roots);
let view = init.view.as_ref().map(|view| view.root(&roots)); let view = init.view.as_ref().map(|view| view.root(&roots));
@ -69,7 +69,7 @@ impl MouseEvent {
init.clientX, init.clientY, init.ctrlKey, init.clientX, init.clientY, init.ctrlKey,
init.altKey, init.shiftKey, init.metaKey, init.altKey, init.shiftKey, init.metaKey,
init.button, related_target.root_ref()); init.button, related_target.root_ref());
Ok(Unrooted::new_rooted(&*ev)) Ok(Temporary::new_rooted(&*ev))
} }
} }
@ -84,7 +84,7 @@ pub trait MouseEventMethods {
fn MetaKey(&self) -> bool; fn MetaKey(&self) -> bool;
fn Button(&self) -> u16; fn Button(&self) -> u16;
fn Buttons(&self)-> u16; fn Buttons(&self)-> u16;
fn GetRelatedTarget(&self) -> Option<Unrooted<EventTarget>>; fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>>;
fn GetModifierState(&self, _keyArg: DOMString) -> bool; fn GetModifierState(&self, _keyArg: DOMString) -> bool;
fn InitMouseEvent(&mut self, fn InitMouseEvent(&mut self,
typeArg: DOMString, typeArg: DOMString,
@ -146,8 +146,8 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
0 0
} }
fn GetRelatedTarget(&self) -> Option<Unrooted<EventTarget>> { fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>> {
self.related_target.clone().map(|target| Unrooted::new(target)) self.related_target.clone().map(|target| Temporary::new(target))
} }
fn GetModifierState(&self, _keyArg: DOMString) -> bool { fn GetModifierState(&self, _keyArg: DOMString) -> bool {

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::NavigatorBinding; use dom::bindings::codegen::BindingDeclarations::NavigatorBinding;
use dom::bindings::js::{JSRef, Unrooted}; use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::window::Window; use dom::window::Window;
@ -21,7 +21,7 @@ impl Navigator {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<Navigator> { pub fn new(window: &JSRef<Window>) -> Temporary<Navigator> {
reflect_dom_object(~Navigator::new_inherited(), reflect_dom_object(~Navigator::new_inherited(),
window, window,
NavigatorBinding::Wrap) NavigatorBinding::Wrap)

View file

@ -10,8 +10,8 @@ use dom::bindings::codegen::InheritTypes::{ElementCast, TextCast, NodeCast, Elem
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeBase, NodeDerived}; use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeBase, NodeDerived};
use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast}; use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast};
use dom::bindings::codegen::BindingDeclarations::NodeBinding::NodeConstants; use dom::bindings::codegen::BindingDeclarations::NodeBinding::NodeConstants;
use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Unrooted, Root}; use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Temporary, Root};
use dom::bindings::js::{OptionalAssignable, UnrootedPushable, OptionalRootedRootable}; use dom::bindings::js::{OptionalAssignable, TemporaryPushable, OptionalRootedRootable};
use dom::bindings::js::{ResultRootable, OptionalRootable}; use dom::bindings::js::{ResultRootable, OptionalRootable};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::{ErrorResult, Fallible, NotFound, HierarchyRequest}; use dom::bindings::error::{ErrorResult, Fallible, NotFound, HierarchyRequest};
@ -403,13 +403,13 @@ pub trait NodeHelpers {
fn type_id(&self) -> NodeTypeId; fn type_id(&self) -> NodeTypeId;
fn parent_node(&self) -> Option<Unrooted<Node>>; fn parent_node(&self) -> Option<Temporary<Node>>;
fn first_child(&self) -> Option<Unrooted<Node>>; fn first_child(&self) -> Option<Temporary<Node>>;
fn last_child(&self) -> Option<Unrooted<Node>>; fn last_child(&self) -> Option<Temporary<Node>>;
fn prev_sibling(&self) -> Option<Unrooted<Node>>; fn prev_sibling(&self) -> Option<Temporary<Node>>;
fn next_sibling(&self) -> Option<Unrooted<Node>>; fn next_sibling(&self) -> Option<Temporary<Node>>;
fn owner_doc(&self) -> Unrooted<Document>; fn owner_doc(&self) -> Temporary<Document>;
fn set_owner_doc(&mut self, document: &JSRef<Document>); fn set_owner_doc(&mut self, document: &JSRef<Document>);
fn wait_until_safe_to_modify_dom(&self); fn wait_until_safe_to_modify_dom(&self);
@ -473,26 +473,26 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
self.get().type_id self.get().type_id
} }
fn parent_node(&self) -> Option<Unrooted<Node>> { fn parent_node(&self) -> Option<Temporary<Node>> {
self.get().parent_node.clone().map(|node| Unrooted::new(node)) self.get().parent_node.clone().map(|node| Temporary::new(node))
} }
fn first_child(&self) -> Option<Unrooted<Node>> { fn first_child(&self) -> Option<Temporary<Node>> {
self.get().first_child.clone().map(|node| Unrooted::new(node)) self.get().first_child.clone().map(|node| Temporary::new(node))
} }
fn last_child(&self) -> Option<Unrooted<Node>> { fn last_child(&self) -> Option<Temporary<Node>> {
self.get().last_child.clone().map(|node| Unrooted::new(node)) self.get().last_child.clone().map(|node| Temporary::new(node))
} }
/// Returns the previous sibling of this node. Fails if this node is borrowed mutably. /// Returns the previous sibling of this node. Fails if this node is borrowed mutably.
fn prev_sibling(&self) -> Option<Unrooted<Node>> { fn prev_sibling(&self) -> Option<Temporary<Node>> {
self.get().prev_sibling.clone().map(|node| Unrooted::new(node)) self.get().prev_sibling.clone().map(|node| Temporary::new(node))
} }
/// Returns the next sibling of this node. Fails if this node is borrowed mutably. /// Returns the next sibling of this node. Fails if this node is borrowed mutably.
fn next_sibling(&self) -> Option<Unrooted<Node>> { fn next_sibling(&self) -> Option<Temporary<Node>> {
self.get().next_sibling.clone().map(|node| Unrooted::new(node)) self.get().next_sibling.clone().map(|node| Temporary::new(node))
} }
#[inline] #[inline]
@ -581,7 +581,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
fn is_parent_of(&self, child: &JSRef<Node>) -> bool { fn is_parent_of(&self, child: &JSRef<Node>) -> bool {
match child.parent_node() { match child.parent_node() {
Some(ref parent) if *parent == Unrooted::new_rooted(self) => true, Some(ref parent) if *parent == Temporary::new_rooted(self) => true,
_ => false _ => false
} }
} }
@ -618,8 +618,8 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
} }
} }
fn owner_doc(&self) -> Unrooted<Document> { fn owner_doc(&self) -> Temporary<Document> {
Unrooted::new(self.owner_doc.get_ref().clone()) Temporary::new(self.owner_doc.get_ref().clone())
} }
fn set_owner_doc(&mut self, document: &JSRef<Document>) { fn set_owner_doc(&mut self, document: &JSRef<Document>) {
@ -656,7 +656,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
/// If the given untrusted node address represents a valid DOM node in the given runtime, /// If the given untrusted node address represents a valid DOM node in the given runtime,
/// returns it. /// returns it.
pub fn from_untrusted_node_address(runtime: *JSRuntime, candidate: UntrustedNodeAddress) pub fn from_untrusted_node_address(runtime: *JSRuntime, candidate: UntrustedNodeAddress)
-> Unrooted<Node> { -> Temporary<Node> {
unsafe { unsafe {
let candidate: uintptr_t = cast::transmute(candidate); let candidate: uintptr_t = cast::transmute(candidate);
let object: *JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime, let object: *JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime,
@ -665,7 +665,7 @@ pub fn from_untrusted_node_address(runtime: *JSRuntime, candidate: UntrustedNode
fail!("Attempted to create a `JS<Node>` from an invalid pointer!") fail!("Attempted to create a `JS<Node>` from an invalid pointer!")
} }
let boxed_node: *mut Node = utils::unwrap(object); let boxed_node: *mut Node = utils::unwrap(object);
Unrooted::new(JS::from_raw(boxed_node)) Temporary::new(JS::from_raw(boxed_node))
} }
} }
@ -913,13 +913,13 @@ impl Node {
(node: ~N, (node: ~N,
document: &JSRef<Document>, document: &JSRef<Document>,
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~N) -> JS<N>) wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~N) -> JS<N>)
-> Unrooted<N> { -> Temporary<N> {
let roots = RootCollection::new(); let roots = RootCollection::new();
assert!(node.reflector().get_jsobject().is_null()); assert!(node.reflector().get_jsobject().is_null());
let window = document.get().window.root(&roots); let window = document.get().window.root(&roots);
let node = reflect_dom_object(node, &window.root_ref(), wrap_fn).root(&roots); let node = reflect_dom_object(node, &window.root_ref(), wrap_fn).root(&roots);
assert!(node.reflector().get_jsobject().is_not_null()); assert!(node.reflector().get_jsobject().is_not_null());
Unrooted::new_rooted(&*node) Temporary::new_rooted(&*node)
} }
pub fn new_inherited(type_id: NodeTypeId, doc: JS<Document>) -> Node { pub fn new_inherited(type_id: NodeTypeId, doc: JS<Document>) -> Node {
@ -977,7 +977,7 @@ impl Node {
// http://dom.spec.whatwg.org/#concept-node-pre-insert // http://dom.spec.whatwg.org/#concept-node-pre-insert
fn pre_insert(node: &mut JSRef<Node>, parent: &mut JSRef<Node>, child: Option<JSRef<Node>>) fn pre_insert(node: &mut JSRef<Node>, parent: &mut JSRef<Node>, child: Option<JSRef<Node>>)
-> Fallible<Unrooted<Node>> { -> Fallible<Temporary<Node>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
// Step 1. // Step 1.
match parent.type_id() { match parent.type_id() {
@ -1110,7 +1110,7 @@ impl Node {
Node::insert(node, parent, referenceChild, Unsuppressed); Node::insert(node, parent, referenceChild, Unsuppressed);
// Step 11. // Step 11.
return Ok(Unrooted::new_rooted(node)) return Ok(Temporary::new_rooted(node))
} }
// http://dom.spec.whatwg.org/#concept-node-insert // http://dom.spec.whatwg.org/#concept-node-insert
@ -1203,10 +1203,10 @@ impl Node {
} }
// http://dom.spec.whatwg.org/#concept-node-pre-remove // http://dom.spec.whatwg.org/#concept-node-pre-remove
fn pre_remove(child: &mut JSRef<Node>, parent: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> { fn pre_remove(child: &mut JSRef<Node>, parent: &mut JSRef<Node>) -> Fallible<Temporary<Node>> {
// Step 1. // Step 1.
match child.parent_node() { match child.parent_node() {
Some(ref node) if *node != Unrooted::new_rooted(parent) => return Err(NotFound), Some(ref node) if *node != Temporary::new_rooted(parent) => return Err(NotFound),
_ => () _ => ()
} }
@ -1214,12 +1214,12 @@ impl Node {
Node::remove(child, parent, Unsuppressed); Node::remove(child, parent, Unsuppressed);
// Step 3. // Step 3.
Ok(Unrooted::new_rooted(child)) Ok(Temporary::new_rooted(child))
} }
// http://dom.spec.whatwg.org/#concept-node-remove // http://dom.spec.whatwg.org/#concept-node-remove
fn remove(node: &mut JSRef<Node>, parent: &mut JSRef<Node>, suppress_observers: SuppressObserver) { fn remove(node: &mut JSRef<Node>, parent: &mut JSRef<Node>, suppress_observers: SuppressObserver) {
assert!(node.parent_node().map_or(false, |node_parent| node_parent == Unrooted::new_rooted(parent))); assert!(node.parent_node().map_or(false, |node_parent| node_parent == Temporary::new_rooted(parent)));
// Step 1-5: ranges. // Step 1-5: ranges.
// Step 6-7: mutation observers. // Step 6-7: mutation observers.
@ -1236,7 +1236,7 @@ impl Node {
// http://dom.spec.whatwg.org/#concept-node-clone // http://dom.spec.whatwg.org/#concept-node-clone
pub fn clone(node: &JSRef<Node>, maybe_doc: Option<&JSRef<Document>>, pub fn clone(node: &JSRef<Node>, maybe_doc: Option<&JSRef<Document>>,
clone_children: CloneChildrenFlag) -> Unrooted<Node> { clone_children: CloneChildrenFlag) -> Temporary<Node> {
let roots = RootCollection::new(); let roots = RootCollection::new();
// Step 1. // Step 1.
@ -1349,7 +1349,7 @@ impl Node {
} }
// Step 7. // Step 7.
Unrooted::new_rooted(&*copy) Temporary::new_rooted(&*copy)
} }
/// Sends layout data, if any, back to the script task to be destroyed. /// Sends layout data, if any, back to the script task to be destroyed.
@ -1372,25 +1372,25 @@ pub trait NodeMethods {
fn NodeType(&self) -> u16; fn NodeType(&self) -> u16;
fn NodeName(&self) -> DOMString; fn NodeName(&self) -> DOMString;
fn GetBaseURI(&self) -> Option<DOMString>; fn GetBaseURI(&self) -> Option<DOMString>;
fn GetOwnerDocument(&self) -> Option<Unrooted<Document>>; fn GetOwnerDocument(&self) -> Option<Temporary<Document>>;
fn GetParentNode(&self) -> Option<Unrooted<Node>>; fn GetParentNode(&self) -> Option<Temporary<Node>>;
fn GetParentElement(&self) -> Option<Unrooted<Element>>; fn GetParentElement(&self) -> Option<Temporary<Element>>;
fn HasChildNodes(&self) -> bool; fn HasChildNodes(&self) -> bool;
fn ChildNodes(&mut self) -> Unrooted<NodeList>; fn ChildNodes(&mut self) -> Temporary<NodeList>;
fn GetFirstChild(&self) -> Option<Unrooted<Node>>; fn GetFirstChild(&self) -> Option<Temporary<Node>>;
fn GetLastChild(&self) -> Option<Unrooted<Node>>; fn GetLastChild(&self) -> Option<Temporary<Node>>;
fn GetPreviousSibling(&self) -> Option<Unrooted<Node>>; fn GetPreviousSibling(&self) -> Option<Temporary<Node>>;
fn GetNextSibling(&self) -> Option<Unrooted<Node>>; fn GetNextSibling(&self) -> Option<Temporary<Node>>;
fn GetNodeValue(&self) -> Option<DOMString>; fn GetNodeValue(&self) -> Option<DOMString>;
fn SetNodeValue(&mut self, val: Option<DOMString>) -> ErrorResult; fn SetNodeValue(&mut self, val: Option<DOMString>) -> ErrorResult;
fn GetTextContent(&self) -> Option<DOMString>; fn GetTextContent(&self) -> Option<DOMString>;
fn SetTextContent(&mut self, value: Option<DOMString>) -> ErrorResult; fn SetTextContent(&mut self, value: Option<DOMString>) -> ErrorResult;
fn InsertBefore(&mut self, node: &mut JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Unrooted<Node>>; fn InsertBefore(&mut self, node: &mut JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Temporary<Node>>;
fn AppendChild(&mut self, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>; fn AppendChild(&mut self, node: &mut JSRef<Node>) -> Fallible<Temporary<Node>>;
fn ReplaceChild(&mut self, node: &mut JSRef<Node>, child: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>; fn ReplaceChild(&mut self, node: &mut JSRef<Node>, child: &mut JSRef<Node>) -> Fallible<Temporary<Node>>;
fn RemoveChild(&mut self, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>; fn RemoveChild(&mut self, node: &mut JSRef<Node>) -> Fallible<Temporary<Node>>;
fn Normalize(&mut self); fn Normalize(&mut self);
fn CloneNode(&self, deep: bool) -> Unrooted<Node>; fn CloneNode(&self, deep: bool) -> Temporary<Node>;
fn IsEqualNode(&self, maybe_node: Option<JSRef<Node>>) -> bool; fn IsEqualNode(&self, maybe_node: Option<JSRef<Node>>) -> bool;
fn CompareDocumentPosition(&self, other: &JSRef<Node>) -> u16; fn CompareDocumentPosition(&self, other: &JSRef<Node>) -> u16;
fn Contains(&self, maybe_other: Option<JSRef<Node>>) -> bool; fn Contains(&self, maybe_other: Option<JSRef<Node>>) -> bool;
@ -1443,7 +1443,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-ownerdocument // http://dom.spec.whatwg.org/#dom-node-ownerdocument
fn GetOwnerDocument(&self) -> Option<Unrooted<Document>> { fn GetOwnerDocument(&self) -> Option<Temporary<Document>> {
match self.type_id { match self.type_id {
ElementNodeTypeId(..) | ElementNodeTypeId(..) |
CommentNodeTypeId | CommentNodeTypeId |
@ -1456,18 +1456,18 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-parentnode // http://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Unrooted<Node>> { fn GetParentNode(&self) -> Option<Temporary<Node>> {
self.parent_node.clone().map(|node| Unrooted::new(node)) self.parent_node.clone().map(|node| Temporary::new(node))
} }
// http://dom.spec.whatwg.org/#dom-node-parentelement // http://dom.spec.whatwg.org/#dom-node-parentelement
fn GetParentElement(&self) -> Option<Unrooted<Element>> { fn GetParentElement(&self) -> Option<Temporary<Element>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
self.parent_node.clone() self.parent_node.clone()
.and_then(|parent| { .and_then(|parent| {
let parent = parent.root(&roots); let parent = parent.root(&roots);
ElementCast::to_ref(&*parent).map(|elem| { ElementCast::to_ref(&*parent).map(|elem| {
Unrooted::new_rooted(elem) Temporary::new_rooted(elem)
}) })
}) })
} }
@ -1478,38 +1478,38 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-childnodes // http://dom.spec.whatwg.org/#dom-node-childnodes
fn ChildNodes(&mut self) -> Unrooted<NodeList> { fn ChildNodes(&mut self) -> Temporary<NodeList> {
let roots = RootCollection::new(); let roots = RootCollection::new();
match self.child_list { match self.child_list {
None => (), None => (),
Some(ref list) => return Unrooted::new(list.clone()), Some(ref list) => return Temporary::new(list.clone()),
} }
let doc = self.owner_doc().root(&roots); let doc = self.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots); let window = doc.deref().window.root(&roots);
let child_list = NodeList::new_child_list(&*window, self); let child_list = NodeList::new_child_list(&*window, self);
self.child_list.assign(Some(child_list)); self.child_list.assign(Some(child_list));
Unrooted::new(self.child_list.get_ref().clone()) Temporary::new(self.child_list.get_ref().clone())
} }
// http://dom.spec.whatwg.org/#dom-node-firstchild // http://dom.spec.whatwg.org/#dom-node-firstchild
fn GetFirstChild(&self) -> Option<Unrooted<Node>> { fn GetFirstChild(&self) -> Option<Temporary<Node>> {
self.first_child.clone().map(|node| Unrooted::new(node)) self.first_child.clone().map(|node| Temporary::new(node))
} }
// http://dom.spec.whatwg.org/#dom-node-lastchild // http://dom.spec.whatwg.org/#dom-node-lastchild
fn GetLastChild(&self) -> Option<Unrooted<Node>> { fn GetLastChild(&self) -> Option<Temporary<Node>> {
self.last_child.clone().map(|node| Unrooted::new(node)) self.last_child.clone().map(|node| Temporary::new(node))
} }
// http://dom.spec.whatwg.org/#dom-node-previoussibling // http://dom.spec.whatwg.org/#dom-node-previoussibling
fn GetPreviousSibling(&self) -> Option<Unrooted<Node>> { fn GetPreviousSibling(&self) -> Option<Temporary<Node>> {
self.prev_sibling.clone().map(|node| Unrooted::new(node)) self.prev_sibling.clone().map(|node| Temporary::new(node))
} }
// http://dom.spec.whatwg.org/#dom-node-nextsibling // http://dom.spec.whatwg.org/#dom-node-nextsibling
fn GetNextSibling(&self) -> Option<Unrooted<Node>> { fn GetNextSibling(&self) -> Option<Temporary<Node>> {
self.next_sibling.clone().map(|node| Unrooted::new(node)) self.next_sibling.clone().map(|node| Temporary::new(node))
} }
// http://dom.spec.whatwg.org/#dom-node-nodevalue // http://dom.spec.whatwg.org/#dom-node-nodevalue
@ -1608,17 +1608,17 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-insertbefore // http://dom.spec.whatwg.org/#dom-node-insertbefore
fn InsertBefore(&mut self, node: &mut JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Unrooted<Node>> { fn InsertBefore(&mut self, node: &mut JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Temporary<Node>> {
Node::pre_insert(node, self, child) Node::pre_insert(node, self, child)
} }
// http://dom.spec.whatwg.org/#dom-node-appendchild // http://dom.spec.whatwg.org/#dom-node-appendchild
fn AppendChild(&mut self, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> { fn AppendChild(&mut self, node: &mut JSRef<Node>) -> Fallible<Temporary<Node>> {
Node::pre_insert(node, self, None) Node::pre_insert(node, self, None)
} }
// http://dom.spec.whatwg.org/#concept-node-replace // http://dom.spec.whatwg.org/#concept-node-replace
fn ReplaceChild(&mut self, node: &mut JSRef<Node>, child: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> { fn ReplaceChild(&mut self, node: &mut JSRef<Node>, child: &mut JSRef<Node>) -> Fallible<Temporary<Node>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
// Step 1. // Step 1.
@ -1710,7 +1710,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
// Ok if not caught by previous error checks. // Ok if not caught by previous error checks.
if node.unrooted() == child.unrooted() { if node.unrooted() == child.unrooted() {
return Ok(Unrooted::new_rooted(child)); return Ok(Temporary::new_rooted(child));
} }
// Step 7-8. // Step 7-8.
@ -1744,12 +1744,12 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// Step 15. // Step 15.
Ok(Unrooted::new_rooted(child)) Ok(Temporary::new_rooted(child))
} }
// http://dom.spec.whatwg.org/#dom-node-removechild // http://dom.spec.whatwg.org/#dom-node-removechild
fn RemoveChild(&mut self, node: &mut JSRef<Node>) fn RemoveChild(&mut self, node: &mut JSRef<Node>)
-> Fallible<Unrooted<Node>> { -> Fallible<Temporary<Node>> {
Node::pre_remove(node, self) Node::pre_remove(node, self)
} }
@ -1782,7 +1782,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-clonenode // http://dom.spec.whatwg.org/#dom-node-clonenode
fn CloneNode(&self, deep: bool) -> Unrooted<Node> { fn CloneNode(&self, deep: bool) -> Temporary<Node> {
match deep { match deep {
true => Node::clone(self, None, CloneChildren), true => Node::clone(self, None, CloneChildren),
false => Node::clone(self, None, DoNotCloneChildren) false => Node::clone(self, None, DoNotCloneChildren)
@ -1959,15 +1959,15 @@ impl Reflectable for Node {
} }
} }
pub fn document_from_node<T: NodeBase>(derived: &JSRef<T>) -> Unrooted<Document> { pub fn document_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Document> {
let node: &JSRef<Node> = NodeCast::from_ref(derived); let node: &JSRef<Node> = NodeCast::from_ref(derived);
node.owner_doc() node.owner_doc()
} }
pub fn window_from_node<T: NodeBase>(derived: &JSRef<T>) -> Unrooted<Window> { pub fn window_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Window> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let document = document_from_node(derived).root(&roots); let document = document_from_node(derived).root(&roots);
Unrooted::new(document.deref().window.clone()) Temporary::new(document.deref().window.clone())
} }
impl<'a> VirtualMethods for JSRef<'a, Node> { impl<'a> VirtualMethods for JSRef<'a, Node> {

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::NodeListBinding; use dom::bindings::codegen::BindingDeclarations::NodeListBinding;
use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection}; use dom::bindings::js::{JS, JSRef, Temporary, RootCollection};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::node::{Node, NodeHelpers}; use dom::node::{Node, NodeHelpers};
use dom::window::Window; use dom::window::Window;
@ -32,24 +32,24 @@ impl NodeList {
} }
pub fn new(window: &JSRef<Window>, pub fn new(window: &JSRef<Window>,
list_type: NodeListType) -> Unrooted<NodeList> { list_type: NodeListType) -> Temporary<NodeList> {
reflect_dom_object(~NodeList::new_inherited(window.unrooted(), list_type), reflect_dom_object(~NodeList::new_inherited(window.unrooted(), list_type),
window, NodeListBinding::Wrap) window, NodeListBinding::Wrap)
} }
pub fn new_simple_list(window: &JSRef<Window>, elements: Vec<JSRef<Node>>) -> Unrooted<NodeList> { pub fn new_simple_list(window: &JSRef<Window>, elements: Vec<JSRef<Node>>) -> Temporary<NodeList> {
NodeList::new(window, Simple(elements.iter().map(|element| element.unrooted()).collect())) NodeList::new(window, Simple(elements.iter().map(|element| element.unrooted()).collect()))
} }
pub fn new_child_list(window: &JSRef<Window>, node: &JSRef<Node>) -> Unrooted<NodeList> { pub fn new_child_list(window: &JSRef<Window>, node: &JSRef<Node>) -> Temporary<NodeList> {
NodeList::new(window, Children(node.unrooted())) NodeList::new(window, Children(node.unrooted()))
} }
} }
pub trait NodeListMethods { pub trait NodeListMethods {
fn Length(&self) -> u32; fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<Node>>; fn Item(&self, index: u32) -> Option<Temporary<Node>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Node>>; fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Node>>;
} }
impl<'a> NodeListMethods for JSRef<'a, NodeList> { impl<'a> NodeListMethods for JSRef<'a, NodeList> {
@ -64,20 +64,20 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
} }
} }
fn Item(&self, index: u32) -> Option<Unrooted<Node>> { fn Item(&self, index: u32) -> Option<Temporary<Node>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
match self.list_type { match self.list_type {
_ if index >= self.Length() => None, _ if index >= self.Length() => None,
Simple(ref elems) => Some(Unrooted::new(elems.get(index as uint).clone())), Simple(ref elems) => Some(Temporary::new(elems.get(index as uint).clone())),
Children(ref node) => { Children(ref node) => {
let node = node.root(&roots); let node = node.root(&roots);
node.deref().children().nth(index as uint) node.deref().children().nth(index as uint)
.map(|child| Unrooted::new_rooted(&child)) .map(|child| Temporary::new_rooted(&child))
} }
} }
} }
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Node>> { fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Node>> {
let item = self.Item(index); let item = self.Item(index);
*found = item.is_some(); *found = item.is_some();
item item

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::ProcessingInstructionBinding; use dom::bindings::codegen::BindingDeclarations::ProcessingInstructionBinding;
use dom::bindings::codegen::InheritTypes::ProcessingInstructionDerived; use dom::bindings::codegen::InheritTypes::ProcessingInstructionDerived;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
use dom::document::Document; use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -35,7 +35,7 @@ impl ProcessingInstruction {
} }
} }
pub fn new(target: DOMString, data: DOMString, document: &JSRef<Document>) -> Unrooted<ProcessingInstruction> { pub fn new(target: DOMString, data: DOMString, document: &JSRef<Document>) -> Temporary<ProcessingInstruction> {
let node = ProcessingInstruction::new_inherited(target, data, document.unrooted()); let node = ProcessingInstruction::new_inherited(target, data, document.unrooted());
Node::reflect_node(~node, document, ProcessingInstructionBinding::Wrap) Node::reflect_node(~node, document, ProcessingInstructionBinding::Wrap)
} }

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::codegen::BindingDeclarations::TestBindingBinding; use dom::bindings::codegen::BindingDeclarations::TestBindingBinding;
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
use self::TestBindingBinding::TestEnum; use self::TestBindingBinding::TestEnum;
@ -51,7 +51,7 @@ pub trait TestBindingMethods {
fn SetByteStringAttribute(&self, _: ByteString); fn SetByteStringAttribute(&self, _: ByteString);
fn EnumAttribute(&self) -> TestEnum; fn EnumAttribute(&self) -> TestEnum;
fn SetEnumAttribute(&self, _: TestEnum); fn SetEnumAttribute(&self, _: TestEnum);
fn InterfaceAttribute(&self) -> Unrooted<Blob>; fn InterfaceAttribute(&self) -> Temporary<Blob>;
fn SetInterfaceAttribute(&self, _: &JSRef<Blob>); fn SetInterfaceAttribute(&self, _: &JSRef<Blob>);
fn AnyAttribute(&self, _: *JSContext) -> JSVal; fn AnyAttribute(&self, _: *JSContext) -> JSVal;
fn SetAnyAttribute(&self, _: *JSContext, _: JSVal); fn SetAnyAttribute(&self, _: *JSContext, _: JSVal);
@ -83,7 +83,7 @@ pub trait TestBindingMethods {
fn GetStringAttributeNullable(&self) -> Option<DOMString>; fn GetStringAttributeNullable(&self) -> Option<DOMString>;
fn SetStringAttributeNullable(&self, _: Option<DOMString>); fn SetStringAttributeNullable(&self, _: Option<DOMString>);
fn GetEnumAttributeNullable(&self) -> Option<TestEnum>; fn GetEnumAttributeNullable(&self) -> Option<TestEnum>;
fn GetInterfaceAttributeNullable(&self) -> Option<Unrooted<Blob>>; fn GetInterfaceAttributeNullable(&self) -> Option<Temporary<Blob>>;
fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>); fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>);
fn PassBoolean(&self, _: bool); fn PassBoolean(&self, _: bool);
@ -231,7 +231,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
fn SetByteStringAttribute(&self, _: ByteString) {} fn SetByteStringAttribute(&self, _: ByteString) {}
fn EnumAttribute(&self) -> TestEnum { _empty } fn EnumAttribute(&self) -> TestEnum { _empty }
fn SetEnumAttribute(&self, _: TestEnum) {} fn SetEnumAttribute(&self, _: TestEnum) {}
fn InterfaceAttribute(&self) -> Unrooted<Blob> { fn InterfaceAttribute(&self) -> Temporary<Blob> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
Blob::new(&*window) Blob::new(&*window)
@ -267,7 +267,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") } fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
fn SetStringAttributeNullable(&self, _: Option<DOMString>) {} fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) } fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) }
fn GetInterfaceAttributeNullable(&self) -> Option<Unrooted<Blob>> { fn GetInterfaceAttributeNullable(&self) -> Option<Temporary<Blob>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let window = self.window.root(&roots); let window = self.window.root(&roots);
Some(Blob::new(&(*window))) Some(Blob::new(&(*window)))

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::TextBinding; use dom::bindings::codegen::BindingDeclarations::TextBinding;
use dom::bindings::codegen::InheritTypes::TextDerived; use dom::bindings::codegen::InheritTypes::TextDerived;
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, Temporary};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
use dom::document::Document; use dom::document::Document;
@ -35,12 +35,12 @@ impl Text {
} }
} }
pub fn new(text: DOMString, document: &JSRef<Document>) -> Unrooted<Text> { pub fn new(text: DOMString, document: &JSRef<Document>) -> Temporary<Text> {
let node = Text::new_inherited(text, document.unrooted()); let node = Text::new_inherited(text, document.unrooted());
Node::reflect_node(~node, document, TextBinding::Wrap) Node::reflect_node(~node, document, TextBinding::Wrap)
} }
pub fn Constructor(owner: &JSRef<Window>, text: DOMString) -> Fallible<Unrooted<Text>> { pub fn Constructor(owner: &JSRef<Window>, text: DOMString) -> Fallible<Temporary<Text>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let document = owner.Document().root(&roots); let document = owner.Document().root(&roots);
Ok(Text::new(text.clone(), &*document)) Ok(Text::new(text.clone(), &*document))
@ -48,12 +48,12 @@ impl Text {
} }
pub trait TextMethods { pub trait TextMethods {
fn SplitText(&self, _offset: u32) -> Fallible<Unrooted<Text>>; fn SplitText(&self, _offset: u32) -> Fallible<Temporary<Text>>;
fn GetWholeText(&self) -> Fallible<DOMString>; fn GetWholeText(&self) -> Fallible<DOMString>;
} }
impl<'a> TextMethods for JSRef<'a, Text> { impl<'a> TextMethods for JSRef<'a, Text> {
fn SplitText(&self, _offset: u32) -> Fallible<Unrooted<Text>> { fn SplitText(&self, _offset: u32) -> Fallible<Temporary<Text>> {
fail!("unimplemented") fail!("unimplemented")
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::UIEventBinding; use dom::bindings::codegen::BindingDeclarations::UIEventBinding;
use dom::bindings::codegen::InheritTypes::{EventCast, UIEventDerived}; use dom::bindings::codegen::InheritTypes::{EventCast, UIEventDerived};
use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Unrooted}; use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Temporary};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId}; use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId};
@ -36,7 +36,7 @@ impl UIEvent {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<UIEvent> { pub fn new(window: &JSRef<Window>) -> Temporary<UIEvent> {
reflect_dom_object(~UIEvent::new_inherited(UIEventTypeId), reflect_dom_object(~UIEvent::new_inherited(UIEventTypeId),
window, window,
UIEventBinding::Wrap) UIEventBinding::Wrap)
@ -44,25 +44,25 @@ impl UIEvent {
pub fn Constructor(owner: &JSRef<Window>, pub fn Constructor(owner: &JSRef<Window>,
type_: DOMString, type_: DOMString,
init: &UIEventBinding::UIEventInit) -> Fallible<Unrooted<UIEvent>> { init: &UIEventBinding::UIEventInit) -> Fallible<Temporary<UIEvent>> {
let roots = RootCollection::new(); let roots = RootCollection::new();
let mut ev = UIEvent::new(owner).root(&roots); let mut ev = UIEvent::new(owner).root(&roots);
let view = init.view.as_ref().map(|view| view.root(&roots)); let view = init.view.as_ref().map(|view| view.root(&roots));
ev.InitUIEvent(type_, init.parent.bubbles, init.parent.cancelable, ev.InitUIEvent(type_, init.parent.bubbles, init.parent.cancelable,
view.root_ref(), init.detail); view.root_ref(), init.detail);
Ok(Unrooted::new_rooted(&*ev)) Ok(Temporary::new_rooted(&*ev))
} }
} }
pub trait UIEventMethods { pub trait UIEventMethods {
fn GetView(&self) -> Option<Unrooted<Window>>; fn GetView(&self) -> Option<Temporary<Window>>;
fn Detail(&self) -> i32; fn Detail(&self) -> i32;
fn LayerX(&self) -> i32; fn LayerX(&self) -> i32;
fn LayerY(&self) -> i32; fn LayerY(&self) -> i32;
fn PageX(&self) -> i32; fn PageX(&self) -> i32;
fn PageY(&self) -> i32; fn PageY(&self) -> i32;
fn Which(&self) -> u32; fn Which(&self) -> u32;
fn GetRangeParent(&self) -> Option<Unrooted<Node>>; fn GetRangeParent(&self) -> Option<Temporary<Node>>;
fn RangeOffset(&self) -> i32; fn RangeOffset(&self) -> i32;
fn CancelBubble(&self) -> bool; fn CancelBubble(&self) -> bool;
fn SetCancelBubble(&mut self, _val: bool); fn SetCancelBubble(&mut self, _val: bool);
@ -76,8 +76,8 @@ pub trait UIEventMethods {
} }
impl<'a> UIEventMethods for JSRef<'a, UIEvent> { impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
fn GetView(&self) -> Option<Unrooted<Window>> { fn GetView(&self) -> Option<Temporary<Window>> {
self.view.clone().map(|view| Unrooted::new(view)) self.view.clone().map(|view| Temporary::new(view))
} }
fn Detail(&self) -> i32 { fn Detail(&self) -> i32 {
@ -123,7 +123,7 @@ impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
0 0
} }
fn GetRangeParent(&self) -> Option<Unrooted<Node>> { fn GetRangeParent(&self) -> Option<Temporary<Node>> {
//TODO //TODO
None None
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::ValidityStateBinding; use dom::bindings::codegen::BindingDeclarations::ValidityStateBinding;
use dom::bindings::js::{JS, JSRef, Unrooted}; use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::window::Window; use dom::window::Window;
@ -23,7 +23,7 @@ impl ValidityState {
} }
} }
pub fn new(window: &JSRef<Window>) -> Unrooted<ValidityState> { pub fn new(window: &JSRef<Window>) -> Temporary<ValidityState> {
reflect_dom_object(~ValidityState::new_inherited(window.unrooted()), reflect_dom_object(~ValidityState::new_inherited(window.unrooted()),
window, window,
ValidityStateBinding::Wrap) ValidityStateBinding::Wrap)

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::WindowBinding; use dom::bindings::codegen::BindingDeclarations::WindowBinding;
use dom::bindings::js::{JS, JSRef, Unrooted, OptionalAssignable}; use dom::bindings::js::{JS, JSRef, Temporary, OptionalAssignable};
use dom::bindings::trace::{Traceable, Untraceable}; use dom::bindings::trace::{Traceable, Untraceable};
use dom::bindings::utils::{Reflectable, Reflector}; use dom::bindings::utils::{Reflectable, Reflector};
use dom::browsercontext::BrowserContext; use dom::browsercontext::BrowserContext;
@ -108,7 +108,7 @@ pub struct TimerData {
pub trait WindowMethods { pub trait WindowMethods {
fn Alert(&self, s: DOMString); fn Alert(&self, s: DOMString);
fn Close(&self); fn Close(&self);
fn Document(&self) -> Unrooted<Document>; fn Document(&self) -> Temporary<Document>;
fn Name(&self) -> DOMString; fn Name(&self) -> DOMString;
fn SetName(&self, _name: DOMString); fn SetName(&self, _name: DOMString);
fn Status(&self) -> DOMString; fn Status(&self) -> DOMString;
@ -117,10 +117,10 @@ pub trait WindowMethods {
fn Stop(&self); fn Stop(&self);
fn Focus(&self); fn Focus(&self);
fn Blur(&self); fn Blur(&self);
fn GetFrameElement(&self) -> Option<Unrooted<Element>>; fn GetFrameElement(&self) -> Option<Temporary<Element>>;
fn Location(&mut self) -> Unrooted<Location>; fn Location(&mut self) -> Temporary<Location>;
fn Console(&mut self) -> Unrooted<Console>; fn Console(&mut self) -> Temporary<Console>;
fn Navigator(&mut self) -> Unrooted<Navigator>; fn Navigator(&mut self) -> Temporary<Navigator>;
fn Confirm(&self, _message: DOMString) -> bool; fn Confirm(&self, _message: DOMString) -> bool;
fn Prompt(&self, _message: DOMString, _default: DOMString) -> Option<DOMString>; fn Prompt(&self, _message: DOMString, _default: DOMString) -> Option<DOMString>;
fn Print(&self); fn Print(&self);
@ -129,8 +129,8 @@ pub trait WindowMethods {
fn ClearTimeout(&mut self, handle: i32); fn ClearTimeout(&mut self, handle: i32);
fn SetInterval(&mut self, _cx: *JSContext, callback: JSVal, timeout: i32) -> i32; fn SetInterval(&mut self, _cx: *JSContext, callback: JSVal, timeout: i32) -> i32;
fn ClearInterval(&mut self, handle: i32); fn ClearInterval(&mut self, handle: i32);
fn Window(&self) -> Unrooted<Window>; fn Window(&self) -> Temporary<Window>;
fn Self(&self) -> Unrooted<Window>; fn Self(&self) -> Temporary<Window>;
} }
impl<'a> WindowMethods for JSRef<'a, Window> { impl<'a> WindowMethods for JSRef<'a, Window> {
@ -144,9 +144,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
chan.send(ExitWindowMsg(self.page.id.clone())); chan.send(ExitWindowMsg(self.page.id.clone()));
} }
fn Document(&self) -> Unrooted<Document> { fn Document(&self) -> Temporary<Document> {
let frame = self.page().frame(); let frame = self.page().frame();
Unrooted::new(frame.get_ref().document.clone()) Temporary::new(frame.get_ref().document.clone())
} }
fn Name(&self) -> DOMString { fn Name(&self) -> DOMString {
@ -176,33 +176,33 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
fn Blur(&self) { fn Blur(&self) {
} }
fn GetFrameElement(&self) -> Option<Unrooted<Element>> { fn GetFrameElement(&self) -> Option<Temporary<Element>> {
None None
} }
fn Location(&mut self) -> Unrooted<Location> { fn Location(&mut self) -> Temporary<Location> {
if self.location.is_none() { if self.location.is_none() {
let page = self.deref().page.clone(); let page = self.deref().page.clone();
let location = Location::new(self, page); let location = Location::new(self, page);
self.location.assign(Some(location)); self.location.assign(Some(location));
} }
Unrooted::new(self.location.get_ref().clone()) Temporary::new(self.location.get_ref().clone())
} }
fn Console(&mut self) -> Unrooted<Console> { fn Console(&mut self) -> Temporary<Console> {
if self.console.is_none() { if self.console.is_none() {
let console = Console::new(self); let console = Console::new(self);
self.console.assign(Some(console)); self.console.assign(Some(console));
} }
Unrooted::new(self.console.get_ref().clone()) Temporary::new(self.console.get_ref().clone())
} }
fn Navigator(&mut self) -> Unrooted<Navigator> { fn Navigator(&mut self) -> Temporary<Navigator> {
if self.navigator.is_none() { if self.navigator.is_none() {
let navigator = Navigator::new(self); let navigator = Navigator::new(self);
self.navigator.assign(Some(navigator)); self.navigator.assign(Some(navigator));
} }
Unrooted::new(self.navigator.get_ref().clone()) Temporary::new(self.navigator.get_ref().clone())
} }
fn Confirm(&self, _message: DOMString) -> bool { fn Confirm(&self, _message: DOMString) -> bool {
@ -241,11 +241,11 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
self.ClearTimeout(handle); self.ClearTimeout(handle);
} }
fn Window(&self) -> Unrooted<Window> { fn Window(&self) -> Temporary<Window> {
Unrooted::new_rooted(self) Temporary::new_rooted(self)
} }
fn Self(&self) -> Unrooted<Window> { fn Self(&self) -> Temporary<Window> {
self.Window() self.Window()
} }
} }
@ -342,7 +342,7 @@ impl Window {
script_chan: ScriptChan, script_chan: ScriptChan,
compositor: ~ScriptListener, compositor: ~ScriptListener,
image_cache_task: ImageCacheTask) image_cache_task: ImageCacheTask)
-> Unrooted<Window> { -> Temporary<Window> {
let win = ~Window { let win = ~Window {
eventtarget: EventTarget::new_inherited(WindowTypeId), eventtarget: EventTarget::new_inherited(WindowTypeId),
script_chan: script_chan, script_chan: script_chan,
@ -357,6 +357,6 @@ impl Window {
browser_context: None, browser_context: None,
}; };
Unrooted::new(WindowBinding::Wrap(cx, win)) Temporary::new(WindowBinding::Wrap(cx, win))
} }
} }

Some files were not shown because too many files have changed in this diff Show more