mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Implement safe rooting strategy via Unrooted, Root, JSRef, and JS.
This commit is contained in:
parent
ffdc3f5b32
commit
d7b96db33c
109 changed files with 1568 additions and 1326 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
use dom::bindings::codegen::BindingDeclarations::HTMLOutputElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLOutputElementDerived;
|
||||
use dom::bindings::js::{JS, JSRef, RootCollection};
|
||||
use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted};
|
||||
use dom::bindings::error::ErrorResult;
|
||||
use dom::document::Document;
|
||||
use dom::element::HTMLOutputElementTypeId;
|
||||
|
@ -36,14 +36,14 @@ impl HTMLOutputElement {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> JS<HTMLOutputElement> {
|
||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Unrooted<HTMLOutputElement> {
|
||||
let element = HTMLOutputElement::new_inherited(localName, document.unrooted());
|
||||
Node::reflect_node(~element, document, HTMLOutputElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLOutputElement {
|
||||
pub fn GetForm(&self) -> Option<JS<HTMLFormElement>> {
|
||||
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -82,12 +82,11 @@ impl HTMLOutputElement {
|
|||
pub fn SetWillValidate(&mut self, _will_validate: bool) {
|
||||
}
|
||||
|
||||
pub fn Validity(&self) -> JS<ValidityState> {
|
||||
pub fn Validity(&self) -> Unrooted<ValidityState> {
|
||||
let roots = RootCollection::new();
|
||||
let doc = self.htmlelement.element.node.owner_doc();
|
||||
let doc = doc.get();
|
||||
let window = doc.window.root(&roots);
|
||||
ValidityState::new(&window.root_ref())
|
||||
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
|
||||
let window = doc.deref().window.root(&roots);
|
||||
ValidityState::new(&*window)
|
||||
}
|
||||
|
||||
pub fn SetValidity(&mut self, _validity: JS<ValidityState>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue