mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
Script: Change script/dom/{bluetooth,canvas,html} to not rely on Deref<str> for DOMString (#39480)
This is part of the future work of implementing LazyDOMString as outlined in https://github.com/servo/servo/issues/39479. We use str() method or direct implementations on DOMString for these methods. We also change some types. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> Testing: This is essentially just renaming a method and a type and should not change functionality. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
1e471b9b41
commit
a4c8ffe753
23 changed files with 97 additions and 95 deletions
|
@ -432,7 +432,7 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible<Bluetooth
|
|||
let mut map = HashMap::new();
|
||||
for (key, bdfi) in manufacturer_data_map.iter() {
|
||||
// Step 7.1 - 7.2.
|
||||
let manufacturer_id = match u16::from_str(key.as_ref()) {
|
||||
let manufacturer_id = match u16::from_str(key.str()) {
|
||||
Ok(id) => id,
|
||||
Err(err) => {
|
||||
return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)));
|
||||
|
@ -461,7 +461,7 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible<Bluetooth
|
|||
}
|
||||
let mut map = HashMap::new();
|
||||
for (key, bdfi) in service_data_map.iter() {
|
||||
let service_name = match u32::from_str(key.as_ref()) {
|
||||
let service_name = match u32::from_str(key.str()) {
|
||||
// Step 9.1.
|
||||
Ok(number) => StringOrUnsignedLong::UnsignedLong(number),
|
||||
// Step 9.2.
|
||||
|
@ -687,7 +687,7 @@ impl PermissionAlgorithm for Bluetooth {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
let device_id = String::from(allowed_device.deviceId.as_ref());
|
||||
let device_id = String::from(allowed_device.deviceId.str());
|
||||
|
||||
// Step 6.2.
|
||||
if let Some(ref filters) = descriptor.filters {
|
||||
|
|
|
@ -153,7 +153,7 @@ impl BluetoothRemoteGATTCharacteristicMethods<crate::DomTypeHolder>
|
|||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
|
||||
// Step 1.
|
||||
if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) {
|
||||
if uuid_is_blocklisted(self.uuid.str(), Blocklist::Reads) {
|
||||
p.reject_error(Security, can_gc);
|
||||
return p;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ impl BluetoothRemoteGATTCharacteristicMethods<crate::DomTypeHolder>
|
|||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
|
||||
// Step 1.
|
||||
if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Writes) {
|
||||
if uuid_is_blocklisted(self.uuid.str(), Blocklist::Writes) {
|
||||
p.reject_error(Security, can_gc);
|
||||
return p;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ impl BluetoothRemoteGATTCharacteristicMethods<crate::DomTypeHolder>
|
|||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
|
||||
// Step 1.
|
||||
if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) {
|
||||
if uuid_is_blocklisted(self.uuid.str(), Blocklist::Reads) {
|
||||
p.reject_error(Security, can_gc);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ impl BluetoothRemoteGATTDescriptorMethods<crate::DomTypeHolder> for BluetoothRem
|
|||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
|
||||
// Step 1.
|
||||
if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) {
|
||||
if uuid_is_blocklisted(self.uuid.str(), Blocklist::Reads) {
|
||||
p.reject_error(Security, can_gc);
|
||||
return p;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ impl BluetoothRemoteGATTDescriptorMethods<crate::DomTypeHolder> for BluetoothRem
|
|||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
|
||||
// Step 1.
|
||||
if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Writes) {
|
||||
if uuid_is_blocklisted(self.uuid.str(), Blocklist::Writes) {
|
||||
p.reject_error(Security, can_gc);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -638,7 +638,7 @@ fn resolve_uuid_name(
|
|||
StringOrUnsignedLong::String(dstring) => {
|
||||
// Step 2.
|
||||
let regex = Regex::new(VALID_UUID_REGEX).unwrap();
|
||||
if regex.is_match(&dstring) {
|
||||
if regex.is_match(dstring.str()) {
|
||||
Ok(dstring)
|
||||
} else {
|
||||
// Step 3.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue