| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
|
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
|
| index 84d915fd495db3acdbbf855b6811c19d87763f45..16884e8e224026979a886f1bba941e6d08309538 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
|
| @@ -50,9 +50,13 @@ class GetCharacteristicsCallback
|
| public:
|
| GetCharacteristicsCallback(
|
| BluetoothRemoteGATTService* service,
|
| + const String characteristicsUUID,
|
| mojom::blink::WebBluetoothGATTQueryQuantity quantity,
|
| ScriptPromiseResolver* resolver)
|
| - : m_service(service), m_quantity(quantity), m_resolver(resolver) {
|
| + : m_service(service),
|
| + m_characteristicsUUID(characteristicsUUID),
|
| + m_quantity(quantity),
|
| + m_resolver(resolver) {
|
| // We always check that the device is connected before constructing this
|
| // object.
|
| CHECK(m_service->device()->gatt()->connected());
|
| @@ -111,12 +115,22 @@ class GetCharacteristicsCallback
|
| DOMException::create(NetworkError, kGATTServerDisconnected));
|
| return;
|
| }
|
| -
|
| - m_resolver->reject(BluetoothError::take(m_resolver, error));
|
| + if (!m_characteristicsUUID.isEmpty() &&
|
| + BluetoothError::isSameError(
|
| + error,
|
| + mojom::blink::WebBluetoothResult::CHARACTERISTIC_NOT_FOUND)) {
|
| + m_resolver->reject(BluetoothError::take(
|
| + m_resolver, error,
|
| + "No Characteristics matching UUID " + m_characteristicsUUID +
|
| + " found in Service with UUID " + m_service->uuid() + "."));
|
| + } else {
|
| + m_resolver->reject(BluetoothError::take(m_resolver, error));
|
| + }
|
| }
|
|
|
| private:
|
| Persistent<BluetoothRemoteGATTService> m_service;
|
| + const String m_characteristicsUUID;
|
| mojom::blink::WebBluetoothGATTQueryQuantity m_quantity;
|
| const Persistent<ScriptPromiseResolver> m_resolver;
|
| };
|
| @@ -178,8 +192,8 @@ ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl(
|
| BluetoothSupplement::fromScriptState(scriptState);
|
| webbluetooth->getCharacteristics(
|
| m_webService->serviceInstanceID, static_cast<int32_t>(quantity),
|
| - characteristicsUUID,
|
| - new GetCharacteristicsCallback(this, quantity, resolver));
|
| + characteristicsUUID, new GetCharacteristicsCallback(
|
| + this, characteristicsUUID, quantity, resolver));
|
|
|
| return promise;
|
| }
|
|
|