Async XHR GET with basic response header support

This commit is contained in:
Manish Goregaokar 2014-05-15 23:11:32 +05:30
parent 90a0bcfa78
commit 533fab46f9
8 changed files with 253 additions and 51 deletions

View file

@ -41,6 +41,7 @@
use dom::bindings::utils::{Reflector, Reflectable, cx_for_dom_object};
use dom::node::Node;
use dom::xmlhttprequest::{XMLHttpRequest, TrustedXHRAddress};
use js::jsapi::{JSObject, JS_AddObjectRoot, JS_RemoveObjectRoot};
use layout_interface::TrustedNodeAddress;
use script_task::StackRoots;
@ -141,6 +142,15 @@ impl JS<Node> {
}
}
impl JS<XMLHttpRequest> {
pub unsafe fn from_trusted_xhr_address(inner: TrustedXHRAddress) -> JS<XMLHttpRequest> {
let TrustedXHRAddress(addr) = inner;
JS {
ptr: RefCell::new(addr as *mut XMLHttpRequest)
}
}
}
impl<T: Reflectable> JS<T> {
/// Create a new JS-owned value wrapped from a raw Rust pointer.
pub unsafe fn from_raw(raw: *mut T) -> JS<T> {