mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
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:
parent
658dc8a501
commit
5addc2dfa3
17 changed files with 42 additions and 53 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue