mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -13,7 +13,7 @@ use crate::dom::bindings::conversions::ToJSValConvertible;
|
|||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::refcounted::Trusted;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||
use crate::dom::bindings::str::{is_token, ByteString, DOMString, USVString};
|
||||
use crate::dom::blob::{normalize_type_string, Blob};
|
||||
|
@ -52,6 +52,7 @@ use ipc_channel::router::ROUTER;
|
|||
use js::jsapi::JS_ClearPendingException;
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use js::jsval::{JSVal, NullValue, UndefinedValue};
|
||||
use js::rust::HandleObject;
|
||||
use js::rust::wrappers::JS_ParseJSON;
|
||||
use js::typedarray::{ArrayBuffer, CreateWith};
|
||||
use mime::{self, Mime, Name};
|
||||
|
@ -213,14 +214,15 @@ impl XMLHttpRequest {
|
|||
canceller: DomRefCell::new(Default::default()),
|
||||
}
|
||||
}
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<XMLHttpRequest> {
|
||||
reflect_dom_object(Box::new(XMLHttpRequest::new_inherited(global)), global)
|
||||
|
||||
fn new(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<XMLHttpRequest> {
|
||||
reflect_dom_object2(Box::new(XMLHttpRequest::new_inherited(global)), global, proto)
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#constructors
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<XMLHttpRequest>> {
|
||||
Ok(XMLHttpRequest::new(global))
|
||||
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> Fallible<DomRoot<XMLHttpRequest>> {
|
||||
Ok(XMLHttpRequest::new(global, proto))
|
||||
}
|
||||
|
||||
fn sync_in_window(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue