Merge pull request #3374 from Manishearth/lint_unrooted_jsmanaged

Add lint for ensuring proper rooting of JS<T>; r=jdm
This commit is contained in:
Manish Goregaokar 2014-09-17 18:17:19 +05:30
commit 11ba79894a
131 changed files with 345 additions and 28 deletions

View file

@ -8,6 +8,7 @@
#![feature(globs, macro_rules, phase, thread_local, unsafe_destructor)]
#![deny(unused_imports, unused_variable)]
#![allow(unrooted_must_root)]
#[phase(plugin, link)]
extern crate log;

View file

@ -16,18 +16,23 @@ extern crate rustc;
extern crate sync;
use syntax::ast;
use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
use rustc::plugin::Registry;
use rustc::middle::ty::expr_ty;
use rustc::middle::{ty, def};
use rustc::middle::typeck::astconv::AstConv;
use rustc::util::ppaux::Repr;
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
"Warn and report types being transmuted")
declare_lint!(UNROOTED_MUST_ROOT, Deny,
"Warn and report usage of unrooted jsmanaged objects")
struct Pass;
struct TransmutePass;
struct UnrootedPass;
impl LintPass for Pass {
impl LintPass for TransmutePass {
fn get_lints(&self) -> LintArray {
lint_array!(TRANSMUTE_TYPE_LINT)
}
@ -56,9 +61,109 @@ impl LintPass for Pass {
}
}
fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
match ty.node {
ast::TyBox(ref t) | ast::TyUniq(ref t) |
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
ast::TyPath(_, _, id) => {
match cx.tcx.def_map.borrow().get_copy(&id) {
def::DefTy(def_id) => {
if ty::has_attr(cx.tcx, def_id, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
}
}
_ => (),
}
}
_ => (),
};
}
impl LintPass for UnrootedPass {
fn get_lints(&self) -> LintArray {
lint_array!(UNROOTED_MUST_ROOT)
}
fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) {
if cx.tcx.map.expect_item(id).attrs.iter().all(|a| !a.check_name("must_root")) {
for ref field in def.fields.iter() {
lint_unrooted_ty(cx, &*field.node.ty,
"Type must be rooted, use #[must_root] on the struct definition to propagate");
}
}
}
fn check_variant(&mut self, cx: &Context, var: &ast::Variant, _gen: &ast::Generics) {
let ref map = cx.tcx.map;
if map.expect_item(map.get_parent(var.node.id)).attrs.iter().all(|a| !a.check_name("must_root")) {
match var.node.kind {
ast::TupleVariantKind(ref vec) => {
for ty in vec.iter() {
lint_unrooted_ty(cx, &*ty.ty,
"Type must be rooted, use #[must_root] on the enum definition to propagate")
}
}
_ => () // Struct variants already caught by check_struct_def
}
}
}
fn check_fn(&mut self, cx: &Context, kind: &syntax::visit::FnKind, decl: &ast::FnDecl,
block: &ast::Block, _span: syntax::codemap::Span, _id: ast::NodeId) {
match *kind {
syntax::visit::FkItemFn(i, _, _, _) |
syntax::visit::FkMethod(i, _, _) if i.as_str() == "new" || i.as_str() == "new_inherited" => {
return;
}
_ => ()
}
match block.rules {
ast::DefaultBlock => {
for arg in decl.inputs.iter() {
lint_unrooted_ty(cx, &*arg.ty,
"Type must be rooted, use #[must_root] on the fn definition to propagate")
}
}
_ => () // fn is `unsafe`
}
}
// Partially copied from rustc::middle::lint::builtin
// Catches `let` statements which store a #[must_root] value
// Expressions which return out of blocks eventually end up in a `let`
// statement or a function return (which will be caught when it is used elsewhere)
fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
// Catch the let binding
let expr = match s.node {
ast::StmtDecl(ref decl, _) => match decl.node {
ast::DeclLocal(ref loc) => match loc.init {
Some(ref e) => &**e,
_ => return
},
_ => return
},
_ => return
};
let t = expr_ty(cx.tcx, &*expr);
match ty::get(t).sty {
ty::ty_struct(did, _) |
ty::ty_enum(did, _) => {
if ty::has_attr(cx.tcx, did, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, expr.span,
format!("Expression of type {} must be rooted", t.repr(cx.tcx)).as_slice());
}
}
_ => {}
}
}
}
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_lint_pass(box Pass as LintPassObject);
reg.register_lint_pass(box TransmutePass as LintPassObject);
reg.register_lint_pass(box UnrootedPass as LintPassObject);
}
#[macro_export]

View file

@ -71,6 +71,7 @@ impl Str for AttrValue {
}
#[deriving(Encodable)]
#[must_root]
pub struct Attr {
reflector_: Reflector,
local_name: Atom,
@ -107,8 +108,8 @@ impl Attr {
pub fn new(window: &JSRef<Window>, local_name: Atom, value: AttrValue,
name: Atom, namespace: Namespace,
prefix: Option<DOMString>, owner: &JSRef<Element>) -> Temporary<Attr> {
let attr = Attr::new_inherited(local_name, value, name, namespace, prefix, owner);
reflect_dom_object(box attr, &Window(*window), AttrBinding::Wrap)
reflect_dom_object(box Attr::new_inherited(local_name, value, name, namespace, prefix, owner),
&Window(*window), AttrBinding::Wrap)
}
}

View file

@ -139,6 +139,7 @@ pub struct CallSetup {
impl CallSetup {
/// Performs the setup needed to make a call.
#[allow(unrooted_must_root)]
pub fn new<T: CallbackContainer>(callback: &T, handling: ExceptionHandling) -> CallSetup {
let global = global_object_for_js_object(callback.callback());
let global = global.root();

View file

@ -2868,7 +2868,10 @@ class CGUnionStruct(CGThing):
enumConversions = [
" e%s(ref inner) => inner.to_jsval(cx)," % v["name"] for v in templateVars
]
return ("""pub enum %s {
# XXXManishearth The following should be #[must_root],
# however we currently allow it till #2661 is fixed
return ("""#[allow(unrooted_must_root)]
pub enum %s {
%s
}

View file

@ -34,6 +34,7 @@ pub enum GlobalRoot<'a, 'b> {
/// A traced reference to a global object, for use in fields of traced Rust
/// structures.
#[deriving(Encodable)]
#[must_root]
pub enum GlobalField {
WindowField(JS<Window>),
WorkerField(JS<WorkerGlobalScope>),

View file

@ -61,6 +61,7 @@ use std::mem;
/// Importantly, it requires explicit rooting in order to interact with the inner value.
/// Can be assigned into JS-owned member fields (i.e. `JS<T>` types) safely via the
/// `JS<T>::assign` method or `OptionalSettable::assign` (for `Option<JS<T>>` fields).
#[allow(unrooted_must_root)]
pub struct Temporary<T> {
inner: JS<T>,
/// On-stack JS pointer to assuage conservative stack scanner
@ -106,11 +107,13 @@ impl<T: Reflectable> Temporary<T> {
}
/// A rooted, JS-owned value. Must only be used as a field in other JS-owned types.
#[must_root]
pub struct JS<T> {
ptr: *const T
}
impl<T> PartialEq for JS<T> {
#[allow(unrooted_must_root)]
fn eq(&self, other: &JS<T>) -> bool {
self.ptr == other.ptr
}
@ -371,6 +374,7 @@ impl RootCollection {
}
/// Create a new stack-bounded root that will not outlive this collection
#[allow(unrooted_must_root)]
fn new_root<'a, 'b, T: Reflectable>(&'a self, unrooted: &JS<T>) -> Root<'a, 'b, T> {
Root::new(self, unrooted)
}

View file

@ -83,6 +83,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: JSVal) {
}
/// Trace the `JSObject` held by `reflector`.
#[allow(unrooted_must_root)]
pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) {
trace_object(tracer, description, reflector.get_jsobject())
}

View file

@ -455,8 +455,9 @@ pub fn reflect_dom_object<T: Reflectable>
}
/// A struct to store a reference to the reflector of a DOM object.
#[allow(raw_pointer_deriving)]
#[allow(raw_pointer_deriving, unrooted_must_root)]
#[deriving(PartialEq)]
#[must_root]
pub struct Reflector {
object: Cell<*mut JSObject>,
}
@ -668,6 +669,7 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
}
/// Returns the global object of the realm that the given JS object was created in.
#[allow(unrooted_must_root)]
pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
unsafe {
let global = GetGlobalForObjectCrossCompartment(obj);
@ -689,6 +691,7 @@ pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
/// Get the `JSContext` for the `JSRuntime` associated with the thread
/// this object is on.
#[allow(unrooted_must_root)]
fn cx_for_dom_reflector(obj: *mut JSObject) -> *mut JSContext {
let global = global_object_for_js_object(obj);
let global = global.root();

View file

@ -16,6 +16,7 @@ pub enum BlobType {
}
#[deriving(Encodable)]
#[must_root]
pub struct Blob {
reflector_: Reflector,
type_: BlobType

View file

@ -67,6 +67,7 @@ impl BrowserContext {
}
#[deriving(Encodable)]
#[must_root]
pub struct SessionHistoryEntry {
document: JS<Document>,
children: Vec<BrowserContext>

View file

@ -17,6 +17,7 @@ use geom::size::Size2D;
use canvas::canvas_render_task::{CanvasMsg, CanvasRenderTask, ClearRect, Close, FillRect, Recreate, StrokeRect};
#[deriving(Encodable)]
#[must_root]
pub struct CanvasRenderingContext2D {
reflector_: Reflector,
global: GlobalField,

View file

@ -18,6 +18,7 @@ use servo_util::str::DOMString;
use std::cell::RefCell;
#[deriving(Encodable)]
#[must_root]
pub struct CharacterData {
pub node: Node,
pub data: Traceable<RefCell<DOMString>>,

View file

@ -17,6 +17,7 @@ use servo_util::str::DOMString;
/// An HTML comment.
#[deriving(Encodable)]
#[must_root]
pub struct Comment {
pub characterdata: CharacterData,
}
@ -35,8 +36,8 @@ impl Comment {
}
pub fn new(text: DOMString, document: &JSRef<Document>) -> Temporary<Comment> {
let node = Comment::new_inherited(text, document);
Node::reflect_node(box node, document, CommentBinding::Wrap)
Node::reflect_node(box Comment::new_inherited(text, document),
document, CommentBinding::Wrap)
}
pub fn Constructor(global: &GlobalRef, data: DOMString) -> Fallible<Temporary<Comment>> {

View file

@ -10,6 +10,7 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct Console {
pub reflector_: Reflector
}

View file

@ -19,6 +19,7 @@ use servo_util::str::DOMString;
use std::cell::Cell;
#[deriving(Encodable)]
#[must_root]
pub struct CustomEvent {
event: Event,
detail: Traceable<Cell<Traceable<JSVal>>>,

View file

@ -37,6 +37,7 @@ use native::task::NativeTaskBuilder;
use url::Url;
#[deriving(Encodable)]
#[must_root]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
receiver: Untraceable<Receiver<ScriptMsg>>,

View file

@ -69,6 +69,7 @@ pub enum IsHTMLDocument {
}
#[deriving(Encodable)]
#[must_root]
pub struct Document {
pub node: Node,
reflector_: Reflector,
@ -309,8 +310,8 @@ 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, url, doctype, content_type);
let document = reflect_dom_object(box document, &Window(*window),
let document = reflect_dom_object(box Document::new_inherited(window, url, doctype, content_type),
&Window(*window),
DocumentBinding::Wrap).root();
let node: &JSRef<Node> = NodeCast::from_ref(&*document);

View file

@ -19,6 +19,7 @@ use dom::nodelist::NodeList;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct DocumentFragment {
pub node: Node,
}
@ -38,8 +39,8 @@ impl DocumentFragment {
}
pub fn new(document: &JSRef<Document>) -> Temporary<DocumentFragment> {
let node = DocumentFragment::new_inherited(document);
Node::reflect_node(box node, document, DocumentFragmentBinding::Wrap)
Node::reflect_node(box DocumentFragment::new_inherited(document),
document, DocumentFragmentBinding::Wrap)
}
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<DocumentFragment>> {

View file

@ -14,6 +14,7 @@ use servo_util::str::DOMString;
/// The `DOCTYPE` tag.
#[deriving(Encodable)]
#[must_root]
pub struct DocumentType {
pub node: Node,
pub name: DOMString,
@ -40,7 +41,7 @@ impl DocumentType {
system_id: system_id.unwrap_or("".to_string())
}
}
#[allow(unrooted_must_root)]
pub fn new(name: DOMString,
public_id: Option<DOMString>,
system_id: Option<DOMString>,

View file

@ -60,6 +60,7 @@ impl DOMErrorName {
}
#[deriving(Encodable)]
#[must_root]
pub struct DOMException {
pub code: DOMErrorName,
pub reflector_: Reflector

View file

@ -23,6 +23,7 @@ use dom::text::Text;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct DOMImplementation {
document: JS<Document>,
reflector_: Reflector,

View file

@ -14,6 +14,7 @@ use dom::window::Window;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct DOMParser {
window: JS<Window>, //XXXjdm Document instead?
reflector_: Reflector

View file

@ -11,6 +11,7 @@ use dom::window::Window;
use servo_util::geometry::Au;
#[deriving(Encodable)]
#[must_root]
pub struct DOMRect {
reflector_: Reflector,
top: f32,
@ -34,8 +35,8 @@ impl DOMRect {
pub fn new(window: &JSRef<Window>,
top: Au, bottom: Au,
left: Au, right: Au) -> Temporary<DOMRect> {
let rect = DOMRect::new_inherited(top, bottom, left, right);
reflect_dom_object(box rect, &Window(*window), DOMRectBinding::Wrap)
reflect_dom_object(box DOMRect::new_inherited(top, bottom, left, right),
&Window(*window), DOMRectBinding::Wrap)
}
}

View file

@ -11,6 +11,7 @@ use dom::domrect::DOMRect;
use dom::window::Window;
#[deriving(Encodable)]
#[must_root]
pub struct DOMRectList {
reflector_: Reflector,
rects: Vec<JS<DOMRect>>,

View file

@ -17,6 +17,7 @@ use servo_util::namespace::Null;
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
#[deriving(Encodable)]
#[must_root]
pub struct DOMTokenList {
reflector_: Reflector,
element: JS<Element>,

View file

@ -42,6 +42,7 @@ use std::cell::{Cell, RefCell};
use std::mem;
#[deriving(Encodable)]
#[must_root]
pub struct Element {
pub node: Node,
pub local_name: Atom,
@ -160,8 +161,8 @@ 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);
Node::reflect_node(box element, document, ElementBinding::Wrap)
Node::reflect_node(box Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document),
document, ElementBinding::Wrap)
}
}
@ -173,6 +174,7 @@ pub trait RawLayoutElementHelpers {
impl RawLayoutElementHelpers for Element {
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_attr_val_for_layout(&self, namespace: &Namespace, name: &str)
-> Option<&'static str> {
// cast to point to T in RefCell<T> directly
@ -188,6 +190,7 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_attr_atom_for_layout(&self, namespace: &Namespace, name: &str)
-> Option<Atom> {
// cast to point to T in RefCell<T> directly
@ -203,6 +206,7 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn has_class_for_layout(&self, name: &str) -> bool {
let attrs: *const Vec<JS<Attr>> = mem::transmute(&self.attrs);
(*attrs).iter().find(|attr: & &JS<Attr>| {
@ -220,6 +224,7 @@ pub trait LayoutElementHelpers {
}
impl LayoutElementHelpers for JS<Element> {
#[allow(unrooted_must_root)]
unsafe fn html_element_in_html_document_for_layout(&self) -> bool {
if (*self.unsafe_get()).namespace != namespace::HTML {
return false

View file

@ -35,6 +35,7 @@ pub enum EventTypeId {
}
#[deriving(Encodable)]
#[must_root]
pub struct Event {
pub type_id: EventTypeId,
reflector_: Reflector,

View file

@ -62,6 +62,7 @@ pub struct EventListenerEntry {
}
#[deriving(Encodable)]
#[must_root]
pub struct EventTarget {
pub type_id: EventTargetTypeId,
reflector_: Reflector,

View file

@ -11,6 +11,7 @@ use dom::blob::{Blob, BlobType, FileTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct File {
pub blob: Blob,
pub name: DOMString,

View file

@ -19,12 +19,14 @@ use std::cell::RefCell;
use std::collections::hashmap::HashMap;
#[deriving(Encodable, Clone)]
#[must_root]
pub enum FormDatum {
StringData(DOMString),
FileData(JS<File>)
}
#[deriving(Encodable)]
#[must_root]
pub struct FormData {
data: Traceable<RefCell<HashMap<DOMString, Vec<FormDatum>>>>,
reflector_: Reflector,
@ -53,6 +55,7 @@ impl FormData {
}
impl<'a> FormDataMethods for JSRef<'a, FormData> {
#[allow(unrooted_must_root)]
fn Append(&self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) {
let file = FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
self.data.deref().borrow_mut().insert_or_update_with(name.clone(), vec!(file.clone()),
@ -84,7 +87,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
fn Has(&self, name: DOMString) -> bool {
self.data.deref().borrow().contains_key_equiv(&name)
}
#[allow(unrooted_must_root)]
fn Set(&self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) {
let file = FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
self.data.deref().borrow_mut().insert(name, vec!(file));

View file

@ -24,6 +24,7 @@ use servo_util::namespace::Null;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLAnchorElement {
pub htmlelement: HTMLElement
}
@ -41,6 +42,7 @@ impl HTMLAnchorElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAnchorElement> {
let element = HTMLAnchorElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLAppletElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLAppletElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAppletElement> {
let element = HTMLAppletElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap)

View file

@ -18,6 +18,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLAreaElement {
pub htmlelement: HTMLElement
}
@ -35,6 +36,7 @@ impl HTMLAreaElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAreaElement> {
let element = HTMLAreaElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLAudioElement {
pub htmlmediaelement: HTMLMediaElement
}
@ -31,6 +32,7 @@ impl HTMLAudioElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAudioElement> {
let element = HTMLAudioElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLBaseElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLBaseElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBaseElement> {
let element = HTMLBaseElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)

View file

@ -21,6 +21,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLBodyElement {
pub htmlelement: HTMLElement
}
@ -38,6 +39,7 @@ impl HTMLBodyElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBodyElement> {
let element = HTMLBodyElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLBodyElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLBRElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLBRElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBRElement> {
let element = HTMLBRElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap)

View file

@ -20,6 +20,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLButtonElement {
pub htmlelement: HTMLElement
}
@ -37,6 +38,7 @@ impl HTMLButtonElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLButtonElement> {
let element = HTMLButtonElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap)

View file

@ -29,6 +29,7 @@ static DefaultWidth: u32 = 300;
static DefaultHeight: u32 = 150;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLCanvasElement {
pub htmlelement: HTMLElement,
context: Traceable<Cell<Option<JS<CanvasRenderingContext2D>>>>,
@ -52,6 +53,7 @@ impl HTMLCanvasElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLCanvasElement> {
let element = HTMLCanvasElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap)

View file

@ -30,12 +30,14 @@ impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter> {
}
#[deriving(Encodable)]
#[must_root]
pub enum CollectionTypeId {
Static(Vec<JS<Element>>),
Live(JS<Node>, Box<CollectionFilter>)
}
#[deriving(Encodable)]
#[must_root]
pub struct HTMLCollection {
collection: CollectionTypeId,
reflector_: Reflector,

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLDataElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLDataElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataElement> {
let element = HTMLDataElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap)

View file

@ -17,6 +17,7 @@ use dom::node::{Node, ElementNodeTypeId, window_from_node};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLDataListElement {
pub htmlelement: HTMLElement
}
@ -34,6 +35,7 @@ impl HTMLDataListElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataListElement> {
let element = HTMLDataListElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLDirectoryElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLDirectoryElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDirectoryElement> {
let element = HTMLDirectoryElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLDivElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLDivElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDivElement> {
let element = HTMLDivElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLDivElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLDListElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLDListElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDListElement> {
let element = HTMLDListElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap)

View file

@ -22,6 +22,7 @@ use servo_util::namespace;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLElement {
pub element: Element
}
@ -43,6 +44,7 @@ impl HTMLElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLElement> {
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, document);
Node::reflect_node(box element, document, HTMLElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLEmbedElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLEmbedElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLEmbedElement> {
let element = HTMLEmbedElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap)

View file

@ -22,6 +22,7 @@ use servo_util::atom::Atom;
use servo_util::str::{DOMString, StaticStringVec};
#[deriving(Encodable)]
#[must_root]
pub struct HTMLFieldSetElement {
pub htmlelement: HTMLElement
}
@ -39,6 +40,7 @@ impl HTMLFieldSetElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFieldSetElement> {
let element = HTMLFieldSetElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLFieldSetElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLFontElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLFontElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFontElement> {
let element = HTMLFontElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLFormElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLFormElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFormElement> {
let element = HTMLFormElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLFrameElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLFrameElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameElement> {
let element = HTMLFrameElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLFrameSetElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLFrameSetElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameSetElement> {
let element = HTMLFrameSetElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLHeadElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLHeadElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHeadElement> {
let element = HTMLHeadElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap)

View file

@ -24,6 +24,7 @@ pub enum HeadingLevel {
}
#[deriving(Encodable)]
#[must_root]
pub struct HTMLHeadingElement {
pub htmlelement: HTMLElement,
pub level: HeadingLevel,
@ -43,6 +44,7 @@ impl HTMLHeadingElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>, level: HeadingLevel) -> Temporary<HTMLHeadingElement> {
let element = HTMLHeadingElement::new_inherited(localName, document, level);
Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLHRElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLHRElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHRElement> {
let element = HTMLHRElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLHtmlElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLHtmlElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHtmlElement> {
let element = HTMLHtmlElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap)

View file

@ -42,6 +42,7 @@ enum SandboxAllowance {
}
#[deriving(Encodable)]
#[must_root]
pub struct HTMLIFrameElement {
pub htmlelement: HTMLElement,
pub size: Traceable<Cell<Option<IFrameSize>>>,
@ -122,6 +123,7 @@ impl HTMLIFrameElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLIFrameElement> {
let element = HTMLIFrameElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)

View file

@ -26,6 +26,7 @@ use url::{Url, UrlParser};
use std::cell::RefCell;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLImageElement {
pub htmlelement: HTMLElement,
image: Untraceable<RefCell<Option<Url>>>,
@ -78,6 +79,7 @@ impl HTMLImageElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLImageElement> {
let element = HTMLImageElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap)

View file

@ -19,6 +19,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLInputElement {
pub htmlelement: HTMLElement,
}
@ -36,6 +37,7 @@ impl HTMLInputElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLInputElement> {
let element = HTMLInputElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLLabelElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLLabelElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLabelElement> {
let element = HTMLLabelElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLLegendElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLLegendElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLegendElement> {
let element = HTMLLegendElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLLIElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLLIElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLIElement> {
let element = HTMLLIElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap)

View file

@ -23,6 +23,7 @@ use std::ascii::StrAsciiExt;
use url::UrlParser;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLLinkElement {
pub htmlelement: HTMLElement,
}
@ -40,6 +41,7 @@ impl HTMLLinkElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLinkElement> {
let element = HTMLLinkElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLMapElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLMapElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMapElement> {
let element = HTMLMapElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLMapElementBinding::Wrap)

View file

@ -13,6 +13,7 @@ use dom::node::ElementNodeTypeId;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLMediaElement {
pub htmlelement: HTMLElement,
}

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLMetaElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLMetaElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMetaElement> {
let element = HTMLMetaElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLMetaElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLMeterElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLMeterElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMeterElement> {
let element = HTMLMeterElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLMeterElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLModElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLModElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLModElement> {
let element = HTMLModElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLModElementBinding::Wrap)

View file

@ -27,6 +27,7 @@ use servo_util::str::DOMString;
use url::Url;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLObjectElement {
pub htmlelement: HTMLElement,
}
@ -44,6 +45,7 @@ impl HTMLObjectElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLObjectElement> {
let element = HTMLObjectElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLOListElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLOListElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOListElement> {
let element = HTMLOListElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLOListElementBinding::Wrap)

View file

@ -19,6 +19,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLOptGroupElement {
pub htmlelement: HTMLElement
}
@ -36,6 +37,7 @@ impl HTMLOptGroupElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOptGroupElement> {
let element = HTMLOptGroupElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLOptGroupElementBinding::Wrap)

View file

@ -19,6 +19,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLOptionElement {
pub htmlelement: HTMLElement
}
@ -36,6 +37,7 @@ impl HTMLOptionElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOptionElement> {
let element = HTMLOptionElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap)

View file

@ -16,6 +16,7 @@ use dom::validitystate::ValidityState;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLOutputElement {
pub htmlelement: HTMLElement
}
@ -33,6 +34,7 @@ impl HTMLOutputElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLOutputElement> {
let element = HTMLOutputElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLOutputElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLParagraphElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLParagraphElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLParagraphElement> {
let element = HTMLParagraphElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLParagraphElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLParamElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLParamElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLParamElement> {
let element = HTMLParamElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLParamElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLPreElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLPreElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLPreElement> {
let element = HTMLPreElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLPreElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLProgressElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLProgressElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLProgressElement> {
let element = HTMLProgressElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLProgressElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLQuoteElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLQuoteElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLQuoteElement> {
let element = HTMLQuoteElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLQuoteElementBinding::Wrap)

View file

@ -20,6 +20,7 @@ use servo_util::namespace::Null;
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
#[deriving(Encodable)]
#[must_root]
pub struct HTMLScriptElement {
pub htmlelement: HTMLElement,
}
@ -37,6 +38,7 @@ impl HTMLScriptElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLScriptElement> {
let element = HTMLScriptElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLScriptElementBinding::Wrap)

View file

@ -22,6 +22,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLSelectElement {
pub htmlelement: HTMLElement
}
@ -39,6 +40,7 @@ impl HTMLSelectElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLSelectElement> {
let element = HTMLSelectElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLSelectElementBinding::Wrap)

View file

@ -21,6 +21,7 @@ use dom::text::Text;
use servo_util::atom::Atom;
use servo_util::namespace;
#[allow(unrooted_must_root)]
pub fn serialize(iterator: &mut NodeIterator) -> String {
let mut html = String::new();
let mut open_elements: Vec<String> = vec!();

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLSourceElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLSourceElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLSourceElement> {
let element = HTMLSourceElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLSourceElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLSpanElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLSpanElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLSpanElement> {
let element = HTMLSpanElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLSpanElementBinding::Wrap)

View file

@ -18,6 +18,7 @@ use servo_util::str::DOMString;
use style::Stylesheet;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLStyleElement {
pub htmlelement: HTMLElement,
}
@ -35,6 +36,7 @@ impl HTMLStyleElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLStyleElement> {
let element = HTMLStyleElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableCaptionElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLTableCaptionElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableCaptionElement> {
let element = HTMLTableCaptionElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableCaptionElementBinding::Wrap)

View file

@ -13,6 +13,7 @@ use dom::node::ElementNodeTypeId;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableCellElement {
pub htmlelement: HTMLElement,
}

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableColElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLTableColElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableColElement> {
let element = HTMLTableColElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableColElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableDataCellElement {
pub htmltablecellelement: HTMLTableCellElement,
}
@ -31,6 +32,7 @@ impl HTMLTableDataCellElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableDataCellElement> {
let element = HTMLTableDataCellElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableDataCellElementBinding::Wrap)

View file

@ -18,6 +18,7 @@ use dom::node::{Node, NodeHelpers, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableElement {
pub htmlelement: HTMLElement,
}
@ -35,6 +36,7 @@ impl HTMLTableElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableElement> {
let element = HTMLTableElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableHeaderCellElement {
pub htmltablecellelement: HTMLTableCellElement,
}
@ -31,6 +32,7 @@ impl HTMLTableHeaderCellElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableHeaderCellElement> {
let element = HTMLTableHeaderCellElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableHeaderCellElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableRowElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLTableRowElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableRowElement> {
let element = HTMLTableRowElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableRowElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTableSectionElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLTableSectionElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTableSectionElement> {
let element = HTMLTableSectionElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableSectionElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTemplateElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLTemplateElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTemplateElement> {
let element = HTMLTemplateElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTemplateElementBinding::Wrap)

View file

@ -19,6 +19,7 @@ use servo_util::atom::Atom;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTextAreaElement {
pub htmlelement: HTMLElement,
}
@ -36,6 +37,7 @@ impl HTMLTextAreaElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTextAreaElement> {
let element = HTMLTextAreaElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTextAreaElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTimeElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLTimeElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTimeElement> {
let element = HTMLTimeElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTimeElementBinding::Wrap)

View file

@ -17,6 +17,7 @@ use dom::text::Text;
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTitleElement {
pub htmlelement: HTMLElement,
}
@ -34,6 +35,7 @@ impl HTMLTitleElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTitleElement> {
let element = HTMLTitleElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTitleElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLTrackElement {
pub htmlelement: HTMLElement,
}
@ -31,6 +32,7 @@ impl HTMLTrackElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLTrackElement> {
let element = HTMLTrackElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTrackElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLUListElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLUListElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLUListElement> {
let element = HTMLUListElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLUListElementBinding::Wrap)

View file

@ -14,6 +14,7 @@ use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLUnknownElement {
pub htmlelement: HTMLElement
}
@ -31,6 +32,7 @@ impl HTMLUnknownElement {
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLUnknownElement> {
let element = HTMLUnknownElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLUnknownElementBinding::Wrap)

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