aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bluetoothremotegattserver.rs
diff options
context:
space:
mode:
authorzakorgyula <gyula.zakor@gmail.com>2016-10-06 17:27:00 +0200
committerzakorgyula <gyula.zakor@gmail.com>2016-11-04 15:22:48 +0100
commitb72dcf326baeef621d265fbdef8cebadeef72080 (patch)
tree522ac4511780efb7ecebd6410085dedfc9967f34 /components/script/dom/bluetoothremotegattserver.rs
parent11dbb7120f26c96504fcf42b267d3a8bde4f0283 (diff)
downloadservo-b72dcf326baeef621d265fbdef8cebadeef72080.tar.gz
servo-b72dcf326baeef621d265fbdef8cebadeef72080.zip
Check if the BluetoothDevice is connected, when calling getGATT functions.
Diffstat (limited to 'components/script/dom/bluetoothremotegattserver.rs')
-rw-r--r--components/script/dom/bluetoothremotegattserver.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs
index 5e589fe07af..3aafc788710 100644
--- a/components/script/dom/bluetoothremotegattserver.rs
+++ b/components/script/dom/bluetoothremotegattserver.rs
@@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMet
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::error::{ErrorResult, Fallible};
-use dom::bindings::error::Error::{self, Security};
+use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
@@ -72,6 +72,9 @@ impl BluetoothRemoteGATTServer {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
}
+ if !self.Device().Gatt().Connected() {
+ return Err(Network)
+ }
let (sender, receiver) = ipc::channel().unwrap();
self.get_bluetooth_thread().send(
BluetoothMethodMsg::GetPrimaryService(String::from(self.Device().Id()), uuid, sender)).unwrap();
@@ -103,6 +106,9 @@ impl BluetoothRemoteGATTServer {
}
}
};
+ if !self.Device().Gatt().Connected() {
+ return Err(Network)
+ }
let (sender, receiver) = ipc::channel().unwrap();
self.get_bluetooth_thread().send(
BluetoothMethodMsg::GetPrimaryServices(String::from(self.Device().Id()), uuid, sender)).unwrap();