Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp

Issue 2478013002: bluetooth: Invalidate services upon disconnection (Closed)
Patch Set: Clean up Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a42951710d219549bb72b51c08f52ac9371f3c33..7527109d5d84f654d2b19d0e1a33f7619afd3054 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
@@ -26,6 +26,9 @@ const char kGATTServerDisconnected[] =
"GATT Server disconnected while retrieving characteristics.";
const char kGATTServerNotConnected[] =
"GATT Server is disconnected. Cannot retrieve characteristics.";
+const char kInvalidService[] =
+ "Service is no longer valid. Remember to retrieve the service again after "
+ "reconnecting.";
} // namespace
@@ -159,6 +162,11 @@ ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl(
DOMException::create(NetworkError, kGATTServerNotConnected));
}
+ if (!device()->isValidService(m_webService->serviceInstanceID)) {
+ return ScriptPromise::rejectWithDOMException(
+ scriptState, DOMException::create(InvalidStateError, kInvalidService));
+ }
+
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();

Powered by Google App Engine
This is Rietveld 408576698