aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bluetooth.rs
diff options
context:
space:
mode:
authorZakor Gyula <zakorgy@inf.u-szeged.hu>2017-02-10 15:14:22 +0100
committerAttila Dusnoki <dati91@gmail.com>2017-02-13 14:58:14 +0100
commitf7e86d2d0edbb95daaa92495d573befedf0673b0 (patch)
treea739b4fefd54f072b8581168dbb1af3332664b3b /components/script/dom/bluetooth.rs
parent4a62562b0f9deb642745a2cd735bc5a6e5187230 (diff)
downloadservo-f7e86d2d0edbb95daaa92495d573befedf0673b0.tar.gz
servo-f7e86d2d0edbb95daaa92495d573befedf0673b0.zip
Use rooted_vec instead of Vec<JS<T>>
Diffstat (limited to 'components/script/dom/bluetooth.rs')
-rw-r--r--components/script/dom/bluetooth.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index ec8d6363793..68e9a2cc32e 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -573,7 +573,6 @@ impl PermissionAlgorithm for Bluetooth {
}
}
- #[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#query-the-bluetooth-permission
fn permission_query(cx: *mut JSContext, promise: &Rc<Promise>,
descriptor: &BluetoothPermissionDescriptor,
@@ -590,7 +589,7 @@ impl PermissionAlgorithm for Bluetooth {
}
// Step 4.
- let mut matching_devices: Vec<JS<BluetoothDevice>> = Vec::new();
+ rooted_vec!(let mut matching_devices);
// TODO: Step 5: Create a map between the current setting object and BluetoothPermissionData
// extra permission data, which replaces the exisitng EXTRA_PERMISSION_DATA global variable.
@@ -644,13 +643,13 @@ impl PermissionAlgorithm for Bluetooth {
// Step 6.3.
// TODO: Implement this correctly, not just using device ids here.
// https://webbluetoothcg.github.io/web-bluetooth/#get-the-bluetoothdevice-representing
- if let Some(ref device) = device_map.get(&device_id) {
- matching_devices.push(JS::from_ref(&*device));
+ if let Some(device) = device_map.get(&device_id) {
+ matching_devices.push(JS::from_ref(&**device));
}
}
// Step 7.
- status.set_devices(matching_devices);
+ status.set_devices(matching_devices.drain(..).collect());
// https://w3c.github.io/permissions/#dom-permissions-query
// Step 7.