diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-21 16:00:48 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-21 16:00:48 +0200 |
commit | 5addc2dfa36a48a657c36ecbda0331bfaa8ebf11 (patch) | |
tree | db35ab2ddce4a406097d59f697ccc01ab0a555f7 /components/script/dom/bluetoothremotegattcharacteristic.rs | |
parent | 658dc8a5013973ceff3c91291d5536043b2e8e58 (diff) | |
download | servo-5addc2dfa36a48a657c36ecbda0331bfaa8ebf11.tar.gz servo-5addc2dfa36a48a657c36ecbda0331bfaa8ebf11.zip |
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.
Diffstat (limited to 'components/script/dom/bluetoothremotegattcharacteristic.rs')
-rw-r--r-- | components/script/dom/bluetoothremotegattcharacteristic.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 6eb7f253a2e..b6d92648448 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -262,7 +262,7 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic { // Step 7. BluetoothResponse::GetDescriptors(descriptors_vec, single) => { if single { - promise.resolve_native(promise_cx, &device.get_or_create_descriptor(&descriptors_vec[0], &self)); + promise.resolve_native(&device.get_or_create_descriptor(&descriptors_vec[0], &self)); return; } let mut descriptors = vec!(); @@ -270,7 +270,7 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic { let bt_descriptor = device.get_or_create_descriptor(&descriptor, &self); descriptors.push(bt_descriptor); } - promise.resolve_native(promise_cx, &descriptors); + promise.resolve_native(&descriptors); }, // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-readvalue BluetoothResponse::ReadValue(result) => { @@ -285,7 +285,7 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic { self.upcast::<EventTarget>().fire_bubbling_event(atom!("characteristicvaluechanged")); // Step 5.5.4. - promise.resolve_native(promise_cx, &value); + promise.resolve_native(&value); }, // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue BluetoothResponse::WriteValue(result) => { @@ -296,7 +296,7 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic { *self.value.borrow_mut() = Some(ByteString::new(result)); // Step 7.5.3. - promise.resolve_native(promise_cx, &()); + promise.resolve_native(&()); }, // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-stopnotifications @@ -306,7 +306,7 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic { // (StartNotification) Step 11. // (StopNotification) Step 5. - promise.resolve_native(promise_cx, self); + promise.resolve_native(self); }, _ => promise.reject_error(promise_cx, Error::Type("Something went wrong...".to_owned())), } |