Auto merge of #14206 - szeged:blacklist-to-blocklist, r=jdm

Rename blacklist to blocklist in WebBluetooth

<!-- Please describe your changes on the following line: -->
There was a renaming in the [specification](1d5cfa4ee8).

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14206)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-22 05:55:02 -06:00 committed by GitHub
commit a89ba50180
26 changed files with 181 additions and 181 deletions

View file

@ -18,7 +18,7 @@ pub mod test;
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothServiceMsg}; use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothServiceMsg};
use bluetooth_traits::{BluetoothDeviceMsg, BluetoothRequest, BluetoothResponse}; use bluetooth_traits::{BluetoothDeviceMsg, BluetoothRequest, BluetoothResponse};
use bluetooth_traits::{BluetoothError, BluetoothResponseResult, BluetoothResult}; use bluetooth_traits::{BluetoothError, BluetoothResponseResult, BluetoothResult};
use bluetooth_traits::blacklist::{uuid_is_blacklisted, Blacklist}; use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions}; use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions};
use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic}; use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic};
use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService}; use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService};
@ -686,7 +686,7 @@ impl BluetoothManager {
} }
} }
} }
services_vec.retain(|s| !uuid_is_blacklisted(&s.uuid, Blacklist::All) && services_vec.retain(|s| !uuid_is_blocklisted(&s.uuid, Blocklist::All) &&
self.allowed_services self.allowed_services
.get(&device_id) .get(&device_id)
.map_or(false, |uuids| uuids.contains(&s.uuid))); .map_or(false, |uuids| uuids.contains(&s.uuid)));
@ -764,7 +764,7 @@ impl BluetoothManager {
if let Some(uuid) = uuid { if let Some(uuid) = uuid {
services_vec.retain(|ref s| s.uuid == uuid); services_vec.retain(|ref s| s.uuid == uuid);
} }
services_vec.retain(|s| !uuid_is_blacklisted(&s.uuid, Blacklist::All)); services_vec.retain(|s| !uuid_is_blocklisted(&s.uuid, Blocklist::All));
if services_vec.is_empty() { if services_vec.is_empty() {
return drop(sender.send(Err(BluetoothError::NotFound))); return drop(sender.send(Err(BluetoothError::NotFound)));
} }
@ -842,7 +842,7 @@ impl BluetoothManager {
); );
} }
} }
characteristics_vec.retain(|c| !uuid_is_blacklisted(&c.uuid, Blacklist::All)); characteristics_vec.retain(|c| !uuid_is_blocklisted(&c.uuid, Blocklist::All));
if characteristics_vec.is_empty() { if characteristics_vec.is_empty() {
return drop(sender.send(Err(BluetoothError::NotFound))); return drop(sender.send(Err(BluetoothError::NotFound)));
} }
@ -903,7 +903,7 @@ impl BluetoothManager {
); );
} }
} }
descriptors_vec.retain(|d| !uuid_is_blacklisted(&d.uuid, Blacklist::All)); descriptors_vec.retain(|d| !uuid_is_blocklisted(&d.uuid, Blocklist::All));
if descriptors_vec.is_empty() { if descriptors_vec.is_empty() {
return drop(sender.send(Err(BluetoothError::NotFound))); return drop(sender.send(Err(BluetoothError::NotFound)));
} }

View file

@ -43,7 +43,7 @@ const EMPTY_NAME_HEART_RATE_ADAPTER: &'static str = "EmptyNameHeartRateAdapter";
const NO_NAME_HEART_RATE_ADAPTER: &'static str = "NoNameHeartRateAdapter"; const NO_NAME_HEART_RATE_ADAPTER: &'static str = "NoNameHeartRateAdapter";
// https://cs.chromium.org/chromium/src/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h?l=284 // https://cs.chromium.org/chromium/src/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h?l=284
const TWO_HEART_RATE_SERVICES_ADAPTER: &'static str = "TwoHeartRateServicesAdapter"; const TWO_HEART_RATE_SERVICES_ADAPTER: &'static str = "TwoHeartRateServicesAdapter";
const BLACKLIST_TEST_ADAPTER: &'static str = "BlacklistTestAdapter"; const BLOCKLIST_TEST_ADAPTER: &'static str = "BlocklistTestAdapter";
// Device names // Device names
const CONNECTABLE_DEVICE_NAME: &'static str = "Connectable Device"; const CONNECTABLE_DEVICE_NAME: &'static str = "Connectable Device";
@ -63,7 +63,7 @@ const HEART_RATE_DEVICE_ADDRESS: &'static str = "00:00:00:00:00:03";
const UNICODE_DEVICE_ADDRESS: &'static str = "00:00:00:00:00:01"; const UNICODE_DEVICE_ADDRESS: &'static str = "00:00:00:00:00:01";
// Service UUIDs // Service UUIDs
const BLACKLIST_TEST_SERVICE_UUID: &'static str = "611c954a-263b-4f4a-aab6-01ddb953f985"; const BLOCKLIST_TEST_SERVICE_UUID: &'static str = "611c954a-263b-4f4a-aab6-01ddb953f985";
// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.device_information.xml // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.device_information.xml
const DEVICE_INFORMATION_UUID: &'static str = "0000180a-0000-1000-8000-00805f9b34fb"; const DEVICE_INFORMATION_UUID: &'static str = "0000180a-0000-1000-8000-00805f9b34fb";
// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.generic_access.xml // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.generic_access.xml
@ -79,7 +79,7 @@ const HUMAN_INTERFACE_DEVICE_SERVICE_UUID: &'static str = "00001812-0000-1000-80
const TX_POWER_SERVICE_UUID: &'static str = "00001804-0000-1000-8000-00805f9b34fb"; const TX_POWER_SERVICE_UUID: &'static str = "00001804-0000-1000-8000-00805f9b34fb";
// Characteristic UUIDs // Characteristic UUIDs
const BLACKLIST_EXCLUDE_READS_CHARACTERISTIC_UUID: &'static str = "bad1c9a2-9a5b-4015-8b60-1579bbbf2135"; const BLOCKLIST_EXCLUDE_READS_CHARACTERISTIC_UUID: &'static str = "bad1c9a2-9a5b-4015-8b60-1579bbbf2135";
// https://www.bluetooth.com/specifications/gatt/ // https://www.bluetooth.com/specifications/gatt/
// viewer?attributeXmlFile=org.bluetooth.characteristic.body_sensor_location.xml // viewer?attributeXmlFile=org.bluetooth.characteristic.body_sensor_location.xml
const BODY_SENSOR_LOCATION_CHARACTERISTIC_UUID: &'static str = "00002a38-0000-1000-8000-00805f9b34fb"; const BODY_SENSOR_LOCATION_CHARACTERISTIC_UUID: &'static str = "00002a38-0000-1000-8000-00805f9b34fb";
@ -97,8 +97,8 @@ const PERIPHERAL_PRIVACY_FLAG_CHARACTERISTIC_UUID: &'static str = "00002a02-0000
const SERIAL_NUMBER_STRING_UUID: &'static str = "00002a25-0000-1000-8000-00805f9b34fb"; const SERIAL_NUMBER_STRING_UUID: &'static str = "00002a25-0000-1000-8000-00805f9b34fb";
// Descriptor UUIDs // Descriptor UUIDs
const BLACKLIST_EXCLUDE_READS_DESCRIPTOR_UUID: &'static str = "aaaaaaaa-aaaa-1181-0510-810819516110"; const BLOCKLIST_EXCLUDE_READS_DESCRIPTOR_UUID: &'static str = "aaaaaaaa-aaaa-1181-0510-810819516110";
const BLACKLIST_DESCRIPTOR_UUID: &'static str = "07711111-6104-0970-7011-1107105110aaa"; const BLOCKLIST_DESCRIPTOR_UUID: &'static str = "07711111-6104-0970-7011-1107105110aaa";
// https://www.bluetooth.com/specifications/gatt/ // https://www.bluetooth.com/specifications/gatt/
// viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_user_description.xml // viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_user_description.xml
const CHARACTERISTIC_USER_DESCRIPTION_UUID: &'static str = "00002901-0000-1000-8000-00805f9b34fb"; const CHARACTERISTIC_USER_DESCRIPTION_UUID: &'static str = "00002901-0000-1000-8000-00805f9b34fb";
@ -374,33 +374,33 @@ fn create_two_heart_rate_services_device(adapter: &BluetoothAdapter) -> Result<(
Ok(()) Ok(())
} }
fn create_blacklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> { fn create_blocklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> {
let connectable_device = let connectable_device =
try!(create_device_with_uuids(adapter, try!(create_device_with_uuids(adapter,
CONNECTABLE_DEVICE_NAME.to_owned(), CONNECTABLE_DEVICE_NAME.to_owned(),
CONNECTABLE_DEVICE_ADDRESS.to_owned(), CONNECTABLE_DEVICE_ADDRESS.to_owned(),
vec![BLACKLIST_TEST_SERVICE_UUID.to_owned(), vec![BLOCKLIST_TEST_SERVICE_UUID.to_owned(),
DEVICE_INFORMATION_UUID.to_owned(), DEVICE_INFORMATION_UUID.to_owned(),
GENERIC_ACCESS_SERVICE_UUID.to_owned(), GENERIC_ACCESS_SERVICE_UUID.to_owned(),
HEART_RATE_SERVICE_UUID.to_owned(), HEART_RATE_SERVICE_UUID.to_owned(),
HUMAN_INTERFACE_DEVICE_SERVICE_UUID.to_owned()])); HUMAN_INTERFACE_DEVICE_SERVICE_UUID.to_owned()]));
let blacklist_test_service = try!(create_service(&connectable_device, BLACKLIST_TEST_SERVICE_UUID.to_owned())); let blocklist_test_service = try!(create_service(&connectable_device, BLOCKLIST_TEST_SERVICE_UUID.to_owned()));
let blacklist_exclude_reads_characteristic = let blocklist_exclude_reads_characteristic =
try!(create_characteristic(&blacklist_test_service, try!(create_characteristic(&blocklist_test_service,
BLACKLIST_EXCLUDE_READS_CHARACTERISTIC_UUID.to_owned())); BLOCKLIST_EXCLUDE_READS_CHARACTERISTIC_UUID.to_owned()));
try!(blacklist_exclude_reads_characteristic try!(blocklist_exclude_reads_characteristic
.set_flags(vec![READ_FLAG.to_string(), WRITE_FLAG.to_string()])); .set_flags(vec![READ_FLAG.to_string(), WRITE_FLAG.to_string()]));
let _blacklist_exclude_reads_descriptor = let _blocklist_exclude_reads_descriptor =
try!(create_descriptor_with_value(&blacklist_exclude_reads_characteristic, try!(create_descriptor_with_value(&blocklist_exclude_reads_characteristic,
BLACKLIST_EXCLUDE_READS_DESCRIPTOR_UUID.to_owned(), BLOCKLIST_EXCLUDE_READS_DESCRIPTOR_UUID.to_owned(),
vec![54; 3])); vec![54; 3]));
let _blacklist_descriptor = let _blocklist_descriptor =
try!(create_descriptor_with_value(&blacklist_exclude_reads_characteristic, try!(create_descriptor_with_value(&blocklist_exclude_reads_characteristic,
BLACKLIST_DESCRIPTOR_UUID.to_owned(), BLOCKLIST_DESCRIPTOR_UUID.to_owned(),
vec![54; 3])); vec![54; 3]));
let device_information_service = try!(create_service(&connectable_device, DEVICE_INFORMATION_UUID.to_owned())); let device_information_service = try!(create_service(&connectable_device, DEVICE_INFORMATION_UUID.to_owned()));
@ -490,10 +490,10 @@ pub fn test(manager: &mut BluetoothManager, data_set_name: String) -> Result<(),
let _ = try!(create_two_heart_rate_services_device(adapter)); let _ = try!(create_two_heart_rate_services_device(adapter));
}, },
BLACKLIST_TEST_ADAPTER => { BLOCKLIST_TEST_ADAPTER => {
try!(set_adapter(adapter, BLACKLIST_TEST_ADAPTER.to_owned())); try!(set_adapter(adapter, BLOCKLIST_TEST_ADAPTER.to_owned()));
let _ = try!(create_blacklisted_device(adapter)); let _ = try!(create_blocklisted_device(adapter));
}, },
_ => return Err(Box::from(WRONG_DATA_SET_ERROR.to_string())), _ => return Err(Box::from(WRONG_DATA_SET_ERROR.to_string())),
} }

View file

@ -9,73 +9,73 @@ use std::io::BufRead;
use std::string::String; use std::string::String;
use util::resource_files::read_resource_file; use util::resource_files::read_resource_file;
const BLACKLIST_FILE: &'static str = "gatt_blacklist.txt"; const BLOCKLIST_FILE: &'static str = "gatt_blocklist.txt";
const BLACKLIST_FILE_NOT_FOUND: &'static str = "Could not find gatt_blacklist.txt file"; const BLOCKLIST_FILE_NOT_FOUND: &'static str = "Could not find gatt_blocklist.txt file";
const EXCLUDE_READS: &'static str = "exclude-reads"; const EXCLUDE_READS: &'static str = "exclude-reads";
const EXCLUDE_WRITES: &'static str = "exclude-writes"; const EXCLUDE_WRITES: &'static str = "exclude-writes";
const VALID_UUID_REGEX: &'static str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; const VALID_UUID_REGEX: &'static str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
thread_local!(pub static BLUETOOTH_BLACKLIST: RefCell<BluetoothBlacklist> = thread_local!(pub static BLUETOOTH_BLOCKLIST: RefCell<BluetoothBlocklist> =
RefCell::new(BluetoothBlacklist(parse_blacklist()))); RefCell::new(BluetoothBlocklist(parse_blocklist())));
pub fn uuid_is_blacklisted(uuid: &str, exclude_type: Blacklist) -> bool { pub fn uuid_is_blocklisted(uuid: &str, exclude_type: Blocklist) -> bool {
BLUETOOTH_BLACKLIST.with(|blist| { BLUETOOTH_BLOCKLIST.with(|blist| {
match exclude_type { match exclude_type {
Blacklist::All => { Blocklist::All => {
blist.borrow().is_blacklisted(uuid) blist.borrow().is_blocklisted(uuid)
}, },
Blacklist::Reads => { Blocklist::Reads => {
blist.borrow().is_blacklisted_for_reads(uuid) blist.borrow().is_blocklisted_for_reads(uuid)
} }
Blacklist::Writes => { Blocklist::Writes => {
blist.borrow().is_blacklisted_for_writes(uuid) blist.borrow().is_blocklisted_for_writes(uuid)
} }
} }
}) })
} }
pub struct BluetoothBlacklist(Option<HashMap<String, Blacklist>>); pub struct BluetoothBlocklist(Option<HashMap<String, Blocklist>>);
#[derive(Eq, PartialEq)] #[derive(Eq, PartialEq)]
pub enum Blacklist { pub enum Blocklist {
All, // Read and Write All, // Read and Write
Reads, Reads,
Writes, Writes,
} }
impl BluetoothBlacklist { impl BluetoothBlocklist {
// https://webbluetoothcg.github.io/web-bluetooth/#blacklisted // https://webbluetoothcg.github.io/web-bluetooth/#blocklisted
pub fn is_blacklisted(&self, uuid: &str) -> bool { pub fn is_blocklisted(&self, uuid: &str) -> bool {
match self.0 { match self.0 {
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blacklist::All)), Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blocklist::All)),
None => false, None => false,
} }
} }
// https://webbluetoothcg.github.io/web-bluetooth/#blacklisted-for-reads // https://webbluetoothcg.github.io/web-bluetooth/#blocklisted-for-reads
pub fn is_blacklisted_for_reads(&self, uuid: &str) -> bool { pub fn is_blocklisted_for_reads(&self, uuid: &str) -> bool {
match self.0 { match self.0 {
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blacklist::All) || Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blocklist::All) ||
et.eq(&Blacklist::Reads)), et.eq(&Blocklist::Reads)),
None => false, None => false,
} }
} }
// https://webbluetoothcg.github.io/web-bluetooth/#blacklisted-for-writes // https://webbluetoothcg.github.io/web-bluetooth/#blocklisted-for-writes
pub fn is_blacklisted_for_writes(&self, uuid: &str) -> bool { pub fn is_blocklisted_for_writes(&self, uuid: &str) -> bool {
match self.0 { match self.0 {
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blacklist::All) || Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blocklist::All) ||
et.eq(&Blacklist::Writes)), et.eq(&Blocklist::Writes)),
None => false, None => false,
} }
} }
} }
// https://webbluetoothcg.github.io/web-bluetooth/#parsing-the-blacklist // https://webbluetoothcg.github.io/web-bluetooth/#parsing-the-blocklist
fn parse_blacklist() -> Option<HashMap<String, Blacklist>> { fn parse_blocklist() -> Option<HashMap<String, Blocklist>> {
// Step 1 missing, currently we parse ./resources/gatt_blacklist.txt. // Step 1 missing, currently we parse ./resources/gatt_blocklist.txt.
let valid_uuid_regex = Regex::new(VALID_UUID_REGEX).unwrap(); let valid_uuid_regex = Regex::new(VALID_UUID_REGEX).unwrap();
let content = read_resource_file(BLACKLIST_FILE).expect(BLACKLIST_FILE_NOT_FOUND); let content = read_resource_file(BLOCKLIST_FILE).expect(BLOCKLIST_FILE_NOT_FOUND);
// Step 3 // Step 3
let mut result = HashMap::new(); let mut result = HashMap::new();
// Step 2 and 4 // Step 2 and 4
@ -88,7 +88,7 @@ fn parse_blacklist() -> Option<HashMap<String, Blacklist>> {
if line.is_empty() || line.starts_with('#') { if line.is_empty() || line.starts_with('#') {
continue; continue;
} }
let mut exclude_type = Blacklist::All; let mut exclude_type = Blocklist::All;
let mut words = line.split_whitespace(); let mut words = line.split_whitespace();
let uuid = match words.next() { let uuid = match words.next() {
Some(uuid) => uuid, Some(uuid) => uuid,
@ -98,14 +98,14 @@ fn parse_blacklist() -> Option<HashMap<String, Blacklist>> {
return None; return None;
} }
match words.next() { match words.next() {
// Step 4.2 We already have an initialized exclude_type variable with Blacklist::All. // Step 4.2 We already have an initialized exclude_type variable with Blocklist::All.
None => {}, None => {},
// Step 4.3 // Step 4.3
Some(EXCLUDE_READS) => { Some(EXCLUDE_READS) => {
exclude_type = Blacklist::Reads; exclude_type = Blocklist::Reads;
}, },
Some(EXCLUDE_WRITES) => { Some(EXCLUDE_WRITES) => {
exclude_type = Blacklist::Writes; exclude_type = Blocklist::Writes;
}, },
// Step 4.4 // Step 4.4
_ => { _ => {

View file

@ -10,7 +10,7 @@ extern crate regex;
extern crate serde_derive; extern crate serde_derive;
extern crate util; extern crate util;
pub mod blacklist; pub mod blocklist;
pub mod scanfilter; pub mod scanfilter;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;

View file

@ -4,7 +4,7 @@
use bluetooth_traits::{BluetoothError, BluetoothRequest}; use bluetooth_traits::{BluetoothError, BluetoothRequest};
use bluetooth_traits::{BluetoothResponse, BluetoothResponseListener, BluetoothResponseResult}; use bluetooth_traits::{BluetoothResponse, BluetoothResponseListener, BluetoothResponseResult};
use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted};
use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence}; use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence};
use bluetooth_traits::scanfilter::{RequestDeviceoptions, ServiceUUIDSequence}; use bluetooth_traits::scanfilter::{RequestDeviceoptions, ServiceUUIDSequence};
use core::clone::Clone; use core::clone::Clone;
@ -193,9 +193,9 @@ fn convert_request_device_options(filters: &Option<Vec<BluetoothRequestDeviceFil
let uuid = try!(BluetoothUUID::service(opt_service.clone())).to_string(); let uuid = try!(BluetoothUUID::service(opt_service.clone())).to_string();
// Step 2.7. // Step 2.7.
// Note: What we are doing here is adding the not blacklisted UUIDs to the result vector, // Note: What we are doing here is adding the not blocklisted UUIDs to the result vector,
// instead of removing them from an already filled vector. // insted of removing them from an already filled vector.
if !uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if !uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
optional_services_uuids.push(uuid); optional_services_uuids.push(uuid);
} }
} }
@ -234,7 +234,7 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter) -> Fallible<Blueto
let uuid = try!(BluetoothUUID::service(service.clone())).to_string(); let uuid = try!(BluetoothUUID::service(service.clone())).to_string();
// Step 2.4.3.4. // Step 2.4.3.4.
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
return Err(Security) return Err(Security)
} }
@ -295,7 +295,7 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter) -> Fallible<Blueto
let uuid = try!(BluetoothUUID::service(service_data_uuid.clone())).to_string(); let uuid = try!(BluetoothUUID::service(service_data_uuid.clone())).to_string();
// Step 2.4.7.3. // Step 2.4.7.3.
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
return Err(Security) return Err(Security)
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted};
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::
BluetoothCharacteristicPropertiesMethods; BluetoothCharacteristicPropertiesMethods;
@ -110,7 +110,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
return p; return p;
} }
}; };
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -141,7 +141,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
} }
}; };
if let Some(ref uuid) = uuid { if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -167,7 +167,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
fn ReadValue(&self) -> Rc<Promise> { fn ReadValue(&self) -> Rc<Promise> {
let p = Promise::new(&self.global()); let p = Promise::new(&self.global());
let p_cx = p.global().get_cx(); let p_cx = p.global().get_cx();
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Reads) { if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -190,7 +190,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> { fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> {
let p = Promise::new(&self.global()); let p = Promise::new(&self.global());
let p_cx = p.global().get_cx(); let p_cx = p.global().get_cx();
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Writes) { if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Writes) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted};
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding:: use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::
@ -90,7 +90,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
fn ReadValue(&self) -> Rc<Promise> { fn ReadValue(&self) -> Rc<Promise> {
let p = Promise::new(&self.global()); let p = Promise::new(&self.global());
let p_cx = p.global().get_cx(); let p_cx = p.global().get_cx();
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Reads) { if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -109,7 +109,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> { fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> {
let p = Promise::new(&self.global()); let p = Promise::new(&self.global());
let p_cx = p.global().get_cx(); let p_cx = p.global().get_cx();
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Writes) { if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Writes) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted};
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
@ -101,7 +101,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
return p; return p;
} }
}; };
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -130,7 +130,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
} }
}; };
if let Some(ref uuid) = uuid { if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use bluetooth_traits::blacklist::{Blacklist, uuid_is_blacklisted}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted};
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
@ -105,7 +105,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
return p; return p;
} }
}; };
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -136,7 +136,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
} }
}; };
if let Some(ref uuid) = uuid { if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -166,7 +166,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
return p; return p;
} }
}; };
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }
@ -200,7 +200,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
} }
}; };
if let Some(ref uuid) = uuid { if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) { if uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
p.reject_error(p_cx, Security); p.reject_error(p_cx, Security);
return p; return p;
} }

View file

@ -1,5 +1,5 @@
# Source: # Source:
# https://github.com/WebBluetoothCG/registries/blob/master/gatt_blacklist.txt # https://github.com/WebBluetoothCG/registries/blob/master/gatt_blocklist.txt
# License: # License:
# https://github.com/WebBluetoothCG/registries/blob/master/LICENSE # https://github.com/WebBluetoothCG/registries/blob/master/LICENSE
@ -40,7 +40,7 @@ f000ffc0-0451-4000-b000-000000000000
# Block access to standardized unique identifiers, for privacy reasons. # Block access to standardized unique identifiers, for privacy reasons.
00002a25-0000-1000-8000-00805f9b34fb 00002a25-0000-1000-8000-00805f9b34fb
# Blacklisted characteristic used to test readValue function. # Blocklisted characteristic used to test readValue function.
bad1c9a2-9a5b-4015-8b60-1579bbbf2135 exclude-reads bad1c9a2-9a5b-4015-8b60-1579bbbf2135 exclude-reads
@ -55,8 +55,8 @@ bad1c9a2-9a5b-4015-8b60-1579bbbf2135 exclude-reads
# Writing to this would let a web page interfere with the broadcasted services. # Writing to this would let a web page interfere with the broadcasted services.
00002903-0000-1000-8000-00805f9b34fb exclude-writes 00002903-0000-1000-8000-00805f9b34fb exclude-writes
# Blacklisted descriptor used to test. # Blocklisted descriptor used to test.
07711111-6104-0970-7011-1107105110aaa 07711111-6104-0970-7011-1107105110aaa
# Blacklisted descriptor used to test. # Blocklisted descriptor used to test.
aaaaaaaa-aaaa-1181-0510-810819516110 exclude-reads aaaaaaaa-aaaa-1181-0510-810819516110 exclude-reads

View file

@ -6746,10 +6746,10 @@
"url": "/_mozilla/mozilla/bluetooth/disconnect/disconnect-twice-in-a-row.html" "url": "/_mozilla/mozilla/bluetooth/disconnect/disconnect-twice-in-a-row.html"
} }
], ],
"mozilla/bluetooth/getCharacteristic/blacklisted-characteristic.html": [ "mozilla/bluetooth/getCharacteristic/blocklisted-characteristic.html": [
{ {
"path": "mozilla/bluetooth/getCharacteristic/blacklisted-characteristic.html", "path": "mozilla/bluetooth/getCharacteristic/blocklisted-characteristic.html",
"url": "/_mozilla/mozilla/bluetooth/getCharacteristic/blacklisted-characteristic.html" "url": "/_mozilla/mozilla/bluetooth/getCharacteristic/blocklisted-characteristic.html"
} }
], ],
"mozilla/bluetooth/getCharacteristic/characteristic-found.html": [ "mozilla/bluetooth/getCharacteristic/characteristic-found.html": [
@ -6800,16 +6800,16 @@
"url": "/_mozilla/mozilla/bluetooth/getCharacteristic/service-is-removed.html" "url": "/_mozilla/mozilla/bluetooth/getCharacteristic/service-is-removed.html"
} }
], ],
"mozilla/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html": [ "mozilla/bluetooth/getCharacteristics/blocklisted-characteristics-with-uuid.html": [
{ {
"path": "mozilla/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html", "path": "mozilla/bluetooth/getCharacteristics/blocklisted-characteristics-with-uuid.html",
"url": "/_mozilla/mozilla/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html" "url": "/_mozilla/mozilla/bluetooth/getCharacteristics/blocklisted-characteristics-with-uuid.html"
} }
], ],
"mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html": [ "mozilla/bluetooth/getCharacteristics/blocklisted-characteristics.html": [
{ {
"path": "mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html", "path": "mozilla/bluetooth/getCharacteristics/blocklisted-characteristics.html",
"url": "/_mozilla/mozilla/bluetooth/getCharacteristics/blacklisted-characteristics.html" "url": "/_mozilla/mozilla/bluetooth/getCharacteristics/blocklisted-characteristics.html"
} }
], ],
"mozilla/bluetooth/getCharacteristics/characteristics-found-with-uuid.html": [ "mozilla/bluetooth/getCharacteristics/characteristics-found-with-uuid.html": [
@ -6902,10 +6902,10 @@
"url": "/_mozilla/mozilla/bluetooth/getCharacteristics/service-is-removed.html" "url": "/_mozilla/mozilla/bluetooth/getCharacteristics/service-is-removed.html"
} }
], ],
"mozilla/bluetooth/getDescriptor/blacklisted-descriptor.html": [ "mozilla/bluetooth/getDescriptor/blocklisted-descriptor.html": [
{ {
"path": "mozilla/bluetooth/getDescriptor/blacklisted-descriptor.html", "path": "mozilla/bluetooth/getDescriptor/blocklisted-descriptor.html",
"url": "/_mozilla/mozilla/bluetooth/getDescriptor/blacklisted-descriptor.html" "url": "/_mozilla/mozilla/bluetooth/getDescriptor/blocklisted-descriptor.html"
} }
], ],
"mozilla/bluetooth/getDescriptor/characteristic-is-removed.html": [ "mozilla/bluetooth/getDescriptor/characteristic-is-removed.html": [
@ -6956,16 +6956,16 @@
"url": "/_mozilla/mozilla/bluetooth/getDescriptor/invalid-descriptor-name.html" "url": "/_mozilla/mozilla/bluetooth/getDescriptor/invalid-descriptor-name.html"
} }
], ],
"mozilla/bluetooth/getDescriptors/blacklisted-descriptors-with-uuid.html": [ "mozilla/bluetooth/getDescriptors/blocklisted-descriptors-with-uuid.html": [
{ {
"path": "mozilla/bluetooth/getDescriptors/blacklisted-descriptors-with-uuid.html", "path": "mozilla/bluetooth/getDescriptors/blocklisted-descriptors-with-uuid.html",
"url": "/_mozilla/mozilla/bluetooth/getDescriptors/blacklisted-descriptors-with-uuid.html" "url": "/_mozilla/mozilla/bluetooth/getDescriptors/blocklisted-descriptors-with-uuid.html"
} }
], ],
"mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html": [ "mozilla/bluetooth/getDescriptors/blocklisted-descriptors.html": [
{ {
"path": "mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html", "path": "mozilla/bluetooth/getDescriptors/blocklisted-descriptors.html",
"url": "/_mozilla/mozilla/bluetooth/getDescriptors/blacklisted-descriptors.html" "url": "/_mozilla/mozilla/bluetooth/getDescriptors/blocklisted-descriptors.html"
} }
], ],
"mozilla/bluetooth/getDescriptors/characteristic-is-removed-with-uuid.html": [ "mozilla/bluetooth/getDescriptors/characteristic-is-removed-with-uuid.html": [
@ -7118,16 +7118,16 @@
"url": "/_mozilla/mozilla/bluetooth/getPrimaryService/service-not-found.html" "url": "/_mozilla/mozilla/bluetooth/getPrimaryService/service-not-found.html"
} }
], ],
"mozilla/bluetooth/getPrimaryServices/blacklisted-services-with-uuid.html": [ "mozilla/bluetooth/getPrimaryServices/blocklisted-services-with-uuid.html": [
{ {
"path": "mozilla/bluetooth/getPrimaryServices/blacklisted-services-with-uuid.html", "path": "mozilla/bluetooth/getPrimaryServices/blocklisted-services-with-uuid.html",
"url": "/_mozilla/mozilla/bluetooth/getPrimaryServices/blacklisted-services-with-uuid.html" "url": "/_mozilla/mozilla/bluetooth/getPrimaryServices/blocklisted-services-with-uuid.html"
} }
], ],
"mozilla/bluetooth/getPrimaryServices/blacklisted-services.html": [ "mozilla/bluetooth/getPrimaryServices/blocklisted-services.html": [
{ {
"path": "mozilla/bluetooth/getPrimaryServices/blacklisted-services.html", "path": "mozilla/bluetooth/getPrimaryServices/blocklisted-services.html",
"url": "/_mozilla/mozilla/bluetooth/getPrimaryServices/blacklisted-services.html" "url": "/_mozilla/mozilla/bluetooth/getPrimaryServices/blocklisted-services.html"
} }
], ],
"mozilla/bluetooth/getPrimaryServices/correct-services.html": [ "mozilla/bluetooth/getPrimaryServices/correct-services.html": [
@ -7244,10 +7244,10 @@
"url": "/_mozilla/mozilla/bluetooth/idl-BluetoothUUID.html" "url": "/_mozilla/mozilla/bluetooth/idl-BluetoothUUID.html"
} }
], ],
"mozilla/bluetooth/readValue/characteristic/blacklisted-characteristic.html": [ "mozilla/bluetooth/readValue/characteristic/blocklisted-characteristic.html": [
{ {
"path": "mozilla/bluetooth/readValue/characteristic/blacklisted-characteristic.html", "path": "mozilla/bluetooth/readValue/characteristic/blocklisted-characteristic.html",
"url": "/_mozilla/mozilla/bluetooth/readValue/characteristic/blacklisted-characteristic.html" "url": "/_mozilla/mozilla/bluetooth/readValue/characteristic/blocklisted-characteristic.html"
} }
], ],
"mozilla/bluetooth/readValue/characteristic/characteristic-is-removed.html": [ "mozilla/bluetooth/readValue/characteristic/characteristic-is-removed.html": [
@ -7286,10 +7286,10 @@
"url": "/_mozilla/mozilla/bluetooth/readValue/characteristic/service-is-removed.html" "url": "/_mozilla/mozilla/bluetooth/readValue/characteristic/service-is-removed.html"
} }
], ],
"mozilla/bluetooth/readValue/descriptor/blacklisted-descriptor.html": [ "mozilla/bluetooth/readValue/descriptor/blocklisted-descriptor.html": [
{ {
"path": "mozilla/bluetooth/readValue/descriptor/blacklisted-descriptor.html", "path": "mozilla/bluetooth/readValue/descriptor/blocklisted-descriptor.html",
"url": "/_mozilla/mozilla/bluetooth/readValue/descriptor/blacklisted-descriptor.html" "url": "/_mozilla/mozilla/bluetooth/readValue/descriptor/blocklisted-descriptor.html"
} }
], ],
"mozilla/bluetooth/readValue/descriptor/characteristic-is-removed.html": [ "mozilla/bluetooth/readValue/descriptor/characteristic-is-removed.html": [
@ -7358,16 +7358,16 @@
"url": "/_mozilla/mozilla/bluetooth/requestDevice/adapter-off.html" "url": "/_mozilla/mozilla/bluetooth/requestDevice/adapter-off.html"
} }
], ],
"mozilla/bluetooth/requestDevice/blacklisted-service-in-filter.html": [ "mozilla/bluetooth/requestDevice/blocklisted-service-in-filter.html": [
{ {
"path": "mozilla/bluetooth/requestDevice/blacklisted-service-in-filter.html", "path": "mozilla/bluetooth/requestDevice/blocklisted-service-in-filter.html",
"url": "/_mozilla/mozilla/bluetooth/requestDevice/blacklisted-service-in-filter.html" "url": "/_mozilla/mozilla/bluetooth/requestDevice/blocklisted-service-in-filter.html"
} }
], ],
"mozilla/bluetooth/requestDevice/blacklisted-service-in-optionalServices.html": [ "mozilla/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html": [
{ {
"path": "mozilla/bluetooth/requestDevice/blacklisted-service-in-optionalServices.html", "path": "mozilla/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html",
"url": "/_mozilla/mozilla/bluetooth/requestDevice/blacklisted-service-in-optionalServices.html" "url": "/_mozilla/mozilla/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html"
} }
], ],
"mozilla/bluetooth/requestDevice/canonicalizeFilter/empty-filter.html": [ "mozilla/bluetooth/requestDevice/canonicalizeFilter/empty-filter.html": [
@ -7592,10 +7592,10 @@
"url": "/_mozilla/mozilla/bluetooth/requestDevice/two-filters.html" "url": "/_mozilla/mozilla/bluetooth/requestDevice/two-filters.html"
} }
], ],
"mozilla/bluetooth/writeValue/characteristic/blacklisted-characteristic.html": [ "mozilla/bluetooth/writeValue/characteristic/blocklisted-characteristic.html": [
{ {
"path": "mozilla/bluetooth/writeValue/characteristic/blacklisted-characteristic.html", "path": "mozilla/bluetooth/writeValue/characteristic/blocklisted-characteristic.html",
"url": "/_mozilla/mozilla/bluetooth/writeValue/characteristic/blacklisted-characteristic.html" "url": "/_mozilla/mozilla/bluetooth/writeValue/characteristic/blocklisted-characteristic.html"
} }
], ],
"mozilla/bluetooth/writeValue/characteristic/characteristic-is-removed.html": [ "mozilla/bluetooth/writeValue/characteristic/characteristic-is-removed.html": [
@ -7634,10 +7634,10 @@
"url": "/_mozilla/mozilla/bluetooth/writeValue/characteristic/write-updates-value.html" "url": "/_mozilla/mozilla/bluetooth/writeValue/characteristic/write-updates-value.html"
} }
], ],
"mozilla/bluetooth/writeValue/descriptor/blacklisted-descriptor.html": [ "mozilla/bluetooth/writeValue/descriptor/blocklisted-descriptor.html": [
{ {
"path": "mozilla/bluetooth/writeValue/descriptor/blacklisted-descriptor.html", "path": "mozilla/bluetooth/writeValue/descriptor/blocklisted-descriptor.html",
"url": "/_mozilla/mozilla/bluetooth/writeValue/descriptor/blacklisted-descriptor.html" "url": "/_mozilla/mozilla/bluetooth/writeValue/descriptor/blocklisted-descriptor.html"
} }
], ],
"mozilla/bluetooth/writeValue/descriptor/characteristic-is-removed.html": [ "mozilla/bluetooth/writeValue/descriptor/characteristic-is-removed.html": [

View file

@ -2,14 +2,14 @@
// Bluetooth UUID constants: // Bluetooth UUID constants:
// Services: // Services:
var blacklist_test_service_uuid = "611c954a-263b-4f4a-aab6-01ddb953f985"; var blocklist_test_service_uuid = "611c954a-263b-4f4a-aab6-01ddb953f985";
var request_disconnection_service_uuid = "01d7d889-7451-419f-aeb8-d65e7b9277af"; var request_disconnection_service_uuid = "01d7d889-7451-419f-aeb8-d65e7b9277af";
// Characteristics: // Characteristics:
var blacklist_exclude_reads_characteristic_uuid = "bad1c9a2-9a5b-4015-8b60-1579bbbf2135"; var blocklist_exclude_reads_characteristic_uuid = "bad1c9a2-9a5b-4015-8b60-1579bbbf2135";
var request_disconnection_characteristic_uuid = "01d7d88a-7451-419f-aeb8-d65e7b9277af"; var request_disconnection_characteristic_uuid = "01d7d88a-7451-419f-aeb8-d65e7b9277af";
// Descriptors: // Descriptors:
var blacklist_exclude_reads_descriptor_uuid = "aaaaaaaa-aaaa-1181-0510-810819516110"; var blocklist_exclude_reads_descriptor_uuid = "aaaaaaaa-aaaa-1181-0510-810819516110";
var blacklist_descriptor_uuid = "07711111-6104-0970-7011-1107105110aaa"; var blocklist_descriptor_uuid = "07711111-6104-0970-7011-1107105110aaa";
var characteristic_user_description_uuid = "00002901-0000-1000-8000-00805f9b34fb"; var characteristic_user_description_uuid = "00002901-0000-1000-8000-00805f9b34fb";
// Bluetooth Adapter types: // Bluetooth Adapter types:
@ -23,7 +23,7 @@ var adapter_type = {
no_name_heart_rate: 'NoNameHeartRateAdapter', no_name_heart_rate: 'NoNameHeartRateAdapter',
glucose_heart_rate: 'GlucoseHeartRateAdapter', glucose_heart_rate: 'GlucoseHeartRateAdapter',
unicode_device: 'UnicodeDeviceAdapter', unicode_device: 'UnicodeDeviceAdapter',
blacklist: 'BlacklistTestAdapter', blocklist: 'BlocklistTestAdapter',
missing_characteristic_heart_rate: 'MissingCharacteristicHeartRateAdapter', missing_characteristic_heart_rate: 'MissingCharacteristicHeartRateAdapter',
missing_service_heart_rate: 'MissingServiceHeartRateAdapter', missing_service_heart_rate: 'MissingServiceHeartRateAdapter',
missing_descriptor_heart_rate: 'MissingDescriptorHeartRateAdapter' missing_descriptor_heart_rate: 'MissingDescriptorHeartRateAdapter'

View file

@ -5,12 +5,12 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [device_information.name]}] filters: [{services: [device_information.name]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(device_information.name)) .then(gattServer => gattServer.getPrimaryService(device_information.name))
.then(service => promise_rejects(t, 'SecurityError', service.getCharacteristic(serial_number_string.name))); .then(service => promise_rejects(t, 'SecurityError', service.getCharacteristic(serial_number_string.name)));
}, 'Serial Number String characteristic is blacklisted.'); }, 'Serial Number String characteristic is blocklisted.');
</script> </script>

View file

@ -5,12 +5,12 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [device_information.name]}] filters: [{services: [device_information.name]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(device_information.name)) .then(gattServer => gattServer.getPrimaryService(device_information.name))
.then(service => promise_rejects(t, 'SecurityError', service.getCharacteristics(serial_number_string.name))); .then(service => promise_rejects(t, 'SecurityError', service.getCharacteristics(serial_number_string.name)));
}, 'Serial Number String characteristic is blacklisted. Should reject with SecurityError.'); }, 'Serial Number String characteristic is blocklisted. Should reject with SecurityError.');
</script> </script>

View file

@ -5,12 +5,12 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [device_information.name]}] filters: [{services: [device_information.name]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(device_information.name)) .then(gattServer => gattServer.getPrimaryService(device_information.name))
.then(service => promise_rejects(t, 'NotFoundError', service.getCharacteristics())); .then(service => promise_rejects(t, 'NotFoundError', service.getCharacteristics()));
}, 'The Device Information service is composed of blacklisted characteristics so we shouldn\'t find any.'); }, 'The Device Information service is composed of blocklisted characteristics so we shouldn\'t find any.');
</script> </script>

View file

@ -5,14 +5,14 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}] filters: [{services: [blocklist_test_service_uuid]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(blacklist_test_service_uuid)) .then(gattServer => gattServer.getPrimaryService(blocklist_test_service_uuid))
.then(service => service.getCharacteristic(blacklist_exclude_reads_characteristic_uuid)) .then(service => service.getCharacteristic(blocklist_exclude_reads_characteristic_uuid))
.then(characteristic => promise_rejects(t, 'SecurityError', .then(characteristic => promise_rejects(t, 'SecurityError',
characteristic.getDescriptor(blacklist_descriptor_uuid))); characteristic.getDescriptor(blocklist_descriptor_uuid)));
}, 'The descriptor is blacklisted.'); }, 'The descriptor is blocklisted.');
</script> </script>

