mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
auto merge of #4566 : mattnenterprise/servo/globalref-by-value, r=Ms2ger
This commit is contained in:
commit
7800d98728
25 changed files with 64 additions and 64 deletions
|
@ -4014,7 +4014,7 @@ let global = global_object_for_js_object(JS_CALLEE(cx, vp).to_object());
|
|||
let global = global.root();
|
||||
""")
|
||||
nativeName = MakeNativeName(self._ctor.identifier.name)
|
||||
callGenerator = CGMethodCall(["&global.r()"], nativeName, True,
|
||||
callGenerator = CGMethodCall(["global.r()"], nativeName, True,
|
||||
self.descriptor, self._ctor)
|
||||
return CGList([preamble, callGenerator])
|
||||
|
||||
|
|
|
@ -37,30 +37,30 @@ fn is_ascii_printable(string: &DOMString) -> bool{
|
|||
}
|
||||
|
||||
impl Blob {
|
||||
pub fn new_inherited(global: &GlobalRef, type_: BlobTypeId,
|
||||
pub fn new_inherited(global: GlobalRef, type_: BlobTypeId,
|
||||
bytes: Option<Vec<u8>>, typeString: &str) -> Blob {
|
||||
Blob {
|
||||
reflector_: Reflector::new(),
|
||||
type_: type_,
|
||||
bytes: bytes,
|
||||
typeString: typeString.into_string(),
|
||||
global: GlobalField::from_rooted(global)
|
||||
global: GlobalField::from_rooted(&global)
|
||||
//isClosed_: false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, bytes: Option<Vec<u8>>,
|
||||
pub fn new(global: GlobalRef, bytes: Option<Vec<u8>>,
|
||||
typeString: &str) -> Temporary<Blob> {
|
||||
reflect_dom_object(box Blob::new_inherited(global, BlobTypeId::Blob, bytes, typeString),
|
||||
*global,
|
||||
global,
|
||||
BlobBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Blob>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<Blob>> {
|
||||
Ok(Blob::new(global, None, ""))
|
||||
}
|
||||
|
||||
pub fn Constructor_(global: &GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> {
|
||||
pub fn Constructor_(global: GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> {
|
||||
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
|
||||
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
|
||||
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
|
||||
|
@ -121,13 +121,13 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
|
|||
let span: i64 = max(relativeEnd - relativeStart, 0);
|
||||
let global = self.global.root();
|
||||
match self.bytes {
|
||||
None => Blob::new(&global.r(), None, relativeContentType.as_slice()),
|
||||
None => Blob::new(global.r(), None, relativeContentType.as_slice()),
|
||||
Some(ref vec) => {
|
||||
let start = relativeStart.to_uint().unwrap();
|
||||
let end = (relativeStart + span).to_uint().unwrap();
|
||||
let mut bytes: Vec<u8> = Vec::new();
|
||||
bytes.push_all(vec.slice(start, end));
|
||||
Blob::new(&global.r(), Some(bytes), relativeContentType.as_slice())
|
||||
Blob::new(global.r(), Some(bytes), relativeContentType.as_slice())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,18 +25,18 @@ pub struct CanvasRenderingContext2D {
|
|||
}
|
||||
|
||||
impl CanvasRenderingContext2D {
|
||||
fn new_inherited(global: &GlobalRef, canvas: JSRef<HTMLCanvasElement>, size: Size2D<i32>) -> CanvasRenderingContext2D {
|
||||
fn new_inherited(global: GlobalRef, canvas: JSRef<HTMLCanvasElement>, size: Size2D<i32>) -> CanvasRenderingContext2D {
|
||||
CanvasRenderingContext2D {
|
||||
reflector_: Reflector::new(),
|
||||
global: GlobalField::from_rooted(global),
|
||||
global: GlobalField::from_rooted(&global),
|
||||
renderer: CanvasPaintTask::start(size),
|
||||
canvas: JS::from_rooted(canvas),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, canvas: JSRef<HTMLCanvasElement>, size: Size2D<i32>) -> Temporary<CanvasRenderingContext2D> {
|
||||
pub fn new(global: GlobalRef, canvas: JSRef<HTMLCanvasElement>, size: Size2D<i32>) -> Temporary<CanvasRenderingContext2D> {
|
||||
reflect_dom_object(box CanvasRenderingContext2D::new_inherited(global, canvas, size),
|
||||
*global, CanvasRenderingContext2DBinding::Wrap)
|
||||
global, CanvasRenderingContext2DBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn recreate(&self, size: Size2D<i32>) {
|
||||
|
|
|
@ -38,7 +38,7 @@ impl Comment {
|
|||
document, CommentBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, data: DOMString) -> Fallible<Temporary<Comment>> {
|
||||
pub fn Constructor(global: GlobalRef, data: DOMString) -> Fallible<Temporary<Comment>> {
|
||||
let document = global.as_window().Document().root();
|
||||
Ok(Comment::new(data, document.r()))
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ impl CustomEvent {
|
|||
global,
|
||||
CustomEventBinding::Wrap)
|
||||
}
|
||||
pub fn new(global: &GlobalRef, type_: DOMString, bubbles: bool, cancelable: bool, detail: JSVal) -> Temporary<CustomEvent> {
|
||||
let ev = CustomEvent::new_uninitialized(*global).root();
|
||||
pub fn new(global: GlobalRef, type_: DOMString, bubbles: bool, cancelable: bool, detail: JSVal) -> Temporary<CustomEvent> {
|
||||
let ev = CustomEvent::new_uninitialized(global).root();
|
||||
ev.r().InitCustomEvent(global.get_cx(), type_, bubbles, cancelable, detail);
|
||||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &CustomEventBinding::CustomEventInit) -> Fallible<Temporary<CustomEvent>>{
|
||||
Ok(CustomEvent::new(global, type_, init.parent.bubbles, init.parent.cancelable, init.detail))
|
||||
|
|
|
@ -451,7 +451,7 @@ impl Document {
|
|||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Document>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<Document>> {
|
||||
Ok(Document::new(global.as_window(), None,
|
||||
IsHTMLDocument::NonHTMLDocument, None,
|
||||
DocumentSource::NotFromParser))
|
||||
|
|
|
@ -41,7 +41,7 @@ impl DocumentFragment {
|
|||
document, DocumentFragmentBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<DocumentFragment>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<DocumentFragment>> {
|
||||
let document = global.as_window().Document();
|
||||
let document = document.root();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ impl DOMParser {
|
|||
DOMParserBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<DOMParser>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<DOMParser>> {
|
||||
Ok(DOMParser::new(global.as_window()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,13 +48,13 @@ impl ErrorEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_uninitialized(global: &GlobalRef) -> Temporary<ErrorEvent> {
|
||||
pub fn new_uninitialized(global: GlobalRef) -> Temporary<ErrorEvent> {
|
||||
reflect_dom_object(box ErrorEvent::new_inherited(EventTypeId::ErrorEvent),
|
||||
*global,
|
||||
global,
|
||||
ErrorEventBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef,
|
||||
pub fn new(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
|
@ -75,7 +75,7 @@ impl ErrorEvent {
|
|||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &ErrorEventBinding::ErrorEventInit) -> Fallible<Temporary<ErrorEvent>>{
|
||||
let msg = match init.message.as_ref() {
|
||||
|
|
|
@ -105,12 +105,12 @@ impl Event {
|
|||
Temporary::from_rooted(event.r())
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &EventBinding::EventInit) -> Fallible<Temporary<Event>> {
|
||||
let bubbles = if init.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
||||
let cancelable = if init.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
|
||||
Ok(Event::new(*global, type_, bubbles, cancelable))
|
||||
Ok(Event::new(global, type_, bubbles, cancelable))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -17,7 +17,7 @@ pub struct File {
|
|||
}
|
||||
|
||||
impl File {
|
||||
fn new_inherited(global: &GlobalRef, type_: BlobTypeId,
|
||||
fn new_inherited(global: GlobalRef, type_: BlobTypeId,
|
||||
_file_bits: JSRef<Blob>, name: DOMString) -> File {
|
||||
File {
|
||||
//TODO: get type from the underlying filesystem instead of "".to_string()
|
||||
|
@ -28,9 +28,9 @@ impl File {
|
|||
// the relevant subfields of file_bits should be copied over
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
|
||||
pub fn new(global: GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
|
||||
reflect_dom_object(box File::new_inherited(global, BlobTypeId::File, file_bits, name),
|
||||
*global,
|
||||
global,
|
||||
FileBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -36,21 +36,21 @@ pub struct FormData {
|
|||
}
|
||||
|
||||
impl FormData {
|
||||
fn new_inherited(form: Option<JSRef<HTMLFormElement>>, global: &GlobalRef) -> FormData {
|
||||
fn new_inherited(form: Option<JSRef<HTMLFormElement>>, global: GlobalRef) -> FormData {
|
||||
FormData {
|
||||
reflector_: Reflector::new(),
|
||||
data: DOMRefCell::new(HashMap::new()),
|
||||
global: GlobalField::from_rooted(global),
|
||||
global: GlobalField::from_rooted(&global),
|
||||
form: form.map(|f| JS::from_rooted(f)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(form: Option<JSRef<HTMLFormElement>>, global: &GlobalRef) -> Temporary<FormData> {
|
||||
pub fn new(form: Option<JSRef<HTMLFormElement>>, global: GlobalRef) -> Temporary<FormData> {
|
||||
reflect_dom_object(box FormData::new_inherited(form, global),
|
||||
*global, FormDataBinding::Wrap)
|
||||
global, FormDataBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {
|
||||
pub fn Constructor(global: GlobalRef, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {
|
||||
Ok(FormData::new(form, global))
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,6 @@ impl PrivateFormDataHelpers for FormData {
|
|||
let global = self.global.root();
|
||||
let f: Option<JSRef<File>> = FileCast::to_ref(value);
|
||||
let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".into_string()));
|
||||
File::new(&global.r(), value, name)
|
||||
File::new(global.r(), value, name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
|
|||
Some(self.context.or_init(|| {
|
||||
let window = window_from_node(self).root();
|
||||
let (w, h) = (self.width.get() as i32, self.height.get() as i32);
|
||||
CanvasRenderingContext2D::new(&GlobalRef::Window(window.r()), self, Size2D(w, h))
|
||||
CanvasRenderingContext2D::new(GlobalRef::Window(window.r()), self, Size2D(w, h))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ impl KeyboardEvent {
|
|||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &KeyboardEventBinding::KeyboardEventInit) -> Fallible<Temporary<KeyboardEvent>> {
|
||||
let event = KeyboardEvent::new(global.as_window(), type_,
|
||||
|
|
|
@ -63,11 +63,11 @@ impl MessageEvent {
|
|||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &MessageEventBinding::MessageEventInit)
|
||||
-> Fallible<Temporary<MessageEvent>> {
|
||||
let ev = MessageEvent::new(*global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
let ev = MessageEvent::new(global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
init.data, init.origin.clone(), init.lastEventId.clone());
|
||||
Ok(ev)
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ impl MouseEvent {
|
|||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &MouseEventBinding::MouseEventInit) -> Fallible<Temporary<MouseEvent>> {
|
||||
let event = MouseEvent::new(global.as_window(), type_,
|
||||
|
|
|
@ -46,11 +46,11 @@ impl ProgressEvent {
|
|||
event.InitEvent(type_, can_bubble, cancelable);
|
||||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &ProgressEventBinding::ProgressEventInit)
|
||||
-> Fallible<Temporary<ProgressEvent>> {
|
||||
let ev = ProgressEvent::new(*global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
let ev = ProgressEvent::new(global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
init.lengthComputable, init.loaded, init.total);
|
||||
Ok(ev)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ impl Range {
|
|||
RangeBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Range>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<Range>> {
|
||||
let document = global.as_window().Document().root();
|
||||
Ok(Range::new(document.r()))
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn SetEnumAttribute(self, _: TestEnum) {}
|
||||
fn InterfaceAttribute(self) -> Temporary<Blob> {
|
||||
let global = self.global.root();
|
||||
Blob::new(&global.r(), None, "")
|
||||
Blob::new(global.r(), None, "")
|
||||
}
|
||||
fn SetInterfaceAttribute(self, _: JSRef<Blob>) {}
|
||||
fn UnionAttribute(self) -> HTMLElementOrLong { eLong(0) }
|
||||
|
@ -99,7 +99,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn GetEnumAttributeNullable(self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn GetInterfaceAttributeNullable(self) -> Option<Temporary<Blob>> {
|
||||
let global = self.global.root();
|
||||
Some(Blob::new(&global.r(), None, ""))
|
||||
Some(Blob::new(global.r(), None, ""))
|
||||
}
|
||||
fn SetInterfaceAttributeNullable(self, _: Option<JSRef<Blob>>) {}
|
||||
fn GetUnionAttributeNullable(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
|
@ -123,7 +123,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn ReceiveEnum(self) -> TestEnum { _empty }
|
||||
fn ReceiveInterface(self) -> Temporary<Blob> {
|
||||
let global = self.global.root();
|
||||
Blob::new(&global.r(), None, "")
|
||||
Blob::new(global.r(), None, "")
|
||||
}
|
||||
fn ReceiveAny(self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||
fn ReceiveUnion(self) -> HTMLElementOrLong { eLong(0) }
|
||||
|
@ -145,7 +145,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn ReceiveNullableEnum(self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn ReceiveNullableInterface(self) -> Option<Temporary<Blob>> {
|
||||
let global = self.global.root();
|
||||
Some(Blob::new(&global.r(), None, ""))
|
||||
Some(Blob::new(global.r(), None, ""))
|
||||
}
|
||||
fn ReceiveNullableUnion(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
fn ReceiveNullableUnion2(self) -> Option<EventOrString> { Some(eString("".into_string())) }
|
||||
|
|
|
@ -38,7 +38,7 @@ impl Text {
|
|||
document, TextBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, text: DOMString) -> Fallible<Temporary<Text>> {
|
||||
pub fn Constructor(global: GlobalRef, text: DOMString) -> Fallible<Temporary<Text>> {
|
||||
let document = global.as_window().Document().root();
|
||||
Ok(Text::new(text, document.r()))
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ impl UIEvent {
|
|||
Temporary::from_rooted(ev.r())
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef,
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
init: &UIEventBinding::UIEventInit) -> Fallible<Temporary<UIEvent>> {
|
||||
let event = UIEvent::new(global.as_window(), type_,
|
||||
|
|
|
@ -40,8 +40,8 @@ impl URLSearchParams {
|
|||
reflect_dom_object(box URLSearchParams::new_inherited(), global, URLSearchParamsBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, init: Option<StringOrURLSearchParams>) -> Fallible<Temporary<URLSearchParams>> {
|
||||
let usp = URLSearchParams::new(*global).root();
|
||||
pub fn Constructor(global: GlobalRef, init: Option<StringOrURLSearchParams>) -> Fallible<Temporary<URLSearchParams>> {
|
||||
let usp = URLSearchParams::new(global).root();
|
||||
match init {
|
||||
Some(eString(_s)) => {
|
||||
// XXXManishearth we need to parse the input here
|
||||
|
|
|
@ -31,8 +31,8 @@ impl WebSocket {
|
|||
WebSocketBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, url: DOMString) -> Fallible<Temporary<WebSocket>> {
|
||||
Ok(WebSocket::new(*global, url))
|
||||
pub fn Constructor(global: GlobalRef, url: DOMString) -> Fallible<Temporary<WebSocket>> {
|
||||
Ok(WebSocket::new(global, url))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,23 +43,23 @@ pub struct Worker {
|
|||
}
|
||||
|
||||
impl Worker {
|
||||
fn new_inherited(global: &GlobalRef, sender: Sender<(TrustedWorkerAddress, ScriptMsg)>) -> Worker {
|
||||
fn new_inherited(global: GlobalRef, sender: Sender<(TrustedWorkerAddress, ScriptMsg)>) -> Worker {
|
||||
Worker {
|
||||
eventtarget: EventTarget::new_inherited(EventTargetTypeId::Worker),
|
||||
refcount: Cell::new(0),
|
||||
global: GlobalField::from_rooted(global),
|
||||
global: GlobalField::from_rooted(&global),
|
||||
sender: sender,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, sender: Sender<(TrustedWorkerAddress, ScriptMsg)>) -> Temporary<Worker> {
|
||||
pub fn new(global: GlobalRef, sender: Sender<(TrustedWorkerAddress, ScriptMsg)>) -> Temporary<Worker> {
|
||||
reflect_dom_object(box Worker::new_inherited(global, sender),
|
||||
*global,
|
||||
global,
|
||||
WorkerBinding::Wrap)
|
||||
}
|
||||
|
||||
// http://www.whatwg.org/html/#dom-worker
|
||||
pub fn Constructor(global: &GlobalRef, scriptURL: DOMString) -> Fallible<Temporary<Worker>> {
|
||||
pub fn Constructor(global: GlobalRef, scriptURL: DOMString) -> Fallible<Temporary<Worker>> {
|
||||
// Step 2-4.
|
||||
let worker_url = match UrlParser::new().base_url(&global.get_url())
|
||||
.parse(scriptURL.as_slice()) {
|
||||
|
|
|
@ -160,13 +160,13 @@ pub struct XMLHttpRequest {
|
|||
}
|
||||
|
||||
impl XMLHttpRequest {
|
||||
fn new_inherited(global: &GlobalRef) -> XMLHttpRequest {
|
||||
fn new_inherited(global: GlobalRef) -> XMLHttpRequest {
|
||||
XMLHttpRequest {
|
||||
eventtarget: XMLHttpRequestEventTarget::new_inherited(XMLHttpRequestEventTargetTypeId::XMLHttpRequest),
|
||||
ready_state: Cell::new(XMLHttpRequestState::Unsent),
|
||||
timeout: Cell::new(0u32),
|
||||
with_credentials: Cell::new(false),
|
||||
upload: JS::from_rooted(XMLHttpRequestUpload::new(*global)),
|
||||
upload: JS::from_rooted(XMLHttpRequestUpload::new(global)),
|
||||
response_url: "".into_string(),
|
||||
status: Cell::new(0),
|
||||
status_text: DOMRefCell::new(ByteString::new(vec!())),
|
||||
|
@ -185,19 +185,19 @@ impl XMLHttpRequest {
|
|||
upload_complete: Cell::new(false),
|
||||
upload_events: Cell::new(false),
|
||||
|
||||
global: GlobalField::from_rooted(global),
|
||||
global: GlobalField::from_rooted(&global),
|
||||
timer: DOMRefCell::new(Timer::new().unwrap()),
|
||||
fetch_time: Cell::new(0),
|
||||
terminate_sender: DOMRefCell::new(None),
|
||||
generation_id: Cell::new(GenerationId(0))
|
||||
}
|
||||
}
|
||||
pub fn new(global: &GlobalRef) -> Temporary<XMLHttpRequest> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<XMLHttpRequest> {
|
||||
reflect_dom_object(box XMLHttpRequest::new_inherited(global),
|
||||
*global,
|
||||
global,
|
||||
XMLHttpRequestBinding::Wrap)
|
||||
}
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<XMLHttpRequest>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<XMLHttpRequest>> {
|
||||
Ok(XMLHttpRequest::new(global))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue