Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fetch): accept arraybuffer in consume_body #20406

Merged
merged 4 commits into from Mar 24, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

feat(webidl): expose arraybuffer overload in body idl

  • Loading branch information
kwonoj committed Mar 24, 2018
commit c0b5eeef575356b05472a5a6759c9eaedbe9cd4d
@@ -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();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.