View file

@ -5,14 +5,14 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}] filters: [{services: [blocklist_test_service_uuid]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(blacklist_test_service_uuid)) .then(gattServer => gattServer.getPrimaryService(blocklist_test_service_uuid))
.then(service => service.getCharacteristic(blacklist_exclude_reads_characteristic_uuid)) .then(service => service.getCharacteristic(blocklist_exclude_reads_characteristic_uuid))
.then(characteristic => promise_rejects(t, 'SecurityError', .then(characteristic => promise_rejects(t, 'SecurityError',
characteristic.getDescriptors(blacklist_descriptor_uuid))); characteristic.getDescriptors(blocklist_descriptor_uuid)));
}, 'The descriptor is blacklisted. Should reject with SecurityError.'); }, 'The descriptor is blocklisted. Should reject with SecurityError.');
</script> </script>

View file

@ -5,17 +5,17 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}] filters: [{services: [blocklist_test_service_uuid]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(blacklist_test_service_uuid)) .then(gattServer => gattServer.getPrimaryService(blocklist_test_service_uuid))
.then(service => service.getCharacteristic(blacklist_exclude_reads_characteristic_uuid)) .then(service => service.getCharacteristic(blocklist_exclude_reads_characteristic_uuid))
.then(characteristic => characteristic.getDescriptors()) .then(characteristic => characteristic.getDescriptors())
.then(descriptors => { .then(descriptors => {
assert_equals(descriptors.length, 1); assert_equals(descriptors.length, 1);
assert_equals(descriptors[0].uuid, blacklist_exclude_reads_descriptor_uuid); assert_equals(descriptors[0].uuid, blocklist_exclude_reads_descriptor_uuid);
}); });
}, 'The descriptors are blacklisted.'); }, 'The descriptors are blocklisted.');
</script> </script>

