aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorAttila Dusnoki <dati91@gmail.com>2017-02-10 16:54:33 +0100
committerAttila Dusnoki <dati91@gmail.com>2017-02-13 14:58:15 +0100
commitb1d388a991de21f00f8817282e0930ada5104d0d (patch)
tree5c62f527aaec938ba6f1a5a1676024892a6cbd55 /components/script
parentf7e86d2d0edbb95daaa92495d573befedf0673b0 (diff)
downloadservo-b1d388a991de21f00f8817282e0930ada5104d0d.tar.gz
servo-b1d388a991de21f00f8817282e0930ada5104d0d.zip
Fix BluetoothPermissionResult return state
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/bluetooth.rs4
-rw-r--r--components/script/dom/bluetoothpermissionresult.rs3
2 files changed, 4 insertions, 3 deletions
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index 68e9a2cc32e..0c77ee1ba90 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -215,12 +215,12 @@ impl Bluetooth {
let option = RequestDeviceoptions::new(BluetoothScanfilterSequence::new(uuid_filters),
ServiceUUIDSequence::new(optional_services_uuids));
- // Step 3 - 5
+ // Step 4 - 5.
if let PermissionState::Denied = get_descriptor_permission_state(PermissionName::Bluetooth, None) {
return p.reject_error(p.global().get_cx(), Error::NotFound);
}
- // Note: Steps 6 - 8 are implemented in
+ // Note: Step 3, 6 - 8 are implemented in
// components/net/bluetooth_thread.rs in request_device function.
self.get_bluetooth_thread().send(BluetoothRequest::RequestDevice(option, sender)).unwrap();
}
diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs
index ec3c83d537b..132d886a06c 100644
--- a/components/script/dom/bluetoothpermissionresult.rs
+++ b/components/script/dom/bluetoothpermissionresult.rs
@@ -87,8 +87,9 @@ impl AsyncBluetoothListener for BluetoothPermissionResult {
fn handle_response(&self, response: BluetoothResponse, promise_cx: *mut JSContext, promise: &Rc<Promise>) {
match response {
// https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
- // Step 11, 13 - 14.
+ // Step 3, 11, 13 - 14.
BluetoothResponse::RequestDevice(device) => {
+ self.set_state(PermissionState::Granted);
let bluetooth = self.get_bluetooth();
let mut device_instance_map = bluetooth.get_device_map().borrow_mut();
if let Some(ref existing_device) = device_instance_map.get(&device.id) {