Address review comments.

This commit is contained in:
Josh Matthews 2014-04-18 00:12:52 -04:00
parent 7b3e6d1f21
commit 0f2d0b1dc3
99 changed files with 388 additions and 380 deletions

View file

@ -17,16 +17,16 @@ pub struct AttrList {
}
impl AttrList {
pub fn new_inherited(window: JS<Window>, elem: JS<Element>) -> AttrList {
pub fn new_inherited(window: &JSRef<Window>, elem: &JSRef<Element>) -> AttrList {
AttrList {
reflector_: Reflector::new(),
window: window,
owner: elem
window: window.unrooted(),
owner: elem.unrooted(),
}
}
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, elem),
window, AttrListBinding::Wrap)
}
}
@ -37,7 +37,7 @@ pub trait AttrListMethods {
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> {
fn Length(&self) -> u32 {
self.owner.root().attrs.len() as u32
}

View file

@ -558,15 +558,6 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
else:
assert(defaultValue is None)
#if type.isGeckoInterface() and not type.unroll().inner.isCallback():
# if type.nullable() or isOptional:
#
# else:
#
# templateBody = CGList([CGGeneric(templateBody),
# CGGeneric("\n"),
# CGGeneric(rootBody)]).define()
return templateBody
assert not (isEnforceRange and isClamp) # These are mutually exclusive
@ -901,12 +892,7 @@ def instantiateJSToNativeConversionTemplate(templateTuple, replacements,
type = declType.define() if declType else None
if type and 'JS<' in type:
if dealWithOptional or 'Option<' in type:
rootBody = """let ${simpleDeclName} = ${declName}.as_ref().map(|inner| {
inner.root() //second root code
});"""
else:
rootBody = "let ${simpleDeclName} = ${declName}.root(); //third root code"
rootBody = "let ${simpleDeclName} = ${declName}.root();"
result.append(CGGeneric(string.Template(rootBody).substitute(replacements)))
result.append(CGGeneric(""))
@ -1725,8 +1711,6 @@ class Argument():
A class for outputting the type and name of an argument
"""
def __init__(self, argType, name, default=None, mutable=False):
if argType and 'JS<' in argType:
argType = argType.replace('JS<', 'JSRef<')
self.argType = argType
self.name = name
self.default = default
@ -4321,7 +4305,7 @@ class CGBindingRoot(CGThing):
'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}',
'dom::types::*',
'dom::bindings',
'dom::bindings::js::{JS, JSRef, RootedReference, Temporary, OptionalRootable}',
'dom::bindings::js::{JS, JSRef, RootedReference, Temporary, OptionalRootable, OptionalRootedRootable}',
'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}',
'dom::bindings::utils::{ConstantSpec, cx_for_dom_object, Default}',
'dom::bindings::utils::{dom_object_slot, DOM_OBJECT_SLOT, DOMClass}',
@ -4603,7 +4587,7 @@ class CGNativeMember(ClassMethod):
else:
typeDecl = "%s"
descriptor = self.descriptorProvider.getDescriptor(iface.identifier.name)
return (typeDecl % descriptor.nativeType,
return (typeDecl % descriptor.argumentType,
False, False)
if type.isSpiderMonkeyInterface():

View file

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

View file

@ -2,6 +2,43 @@
* 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/. */
/// The DOM is made up of Rust types whose lifetime is entirely controlled by the whims of
/// the SpiderMonkey garbage collector. The types in this module are designed to ensure
/// that any interactions with said Rust types only occur on values that will remain alive
/// the entire time.
///
/// Here is a brief overview of the important types:
/// - JSRef<T>: a freely-copyable reference to a rooted value.
/// - JS<T>: a pointer to JS-owned memory that can automatically be traced by the GC when
/// encountered as a field of a Rust structure.
/// - Temporary<T>: a value that will remain rooted for the duration of its lifetime.
///
/// The rule of thumb is as follows:
/// - All methods return Temporary<T>, to ensure the value remains alive until it is stored
/// somewhere that is reachable by the GC.
/// - All functions take &JSRef<T> arguments, to ensure that they will remain uncollected for
/// the duration of their usage.
/// - All types contain JS<T> fields and derive the Encodable trait, to ensure that they are
/// transitively marked as reachable by the GC if the enclosing value is reachable.
/// - All methods for type T are implemented for JSRef<T>, to ensure that the self value
/// will not be collected for the duration of the method call.
///
/// Both Temporary<T> and JS<T> do not allow access to their inner value without explicitly
/// creating a stack-based root via the `root` method. This returns a Root<T>, which causes
/// the JS-owned value to be uncollectable for the duration of the Root type's lifetime.
/// A JSRef<T> can be obtained from a Root<T> either by dereferencing the Root<T> (`*rooted`)
/// or explicitly calling the `root_ref` method. These JSRef<T> values are not allowed to
/// outlive their originating Root<T>, to ensure that all interactions with the enclosed value
/// only occur when said value is uncollectable, and will cause static lifetime errors if
/// misused.
///
/// Other miscellaneous helper traits:
/// - OptionalRootable and OptionalRootedRootable: make rooting Option values easy via a `root` method
/// - ResultRootable: make rooting successful Result values easy
/// - TemporaryPushable: allows mutating vectors of JS<T> with new elements of JSRef/Temporary
/// - OptionalSettable: allows assigning Option values of JSRef/Temporary to fields of Option<JS<T>>
/// - RootedReference: makes obtaining an Option<JSRef<T>> from an Option<Root<T>> easy
use dom::bindings::utils::{Reflector, Reflectable, cx_for_dom_object};
use dom::window::Window;
use js::jsapi::{JSObject, JSContext, JS_AddObjectRoot, JS_RemoveObjectRoot};
@ -15,7 +52,7 @@ use std::local_data;
/// A type that represents a JS-owned value that is rooted for the lifetime of this value.
/// Importantly, it requires explicit rooting in order to interact with the inner value.
/// 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 `OptionalSettable::assign` (for Option<JS<T>> fields).
pub struct Temporary<T> {
inner: JS<T>,
}
@ -49,7 +86,7 @@ impl<T: Reflectable> Temporary<T> {
}
/// Create a new Temporary value from a rooted value.
pub fn new_rooted<'a>(root: &JSRef<'a, T>) -> Temporary<T> {
pub fn from_rooted<'a>(root: &JSRef<'a, T>) -> Temporary<T> {
Temporary::new(root.unrooted())
}
@ -182,39 +219,38 @@ impl<'a, 'b, T: Reflectable> RootedReference<T> for Option<Root<'a, 'b, T>> {
}
}
// This trait should never be public; it allows access to unrooted values, and is thus
// easy to misuse.
/// Trait that allows extracting a JS<T> value from a variety of rooting-related containers,
/// which in general is an unsafe operation since they can outlive the rooted lifetime of the
/// original value.
/*definitely not public*/ trait Assignable<T> {
fn get_js(&self) -> JS<T>;
unsafe fn get_js(&self) -> JS<T>;
}
impl<T> Assignable<T> for JS<T> {
fn get_js(&self) -> JS<T> {
unsafe fn get_js(&self) -> JS<T> {
self.clone()
}
}
impl<'a, T> Assignable<T> for JSRef<'a, T> {
fn get_js(&self) -> JS<T> {
unsafe fn get_js(&self) -> JS<T> {
self.unrooted()
}
}
// Assignable should not be exposed publically, since it's used to
// extract unrooted values in a safe way WHEN USED CORRECTLY.
impl<T: Reflectable> Assignable<T> for Temporary<T> {
fn get_js(&self) -> JS<T> {
unsafe { self.inner() }
unsafe fn get_js(&self) -> JS<T> {
self.inner()
}
}
pub trait OptionalAssignable<T> {
pub trait OptionalSettable<T> {
fn assign(&mut self, val: Option<T>);
}
impl<T: Assignable<U>, U: Reflectable> OptionalAssignable<T> for Option<JS<U>> {
impl<T: Assignable<U>, U: Reflectable> OptionalSettable<T> for Option<JS<U>> {
fn assign(&mut self, val: Option<T>) {
*self = val.map(|val| val.get_js());
*self = val.map(|val| unsafe { val.get_js() });
}
}
@ -252,12 +288,17 @@ impl<T: Reflectable, U> ResultRootable<T, U> for Result<Temporary<T>, U> {
/// 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.
pub trait TemporaryPushable<T> {
fn push_unrooted(&mut self, val: Temporary<T>);
fn push_unrooted(&mut self, val: &T);
fn insert_unrooted(&mut self, index: uint, val: &T);
}
impl<T: Reflectable> TemporaryPushable<T> for Vec<JS<T>> {
fn push_unrooted(&mut self, val: Temporary<T>) {
unsafe { self.push(val.inner()) };
impl<T: Assignable<U>, U: Reflectable> TemporaryPushable<T> for Vec<JS<U>> {
fn push_unrooted(&mut self, val: &T) {
self.push(unsafe { val.get_js() });
}
fn insert_unrooted(&mut self, index: uint, val: &T) {
self.insert(index, unsafe { val.get_js() });
}
}
@ -277,26 +318,16 @@ impl RootCollection {
Root::new(self, unrooted)
}
fn root<'a, 'b, T: Reflectable>(&self, unrooted: &Root<'a, 'b, T>) {
self.root_raw(unrooted.js_ptr);
}
/// Root a raw JS pointer.
pub fn root_raw(&self, unrooted: *JSObject) {
fn root<'a, 'b, T: Reflectable>(&self, untracked: &Root<'a, 'b, T>) {
let mut roots = self.roots.borrow_mut();
roots.push(unrooted);
debug!(" rooting {:?}", unrooted);
roots.push(untracked.js_ptr);
debug!(" rooting {:?}", untracked.js_ptr);
}
fn unroot<'a, 'b, T: Reflectable>(&self, rooted: &Root<'a, 'b, T>) {
self.unroot_raw(rooted.js_ptr);
}
/// Unroot a raw JS pointer. Must occur in reverse order to its rooting.
pub fn unroot_raw(&self, rooted: *JSObject) {
let mut roots = self.roots.borrow_mut();
debug!("unrooting {:?} (expecting {:?}", roots.last().unwrap(), rooted);
assert!(*roots.last().unwrap() == rooted);
debug!("unrooting {:?} (expecting {:?}", roots.last().unwrap(), rooted.js_ptr);
assert!(*roots.last().unwrap() == rooted.js_ptr);
roots.pop().unwrap();
}
}

View file

@ -412,6 +412,9 @@ impl Reflector {
self.object = object;
}
/// Return a pointer to the memory location at which the JS reflector object is stored.
/// Used by Temporary values to root the reflector, as required by the JSAPI rooting
/// APIs.
pub fn rootable(&self) -> **JSObject {
&self.object as **JSObject
}

View file

@ -16,15 +16,15 @@ pub struct Blob {
}
impl Blob {
pub fn new_inherited(window: JS<Window>) -> Blob {
pub fn new_inherited(window: &JSRef<Window>) -> Blob {
Blob {
reflector_: Reflector::new(),
window: window
window: window.unrooted()
}
}
pub fn new(window: &JSRef<Window>) -> Temporary<Blob> {
reflect_dom_object(~Blob::new_inherited(window.unrooted()),
reflect_dom_object(~Blob::new_inherited(window),
window,
BlobBinding::Wrap)
}

View file

@ -5,7 +5,7 @@
//! DOM bindings for `CharacterData`.
use dom::bindings::codegen::InheritTypes::CharacterDataDerived;
use dom::bindings::js::{JS, JSRef};
use dom::bindings::js::JSRef;
use dom::bindings::error::{Fallible, ErrorResult, IndexSize};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::document::Document;
@ -31,7 +31,7 @@ impl CharacterDataDerived for EventTarget {
}
impl CharacterData {
pub fn new_inherited(id: NodeTypeId, data: DOMString, document: JS<Document>) -> CharacterData {
pub fn new_inherited(id: NodeTypeId, data: DOMString, document: &JSRef<Document>) -> CharacterData {
CharacterData {
node: Node::new_inherited(id, document),
data: data

View file

@ -19,7 +19,7 @@ pub struct ClientRect {
}
impl ClientRect {
pub fn new_inherited(window: JS<Window>,
pub fn new_inherited(window: &JSRef<Window>,
top: Au, bottom: Au,
left: Au, right: Au) -> ClientRect {
ClientRect {
@ -28,14 +28,14 @@ impl ClientRect {
left: left.to_nearest_px() as f32,
right: right.to_nearest_px() as f32,
reflector_: Reflector::new(),
window: window,
window: window.unrooted(),
}
}
pub fn new(window: &JSRef<Window>,
top: Au, bottom: Au,
left: Au, right: Au) -> Temporary<ClientRect> {
let rect = ClientRect::new_inherited(window.unrooted(), top, bottom, left, right);
let rect = ClientRect::new_inherited(window, top, bottom, left, right);
reflect_dom_object(~rect, window, ClientRectBinding::Wrap)
}
}

View file

@ -16,18 +16,18 @@ pub struct ClientRectList {
}
impl ClientRectList {
pub fn new_inherited(window: JS<Window>,
pub fn new_inherited(window: &JSRef<Window>,
rects: Vec<JSRef<ClientRect>>) -> ClientRectList {
ClientRectList {
reflector_: Reflector::new(),
rects: rects.iter().map(|rect| rect.unrooted()).collect(),
window: window,
window: window.unrooted(),
}
}
pub fn new(window: &JSRef<Window>,
rects: Vec<JSRef<ClientRect>>) -> Temporary<ClientRectList> {
reflect_dom_object(~ClientRectList::new_inherited(window.unrooted(), rects),
reflect_dom_object(~ClientRectList::new_inherited(window, rects),
window, ClientRectListBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::InheritTypes::CommentDerived;
use dom::bindings::codegen::BindingDeclarations::CommentBinding;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::Fallible;
use dom::characterdata::CharacterData;
use dom::document::Document;
@ -29,14 +29,14 @@ impl CommentDerived for EventTarget {
}
impl Comment {
pub fn new_inherited(text: DOMString, document: JS<Document>) -> Comment {
pub fn new_inherited(text: DOMString, document: &JSRef<Document>) -> Comment {
Comment {
characterdata: CharacterData::new_inherited(CommentNodeTypeId, text, document)
}
}
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);
Node::reflect_node(~node, document, CommentBinding::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::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast};
use dom::bindings::codegen::BindingDeclarations::DocumentBinding;
use dom::bindings::js::{JS, JSRef, Temporary, OptionalAssignable};
use dom::bindings::js::{JS, JSRef, Temporary, OptionalSettable, TemporaryPushable};
use dom::bindings::js::OptionalRootable;
use dom::bindings::trace::Untraceable;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
@ -160,7 +160,7 @@ impl<'a> DocumentHelpers for JSRef<'a, Document> {
let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&node);
match elem {
Some(elem) => {
if elements.get(head) == &elem.unrooted() {
if &*elements.get(head).root() == elem {
head = head + 1;
}
if new_node == &node || head == elements.len() {
@ -170,19 +170,21 @@ impl<'a> DocumentHelpers for JSRef<'a, Document> {
None => {}
}
}
elements.insert(head, element.unrooted());
elements.insert_unrooted(head, element);
return;
},
None => (),
}
self.idmap.insert(id, vec!(element.unrooted()));
let mut elements = vec!();
elements.push_unrooted(element);
self.idmap.insert(id, elements);
}
}
impl Document {
pub fn reflect_document(document: ~Document,
window: &JSRef<Window>,
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~Document) -> JS<Document>)
window: &JSRef<Window>,
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~Document) -> JS<Document>)
-> Temporary<Document> {
assert!(document.reflector().get_jsobject().is_null());
let mut raw_doc = reflect_dom_object(document, window, wrap_fn).root();
@ -191,10 +193,10 @@ impl Document {
let mut doc_alias = raw_doc.clone();
let node: &mut JSRef<Node> = NodeCast::from_mut_ref(&mut doc_alias);
node.set_owner_doc(&*raw_doc);
Temporary::new_rooted(&*raw_doc)
Temporary::from_rooted(&*raw_doc)
}
pub fn new_inherited(window: JS<Window>,
pub fn new_inherited(window: &JSRef<Window>,
url: Option<Url>,
is_html_document: IsHTMLDocument,
content_type: Option<DOMString>) -> Document {
@ -203,7 +205,7 @@ impl Document {
Document {
node: Node::new_without_doc(DocumentNodeTypeId),
reflector_: Reflector::new(),
window: window,
window: window.unrooted(),
idmap: HashMap::new(),
implementation: None,
content_type: match content_type {
@ -230,7 +232,7 @@ impl 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, url, doctype, content_type);
Document::reflect_document(~document, window, DocumentBinding::Wrap)
}
}
@ -274,7 +276,7 @@ impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
self.GetDocumentElement().root().filtered(|root| {
root.node.type_id == ElementNodeTypeId(HTMLHtmlElementTypeId)
}).map(|elem| {
Temporary::new_rooted(HTMLHtmlElementCast::to_ref(&*elem).unwrap())
Temporary::from_rooted(HTMLHtmlElementCast::to_ref(&*elem).unwrap())
})
}
}
@ -364,14 +366,14 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
child.is_doctype()
}).map(|node| {
let doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(&node).unwrap();
Temporary::new(doctype.unrooted())
Temporary::from_rooted(doctype)
})
}
// http://dom.spec.whatwg.org/#dom-document-documentelement
fn GetDocumentElement(&self) -> Option<Temporary<Element>> {
let node: &JSRef<Node> = NodeCast::from_ref(self);
node.child_elements().next().map(|elem| Temporary::new_rooted(&elem))
node.child_elements().next().map(|elem| Temporary::from_rooted(&elem))
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagname
@ -522,7 +524,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
Node::adopt(node, self);
// Step 3.
Ok(Temporary::new_rooted(node))
Ok(Temporary::from_rooted(node))
}
// http://dom.spec.whatwg.org/#dom-document-createevent
@ -604,7 +606,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
node.children().find(|child| {
child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId)
}).map(|node| {
Temporary::new_rooted(HTMLHeadElementCast::to_ref(&node).unwrap())
Temporary::from_rooted(HTMLHeadElementCast::to_ref(&node).unwrap())
})
})
}
@ -621,7 +623,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
_ => false
}
}).map(|node| {
Temporary::new_rooted(HTMLElementCast::to_ref(&node).unwrap())
Temporary::from_rooted(HTMLElementCast::to_ref(&node).unwrap())
})
})
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::InheritTypes::{DocumentFragmentDerived, NodeCast};
use dom::bindings::codegen::BindingDeclarations::DocumentFragmentBinding;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::Fallible;
use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -28,14 +28,14 @@ impl DocumentFragmentDerived for EventTarget {
impl DocumentFragment {
/// Creates a new DocumentFragment.
pub fn new_inherited(document: JS<Document>) -> DocumentFragment {
pub fn new_inherited(document: &JSRef<Document>) -> DocumentFragment {
DocumentFragment {
node: Node::new_inherited(DocumentFragmentNodeTypeId, document),
}
}
pub fn new(document: &JSRef<Document>) -> Temporary<DocumentFragment> {
let node = DocumentFragment::new_inherited(document.unrooted());
let node = DocumentFragment::new_inherited(document);
Node::reflect_node(~node, document, DocumentFragmentBinding::Wrap)
}

View file

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

View file

@ -26,15 +26,15 @@ pub struct DOMImplementation {
}
impl DOMImplementation {
pub fn new_inherited(owner: JS<Window>) -> DOMImplementation {
pub fn new_inherited(owner: &JSRef<Window>) -> DOMImplementation {
DOMImplementation {
owner: owner,
owner: owner.unrooted(),
reflector_: Reflector::new(),
}
}
pub fn new(owner: &JSRef<Window>) -> Temporary<DOMImplementation> {
reflect_dom_object(~DOMImplementation::new_inherited(owner.unrooted()), owner,
reflect_dom_object(~DOMImplementation::new_inherited(owner), owner,
DOMImplementationBinding::Wrap)
}
}
@ -115,7 +115,7 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// FIXME: https://github.com/mozilla/servo/issues/1522
// Step 7.
Ok(Temporary::new_rooted(&*doc))
Ok(Temporary::from_rooted(&*doc))
}
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
@ -167,6 +167,6 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// FIXME: https://github.com/mozilla/servo/issues/1522
// Step 9.
Temporary::new_rooted(&*doc)
Temporary::from_rooted(&*doc)
}
}

View file

@ -18,15 +18,15 @@ pub struct DOMParser {
}
impl DOMParser {
pub fn new_inherited(owner: JS<Window>) -> DOMParser {
pub fn new_inherited(owner: &JSRef<Window>) -> DOMParser {
DOMParser {
owner: owner,
owner: owner.unrooted(),
reflector_: Reflector::new()
}
}
pub fn new(owner: &JSRef<Window>) -> Temporary<DOMParser> {
reflect_dom_object(~DOMParser::new_inherited(owner.unrooted()), owner,
reflect_dom_object(~DOMParser::new_inherited(owner), owner,
DOMParserBinding::Wrap)
}

View file

@ -9,7 +9,7 @@ use dom::attrlist::AttrList;
use dom::bindings::codegen::BindingDeclarations::ElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, Temporary, TemporaryPushable};
use dom::bindings::js::{OptionalAssignable, OptionalRootable, Root};
use dom::bindings::js::{OptionalSettable, OptionalRootable, Root};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::bindings::error::{ErrorResult, Fallible, NamespaceError, InvalidCharacter};
use dom::bindings::utils::{QName, Name, InvalidXMLName, xml_name_type};
@ -141,7 +141,7 @@ pub enum ElementTypeId {
//
impl Element {
pub fn new_inherited(type_id: ElementTypeId, local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: JS<Document>) -> Element {
pub fn new_inherited(type_id: ElementTypeId, local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: &JSRef<Document>) -> Element {
Element {
node: Node::new_inherited(ElementNodeTypeId(type_id), document),
local_name: local_name,
@ -154,7 +154,7 @@ impl 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);
Node::reflect_node(~element, document, ElementBinding::Wrap)
}
}
@ -230,11 +230,11 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
if self.html_element_in_html_document() {
self.get().attrs.iter().map(|attr| attr.root()).find(|attr| {
name.to_ascii_lower() == attr.local_name && attr.namespace == namespace
}).map(|x| Temporary::new_rooted(&*x))
}).map(|x| Temporary::from_rooted(&*x))
} else {
self.get().attrs.iter().map(|attr| attr.root()).find(|attr| {
name == attr.local_name && attr.namespace == namespace
}).map(|x| Temporary::new_rooted(&*x))
}).map(|x| Temporary::from_rooted(&*x))
}
}
@ -282,7 +282,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
let window = window_from_node(self).root();
let attr = Attr::new(&*window, local_name.clone(), value.clone(),
name, namespace.clone(), prefix, self);
self.get_mut().attrs.push_unrooted(attr);
self.get_mut().attrs.push_unrooted(&attr);
(self.get().attrs.len() - 1, FirstSetAttr)
}
};

View file

@ -91,7 +91,7 @@ impl Event {
init: &EventBinding::EventInit) -> Fallible<Temporary<Event>> {
let mut ev = Event::new(global).root();
ev.InitEvent(type_, init.bubbles, init.cancelable);
Ok(Temporary::new_rooted(&*ev))
Ok(Temporary::from_rooted(&*ev))
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::callback::ReportExceptions;
use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, NodeDerived};
use dom::bindings::js::{JSRef, OptionalAssignable, Root};
use dom::bindings::js::{JSRef, OptionalSettable, Root};
use dom::eventtarget::{Capturing, Bubbling, EventTarget};
use dom::event::{Event, PhaseAtTarget, PhaseNone, PhaseBubbling, PhaseCapturing, EventMethods};
use dom::node::{Node, NodeHelpers};

View file

@ -28,17 +28,17 @@ pub struct FormData {
}
impl FormData {
pub fn new_inherited(form: Option<JSRef<HTMLFormElement>>, window: JS<Window>) -> FormData {
pub fn new_inherited(form: Option<JSRef<HTMLFormElement>>, window: &JSRef<Window>) -> FormData {
FormData {
data: HashMap::new(),
reflector_: Reflector::new(),
window: window,
window: window.unrooted(),
form: form.map(|form| form.unrooted())
}
}
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), window, FormDataBinding::Wrap)
}
pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAnchorElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLAnchorElementTypeId;
@ -28,14 +28,14 @@ impl HTMLAnchorElementDerived for EventTarget {
}
impl HTMLAnchorElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLAnchorElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLAnchorElement {
HTMLAnchorElement {
htmlelement: HTMLElement::new_inherited(HTMLAnchorElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLAnchorElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAppletElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAppletElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLAppletElementTypeId;
@ -28,14 +28,14 @@ impl HTMLAppletElementDerived for EventTarget {
}
impl HTMLAppletElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLAppletElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLAppletElement {
HTMLAppletElement {
htmlelement: HTMLElement::new_inherited(HTMLAppletElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLAppletElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAreaElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAreaElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLAreaElementTypeId;
@ -28,14 +28,14 @@ impl HTMLAreaElementDerived for EventTarget {
}
impl HTMLAreaElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLAreaElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLAreaElement {
HTMLAreaElement {
htmlelement: HTMLElement::new_inherited(HTMLAreaElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLAreaElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLAudioElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLAudioElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLAudioElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLAudioElementDerived for EventTarget {
}
impl HTMLAudioElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLAudioElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLAudioElement {
HTMLAudioElement {
htmlmediaelement: HTMLMediaElement::new_inherited(HTMLAudioElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLAudioElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLBaseElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBaseElementDerived;
use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLBaseElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -28,14 +28,14 @@ impl HTMLBaseElementDerived for EventTarget {
}
impl HTMLBaseElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLBaseElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLBaseElement {
HTMLBaseElement {
htmlelement: HTMLElement::new_inherited(HTMLBaseElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLBaseElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLBodyElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBodyElementDerived;
use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLBodyElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -28,14 +28,14 @@ impl HTMLBodyElementDerived for EventTarget {
}
impl HTMLBodyElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLBodyElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLBodyElement {
HTMLBodyElement {
htmlelement: HTMLElement::new_inherited(HTMLBodyElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLBodyElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLBRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBRElementDerived;
use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLBRElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -28,14 +28,14 @@ impl HTMLBRElementDerived for EventTarget {
}
impl HTMLBRElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLBRElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLBRElement {
HTMLBRElement {
htmlelement: HTMLElement::new_inherited(HTMLBRElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLBRElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLButtonElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLButtonElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLButtonElementTypeId;
@ -30,14 +30,14 @@ impl HTMLButtonElementDerived for EventTarget {
}
impl HTMLButtonElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLButtonElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLButtonElement {
HTMLButtonElement {
htmlelement: HTMLElement::new_inherited(HTMLButtonElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLButtonElementBinding::Wrap)
}
}
@ -67,7 +67,6 @@ pub trait HTMLButtonElementMethods {
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Temporary<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
fn CheckValidity(&self) -> bool;
@ -171,9 +170,6 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
ValidityState::new(&*window)
}
fn SetValidity(&mut self, _validity: JS<ValidityState>) {
}
fn ValidationMessage(&self) -> DOMString {
~""
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLCanvasElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLCanvasElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::{ErrorResult};
use dom::document::Document;
use dom::element::HTMLCanvasElementTypeId;
@ -28,14 +28,14 @@ impl HTMLCanvasElementDerived for EventTarget {
}
impl HTMLCanvasElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLCanvasElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLCanvasElement {
HTMLCanvasElement {
htmlelement: HTMLElement::new_inherited(HTMLCanvasElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLCanvasElementBinding::Wrap)
}
}

View file

@ -38,16 +38,16 @@ pub struct HTMLCollection {
}
impl HTMLCollection {
pub fn new_inherited(window: JS<Window>, collection: CollectionTypeId) -> HTMLCollection {
pub fn new_inherited(window: &JSRef<Window>, collection: CollectionTypeId) -> HTMLCollection {
HTMLCollection {
collection: collection,
reflector_: Reflector::new(),
window: window,
window: window.unrooted(),
}
}
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, collection),
window, HTMLCollectionBinding::Wrap)
}
}
@ -159,7 +159,7 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
})
.nth(index as uint)
.clone()
.map(|elem| Temporary::new_rooted(&elem))
.map(|elem| Temporary::from_rooted(&elem))
}
}
}
@ -179,7 +179,7 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
.find(|elem| {
elem.get_string_attribute("name") == key ||
elem.get_string_attribute("id") == key })
.map(|maybe_elem| Temporary::new_rooted(&*maybe_elem)),
.map(|maybe_elem| Temporary::from_rooted(&*maybe_elem)),
Live(ref root, ref filter) => {
let root = root.root();
root.deref().traverse_preorder()
@ -191,7 +191,7 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
.find(|elem| {
elem.get_string_attribute("name") == key ||
elem.get_string_attribute("id") == key })
.map(|maybe_elem| Temporary::new_rooted(&maybe_elem))
.map(|maybe_elem| Temporary::from_rooted(&maybe_elem))
}
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDataElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDataElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLDataElementTypeId;
@ -28,14 +28,14 @@ impl HTMLDataElementDerived for EventTarget {
}
impl HTMLDataElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLDataElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLDataElement {
HTMLDataElement {
htmlelement: HTMLElement::new_inherited(HTMLDataElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLDataElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDataListElementBinding;
use dom::bindings::codegen::InheritTypes::{HTMLDataListElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::{Element, HTMLDataListElementTypeId};
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -28,14 +28,14 @@ impl HTMLDataListElementDerived for EventTarget {
}
impl HTMLDataListElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLDataListElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLDataListElement {
HTMLDataListElement {
htmlelement: HTMLElement::new_inherited(HTMLDataListElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLDataListElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDirectoryElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDirectoryElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLDirectoryElementTypeId;
@ -28,14 +28,14 @@ impl HTMLDirectoryElementDerived for EventTarget {
}
impl HTMLDirectoryElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLDirectoryElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLDirectoryElement {
HTMLDirectoryElement {
htmlelement: HTMLElement::new_inherited(HTMLDirectoryElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLDirectoryElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDivElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDivElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLDivElementTypeId;
@ -28,14 +28,14 @@ impl HTMLDivElementDerived for EventTarget {
}
impl HTMLDivElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLDivElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLDivElement {
HTMLDivElement {
htmlelement: HTMLElement::new_inherited(HTMLDivElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLDivElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLDListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDListElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLDListElementTypeId;
@ -28,14 +28,14 @@ impl HTMLDListElementDerived for EventTarget {
}
impl HTMLDListElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLDListElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLDListElement {
HTMLDListElement {
htmlelement: HTMLElement::new_inherited(HTMLDListElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLDListElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLElementBinding;
use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::bindings::codegen::InheritTypes::HTMLElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document;
use dom::element::{Element, ElementTypeId, HTMLElementTypeId};
@ -33,14 +33,14 @@ impl HTMLElementDerived for EventTarget {
}
impl HTMLElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: JS<Document>) -> HTMLElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: &JSRef<Document>) -> HTMLElement {
HTMLElement {
element: Element::new_inherited(type_id, tag_name, namespace::HTML, None, document)
}
}
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);
Node::reflect_node(~element, document, HTMLElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLEmbedElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLEmbedElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLEmbedElementTypeId;
@ -28,14 +28,14 @@ impl HTMLEmbedElementDerived for EventTarget {
}
impl HTMLEmbedElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLEmbedElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLEmbedElement {
HTMLEmbedElement {
htmlelement: HTMLElement::new_inherited(HTMLEmbedElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLEmbedElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFieldSetElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFieldSetElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{Element, HTMLFieldSetElementTypeId};
@ -31,14 +31,14 @@ impl HTMLFieldSetElementDerived for EventTarget {
}
impl HTMLFieldSetElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLFieldSetElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLFieldSetElement {
HTMLFieldSetElement {
htmlelement: HTMLElement::new_inherited(HTMLFieldSetElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLFieldSetElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFontElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFontElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLFontElementTypeId;
@ -28,14 +28,14 @@ impl HTMLFontElementDerived for EventTarget {
}
impl HTMLFontElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLFontElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLFontElement {
HTMLFontElement {
htmlelement: HTMLElement::new_inherited(HTMLFontElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLFontElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFormElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{Element, HTMLFormElementTypeId};
@ -29,14 +29,14 @@ impl HTMLFormElementDerived for EventTarget {
}
impl HTMLFormElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLFormElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLFormElement {
HTMLFormElement {
htmlelement: HTMLElement::new_inherited(HTMLFormElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLFormElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFrameElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrameElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLFrameElementTypeId;
@ -29,14 +29,14 @@ impl HTMLFrameElementDerived for EventTarget {
}
impl HTMLFrameElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLFrameElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLFrameElement {
HTMLFrameElement {
htmlelement: HTMLElement::new_inherited(HTMLFrameElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLFrameElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLFrameSetElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrameSetElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLFrameSetElementTypeId;
@ -28,14 +28,14 @@ impl HTMLFrameSetElementDerived for EventTarget {
}
impl HTMLFrameSetElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLFrameSetElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLFrameSetElement {
HTMLFrameSetElement {
htmlelement: HTMLElement::new_inherited(HTMLFrameSetElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLFrameSetElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHeadElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHeadElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLHeadElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLHeadElementDerived for EventTarget {
}
impl HTMLHeadElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLHeadElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLHeadElement {
HTMLHeadElement {
htmlelement: HTMLElement::new_inherited(HTMLHeadElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLHeadElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHeadingElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHeadingElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLHeadingElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -38,7 +38,7 @@ impl HTMLHeadingElementDerived for EventTarget {
}
impl HTMLHeadingElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>, level: HeadingLevel) -> HTMLHeadingElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>, level: HeadingLevel) -> HTMLHeadingElement {
HTMLHeadingElement {
htmlelement: HTMLElement::new_inherited(HTMLHeadingElementTypeId, localName, document),
level: level,
@ -46,7 +46,7 @@ impl 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, level);
Node::reflect_node(~element, document, HTMLHeadingElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHRElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLHRElementTypeId;
@ -28,14 +28,14 @@ impl HTMLHRElementDerived for EventTarget {
}
impl HTMLHRElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLHRElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLHRElement {
HTMLHRElement {
htmlelement: HTMLElement::new_inherited(HTMLHRElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLHRElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLHtmlElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLHtmlElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLHtmlElementTypeId;
@ -28,14 +28,14 @@ impl HTMLHtmlElementDerived for EventTarget {
}
impl HTMLHtmlElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLHtmlElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLHtmlElement {
HTMLHtmlElement {
htmlelement: HTMLElement::new_inherited(HTMLHtmlElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLHtmlElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLIFrameElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementDerived, HTMLElementCast};
use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::trace::Untraceable;
use dom::document::Document;
use dom::element::{HTMLIFrameElementTypeId, Element};
@ -70,7 +70,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
}
impl HTMLIFrameElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLIFrameElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLIFrameElement {
HTMLIFrameElement {
htmlelement: HTMLElement::new_inherited(HTMLIFrameElementTypeId, localName, document),
frame: Untraceable::new(None),
@ -80,7 +80,7 @@ impl 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);
Node::reflect_node(~element, document, HTMLIFrameElementBinding::Wrap)
}
}

View file

@ -68,7 +68,7 @@ impl<'a> PrivateHTMLImageElementHelpers for JSRef<'a, HTMLImageElement> {
}
impl HTMLImageElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLImageElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLImageElement {
HTMLImageElement {
htmlelement: HTMLElement::new_inherited(HTMLImageElementTypeId, localName, document),
image: Untraceable::new(None),
@ -76,7 +76,7 @@ impl 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);
Node::reflect_node(~element, document, HTMLImageElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLInputElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLInputElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document;
use dom::element::HTMLInputElementTypeId;
@ -28,14 +28,14 @@ impl HTMLInputElementDerived for EventTarget {
}
impl HTMLInputElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLInputElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLInputElement {
HTMLInputElement {
htmlelement: HTMLElement::new_inherited(HTMLInputElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLInputElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLabelElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLabelElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLLabelElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLLabelElementDerived for EventTarget {
}
impl HTMLLabelElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLLabelElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLLabelElement {
HTMLLabelElement {
htmlelement: HTMLElement::new_inherited(HTMLLabelElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLLabelElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLegendElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLegendElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLLegendElementTypeId;
@ -28,14 +28,14 @@ impl HTMLLegendElementDerived for EventTarget {
}
impl HTMLLegendElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLLegendElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLLegendElement {
HTMLLegendElement {
htmlelement: HTMLElement::new_inherited(HTMLLegendElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLLegendElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLIElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLIElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLLIElementTypeId;
@ -28,14 +28,14 @@ impl HTMLLIElementDerived for EventTarget {
}
impl HTMLLIElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLLIElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLLIElement {
HTMLLIElement {
htmlelement: HTMLElement::new_inherited(HTMLLIElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLLIElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLLinkElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLLinkElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLLinkElementTypeId;
@ -28,14 +28,14 @@ impl HTMLLinkElementDerived for EventTarget {
}
impl HTMLLinkElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLLinkElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLLinkElement {
HTMLLinkElement {
htmlelement: HTMLElement::new_inherited(HTMLLinkElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLLinkElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMainElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMainElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLMainElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLMainElementDerived for EventTarget {
}
impl HTMLMainElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLMainElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLMainElement {
HTMLMainElement {
htmlelement: HTMLElement::new_inherited(HTMLMainElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLMainElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMapElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMapElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLMapElementTypeId;
@ -29,14 +29,14 @@ impl HTMLMapElementDerived for EventTarget {
}
impl HTMLMapElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLMapElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLMapElement {
HTMLMapElement {
htmlelement: HTMLElement::new_inherited(HTMLMapElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLMapElementBinding::Wrap)
}
}

View file

@ -2,7 +2,7 @@
* 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/. */
use dom::bindings::js::{JS, JSRef};
use dom::bindings::js::{JSRef};
use dom::bindings::codegen::InheritTypes::HTMLMediaElementDerived;
use dom::bindings::error::ErrorResult;
use dom::document::Document;
@ -28,7 +28,7 @@ impl HTMLMediaElementDerived for EventTarget {
}
impl HTMLMediaElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: JS<Document>) -> HTMLMediaElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: &JSRef<Document>) -> HTMLMediaElement {
HTMLMediaElement {
htmlelement: HTMLElement::new_inherited(type_id, tag_name, document)
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMetaElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMetaElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLMetaElementTypeId;
@ -28,14 +28,14 @@ impl HTMLMetaElementDerived for EventTarget {
}
impl HTMLMetaElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLMetaElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLMetaElement {
HTMLMetaElement {
htmlelement: HTMLElement::new_inherited(HTMLMetaElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLMetaElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLMeterElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMeterElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLMeterElementTypeId;
@ -28,14 +28,14 @@ impl HTMLMeterElementDerived for EventTarget {
}
impl HTMLMeterElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLMeterElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLMeterElement {
HTMLMeterElement {
htmlelement: HTMLElement::new_inherited(HTMLMeterElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLMeterElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLModElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLModElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLModElementTypeId;
@ -28,14 +28,14 @@ impl HTMLModElementDerived for EventTarget {
}
impl HTMLModElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLModElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLModElement {
HTMLModElement {
htmlelement: HTMLElement::new_inherited(HTMLModElementTypeId, localName, document)
}
}
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);
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::InheritTypes::HTMLObjectElementDerived;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{Element, HTMLObjectElementTypeId};
@ -42,14 +42,14 @@ impl HTMLObjectElementDerived for EventTarget {
}
impl HTMLObjectElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLObjectElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLObjectElement {
HTMLObjectElement {
htmlelement: HTMLElement::new_inherited(HTMLObjectElementTypeId, localName, document),
}
}
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);
Node::reflect_node(~element, document, HTMLObjectElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOListElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLOListElementTypeId;
@ -28,14 +28,14 @@ impl HTMLOListElementDerived for EventTarget {
}
impl HTMLOListElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLOListElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLOListElement {
HTMLOListElement {
htmlelement: HTMLElement::new_inherited(HTMLOListElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLOListElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOptGroupElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOptGroupElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLOptGroupElementTypeId;
@ -28,14 +28,14 @@ impl HTMLOptGroupElementDerived for EventTarget {
}
impl HTMLOptGroupElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLOptGroupElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLOptGroupElement {
HTMLOptGroupElement {
htmlelement: HTMLElement::new_inherited(HTMLOptGroupElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLOptGroupElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOptionElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLOptionElementTypeId;
@ -29,14 +29,14 @@ impl HTMLOptionElementDerived for EventTarget {
}
impl HTMLOptionElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLOptionElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLOptionElement {
HTMLOptionElement {
htmlelement: HTMLElement::new_inherited(HTMLOptionElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLOptionElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLOutputElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOutputElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLOutputElementTypeId;
@ -30,14 +30,14 @@ impl HTMLOutputElementDerived for EventTarget {
}
impl HTMLOutputElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLOutputElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLOutputElement {
HTMLOutputElement {
htmlelement: HTMLElement::new_inherited(HTMLOutputElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLOutputElementBinding::Wrap)
}
}
@ -54,7 +54,6 @@ pub trait HTMLOutputElementMethods {
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Temporary<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
fn CheckValidity(&self) -> bool;
@ -106,9 +105,6 @@ impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> {
ValidityState::new(&*window)
}
fn SetValidity(&mut self, _validity: JS<ValidityState>) {
}
fn ValidationMessage(&self) -> DOMString {
~""
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLParagraphElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLParagraphElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLParagraphElementTypeId;
@ -28,14 +28,14 @@ impl HTMLParagraphElementDerived for EventTarget {
}
impl HTMLParagraphElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLParagraphElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLParagraphElement {
HTMLParagraphElement {
htmlelement: HTMLElement::new_inherited(HTMLParagraphElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLParagraphElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLParamElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLParamElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLParamElementTypeId;
@ -28,14 +28,14 @@ impl HTMLParamElementDerived for EventTarget {
}
impl HTMLParamElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLParamElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLParamElement {
HTMLParamElement {
htmlelement: HTMLElement::new_inherited(HTMLParamElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLParamElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLPreElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLPreElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLPreElementTypeId;
@ -28,14 +28,14 @@ impl HTMLPreElementDerived for EventTarget {
}
impl HTMLPreElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLPreElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLPreElement {
HTMLPreElement {
htmlelement: HTMLElement::new_inherited(HTMLPreElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLPreElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLProgressElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLProgressElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document;
use dom::element::HTMLProgressElementTypeId;
@ -28,14 +28,14 @@ impl HTMLProgressElementDerived for EventTarget {
}
impl HTMLProgressElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLProgressElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLProgressElement {
HTMLProgressElement {
htmlelement: HTMLElement::new_inherited(HTMLProgressElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLProgressElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLQuoteElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLQuoteElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLQuoteElementTypeId;
@ -28,14 +28,14 @@ impl HTMLQuoteElementDerived for EventTarget {
}
impl HTMLQuoteElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLQuoteElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLQuoteElement {
HTMLQuoteElement {
htmlelement: HTMLElement::new_inherited(HTMLQuoteElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLQuoteElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLScriptElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLScriptElementDerived;
use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{HTMLScriptElementTypeId, Element, AttributeHandlers};
@ -29,14 +29,14 @@ impl HTMLScriptElementDerived for EventTarget {
}
impl HTMLScriptElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLScriptElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLScriptElement {
HTMLScriptElement {
htmlelement: HTMLElement::new_inherited(HTMLScriptElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLScriptElementBinding::Wrap)
}
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLSelectElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLSelectElementDerived;
use dom::bindings::codegen::UnionTypes::{HTMLElementOrLong, HTMLOptionElementOrHTMLOptGroupElement};
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{Element, HTMLSelectElementTypeId};
@ -32,14 +32,14 @@ impl HTMLSelectElementDerived for EventTarget {
}
impl HTMLSelectElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLSelectElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLSelectElement {
HTMLSelectElement {
htmlelement: HTMLElement::new_inherited(HTMLSelectElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLSelectElementBinding::Wrap)
}
}
@ -74,7 +74,6 @@ pub trait HTMLSelectElementMethods {
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Temporary<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
fn CheckValidity(&self) -> bool;
@ -196,9 +195,6 @@ impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
ValidityState::new(&*window)
}
fn SetValidity(&mut self, _validity: JS<ValidityState>) {
}
fn ValidationMessage(&self) -> DOMString {
~""
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLSourceElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLSourceElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLSourceElementTypeId;
@ -28,14 +28,14 @@ impl HTMLSourceElementDerived for EventTarget {
}
impl HTMLSourceElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLSourceElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLSourceElement {
HTMLSourceElement {
htmlelement: HTMLElement::new_inherited(HTMLSourceElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLSourceElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLSpanElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLSpanElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLSpanElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLSpanElementDerived for EventTarget {
}
impl HTMLSpanElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLSpanElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLSpanElement {
HTMLSpanElement {
htmlelement: HTMLElement::new_inherited(HTMLSpanElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLSpanElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLStyleElementBinding;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLStyleElementDerived, NodeCast};
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLStyleElementTypeId;
@ -31,14 +31,14 @@ impl HTMLStyleElementDerived for EventTarget {
}
impl HTMLStyleElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLStyleElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLStyleElement {
HTMLStyleElement {
htmlelement: HTMLElement::new_inherited(HTMLStyleElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLStyleElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableCaptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableCaptionElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTableCaptionElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTableCaptionElementDerived for EventTarget {
}
impl HTMLTableCaptionElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableCaptionElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableCaptionElement {
HTMLTableCaptionElement {
htmlelement: HTMLElement::new_inherited(HTMLTableCaptionElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableCaptionElementBinding::Wrap)
}
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::InheritTypes::HTMLTableCellElementDerived;
use dom::bindings::js::{JS, JSRef};
use dom::bindings::js::JSRef;
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{ElementTypeId, HTMLTableDataCellElementTypeId, HTMLTableHeaderCellElementTypeId};
@ -28,7 +28,7 @@ impl HTMLTableCellElementDerived for EventTarget {
}
impl HTMLTableCellElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: JS<Document>) -> HTMLTableCellElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: &JSRef<Document>) -> HTMLTableCellElement {
HTMLTableCellElement {
htmlelement: HTMLElement::new_inherited(type_id, tag_name, document)
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableColElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableColElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTableColElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTableColElementDerived for EventTarget {
}
impl HTMLTableColElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableColElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableColElement {
HTMLTableColElement {
htmlelement: HTMLElement::new_inherited(HTMLTableColElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableColElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableDataCellElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableDataCellElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLTableDataCellElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLTableDataCellElementDerived for EventTarget {
}
impl HTMLTableDataCellElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableDataCellElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableDataCellElement {
HTMLTableDataCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableDataCellElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableDataCellElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTableElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTableElementDerived for EventTarget {
}
impl HTMLTableElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableElement {
HTMLTableElement {
htmlelement: HTMLElement::new_inherited(HTMLTableElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableHeaderCellElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLTableHeaderCellElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLTableHeaderCellElementDerived for EventTarget {
}
impl HTMLTableHeaderCellElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableHeaderCellElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableHeaderCellElement {
HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableHeaderCellElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableHeaderCellElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableRowElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableRowElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTableRowElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTableRowElementDerived for EventTarget {
}
impl HTMLTableRowElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableRowElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableRowElement {
HTMLTableRowElement {
htmlelement: HTMLElement::new_inherited(HTMLTableRowElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableRowElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTableSectionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableSectionElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTableSectionElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTableSectionElementDerived for EventTarget {
}
impl HTMLTableSectionElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTableSectionElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableSectionElement {
HTMLTableSectionElement {
htmlelement: HTMLElement::new_inherited(HTMLTableSectionElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTableSectionElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTemplateElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTemplateElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLTemplateElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLTemplateElementDerived for EventTarget {
}
impl HTMLTemplateElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTemplateElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTemplateElement {
HTMLTemplateElement {
htmlelement: HTMLElement::new_inherited(HTMLTemplateElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTemplateElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTextAreaElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTextAreaElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::{ErrorResult, Fallible};
use dom::document::Document;
use dom::element::HTMLTextAreaElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTextAreaElementDerived for EventTarget {
}
impl HTMLTextAreaElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTextAreaElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTextAreaElement {
HTMLTextAreaElement {
htmlelement: HTMLElement::new_inherited(HTMLTextAreaElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTextAreaElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTimeElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTimeElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTimeElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTimeElementDerived for EventTarget {
}
impl HTMLTimeElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTimeElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTimeElement {
HTMLTimeElement {
htmlelement: HTMLElement::new_inherited(HTMLTimeElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTimeElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTitleElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTitleElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTitleElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTitleElementDerived for EventTarget {
}
impl HTMLTitleElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTitleElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTitleElement {
HTMLTitleElement {
htmlelement: HTMLElement::new_inherited(HTMLTitleElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTitleElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLTrackElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTrackElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLTrackElementTypeId;
@ -28,14 +28,14 @@ impl HTMLTrackElementDerived for EventTarget {
}
impl HTMLTrackElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLTrackElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTrackElement {
HTMLTrackElement {
htmlelement: HTMLElement::new_inherited(HTMLTrackElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLTrackElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLUListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLUListElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLUListElementTypeId;
@ -28,14 +28,14 @@ impl HTMLUListElementDerived for EventTarget {
}
impl HTMLUListElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLUListElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLUListElement {
HTMLUListElement {
htmlelement: HTMLElement::new_inherited(HTMLUListElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLUListElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLUnknownElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLUnknownElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::HTMLUnknownElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -27,14 +27,14 @@ impl HTMLUnknownElementDerived for EventTarget {
}
impl HTMLUnknownElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLUnknownElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLUnknownElement {
HTMLUnknownElement {
htmlelement: HTMLElement::new_inherited(HTMLUnknownElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLUnknownElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::HTMLVideoElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLVideoElementDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::HTMLVideoElementTypeId;
@ -28,14 +28,14 @@ impl HTMLVideoElementDerived for EventTarget {
}
impl HTMLVideoElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLVideoElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLVideoElement {
HTMLVideoElement {
htmlmediaelement: HTMLMediaElement::new_inherited(HTMLVideoElementTypeId, localName, document)
}
}
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);
Node::reflect_node(~element, document, HTMLVideoElementBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::MouseEventBinding;
use dom::bindings::codegen::InheritTypes::{UIEventCast, MouseEventDerived};
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary};
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, OptionalSettable};
use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, MouseEventTypeId};
@ -68,7 +68,7 @@ impl MouseEvent {
init.clientX, init.clientY, init.ctrlKey,
init.altKey, init.shiftKey, init.metaKey,
init.button, related_target.root_ref());
Ok(Temporary::new_rooted(&*ev))
Ok(Temporary::from_rooted(&*ev))
}
}
@ -183,7 +183,7 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
self.shift_key = shiftKeyArg;
self.meta_key = metaKeyArg;
self.button = buttonArg;
self.related_target = relatedTargetArg.map(|target| target.unrooted());
self.related_target.assign(relatedTargetArg);
}
}

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeBase, NodeDeri
use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast};
use dom::bindings::codegen::BindingDeclarations::NodeBinding::NodeConstants;
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, Root};
use dom::bindings::js::{OptionalAssignable, TemporaryPushable, OptionalRootedRootable};
use dom::bindings::js::{OptionalSettable, TemporaryPushable, OptionalRootedRootable};
use dom::bindings::js::{ResultRootable, OptionalRootable};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::{ErrorResult, Fallible, NotFound, HierarchyRequest};
@ -566,7 +566,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
fn is_parent_of(&self, child: &JSRef<Node>) -> bool {
match child.parent_node() {
Some(ref parent) if *parent == Temporary::new_rooted(self) => true,
Some(ref parent) if *parent == Temporary::from_rooted(self) => true,
_ => false
}
}
@ -604,7 +604,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
}
fn set_owner_doc(&mut self, document: &JSRef<Document>) {
self.owner_doc = Some(document.unrooted());
self.owner_doc.assign(Some(document.clone()));
}
fn children(&self) -> AbstractNodeChildrenIterator {
@ -891,12 +891,11 @@ impl Node {
let window = document.get().window.root();
let node = reflect_dom_object(node, &window.root_ref(), wrap_fn).root();
assert!(node.reflector().get_jsobject().is_not_null());
Temporary::new_rooted(&*node)
Temporary::from_rooted(&*node)
}
pub fn new_inherited(type_id: NodeTypeId, doc: JS<Document>) -> Node {
let doc = doc.root();
Node::new_(type_id, Some(doc.root_ref()))
pub fn new_inherited(type_id: NodeTypeId, doc: &JSRef<Document>) -> Node {
Node::new_(type_id, Some(doc.clone()))
}
pub fn new_without_doc(type_id: NodeTypeId) -> Node {
@ -1079,7 +1078,7 @@ impl Node {
Node::insert(node, parent, referenceChild, Unsuppressed);
// Step 11.
return Ok(Temporary::new_rooted(node))
return Ok(Temporary::from_rooted(node))
}
// http://dom.spec.whatwg.org/#concept-node-insert
@ -1174,7 +1173,7 @@ impl Node {
fn pre_remove(child: &mut JSRef<Node>, parent: &mut JSRef<Node>) -> Fallible<Temporary<Node>> {
// Step 1.
match child.parent_node() {
Some(ref node) if *node != Temporary::new_rooted(parent) => return Err(NotFound),
Some(ref node) if *node != Temporary::from_rooted(parent) => return Err(NotFound),
_ => ()
}
@ -1182,12 +1181,12 @@ impl Node {
Node::remove(child, parent, Unsuppressed);
// Step 3.
Ok(Temporary::new_rooted(child))
Ok(Temporary::from_rooted(child))
}
// http://dom.spec.whatwg.org/#concept-node-remove
fn remove(node: &mut JSRef<Node>, parent: &mut JSRef<Node>, suppress_observers: SuppressObserver) {
assert!(node.parent_node().map_or(false, |node_parent| node_parent == Temporary::new_rooted(parent)));
assert!(node.parent_node().map_or(false, |node_parent| node_parent == Temporary::from_rooted(parent)));
// Step 1-5: ranges.
// Step 6-7: mutation observers.
@ -1296,10 +1295,10 @@ impl Node {
let window = document.get().window.root();
for attr in node_elem.attrs.iter().map(|attr| attr.root()) {
copy_elem.attrs.push_unrooted(
Attr::new(&*window,
attr.deref().local_name.clone(), attr.deref().value.clone(),
attr.deref().name.clone(), attr.deref().namespace.clone(),
attr.deref().prefix.clone(), &copy_elem_alias));
&Attr::new(&*window,
attr.deref().local_name.clone(), attr.deref().value.clone(),
attr.deref().name.clone(), attr.deref().namespace.clone(),
attr.deref().prefix.clone(), &copy_elem_alias));
}
},
_ => ()
@ -1316,7 +1315,7 @@ impl Node {
}
// Step 7.
Temporary::new_rooted(&*copy)
Temporary::from_rooted(&*copy)
}
/// Sends layout data, if any, back to the script task to be destroyed.
@ -1433,7 +1432,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
.and_then(|parent| {
let parent = parent.root();
ElementCast::to_ref(&*parent).map(|elem| {
Temporary::new_rooted(elem)
Temporary::from_rooted(elem)
})
})
}
@ -1546,7 +1545,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
let document = self.owner_doc().root();
Some(NodeCast::from_unrooted(document.deref().CreateTextNode(value)))
}.root();
// Step 3.
Node::replace_all(node.root_ref(), self);
}
@ -1671,8 +1670,8 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
}
// Ok if not caught by previous error checks.
if node.unrooted() == child.unrooted() {
return Ok(Temporary::new_rooted(child));
if *node == *child {
return Ok(Temporary::from_rooted(child));
}
// Step 7-8.
@ -1706,7 +1705,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
}
// Step 15.
Ok(Temporary::new_rooted(child))
Ok(Temporary::from_rooted(child))
}
// http://dom.spec.whatwg.org/#dom-node-removechild

View file

@ -22,18 +22,18 @@ pub struct NodeList {
}
impl NodeList {
pub fn new_inherited(window: JS<Window>,
pub fn new_inherited(window: &JSRef<Window>,
list_type: NodeListType) -> NodeList {
NodeList {
list_type: list_type,
reflector_: Reflector::new(),
window: window
window: window.unrooted()
}
}
pub fn new(window: &JSRef<Window>,
list_type: NodeListType) -> Temporary<NodeList> {
reflect_dom_object(~NodeList::new_inherited(window.unrooted(), list_type),
reflect_dom_object(~NodeList::new_inherited(window, list_type),
window, NodeListBinding::Wrap)
}
@ -70,7 +70,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
Children(ref node) => {
let node = node.root();
node.deref().children().nth(index as uint)
.map(|child| Temporary::new_rooted(&child))
.map(|child| Temporary::from_rooted(&child))
}
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::ProcessingInstructionBinding;
use dom::bindings::codegen::InheritTypes::ProcessingInstructionDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::characterdata::CharacterData;
use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
@ -28,7 +28,7 @@ impl ProcessingInstructionDerived for EventTarget {
}
impl ProcessingInstruction {
pub fn new_inherited(target: DOMString, data: DOMString, document: JS<Document>) -> ProcessingInstruction {
pub fn new_inherited(target: DOMString, data: DOMString, document: &JSRef<Document>) -> ProcessingInstruction {
ProcessingInstruction {
characterdata: CharacterData::new_inherited(ProcessingInstructionNodeTypeId, data, document),
target: target
@ -36,7 +36,7 @@ impl 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);
Node::reflect_node(~node, document, ProcessingInstructionBinding::Wrap)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::TextBinding;
use dom::bindings::codegen::InheritTypes::TextDerived;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::error::Fallible;
use dom::characterdata::CharacterData;
use dom::document::Document;
@ -29,14 +29,14 @@ impl TextDerived for EventTarget {
}
impl Text {
pub fn new_inherited(text: DOMString, document: JS<Document>) -> Text {
pub fn new_inherited(text: DOMString, document: &JSRef<Document>) -> Text {
Text {
characterdata: CharacterData::new_inherited(TextNodeTypeId, text, document)
}
}
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);
Node::reflect_node(~node, document, TextBinding::Wrap)
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::BindingDeclarations::UIEventBinding;
use dom::bindings::codegen::InheritTypes::{EventCast, UIEventDerived};
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary};
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, OptionalSettable};
use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId};
@ -49,7 +49,7 @@ impl UIEvent {
let view = init.view.as_ref().map(|view| view.root());
ev.InitUIEvent(type_, init.parent.bubbles, init.parent.cancelable,
view.root_ref(), init.detail);
Ok(Temporary::new_rooted(&*ev))
Ok(Temporary::from_rooted(&*ev))
}
}
@ -93,7 +93,7 @@ impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
let event: &mut JSRef<Event> = EventCast::from_mut_ref(self);
event.InitEvent(type_, can_bubble, cancelable);
}
self.view = view.map(|view| view.unrooted());
self.view.assign(view);
self.detail = detail;
}

View file

@ -15,16 +15,16 @@ pub struct ValidityState {
}
impl ValidityState {
pub fn new_inherited(window: JS<Window>) -> ValidityState {
pub fn new_inherited(window: &JSRef<Window>) -> ValidityState {
ValidityState {
reflector_: Reflector::new(),
window: window,
window: window.unrooted(),
state: 0,
}
}
pub fn new(window: &JSRef<Window>) -> Temporary<ValidityState> {
reflect_dom_object(~ValidityState::new_inherited(window.unrooted()),
reflect_dom_object(~ValidityState::new_inherited(window),
window,
ValidityStateBinding::Wrap)
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::WindowBinding;
use dom::bindings::js::{JS, JSRef, Temporary, OptionalAssignable};
use dom::bindings::js::{JS, JSRef, Temporary, OptionalSettable};
use dom::bindings::trace::{Traceable, Untraceable};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::browsercontext::BrowserContext;
@ -242,7 +242,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
}
fn Window(&self) -> Temporary<Window> {
Temporary::new_rooted(self)
Temporary::from_rooted(self)
}
fn Self(&self) -> Temporary<Window> {

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::InheritTypes::XMLHttpRequestDerived;
use dom::document::Document;
use dom::eventtarget::{EventTarget, XMLHttpRequestTargetTypeId};
use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, JSRef, Temporary, OptionalAssignable};
use dom::bindings::js::{JS, JSRef, Temporary, OptionalSettable};
use js::jsapi::JSContext;
use js::jsval::{JSVal, NullValue};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};