From b52f9e483fbc3e52677acc77db43783c469c5c9d Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 1 Feb 2017 16:41:29 +0100 Subject: [PATCH] Remove the 29 byte length restriction, when requesting bluetooth devices --- components/script/dom/bluetooth.rs | 13 +--------- tests/wpt/mozilla/meta/MANIFEST.json | 24 ------------------- .../max-length-for-name-in-adv-name.html | 14 ----------- ...max-length-for-name-in-adv-namePrefix.html | 14 ----------- ...icode-max-length-for-name-in-adv-name.html | 17 ------------- ...max-length-for-name-in-adv-namePrefix.html | 17 ------------- 6 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html delete mode 100644 tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html delete mode 100644 tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html delete mode 100644 tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index ce4e15103f4..82d455e5f4f 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothBinding::{self, BluetoothDataFilt use dom::bindings::codegen::Bindings::BluetoothBinding::{BluetoothMethods, RequestDeviceOptions}; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong; -use dom::bindings::error::Error::{self, Network, NotFound, Security, Type}; +use dom::bindings::error::Error::{self, Network, Security, Type}; use dom::bindings::error::Fallible; use dom::bindings::js::{JS, Root}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; @@ -40,11 +40,6 @@ const MANUFACTURER_DATA_ERROR: &'static str = "'manufacturerData', if present, m const MASK_LENGTH_ERROR: &'static str = "`mask`, if present, must have the same length as `dataPrefix`."; // 248 is the maximum number of UTF-8 code units in a Bluetooth Device Name. const MAX_DEVICE_NAME_LENGTH: usize = 248; -// A device name can never be longer than 29 bytes. -// An advertising packet is at most 31 bytes long. -// The length and identifier of the length field take 2 bytes. -// That leaves 29 bytes for the name. -const MAX_FILTER_NAME_LENGTH: usize = 29; const NAME_PREFIX_ERROR: &'static str = "'namePrefix', if present, must be nonempty."; const NAME_TOO_LONG_ERROR: &'static str = "A device name can't be longer than 248 bytes."; const SERVICE_DATA_ERROR: &'static str = "'serviceData', if present, must be non-empty to filter devices."; @@ -311,9 +306,6 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible MAX_DEVICE_NAME_LENGTH { return Err(Type(NAME_TOO_LONG_ERROR.to_owned())); } - if name.len() > MAX_FILTER_NAME_LENGTH { - return Err(NotFound); - } // Step 4.2. Some(name.to_string()) @@ -331,9 +323,6 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible MAX_DEVICE_NAME_LENGTH { return Err(Type(NAME_TOO_LONG_ERROR.to_owned())); } - if name_prefix.len() > MAX_FILTER_NAME_LENGTH { - return Err(NotFound); - } // Step 5.2. name_prefix.to_string() diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 3f703020e7c..136be90a6c7 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -7766,18 +7766,6 @@ "url": "/_mozilla/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-device-name-namePrefix.html" } ], - "mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html": [ - { - "path": "mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html", - "url": "/_mozilla/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html" - } - ], - "mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html": [ - { - "path": "mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html", - "url": "/_mozilla/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html" - } - ], "mozilla/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html": [ { "path": "mozilla/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html", @@ -7802,18 +7790,6 @@ "url": "/_mozilla/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-device-name-namePrefix.html" } ], - "mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html": [ - { - "path": "mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html", - "url": "/_mozilla/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html" - } - ], - "mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html": [ - { - "path": "mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html", - "url": "/_mozilla/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html" - } - ], "mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-name.html": [ { "path": "mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-name.html", diff --git a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html deleted file mode 100644 index 246a43a4a0d..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-name.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html deleted file mode 100644 index 3f737f48748..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/max-length-for-name-in-adv-namePrefix.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html deleted file mode 100644 index 84f564efbfd..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-name.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - diff --git a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html deleted file mode 100644 index d96664c337c..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/unicode-max-length-for-name-in-adv-namePrefix.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - -