mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -136,14 +136,14 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTServer {
|
|||
self.connected.set(connected);
|
||||
|
||||
// Step 5.2.5.
|
||||
promise.resolve_native(promise_cx, self);
|
||||
promise.resolve_native(self);
|
||||
},
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren
|
||||
// Step 7.
|
||||
BluetoothResponse::GetPrimaryServices(services_vec, single) => {
|
||||
let device = self.Device();
|
||||
if single {
|
||||
promise.resolve_native(promise_cx, &device.get_or_create_service(&services_vec[0], &self));
|
||||
promise.resolve_native(&device.get_or_create_service(&services_vec[0], &self));
|
||||
return;
|
||||
}
|
||||
let mut services = vec!();
|
||||
|
@ -151,7 +151,7 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTServer {
|
|||
let bt_service = device.get_or_create_service(&service, &self);
|
||||
services.push(bt_service);
|
||||
}
|
||||
promise.resolve_native(promise_cx, &services);
|
||||
promise.resolve_native(&services);
|
||||
},
|
||||
_ => promise.reject_error(promise_cx, Error::Type("Something went wrong...".to_owned())),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue