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

Unified Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

Issue 2459523002: bluetooth: Return specific error if getPrimaryServices() is called without requesting access to any… (Closed)
Patch Set: s/foo/TestName/ 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: content/browser/bluetooth/web_bluetooth_service_impl.cc
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc
index 66216c1119d13ffd40f32f1de175244bd583aa44..e75ec1799441fb72c41595d4b56e61c40dc8bfcc 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -407,6 +407,14 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
: UMAWebBluetoothFunction::GET_PRIMARY_SERVICES);
RecordGetPrimaryServicesServices(quantity, services_uuid);
+ if (!allowed_devices_map_.IsOriginAllowedToAccessAtLeastOneService(
+ GetOrigin(), device_id)) {
+ callback.Run(
+ blink::mojom::WebBluetoothResult::NOT_ALLOWED_TO_ACCESS_ANY_SERVICE,
+ nullptr /* service */);
+ return;
+ }
+
if (services_uuid &&
!allowed_devices_map_.IsOriginAllowedToAccessService(
GetOrigin(), device_id, services_uuid.value())) {

Powered by Google App Engine
This is Rietveld 408576698