Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp |
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp |
index 384c5cedd4a342e75c8d0c43d5a51a4a54f16866..959cd334eddb274e82fcda6d9ab5f7143fddc02f 100644 |
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp |
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp |
@@ -96,6 +96,7 @@ void BluetoothRemoteGATTServer::disconnect(ScriptState* scriptState) { |
// Callback that allows us to resolve the promise with a single service or |
// with a vector owning the services. |
void BluetoothRemoteGATTServer::GetPrimaryServicesCallback( |
+ const String& requestedServiceUUID, |
mojom::blink::WebBluetoothGATTQueryQuantity quantity, |
ScriptPromiseResolver* resolver, |
mojom::blink::WebBluetoothResult result, |
@@ -131,7 +132,13 @@ void BluetoothRemoteGATTServer::GetPrimaryServicesCallback( |
} |
resolver->resolve(gattServices); |
} else { |
- resolver->reject(BluetoothError::take(resolver, result)); |
+ if (result == mojom::blink::WebBluetoothResult::SERVICE_NOT_FOUND) { |
+ resolver->reject(BluetoothError::take( |
+ resolver, result, "No Services matching UUID " + |
+ requestedServiceUUID + " found in Device.")); |
+ } else { |
+ resolver->reject(BluetoothError::take(resolver, result)); |
+ } |
} |
} |
@@ -187,7 +194,8 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl( |
device()->id(), quantity, servicesUUID, |
convertToBaseCallback( |
WTF::bind(&BluetoothRemoteGATTServer::GetPrimaryServicesCallback, |
- wrapPersistent(this), quantity, wrapPersistent(resolver)))); |
+ wrapPersistent(this), servicesUUID, quantity, |
+ wrapPersistent(resolver)))); |
return promise; |
} |