mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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,
|
||||
FormData,
|
||||
Json,
|
||||
Text
|
||||
Text,
|
||||
ArrayBuffer
|
||||
}
|
||||
|
||||
pub enum FetchedData {
|
||||
|
|
|
@ -611,6 +611,12 @@ impl RequestMethods for Request {
|
|||
fn Json(&self) -> Rc<Promise> {
|
||||
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 {
|
||||
|
|
|
@ -354,6 +354,12 @@ impl ResponseMethods for Response {
|
|||
fn Json(&self) -> Rc<Promise> {
|
||||
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 {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
interface Body {
|
||||
readonly attribute boolean bodyUsed;
|
||||
|
||||
// [NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||
[NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||
[NewObject] Promise<Blob> blob();
|
||||
[NewObject] Promise<FormData> formData();
|
||||
[NewObject] Promise<any> json();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue