Make Promise::resolve_native actually sound

We shouldn't have to pass a raw JSContext pointer, and to enter the
promise's context's compartment by hand.
This commit is contained in:
Anthony Ramine 2017-09-21 16:00:48 +02:00
parent 658dc8a501
commit 5addc2dfa3
17 changed files with 42 additions and 53 deletions

View file

@ -79,10 +79,10 @@ pub fn consume_body_with_promise<T: BodyOperations + DomObject>(object: &T,
match pkg_data_results {
Ok(results) => {
match results {
FetchedData::Text(s) => promise.resolve_native(cx, &USVString(s)),
FetchedData::Json(j) => promise.resolve_native(cx, &j),
FetchedData::BlobData(b) => promise.resolve_native(cx, &b),
FetchedData::FormData(f) => promise.resolve_native(cx, &f),
FetchedData::Text(s) => promise.resolve_native(&USVString(s)),
FetchedData::Json(j) => promise.resolve_native(&j),
FetchedData::BlobData(b) => promise.resolve_native(&b),
FetchedData::FormData(f) => promise.resolve_native(&f),
};
},
Err(err) => promise.reject_error(cx, err),