aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bluetoothremotegattserver.rs
diff options
context:
space:
mode:
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();