Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
| index 37bdfeb9f8513b1b5bedddb9e8672bd81bbc2b97..776be563ece5fbfeedaac6706352491f661b4a6f 100644 |
| --- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
| +++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
| @@ -102,27 +102,30 @@ static void canonicalizeFilter(const BluetoothScanFilter& filter, |
| static void convertRequestDeviceOptions(const RequestDeviceOptions& options, |
| WebRequestDeviceOptions& result, |
| ExceptionState& exceptionState) { |
| - ASSERT(options.hasFilters()); |
| + result.acceptAllDevices = options.acceptAllDevices(); |
|
ortuno
2016/10/31 00:00:02
In order to debug the spec and make the implementa
|
| + if (!result.acceptAllDevices) { |
| + if (!options.hasFilters() || options.filters().isEmpty()) { |
| + exceptionState.throwTypeError( |
| + "'filters' member must be non-empty to find any devices when " |
| + "'acceptAllDevices' is false."); |
| + return; |
| + } |
| - if (options.filters().isEmpty()) { |
| - exceptionState.throwTypeError( |
| - "'filters' member must be non-empty to find any devices."); |
| - } |
| + Vector<WebBluetoothScanFilter> filters; |
| + for (const BluetoothScanFilter& filter : options.filters()) { |
| + WebBluetoothScanFilter canonicalizedFilter = WebBluetoothScanFilter(); |
| - Vector<WebBluetoothScanFilter> filters; |
| - for (const BluetoothScanFilter& filter : options.filters()) { |
| - WebBluetoothScanFilter canonicalizedFilter = WebBluetoothScanFilter(); |
| + canonicalizeFilter(filter, canonicalizedFilter, exceptionState); |
| - canonicalizeFilter(filter, canonicalizedFilter, exceptionState); |
| + if (exceptionState.hadException()) |
| + return; |
| - if (exceptionState.hadException()) |
| - return; |
| + filters.append(canonicalizedFilter); |
| + } |
| - filters.append(canonicalizedFilter); |
| + result.filters.assign(filters); |
| } |
| - result.filters.assign(filters); |
| - |
| if (options.hasOptionalServices()) { |
| Vector<WebString> optionalServices; |
| for (const StringOrUnsignedLong& optionalService : |