diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-16 01:28:36 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-16 22:11:27 +0530 |
commit | 12dc54d23849f6bc90667e2df432e30587e4af49 (patch) | |
tree | 6b3a8ba1d1bd343ec65108e7b5f67ff1a4154311 /components/script/dom/nodelist.rs | |
parent | 13ae369dec3f02b5f992f1c6c276cde646ef39e9 (diff) | |
download | servo-12dc54d23849f6bc90667e2df432e30587e4af49.tar.gz servo-12dc54d23849f6bc90667e2df432e30587e4af49.zip |
Add unrooted_must_root lint for enums and structs containing JS<T>, as well as functions with JS<T> in their parameter list
For safe wrappers over JS<T> (eg Temporary<T>) use #[allow(unrooted_must_root)].
For all other types containing a #[must_root] value, annotate the type with #[must_root] to ensure that it is never used unrooted
Diffstat (limited to 'components/script/dom/nodelist.rs')
-rw-r--r-- | components/script/dom/nodelist.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 424eb09416c..0ebd2e0db25 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -11,18 +11,21 @@ use dom::node::{Node, NodeHelpers}; use dom::window::Window; #[deriving(Encodable)] +#[must_root] pub enum NodeListType { Simple(Vec<JS<Node>>), Children(JS<Node>) } #[deriving(Encodable)] +#[must_root] pub struct NodeList { list_type: NodeListType, reflector_: Reflector, } impl NodeList { + #[allow(unrooted_must_root)] pub fn new_inherited(list_type: NodeListType) -> NodeList { NodeList { list_type: list_type, @@ -30,6 +33,7 @@ impl NodeList { } } + #[allow(unrooted_must_root)] pub fn new(window: &JSRef<Window>, list_type: NodeListType) -> Temporary<NodeList> { reflect_dom_object(box NodeList::new_inherited(list_type), |