diff options
author | fokinv <fokin.valentin@stud.u-szeged.hu> | 2016-10-10 09:35:59 +0200 |
---|---|---|
committer | zakorgyula <gyula.zakor@gmail.com> | 2016-11-04 15:36:55 +0100 |
commit | d30bcbd33948f41fc3389f8105885060fd7541a5 (patch) | |
tree | 219debf2e7bc99d75e250a2234832dee53f319de | |
parent | dd733f6994e27a91e46fb8f9feb9a7e7179cfcda (diff) | |
download | servo-d30bcbd33948f41fc3389f8105885060fd7541a5.tar.gz servo-d30bcbd33948f41fc3389f8105885060fd7541a5.zip |
Blacklisted items are removed when calling getServices/Characteristics/Descriptors.
-rw-r--r-- | components/bluetooth/lib.rs | 7 | ||||
-rw-r--r-- | components/bluetooth_traits/Cargo.toml | 2 | ||||
-rw-r--r-- | components/bluetooth_traits/blacklist.rs (renamed from components/script/bluetooth_blacklist.rs) | 0 | ||||
-rw-r--r-- | components/bluetooth_traits/lib.rs | 3 | ||||
-rw-r--r-- | components/script/dom/bluetooth.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bluetoothremotegattcharacteristic.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bluetoothremotegattdescriptor.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bluetoothremotegattserver.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bluetoothremotegattservice.rs | 2 | ||||
-rw-r--r-- | components/script/lib.rs | 1 | ||||
-rw-r--r-- | components/servo/Cargo.lock | 2 | ||||
-rw-r--r-- | ports/cef/Cargo.lock | 2 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html.ini | 4 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html.ini | 4 |
14 files changed, 20 insertions, 15 deletions
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 55c883917f6..f01332fe01b 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -19,6 +19,7 @@ use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothCharacteristicsMsg}; use bluetooth_traits::{BluetoothDescriptorMsg, BluetoothDescriptorsMsg}; use bluetooth_traits::{BluetoothDeviceMsg, BluetoothError, BluetoothMethodMsg}; use bluetooth_traits::{BluetoothResult, BluetoothServiceMsg, BluetoothServicesMsg}; +use bluetooth_traits::blacklist::{uuid_is_blacklisted, Blacklist}; use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions}; use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic}; use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService}; @@ -681,7 +682,8 @@ impl BluetoothManager { } } } - services_vec.retain(|s| self.allowed_services + services_vec.retain(|s| !uuid_is_blacklisted(&s.uuid, Blacklist::All) && + self.allowed_services .get(&device_id) .map_or(false, |uuids| uuids.contains(&s.uuid))); if services_vec.is_empty() { @@ -758,6 +760,7 @@ impl BluetoothManager { if let Some(uuid) = uuid { services_vec.retain(|ref s| s.uuid == uuid); } + services_vec.retain(|s| !uuid_is_blacklisted(&s.uuid, Blacklist::All)); if services_vec.is_empty() { return drop(sender.send(Err(BluetoothError::NotFound))); } @@ -834,6 +837,7 @@ impl BluetoothManager { }); } } + characteristics_vec.retain(|c| !uuid_is_blacklisted(&c.uuid, Blacklist::All)); if characteristics_vec.is_empty() { return drop(sender.send(Err(BluetoothError::NotFound))); } @@ -888,6 +892,7 @@ impl BluetoothManager { }); } } + descriptors_vec.retain(|d| !uuid_is_blacklisted(&d.uuid, Blacklist::All)); if descriptors_vec.is_empty() { return drop(sender.send(Err(BluetoothError::NotFound))); } diff --git a/components/bluetooth_traits/Cargo.toml b/components/bluetooth_traits/Cargo.toml index c562d679a38..5ac8057c2b2 100644 --- a/components/bluetooth_traits/Cargo.toml +++ b/components/bluetooth_traits/Cargo.toml @@ -11,5 +11,7 @@ path = "lib.rs" [dependencies] ipc-channel = "0.5" +regex = "0.1.43" serde = "0.8" serde_derive = "0.8" +util = {path = "../util"} diff --git a/components/script/bluetooth_blacklist.rs b/components/bluetooth_traits/blacklist.rs index f9d1c564692..f9d1c564692 100644 --- a/components/script/bluetooth_blacklist.rs +++ b/components/bluetooth_traits/blacklist.rs diff --git a/components/bluetooth_traits/lib.rs b/components/bluetooth_traits/lib.rs index cea2a7b7a33..d93ff4109f7 100644 --- a/components/bluetooth_traits/lib.rs +++ b/components/bluetooth_traits/lib.rs @@ -5,9 +5,12 @@ #![feature(proc_macro)] extern crate ipc_channel; +extern crate regex; #[macro_use] extern crate serde_derive; +extern crate util; +pub mod blacklist; pub mod scanfilter; use ipc_channel::ipc::IpcSender; diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index e6eeb35cd2c..3325ef150fe 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -2,8 +2,8 @@ * 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 bluetooth_traits::{BluetoothError, BluetoothMethodMsg}; +use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence}; use bluetooth_traits::scanfilter::{RequestDeviceoptions, ServiceUUIDSequence}; use core::clone::Clone; diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 49207d09fbd..299ef921ee6 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -2,8 +2,8 @@ * 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 bluetooth_traits::BluetoothMethodMsg; +use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: BluetoothCharacteristicPropertiesMethods; diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index c7e64b7305c..30886baf473 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -2,8 +2,8 @@ * 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 bluetooth_traits::BluetoothMethodMsg; +use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding:: diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 3aafc788710..3499e431f1c 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -2,8 +2,8 @@ * 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 bluetooth_traits::BluetoothMethodMsg; +use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index a8c8265c3fd..cd7c6ab4366 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -2,8 +2,8 @@ * 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 bluetooth_traits::BluetoothMethodMsg; +use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; diff --git a/components/script/lib.rs b/components/script/lib.rs index d847af7b62f..94e9683ffaf 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -96,7 +96,6 @@ extern crate webrender_traits; extern crate websocket; extern crate xml5ever; -pub mod bluetooth_blacklist; mod body; pub mod clipboard_provider; mod devtools; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 3ae065e88eb..3bb4d5205b5 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -207,8 +207,10 @@ name = "bluetooth_traits" version = "0.0.1" dependencies = [ "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "util 0.0.1", ] [[package]] diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index a0e1dc4b6f7..608fad2789d 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -178,8 +178,10 @@ name = "bluetooth_traits" version = "0.0.1" dependencies = [ "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "util 0.0.1", ] [[package]] diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html.ini deleted file mode 100644 index 0361a4f320d..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[blacklisted-characteristics.html] - type: testharness - [The Device Information service is composed of blacklisted characteristics so we shouldn't find any.] - expected: FAIL diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html.ini deleted file mode 100644 index 45cb3b6e316..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[blacklisted-descriptors.html] - type: testharness - [The descriptors are blacklisted.] - expected: FAIL |