mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Rename blacklist to blocklist
This commit is contained in:
parent
870841099a
commit
f98fbecfda
26 changed files with 181 additions and 181 deletions
|
@ -18,7 +18,7 @@ pub mod test;
|
|||
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothServiceMsg};
|
||||
use bluetooth_traits::{BluetoothDeviceMsg, BluetoothRequest, BluetoothResponse};
|
||||
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 device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic};
|
||||
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
|
||||
.get(&device_id)
|
||||
.map_or(false, |uuids| uuids.contains(&s.uuid)));
|
||||
|
@ -764,7 +764,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));
|
||||
services_vec.retain(|s| !uuid_is_blocklisted(&s.uuid, Blocklist::All));
|
||||
if services_vec.is_empty() {
|
||||
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() {
|
||||
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() {
|
||||
return drop(sender.send(Err(BluetoothError::NotFound)));
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ const EMPTY_NAME_HEART_RATE_ADAPTER: &'static str = "EmptyNameHeartRateAdapter";
|
|||
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
|
||||
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
|
||||
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";
|
||||
|
||||
// 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
|
||||
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
|
||||
|
@ -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";
|
||||
|
||||
// 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/
|
||||
// viewer?attributeXmlFile=org.bluetooth.characteristic.body_sensor_location.xml
|
||||
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";
|
||||
|
||||
// Descriptor UUIDs
|
||||
const BLACKLIST_EXCLUDE_READS_DESCRIPTOR_UUID: &'static str = "aaaaaaaa-aaaa-1181-0510-810819516110";
|
||||
const BLACKLIST_DESCRIPTOR_UUID: &'static str = "07711111-6104-0970-7011-1107105110aaa";
|
||||
const BLOCKLIST_EXCLUDE_READS_DESCRIPTOR_UUID: &'static str = "aaaaaaaa-aaaa-1181-0510-810819516110";
|
||||
const BLOCKLIST_DESCRIPTOR_UUID: &'static str = "07711111-6104-0970-7011-1107105110aaa";
|
||||
// https://www.bluetooth.com/specifications/gatt/
|
||||
// viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_user_description.xml
|
||||
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(())
|
||||
}
|
||||
|
||||
fn create_blacklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> {
|
||||
fn create_blocklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> {
|
||||
let connectable_device =
|
||||
try!(create_device_with_uuids(adapter,
|
||||
CONNECTABLE_DEVICE_NAME.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(),
|
||||
GENERIC_ACCESS_SERVICE_UUID.to_owned(),
|
||||
HEART_RATE_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 =
|
||||
try!(create_characteristic(&blacklist_test_service,
|
||||
BLACKLIST_EXCLUDE_READS_CHARACTERISTIC_UUID.to_owned()));
|
||||
try!(blacklist_exclude_reads_characteristic
|
||||
let blocklist_exclude_reads_characteristic =
|
||||
try!(create_characteristic(&blocklist_test_service,
|
||||
BLOCKLIST_EXCLUDE_READS_CHARACTERISTIC_UUID.to_owned()));
|
||||
try!(blocklist_exclude_reads_characteristic
|
||||
.set_flags(vec![READ_FLAG.to_string(), WRITE_FLAG.to_string()]));
|
||||
|
||||
let _blacklist_exclude_reads_descriptor =
|
||||
try!(create_descriptor_with_value(&blacklist_exclude_reads_characteristic,
|
||||
BLACKLIST_EXCLUDE_READS_DESCRIPTOR_UUID.to_owned(),
|
||||
let _blocklist_exclude_reads_descriptor =
|
||||
try!(create_descriptor_with_value(&blocklist_exclude_reads_characteristic,
|
||||
BLOCKLIST_EXCLUDE_READS_DESCRIPTOR_UUID.to_owned(),
|
||||
vec![54; 3]));
|
||||
|
||||
let _blacklist_descriptor =
|
||||
try!(create_descriptor_with_value(&blacklist_exclude_reads_characteristic,
|
||||
BLACKLIST_DESCRIPTOR_UUID.to_owned(),
|
||||
let _blocklist_descriptor =
|
||||
try!(create_descriptor_with_value(&blocklist_exclude_reads_characteristic,
|
||||
BLOCKLIST_DESCRIPTOR_UUID.to_owned(),
|
||||
vec![54; 3]));
|
||||
|
||||
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));
|
||||
},
|
||||
BLACKLIST_TEST_ADAPTER => {
|
||||
try!(set_adapter(adapter, BLACKLIST_TEST_ADAPTER.to_owned()));
|
||||
BLOCKLIST_TEST_ADAPTER => {
|
||||
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())),
|
||||
}
|
||||
|
|
|
@ -9,73 +9,73 @@ use std::io::BufRead;
|
|||
use std::string::String;
|
||||
use util::resource_files::read_resource_file;
|
||||
|
||||
const BLACKLIST_FILE: &'static str = "gatt_blacklist.txt";
|
||||
const BLACKLIST_FILE_NOT_FOUND: &'static str = "Could not find gatt_blacklist.txt file";
|
||||
const BLOCKLIST_FILE: &'static str = "gatt_blocklist.txt";
|
||||
const BLOCKLIST_FILE_NOT_FOUND: &'static str = "Could not find gatt_blocklist.txt file";
|
||||
const EXCLUDE_READS: &'static str = "exclude-reads";
|
||||
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}";
|
||||
|
||||
thread_local!(pub static BLUETOOTH_BLACKLIST: RefCell<BluetoothBlacklist> =
|
||||
RefCell::new(BluetoothBlacklist(parse_blacklist())));
|
||||
thread_local!(pub static BLUETOOTH_BLOCKLIST: RefCell<BluetoothBlocklist> =
|
||||
RefCell::new(BluetoothBlocklist(parse_blocklist())));
|
||||
|
||||
pub fn uuid_is_blacklisted(uuid: &str, exclude_type: Blacklist) -> bool {
|
||||
BLUETOOTH_BLACKLIST.with(|blist| {
|
||||
pub fn uuid_is_blocklisted(uuid: &str, exclude_type: Blocklist) -> bool {
|
||||
BLUETOOTH_BLOCKLIST.with(|blist| {
|
||||
match exclude_type {
|
||||
Blacklist::All => {
|
||||
blist.borrow().is_blacklisted(uuid)
|
||||
Blocklist::All => {
|
||||
blist.borrow().is_blocklisted(uuid)
|
||||
},
|
||||
Blacklist::Reads => {
|
||||
blist.borrow().is_blacklisted_for_reads(uuid)
|
||||
Blocklist::Reads => {
|
||||
blist.borrow().is_blocklisted_for_reads(uuid)
|
||||
}
|
||||
Blacklist::Writes => {
|
||||
blist.borrow().is_blacklisted_for_writes(uuid)
|
||||
Blocklist::Writes => {
|
||||
blist.borrow().is_blocklisted_for_writes(uuid)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub struct BluetoothBlacklist(Option<HashMap<String, Blacklist>>);
|
||||
pub struct BluetoothBlocklist(Option<HashMap<String, Blocklist>>);
|
||||
|
||||
#[derive(Eq, PartialEq)]
|
||||
pub enum Blacklist {
|
||||
pub enum Blocklist {
|
||||
All, // Read and Write
|
||||
Reads,
|
||||
Writes,
|
||||
}
|
||||
|
||||
impl BluetoothBlacklist {
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#blacklisted
|
||||
pub fn is_blacklisted(&self, uuid: &str) -> bool {
|
||||
impl BluetoothBlocklist {
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#blocklisted
|
||||
pub fn is_blocklisted(&self, uuid: &str) -> bool {
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#blacklisted-for-reads
|
||||
pub fn is_blacklisted_for_reads(&self, uuid: &str) -> bool {
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#blocklisted-for-reads
|
||||
pub fn is_blocklisted_for_reads(&self, uuid: &str) -> bool {
|
||||
match self.0 {
|
||||
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blacklist::All) ||
|
||||
et.eq(&Blacklist::Reads)),
|
||||
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blocklist::All) ||
|
||||
et.eq(&Blocklist::Reads)),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#blacklisted-for-writes
|
||||
pub fn is_blacklisted_for_writes(&self, uuid: &str) -> bool {
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#blocklisted-for-writes
|
||||
pub fn is_blocklisted_for_writes(&self, uuid: &str) -> bool {
|
||||
match self.0 {
|
||||
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blacklist::All) ||
|
||||
et.eq(&Blacklist::Writes)),
|
||||
Some(ref map) => map.get(uuid).map_or(false, |et| et.eq(&Blocklist::All) ||
|
||||
et.eq(&Blocklist::Writes)),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#parsing-the-blacklist
|
||||
fn parse_blacklist() -> Option<HashMap<String, Blacklist>> {
|
||||
// Step 1 missing, currently we parse ./resources/gatt_blacklist.txt.
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#parsing-the-blocklist
|
||||
fn parse_blocklist() -> Option<HashMap<String, Blocklist>> {
|
||||
// Step 1 missing, currently we parse ./resources/gatt_blocklist.txt.
|
||||
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
|
||||
let mut result = HashMap::new();
|
||||
// Step 2 and 4
|
||||
|
@ -88,7 +88,7 @@ fn parse_blacklist() -> Option<HashMap<String, Blacklist>> {
|
|||
if line.is_empty() || line.starts_with('#') {
|
||||
continue;
|
||||
}
|
||||
let mut exclude_type = Blacklist::All;
|
||||
let mut exclude_type = Blocklist::All;
|
||||
let mut words = line.split_whitespace();
|
||||
let uuid = match words.next() {
|
||||
Some(uuid) => uuid,
|
||||
|
@ -98,14 +98,14 @@ fn parse_blacklist() -> Option<HashMap<String, Blacklist>> {
|
|||
return None;
|
||||
}
|
||||
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 => {},
|
||||
// Step 4.3
|
||||
Some(EXCLUDE_READS) => {
|
||||
exclude_type = Blacklist::Reads;
|
||||
exclude_type = Blocklist::Reads;
|
||||
},
|
||||
Some(EXCLUDE_WRITES) => {
|
||||
exclude_type = Blacklist::Writes;
|
||||
exclude_type = Blocklist::Writes;
|
||||
},
|
||||
// Step 4.4
|
||||
_ => {
|
|
@ -10,7 +10,7 @@ extern crate regex;
|
|||
extern crate serde_derive;
|
||||
extern crate util;
|
||||
|
||||
pub mod blacklist;
|
||||
pub mod blocklist;
|
||||
pub mod scanfilter;
|
||||
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use bluetooth_traits::{BluetoothError, BluetoothRequest};
|
||||
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::{RequestDeviceoptions, ServiceUUIDSequence};
|
||||
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();
|
||||
|
||||
// Step 2.7.
|
||||
// Note: What we are doing here is adding the not blacklisted UUIDs to the result vector,
|
||||
// instead of removing them from an already filled vector.
|
||||
if !uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
|
||||
// Note: What we are doing here is adding the not blocklisted UUIDs to the result vector,
|
||||
// insted of removing them from an already filled vector.
|
||||
if !uuid_is_blocklisted(uuid.as_ref(), Blocklist::All) {
|
||||
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();
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter) -> Fallible<Blueto
|
|||
let uuid = try!(BluetoothUUID::service(service_data_uuid.clone())).to_string();
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
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::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::
|
||||
BluetoothCharacteristicPropertiesMethods;
|
||||
|
@ -110,7 +110,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
}
|
||||
};
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
fn ReadValue(&self) -> Rc<Promise> {
|
||||
let p = Promise::new(&self.global());
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> {
|
||||
let p = Promise::new(&self.global());
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
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::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::
|
||||
|
@ -90,7 +90,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
|||
fn ReadValue(&self) -> Rc<Promise> {
|
||||
let p = Promise::new(&self.global());
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
|||
fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> {
|
||||
let p = Promise::new(&self.global());
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
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::BluetoothRemoteGATTServerBinding;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||
|
@ -101,7 +101,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
}
|
||||
};
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
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::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
||||
|
@ -105,7 +105,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
|||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
|||
}
|
||||
};
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
|||
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);
|
||||
return p;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
|||
}
|
||||
};
|
||||
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);
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue