diff options
Diffstat (limited to 'components/script/dom/bluetoothremotegattservice.rs')
-rw-r--r-- | components/script/dom/bluetoothremotegattservice.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index 78427f7f6de..48cf9be6361 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -2,9 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use bluetooth_blacklist::{Blacklist, uuid_is_blacklisted}; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; -use dom::bindings::error::Error::Type; +use dom::bindings::error::Error::{Security, Type}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, MutHeap, Root}; @@ -88,6 +89,9 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService { characteristic: BluetoothCharacteristicUUID) -> Fallible<Root<BluetoothRemoteGATTCharacteristic>> { let uuid = try!(BluetoothUUID::GetCharacteristic(self.global().r(), characteristic)).to_string(); + if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { + return Err(Security) + } let (sender, receiver) = ipc::channel().unwrap(); self.get_bluetooth_thread().send( BluetoothMethodMsg::GetCharacteristic(self.get_instance_id(), uuid, sender)).unwrap(); @@ -122,7 +126,12 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService { -> Fallible<Vec<Root<BluetoothRemoteGATTCharacteristic>>> { let mut uuid: Option<String> = None; if let Some(c) = characteristic { - uuid = Some(try!(BluetoothUUID::GetCharacteristic(self.global().r(), c)).to_string()) + uuid = Some(try!(BluetoothUUID::GetCharacteristic(self.global().r(), c)).to_string()); + if let Some(ref uuid) = uuid { + if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { + return Err(Security) + } + } }; let mut characteristics = vec!(); let (sender, receiver) = ipc::channel().unwrap(); |