mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Replace uses of JS<T>.unrooted() with JS::from_rooted #2580
This commit is contained in:
parent
da668f53d9
commit
bda29ade09
20 changed files with 51 additions and 53 deletions
|
@ -88,7 +88,7 @@ impl Attr {
|
||||||
name: name, //TODO: Intern attribute names
|
name: name, //TODO: Intern attribute names
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
owner: Cell::new(owner.unrooted()),
|
owner: Cell::new(JS::from_rooted(owner)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ impl AttrList {
|
||||||
pub fn new_inherited(window: &JSRef<Window>, elem: &JSRef<Element>) -> AttrList {
|
pub fn new_inherited(window: &JSRef<Window>, elem: &JSRef<Element>) -> AttrList {
|
||||||
AttrList {
|
AttrList {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted(),
|
window: JS::from_rooted(window),
|
||||||
owner: elem.unrooted(),
|
owner: JS::from_rooted(elem),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl<T: Reflectable> Temporary<T> {
|
||||||
|
|
||||||
/// Create a new Temporary value from a rooted value.
|
/// Create a new Temporary value from a rooted value.
|
||||||
pub fn from_rooted<'a>(root: &JSRef<'a, T>) -> Temporary<T> {
|
pub fn from_rooted<'a>(root: &JSRef<'a, T>) -> Temporary<T> {
|
||||||
Temporary::new(root.unrooted())
|
Temporary::new(JS::from_rooted(root))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a stack-bounded root for this value.
|
/// Create a stack-bounded root for this value.
|
||||||
|
@ -167,7 +167,7 @@ impl<T: Reflectable> JS<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Assignable<U>, U: Reflectable> JS<U> {
|
impl<T: Assignable<U>, U: Reflectable> JS<U> {
|
||||||
pub fn from_rooted(root: T) -> JS<U> {
|
pub fn from_rooted(root: &T) -> JS<U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
root.get_js()
|
root.get_js()
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ pub trait OptionalUnrootable<T> {
|
||||||
|
|
||||||
impl<'a, T: Reflectable> OptionalUnrootable<T> for Option<JSRef<'a, T>> {
|
impl<'a, T: Reflectable> OptionalUnrootable<T> for Option<JSRef<'a, T>> {
|
||||||
fn unrooted(&self) -> Option<JS<T>> {
|
fn unrooted(&self) -> Option<JS<T>> {
|
||||||
self.as_ref().map(|inner| inner.unrooted())
|
self.as_ref().map(|inner| JS::from_rooted(inner))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl Blob {
|
||||||
pub fn new_inherited(window: &JSRef<Window>) -> Blob {
|
pub fn new_inherited(window: &JSRef<Window>) -> Blob {
|
||||||
Blob {
|
Blob {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted()
|
window: JS::from_rooted(window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ pub struct SessionHistoryEntry {
|
||||||
impl SessionHistoryEntry {
|
impl SessionHistoryEntry {
|
||||||
fn new(document: &JSRef<Document>) -> SessionHistoryEntry {
|
fn new(document: &JSRef<Document>) -> SessionHistoryEntry {
|
||||||
SessionHistoryEntry {
|
SessionHistoryEntry {
|
||||||
document: document.unrooted(),
|
document: JS::from_rooted(document),
|
||||||
children: vec!()
|
children: vec!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl ClientRect {
|
||||||
left: left.to_nearest_px() as f32,
|
left: left.to_nearest_px() as f32,
|
||||||
right: right.to_nearest_px() as f32,
|
right: right.to_nearest_px() as f32,
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted(),
|
window: JS::from_rooted(window),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ pub struct ClientRectList {
|
||||||
impl ClientRectList {
|
impl ClientRectList {
|
||||||
pub fn new_inherited(window: &JSRef<Window>,
|
pub fn new_inherited(window: &JSRef<Window>,
|
||||||
rects: Vec<JSRef<ClientRect>>) -> ClientRectList {
|
rects: Vec<JSRef<ClientRect>>) -> ClientRectList {
|
||||||
let rects = rects.iter().map(|rect| rect.unrooted()).collect();
|
let rects = rects.iter().map(|rect| JS::from_rooted(rect)).collect();
|
||||||
ClientRectList {
|
ClientRectList {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
rects: rects,
|
rects: rects,
|
||||||
window: window.unrooted(),
|
window: JS::from_rooted(window),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ impl Document {
|
||||||
Document {
|
Document {
|
||||||
node: Node::new_without_doc(DocumentNodeTypeId),
|
node: Node::new_without_doc(DocumentNodeTypeId),
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted(),
|
window: JS::from_rooted(window),
|
||||||
idmap: Traceable::new(RefCell::new(HashMap::new())),
|
idmap: Traceable::new(RefCell::new(HashMap::new())),
|
||||||
implementation: Cell::new(None),
|
implementation: Cell::new(None),
|
||||||
content_type: match content_type {
|
content_type: match content_type {
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub struct DOMImplementation {
|
||||||
impl DOMImplementation {
|
impl DOMImplementation {
|
||||||
pub fn new_inherited(owner: &JSRef<Window>) -> DOMImplementation {
|
pub fn new_inherited(owner: &JSRef<Window>) -> DOMImplementation {
|
||||||
DOMImplementation {
|
DOMImplementation {
|
||||||
owner: owner.unrooted(),
|
owner: JS::from_rooted(owner),
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct DOMParser {
|
||||||
impl DOMParser {
|
impl DOMParser {
|
||||||
pub fn new_inherited(owner: &JSRef<Window>) -> DOMParser {
|
pub fn new_inherited(owner: &JSRef<Window>) -> DOMParser {
|
||||||
DOMParser {
|
DOMParser {
|
||||||
owner: owner.unrooted(),
|
owner: JS::from_rooted(owner),
|
||||||
reflector_: Reflector::new()
|
reflector_: Reflector::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl DOMTokenList {
|
||||||
local_name: &'static str) -> DOMTokenList {
|
local_name: &'static str) -> DOMTokenList {
|
||||||
DOMTokenList {
|
DOMTokenList {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
element: JS::from_rooted(element.clone()),
|
element: JS::from_rooted(element),
|
||||||
local_name: local_name,
|
local_name: local_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use dom::bindings::callback::ReportExceptions;
|
use dom::bindings::callback::ReportExceptions;
|
||||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, NodeDerived};
|
use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, NodeDerived};
|
||||||
use dom::bindings::js::{JSRef, OptionalSettable, OptionalRootable, Root};
|
use dom::bindings::js::{JS, JSRef, OptionalSettable, OptionalRootable, Root};
|
||||||
use dom::eventtarget::{Capturing, Bubbling, EventTarget};
|
use dom::eventtarget::{Capturing, Bubbling, EventTarget};
|
||||||
use dom::event::{Event, PhaseAtTarget, PhaseNone, PhaseBubbling, PhaseCapturing, EventMethods};
|
use dom::event::{Event, PhaseAtTarget, PhaseNone, PhaseBubbling, PhaseCapturing, EventMethods};
|
||||||
use dom::node::{Node, NodeHelpers};
|
use dom::node::{Node, NodeHelpers};
|
||||||
|
@ -29,7 +29,7 @@ pub fn dispatch_event<'a, 'b>(target: &JSRef<'a, EventTarget>,
|
||||||
let target_node: &JSRef<Node> = NodeCast::to_ref(target).unwrap();
|
let target_node: &JSRef<Node> = NodeCast::to_ref(target).unwrap();
|
||||||
target_node.ancestors().map(|ancestor| {
|
target_node.ancestors().map(|ancestor| {
|
||||||
let ancestor_target: &JSRef<EventTarget> = EventTargetCast::from_ref(&ancestor);
|
let ancestor_target: &JSRef<EventTarget> = EventTargetCast::from_ref(&ancestor);
|
||||||
ancestor_target.unrooted().root()
|
JS::from_rooted(ancestor_target).root()
|
||||||
}).collect()
|
}).collect()
|
||||||
} else {
|
} else {
|
||||||
vec!()
|
vec!()
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl FormData {
|
||||||
FormData {
|
FormData {
|
||||||
data: Traceable::new(RefCell::new(HashMap::new())),
|
data: Traceable::new(RefCell::new(HashMap::new())),
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted(),
|
window: JS::from_rooted(window),
|
||||||
form: form.unrooted(),
|
form: form.unrooted(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ pub trait FormDataMethods {
|
||||||
impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
||||||
fn Append(&self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) {
|
fn Append(&self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) {
|
||||||
let blob = BlobData {
|
let blob = BlobData {
|
||||||
blob: value.unrooted(),
|
blob: JS::from_rooted(value),
|
||||||
name: filename.unwrap_or("default".to_string())
|
name: filename.unwrap_or("default".to_string())
|
||||||
};
|
};
|
||||||
self.data.deref().borrow_mut().insert(name.clone(), blob);
|
self.data.deref().borrow_mut().insert(name.clone(), blob);
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl HTMLCollection {
|
||||||
HTMLCollection {
|
HTMLCollection {
|
||||||
collection: collection,
|
collection: collection,
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted(),
|
window: JS::from_rooted(window),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ impl HTMLCollection {
|
||||||
impl HTMLCollection {
|
impl HTMLCollection {
|
||||||
pub fn create(window: &JSRef<Window>, root: &JSRef<Node>,
|
pub fn create(window: &JSRef<Window>, root: &JSRef<Node>,
|
||||||
filter: Box<CollectionFilter>) -> Temporary<HTMLCollection> {
|
filter: Box<CollectionFilter>) -> Temporary<HTMLCollection> {
|
||||||
HTMLCollection::new(window, Live(root.unrooted(), filter))
|
HTMLCollection::new(window, Live(JS::from_rooted(root), filter))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn by_tag_name(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString)
|
pub fn by_tag_name(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString)
|
||||||
|
|
|
@ -819,7 +819,7 @@ impl NodeIterator {
|
||||||
include_start: bool,
|
include_start: bool,
|
||||||
include_descendants_of_void: bool) -> NodeIterator {
|
include_descendants_of_void: bool) -> NodeIterator {
|
||||||
NodeIterator {
|
NodeIterator {
|
||||||
start_node: start_node.unrooted(),
|
start_node: JS::from_rooted(start_node),
|
||||||
current_node: None,
|
current_node: None,
|
||||||
depth: 0,
|
depth: 0,
|
||||||
include_start: include_start,
|
include_start: include_start,
|
||||||
|
@ -849,19 +849,19 @@ impl<'a> Iterator<JSRef<'a, Node>> for NodeIterator {
|
||||||
Some(self.start_node)
|
Some(self.start_node)
|
||||||
} else {
|
} else {
|
||||||
self.next_child(&*self.start_node.root())
|
self.next_child(&*self.start_node.root())
|
||||||
.map(|child| child.unrooted())
|
.map(|child| JS::from_rooted(&child))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(node) => {
|
Some(node) => {
|
||||||
match self.next_child(&*node) {
|
match self.next_child(&*node) {
|
||||||
Some(child) => {
|
Some(child) => {
|
||||||
self.depth += 1;
|
self.depth += 1;
|
||||||
Some(child.unrooted())
|
Some(JS::from_rooted(&child))
|
||||||
},
|
},
|
||||||
None if node.deref().unrooted() == self.start_node => None,
|
None if JS::from_rooted(&*node) == self.start_node => None,
|
||||||
None => {
|
None => {
|
||||||
match node.deref().next_sibling().root() {
|
match node.deref().next_sibling().root() {
|
||||||
Some(sibling) => Some(sibling.deref().unrooted()),
|
Some(sibling) => Some(JS::from_rooted(&*sibling)),
|
||||||
None => {
|
None => {
|
||||||
let mut candidate = node.deref().clone();
|
let mut candidate = node.deref().clone();
|
||||||
while candidate.next_sibling().is_none() {
|
while candidate.next_sibling().is_none() {
|
||||||
|
@ -869,12 +869,12 @@ impl<'a> Iterator<JSRef<'a, Node>> for NodeIterator {
|
||||||
.expect("Got to root without reaching start node")
|
.expect("Got to root without reaching start node")
|
||||||
.root()).clone();
|
.root()).clone();
|
||||||
self.depth -= 1;
|
self.depth -= 1;
|
||||||
if candidate.unrooted() == self.start_node {
|
if JS::from_rooted(&candidate) == self.start_node {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if candidate.unrooted() != self.start_node {
|
if JS::from_rooted(&candidate) != self.start_node {
|
||||||
candidate.next_sibling().map(|node| node.root().unrooted())
|
candidate.next_sibling().map(|node| JS::from_rooted(node.root().deref()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -940,7 +940,6 @@ impl Node {
|
||||||
last_child: Cell::new(None),
|
last_child: Cell::new(None),
|
||||||
next_sibling: Cell::new(None),
|
next_sibling: Cell::new(None),
|
||||||
prev_sibling: Cell::new(None),
|
prev_sibling: Cell::new(None),
|
||||||
|
|
||||||
owner_doc: Cell::new(doc.unrooted()),
|
owner_doc: Cell::new(doc.unrooted()),
|
||||||
child_list: Cell::new(None),
|
child_list: Cell::new(None),
|
||||||
|
|
||||||
|
@ -1243,7 +1242,7 @@ impl Node {
|
||||||
|
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let mut document = match maybe_doc {
|
let mut document = match maybe_doc {
|
||||||
Some(doc) => doc.unrooted().root(),
|
Some(doc) => JS::from_rooted(doc).root(),
|
||||||
None => node.owner_doc().root()
|
None => node.owner_doc().root()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1304,9 +1303,9 @@ impl Node {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
let document = if copy.is_document() {
|
let document = if copy.is_document() {
|
||||||
let doc: &JSRef<Document> = DocumentCast::to_ref(&*copy).unwrap();
|
let doc: &JSRef<Document> = DocumentCast::to_ref(&*copy).unwrap();
|
||||||
doc.unrooted().root()
|
JS::from_rooted(doc).root()
|
||||||
} else {
|
} else {
|
||||||
document.unrooted().root()
|
JS::from_rooted(&*document).root()
|
||||||
};
|
};
|
||||||
assert!(&*copy.owner_doc().root() == &*document);
|
assert!(&*copy.owner_doc().root() == &*document);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl NodeList {
|
||||||
NodeList {
|
NodeList {
|
||||||
list_type: list_type,
|
list_type: list_type,
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: window.unrooted()
|
window: JS::from_rooted(window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ impl NodeList {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_simple_list(window: &JSRef<Window>, elements: Vec<JSRef<Node>>) -> Temporary<NodeList> {
|
pub fn new_simple_list(window: &JSRef<Window>, elements: Vec<JSRef<Node>>) -> Temporary<NodeList> {
|
||||||
NodeList::new(window, Simple(elements.iter().map(|element| element.unrooted()).collect()))
|
NodeList::new(window, Simple(elements.iter().map(|element| JS::from_rooted(element)).collect()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_child_list(window: &JSRef<Window>, node: &JSRef<Node>) -> Temporary<NodeList> {
|
pub fn new_child_list(window: &JSRef<Window>, node: &JSRef<Node>) -> Temporary<NodeList> {
|
||||||
NodeList::new(window, Children(node.unrooted()))
|
NodeList::new(window, Children(JS::from_rooted(node)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub struct Performance {
|
||||||
|
|
||||||
impl Performance {
|
impl Performance {
|
||||||
fn new_inherited(window: &JSRef<Window>) -> Performance {
|
fn new_inherited(window: &JSRef<Window>) -> Performance {
|
||||||
let timing = PerformanceTiming::new(window).root().root_ref().unrooted();
|
let timing = JS::from_rooted(&PerformanceTiming::new(window).root().root_ref());
|
||||||
Performance {
|
Performance {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
timing: timing,
|
timing: timing,
|
||||||
|
|
|
@ -19,7 +19,7 @@ impl ValidityState {
|
||||||
pub fn new_inherited(window: &JSRef<Window>) -> ValidityState {
|
pub fn new_inherited(window: &JSRef<Window>) -> ValidityState {
|
||||||
ValidityState {
|
ValidityState {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
window: Cell::new(window.unrooted()),
|
window: Cell::new(JS::from_rooted(window)),
|
||||||
state: 0,
|
state: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestRespo
|
||||||
use dom::bindings::codegen::InheritTypes::{EventCast, EventTargetCast, XMLHttpRequestDerived};
|
use dom::bindings::codegen::InheritTypes::{EventCast, EventTargetCast, XMLHttpRequestDerived};
|
||||||
use dom::bindings::conversions::ToJSValConvertible;
|
use dom::bindings::conversions::ToJSValConvertible;
|
||||||
use dom::bindings::error::{ErrorResult, Fallible, InvalidState, InvalidAccess, Network, Syntax, Security};
|
use dom::bindings::error::{ErrorResult, Fallible, InvalidState, InvalidAccess, Network, Syntax, Security};
|
||||||
use dom::bindings::js::{JS, JSRef, Temporary, OptionalSettable, OptionalRootedRootable};
|
use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootedRootable};
|
||||||
use dom::bindings::str::ByteString;
|
use dom::bindings::str::ByteString;
|
||||||
use dom::bindings::trace::Untraceable;
|
use dom::bindings::trace::Untraceable;
|
||||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||||
|
@ -106,7 +106,7 @@ pub struct XMLHttpRequest {
|
||||||
ready_state: XMLHttpRequestState,
|
ready_state: XMLHttpRequestState,
|
||||||
timeout: u32,
|
timeout: u32,
|
||||||
with_credentials: bool,
|
with_credentials: bool,
|
||||||
upload: Cell<Option<JS<XMLHttpRequestUpload>>>,
|
upload: Cell<JS<XMLHttpRequestUpload>>,
|
||||||
response_url: DOMString,
|
response_url: DOMString,
|
||||||
status: u16,
|
status: u16,
|
||||||
status_text: ByteString,
|
status_text: ByteString,
|
||||||
|
@ -136,7 +136,7 @@ impl XMLHttpRequest {
|
||||||
ready_state: Unsent,
|
ready_state: Unsent,
|
||||||
timeout: 0u32,
|
timeout: 0u32,
|
||||||
with_credentials: false,
|
with_credentials: false,
|
||||||
upload: Cell::new(None),
|
upload: Cell::new(JS::from_rooted(&XMLHttpRequestUpload::new(owner))),
|
||||||
response_url: "".to_string(),
|
response_url: "".to_string(),
|
||||||
status: 0,
|
status: 0,
|
||||||
status_text: ByteString::new(vec!()),
|
status_text: ByteString::new(vec!()),
|
||||||
|
@ -155,10 +155,9 @@ impl XMLHttpRequest {
|
||||||
upload_complete: false,
|
upload_complete: false,
|
||||||
upload_events: false,
|
upload_events: false,
|
||||||
|
|
||||||
global: owner.unrooted(),
|
global: JS::from_rooted(owner),
|
||||||
pinned: false,
|
pinned: false,
|
||||||
};
|
};
|
||||||
xhr.upload.assign(Some(XMLHttpRequestUpload::new(owner)));
|
|
||||||
xhr
|
xhr
|
||||||
}
|
}
|
||||||
pub fn new(window: &JSRef<Window>) -> Temporary<XMLHttpRequest> {
|
pub fn new(window: &JSRef<Window>) -> Temporary<XMLHttpRequest> {
|
||||||
|
@ -407,7 +406,7 @@ impl<'a> XMLHttpRequestMethods<'a> for JSRef<'a, XMLHttpRequest> {
|
||||||
self.with_credentials = with_credentials
|
self.with_credentials = with_credentials
|
||||||
}
|
}
|
||||||
fn Upload(&self) -> Temporary<XMLHttpRequestUpload> {
|
fn Upload(&self) -> Temporary<XMLHttpRequestUpload> {
|
||||||
Temporary::new(self.upload.get().get_ref().clone())
|
Temporary::new(self.upload.get())
|
||||||
}
|
}
|
||||||
fn Send(&mut self, data: Option<DOMString>) -> ErrorResult {
|
fn Send(&mut self, data: Option<DOMString>) -> ErrorResult {
|
||||||
if self.ready_state != Opened || self.send_flag {
|
if self.ready_state != Opened || self.send_flag {
|
||||||
|
@ -429,7 +428,7 @@ impl<'a> XMLHttpRequestMethods<'a> for JSRef<'a, XMLHttpRequest> {
|
||||||
};
|
};
|
||||||
if !self.sync {
|
if !self.sync {
|
||||||
// Step 8
|
// Step 8
|
||||||
let upload_target = &*self.upload.get().root().unwrap();
|
let upload_target = &*self.upload.get().root();
|
||||||
let event_target: &JSRef<EventTarget> = EventTargetCast::from_ref(upload_target);
|
let event_target: &JSRef<EventTarget> = EventTargetCast::from_ref(upload_target);
|
||||||
if event_target.has_handlers() {
|
if event_target.has_handlers() {
|
||||||
self.upload_events = true;
|
self.upload_events = true;
|
||||||
|
@ -738,10 +737,10 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
|
|
||||||
fn dispatch_progress_event(&self, upload: bool, type_: DOMString, loaded: u64, total: Option<u64>) {
|
fn dispatch_progress_event(&self, upload: bool, type_: DOMString, loaded: u64, total: Option<u64>) {
|
||||||
let win = &*self.global.root();
|
let win = &*self.global.root();
|
||||||
let upload_target = &*self.upload.get().root().unwrap();
|
let upload_target = &*self.upload.get().root();
|
||||||
let progressevent = ProgressEvent::new(win, type_, false, false,
|
let mut progressevent = ProgressEvent::new(win, type_, false, false,
|
||||||
total.is_some(), loaded,
|
total.is_some(), loaded,
|
||||||
total.unwrap_or(0)).root();
|
total.unwrap_or(0)).root();
|
||||||
let target: &JSRef<EventTarget> = if upload {
|
let target: &JSRef<EventTarget> = if upload {
|
||||||
EventTargetCast::from_ref(upload_target)
|
EventTargetCast::from_ref(upload_target)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -972,8 +972,8 @@ impl ScriptTask {
|
||||||
// Create the root frame.
|
// Create the root frame.
|
||||||
let mut frame = page.mut_frame();
|
let mut frame = page.mut_frame();
|
||||||
*frame = Some(Frame {
|
*frame = Some(Frame {
|
||||||
document: document.deref().unrooted(),
|
document: JS::from_rooted(document.deref()),
|
||||||
window: window.deref().unrooted(),
|
window: JS::from_rooted(window.deref()),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,12 +1178,12 @@ impl ScriptTask {
|
||||||
match *mouse_over_targets {
|
match *mouse_over_targets {
|
||||||
Some(ref mouse_over_targets) => {
|
Some(ref mouse_over_targets) => {
|
||||||
if !target_compare {
|
if !target_compare {
|
||||||
target_compare = !mouse_over_targets.contains(&node.unrooted());
|
target_compare = !mouse_over_targets.contains(&JS::from_rooted(&node));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
target_list.push(node.unrooted());
|
target_list.push(JS::from_rooted(&node));
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue