mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
feat(webidl): expose arraybuffer overload in body idl
This commit is contained in:
parent
72f326b22b
commit
c0b5eeef57
4 changed files with 15 additions and 2 deletions
|
@ -27,7 +27,8 @@ pub enum BodyType {
|
||||||
Blob,
|
Blob,
|
||||||
FormData,
|
FormData,
|
||||||
Json,
|
Json,
|
||||||
Text
|
Text,
|
||||||
|
ArrayBuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum FetchedData {
|
pub enum FetchedData {
|
||||||
|
|
|
@ -611,6 +611,12 @@ impl RequestMethods for Request {
|
||||||
fn Json(&self) -> Rc<Promise> {
|
fn Json(&self) -> Rc<Promise> {
|
||||||
consume_body(self, BodyType::Json)
|
consume_body(self, BodyType::Json)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
// https://fetch.spec.whatwg.org/#dom-body-arraybuffer
|
||||||
|
fn ArrayBuffer(&self) -> Rc<Promise> {
|
||||||
|
consume_body(self, BodyType::ArrayBuffer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BodyOperations for Request {
|
impl BodyOperations for Request {
|
||||||
|
|
|
@ -354,6 +354,12 @@ impl ResponseMethods for Response {
|
||||||
fn Json(&self) -> Rc<Promise> {
|
fn Json(&self) -> Rc<Promise> {
|
||||||
consume_body(self, BodyType::Json)
|
consume_body(self, BodyType::Json)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
// https://fetch.spec.whatwg.org/#dom-body-arraybuffer
|
||||||
|
fn ArrayBuffer(&self) -> Rc<Promise> {
|
||||||
|
consume_body(self, BodyType::ArrayBuffer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_without_fragment(url: &ServoUrl) -> &str {
|
fn serialize_without_fragment(url: &ServoUrl) -> &str {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
interface Body {
|
interface Body {
|
||||||
readonly attribute boolean bodyUsed;
|
readonly attribute boolean bodyUsed;
|
||||||
|
|
||||||
// [NewObject] Promise<ArrayBuffer> arrayBuffer();
|
[NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||||
[NewObject] Promise<Blob> blob();
|
[NewObject] Promise<Blob> blob();
|
||||||
[NewObject] Promise<FormData> formData();
|
[NewObject] Promise<FormData> formData();
|
||||||
[NewObject] Promise<any> json();
|
[NewObject] Promise<any> json();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue