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

refactor(consume_body): json stored in roottraceablebox

  • Loading branch information
kwonoj committed Mar 24, 2018
commit e6de213a13d6118a30ae5e90a91ccf81653677a7
@@ -38,7 +38,7 @@ pub enum BodyType {

pub enum FetchedData {
Text(String),
Json(JSValue),
Json(RootedTraceableBox<Heap<JSValue>>),

This comment has been minimized.

@kwonoj

kwonoj Mar 24, 2018

Author Contributor

Updated Json to store RootedTraceableBox<Heap> as suggested. Still it stores JSValue instead of JSVal, by JSVal doesn't meet trait bounds for RootedTraceableBox.

BlobData(DomRoot<Blob>),
FormData(DomRoot<FormData>),
ArrayBuffer(RootedTraceableBox<Heap<*mut JSObject>>),
@@ -137,7 +137,8 @@ fn run_json_data_algorithm(cx: *mut JSContext,
// TODO: See issue #13464. Exception should be thrown instead of cleared.
return Err(Error::Type("Failed to parse JSON".to_string()));
}
Ok(FetchedData::Json(rval.get()))
let rooted_heap = RootedTraceableBox::from_box(Heap::boxed(rval.get()));
Ok(FetchedData::Json(rooted_heap))
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.