View file

@ -5,12 +5,12 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [device_information.name]}], filters: [{services: [device_information.name]}],
optionalServices: [human_interface_device.name] optionalServices: [human_interface_device.name]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => promise_rejects(t, 'SecurityError', gattServer.getPrimaryServices(human_interface_device.name))); .then(gattServer => promise_rejects(t, 'SecurityError', gattServer.getPrimaryServices(human_interface_device.name)));
}, 'Request for services. Does not return blacklisted service.'); }, 'Request for services. Does not return blocklisted service.');
</script> </script>

View file

@ -5,11 +5,11 @@
<script> <script>
'use strict'; 'use strict';
promise_test(() => { promise_test(() => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [device_information.name]}], filters: [{services: [device_information.name]}],
optionalServices: [ optionalServices: [
blacklist_test_service_uuid, generic_access.name, blocklist_test_service_uuid, generic_access.name,
heart_rate.name, human_interface_device.name heart_rate.name, human_interface_device.name
] ]
}) })
@ -17,10 +17,10 @@ promise_test(() => {
.then(gattServer => gattServer.getPrimaryServices()) .then(gattServer => gattServer.getPrimaryServices())
.then(services => { .then(services => {
assert_equals(services.length, 4); assert_equals(services.length, 4);
assert_equals(services[0].uuid, blacklist_test_service_uuid); assert_equals(services[0].uuid, blocklist_test_service_uuid);
assert_equals(services[1].uuid, device_information.uuid); assert_equals(services[1].uuid, device_information.uuid);
assert_equals(services[2].uuid, generic_access.uuid); assert_equals(services[2].uuid, generic_access.uuid);
assert_equals(services[3].uuid, heart_rate.uuid); assert_equals(services[3].uuid, heart_rate.uuid);
}); });
}, 'Request for services. Does not return blacklisted service.'); }, 'Request for services. Does not return blocklisted service.');
</script> </script>

View file

@ -5,13 +5,13 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}] filters: [{services: [blocklist_test_service_uuid]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(blacklist_test_service_uuid)) .then(gattServer => gattServer.getPrimaryService(blocklist_test_service_uuid))
.then(service => service.getCharacteristic(blacklist_exclude_reads_characteristic_uuid)) .then(service => service.getCharacteristic(blocklist_exclude_reads_characteristic_uuid))
.then(characteristic => { .then(characteristic => {
return characteristic.writeValue(new Uint8Array(1)) return characteristic.writeValue(new Uint8Array(1))
.then(() => promise_rejects(t, 'SecurityError', characteristic.readValue())); .then(() => promise_rejects(t, 'SecurityError', characteristic.readValue()));

View file

@ -5,14 +5,14 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}] filters: [{services: [blocklist_test_service_uuid]}]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(blacklist_test_service_uuid)) .then(gattServer => gattServer.getPrimaryService(blocklist_test_service_uuid))
.then(service => service.getCharacteristic(blacklist_exclude_reads_characteristic_uuid)) .then(service => service.getCharacteristic(blocklist_exclude_reads_characteristic_uuid))
.then(characteristic => characteristic.getDescriptor(blacklist_exclude_reads_descriptor_uuid)) .then(characteristic => characteristic.getDescriptor(blocklist_exclude_reads_descriptor_uuid))
.then(descriptor => { .then(descriptor => {
return descriptor.writeValue(new Uint8Array(1)) return descriptor.writeValue(new Uint8Array(1))
.then(() => promise_rejects(t, 'SecurityError', descriptor.readValue())); .then(() => promise_rejects(t, 'SecurityError', descriptor.readValue()));

View file

@ -5,9 +5,9 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return promise_rejects( return promise_rejects(
t, 'SecurityError', window.navigator.bluetooth.requestDevice({filters: [{services: [human_interface_device.name]}]}), t, 'SecurityError', window.navigator.bluetooth.requestDevice({filters: [{services: [human_interface_device.name]}]}),
'Requesting blacklisted service rejects.'); 'Requesting blocklisted service rejects.');
}, 'Reject with SecurityError if requesting a blacklisted service.'); }, 'Reject with SecurityError if requesting a blocklisted service.');
</script> </script>

View file

@ -6,14 +6,14 @@
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
let expected = 'SecurityError'; let expected = 'SecurityError';
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}], filters: [{services: [blocklist_test_service_uuid]}],
optionalServices: [human_interface_device.name] optionalServices: [human_interface_device.name]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())
.then(gattServer => Promise.all([ .then(gattServer => Promise.all([
promise_rejects(t, expected, gattServer.getPrimaryService(human_interface_device.name)), promise_rejects(t, expected, gattServer.getPrimaryService(human_interface_device.name)),
promise_rejects(t, expected, gattServer.getPrimaryServices(human_interface_device.name))])); promise_rejects(t, expected, gattServer.getPrimaryServices(human_interface_device.name))]));
}, 'Blacklisted UUID in optionalServices is removed and access not granted.'); }, 'Blocklisted UUID in optionalServices is removed and access not granted.');
</script> </script>

View file

@ -5,9 +5,9 @@
<script> <script>
'use strict'; 'use strict';
promise_test(t => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.blacklist); window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
return window.navigator.bluetooth.requestDevice({ return window.navigator.bluetooth.requestDevice({
filters: [{services: [blacklist_test_service_uuid]}], filters: [{services: [blocklist_test_service_uuid]}],
optionalServices: [generic_access.name] optionalServices: [generic_access.name]
}) })
.then(device => device.gatt.connect()) .then(device => device.gatt.connect())