Bug 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothUuid|, r=joliu
☠☠ backed out by f4126bc1065f ☠ ☠
authorThomas Zimmermann <tdz@users.sourceforge.net>
Wed, 11 Nov 2015 11:14:40 +0100
changeset 308356 aa607b61225ca74c1e6d7671df2a86b6ffda7ff0
parent 308355 7251fc4dce99c68a4f6bf35be5d802518445526b
child 308357 f4126bc1065fb63770ed47480bad237ab1071ade
push id7465
push usercku@mozilla.com
push dateThu, 12 Nov 2015 09:05:57 +0000
reviewersjoliu
bugs1220121
milestone45.0a1
Bug 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothUuid|, r=joliu
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
dom/bluetooth/bluez/BluetoothDBusService.cpp
dom/bluetooth/bluez/BluetoothDBusService.h
dom/bluetooth/common/BluetoothService.h
dom/bluetooth/common/BluetoothUtils.cpp
dom/bluetooth/common/BluetoothUtils.h
dom/bluetooth/common/webapi/BluetoothAdapter.cpp
dom/bluetooth/common/webapi/BluetoothGatt.cpp
dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
dom/bluetooth/common/webapi/BluetoothGattServer.cpp
dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
dom/bluetooth/ipc/BluetoothServiceChildProcess.h
dom/bluetooth/ipc/PBluetooth.ipdl
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
@@ -321,138 +321,114 @@ BluetoothServiceBluedroid::StopInternal(
 }
 
 //
 // GATT Client
 //
 
 void
 BluetoothServiceBluedroid::StartLeScanInternal(
-  const nsTArray<nsString>& aServiceUuids,
+  const nsTArray<BluetoothUuid>& aServiceUuids,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  nsTArray<BluetoothUuid> serviceUuids(aServiceUuids.Length());
-
-  for (auto i = 0ul; i < aServiceUuids.Length(); ++i) {
-    StringToUuid(aServiceUuids[i], serviceUuids[i]);
-  }
-
-  gatt->StartLeScan(serviceUuids, aRunnable);
+  gatt->StartLeScan(aServiceUuids, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::StopLeScanInternal(
-  const nsAString& aScanUuid,
+  const BluetoothUuid& aScanUuid,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid scanUuid;
-  StringToUuid(aScanUuid, scanUuid);
-
-  gatt->StopLeScan(scanUuid, aRunnable);
+  gatt->StopLeScan(aScanUuid, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::ConnectGattClientInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->Connect(appUuid, aDeviceAddress, aRunnable);
+  gatt->Connect(aAppUuid, aDeviceAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::DisconnectGattClientInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->Disconnect(appUuid, aDeviceAddress, aRunnable);
+  gatt->Disconnect(aAppUuid, aDeviceAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::DiscoverGattServicesInternal(
-  const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
+  const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->Discover(appUuid, aRunnable);
+  gatt->Discover(aAppUuid, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientStartNotificationsInternal(
-  const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
+  const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
   const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->RegisterNotifications(appUuid, aServId, aCharId, aRunnable);
+  gatt->RegisterNotifications(aAppUuid, aServId, aCharId, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientStopNotificationsInternal(
-  const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
+  const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
   const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->DeregisterNotifications(appUuid, aServId, aCharId, aRunnable);
+  gatt->DeregisterNotifications(aAppUuid, aServId, aCharId, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::UnregisterGattClientInternal(
   int aClientIf, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -476,138 +452,120 @@ BluetoothServiceBluedroid::GattClientRea
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   gatt->ReadRemoteRssi(aClientIf, aDeviceAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientReadCharacteristicValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ReadCharacteristicValue(appUuid, aServiceId, aCharacteristicId,
+  gatt->ReadCharacteristicValue(aAppUuid, aServiceId, aCharacteristicId,
                                 aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientWriteCharacteristicValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattWriteType& aWriteType,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->WriteCharacteristicValue(appUuid, aServiceId, aCharacteristicId,
+  gatt->WriteCharacteristicValue(aAppUuid, aServiceId, aCharacteristicId,
                                  aWriteType, aValue, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientReadDescriptorValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattId& aDescriptorId,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ReadDescriptorValue(appUuid, aServiceId, aCharacteristicId,
+  gatt->ReadDescriptorValue(aAppUuid, aServiceId, aCharacteristicId,
                             aDescriptorId, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientWriteDescriptorValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattId& aDescriptorId,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->WriteDescriptorValue(appUuid, aServiceId, aCharacteristicId,
+  gatt->WriteDescriptorValue(aAppUuid, aServiceId, aCharacteristicId,
                              aDescriptorId, aValue, aRunnable);
 }
 
 // GATT Server
 void
 BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ConnectPeripheral(appUuid, aAddress, aRunnable);
+  gatt->ConnectPeripheral(aAppUuid, aAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->DisconnectPeripheral(appUuid, aAddress, aRunnable);
+  gatt->DisconnectPeripheral(aAppUuid, aAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -616,211 +574,184 @@ BluetoothServiceBluedroid::UnregisterGat
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   gatt->UnregisterServer(aServerIf, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerAddServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   uint16_t aHandleCount,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerAddService(appUuid, aServiceId, aHandleCount, aRunnable);
+  gatt->ServerAddService(aAppUuid, aServiceId, aHandleCount, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothAttributeHandle& aIncludedServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerAddIncludedService(appUuid,
+  gatt->ServerAddIncludedService(aAppUuid,
                                  aServiceHandle,
                                  aIncludedServiceHandle,
                                  aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothUuid& aCharacteristicUuid,
   BluetoothGattAttrPerm aPermissions,
   BluetoothGattCharProp aProperties,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerAddCharacteristic(appUuid,
+  gatt->ServerAddCharacteristic(aAppUuid,
                                 aServiceHandle,
                                 aCharacteristicUuid,
                                 aPermissions,
                                 aProperties,
                                 aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   const BluetoothUuid& aDescriptorUuid,
   BluetoothGattAttrPerm aPermissions,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerAddDescriptor(appUuid,
+  gatt->ServerAddDescriptor(aAppUuid,
                             aServiceHandle,
                             aCharacteristicHandle,
                             aDescriptorUuid,
                             aPermissions,
                             aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerRemoveServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerRemoveService(appUuid, aServiceHandle, aRunnable);
+  gatt->ServerRemoveService(aAppUuid, aServiceHandle, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerStartServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerStartService(appUuid, aServiceHandle, aRunnable);
+  gatt->ServerStartService(aAppUuid, aServiceHandle, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerStopServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerStopService(appUuid, aServiceHandle, aRunnable);
+  gatt->ServerStopService(aAppUuid, aServiceHandle, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerSendResponseInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   uint16_t aStatus,
   int32_t aRequestId,
   const BluetoothGattResponse& aRsp,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
   gatt->ServerSendResponse(
-    appUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
+    aAppUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerSendIndicationInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   bool aConfirm,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothUuid appUuid;
-  StringToUuid(aAppUuid, appUuid);
-
-  gatt->ServerSendIndication(appUuid,
+  gatt->ServerSendIndication(aAppUuid,
                              aAddress,
                              aCharacteristicHandle,
                              aConfirm,
                              aValue,
                              aRunnable);
 }
 
 nsresult
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
@@ -270,170 +270,170 @@ public:
   virtual nsresult
   SendInputMessage(const nsAString& aDeviceAddresses,
                    const nsAString& aMessage) override;
 
   //
   // GATT Client
   //
 
-  virtual void StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
+  virtual void StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
                                    BluetoothReplyRunnable* aRunnable);
 
-  virtual void StopLeScanInternal(const nsAString& aScanUuid,
+  virtual void StopLeScanInternal(const BluetoothUuid& aScanUuid,
                                   BluetoothReplyRunnable* aRunnable);
 
   virtual void
-  ConnectGattClientInternal(const nsAString& aAppUuid,
+  ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
                             const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  DisconnectGattClientInternal(const nsAString& aAppUuid,
+  DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
                                const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  DiscoverGattServicesInternal(const nsAString& aAppUuid,
+  DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStartNotificationsInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServId,
     const BluetoothGattId& aCharId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStopNotificationsInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServId,
     const BluetoothGattId& aCharId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadRemoteRssiInternal(
     int aClientIf, const BluetoothAddress& aDeviceAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientWriteCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattWriteType& aWriteType,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientWriteDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerConnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     uint16_t aHandleCount,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aIncludedServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothUuid& aCharacteristicUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothGattCharProp aProperties,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     const BluetoothUuid& aDescriptorUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendResponseInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendIndicationInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   //
   // Bluetooth notifications
--- a/dom/bluetooth/bluez/BluetoothDBusService.cpp
+++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp
@@ -4290,58 +4290,58 @@ BluetoothDBusService::UpdateNotification
   avrcp->GetAddress(deviceAddress);
 
   Task* task = new UpdateNotificationTask(deviceAddress, aEventId, aData);
   DispatchToDBusThread(task);
 }
 
 void
 BluetoothDBusService::StartLeScanInternal(
-  const nsTArray<nsString>& aServiceUuids,
+  const nsTArray<BluetoothUuid>& aServiceUuids,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::StopLeScanInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::ConnectGattClientInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::DisconnectGattClientInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::DiscoverGattServicesInternal(
-  const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
+  const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientStartNotificationsInternal(
-  const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
+  const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
   const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientStopNotificationsInternal(
-  const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
+  const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
   const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::UnregisterGattClientInternal(
   int aClientIf, BluetoothReplyRunnable* aRunnable)
 {
@@ -4351,47 +4351,47 @@ void
 BluetoothDBusService::GattClientReadRemoteRssiInternal(
   int aClientIf, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientReadCharacteristicValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientWriteCharacteristicValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattWriteType& aWriteType,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientReadDescriptorValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattId& aDescriptorId,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientWriteDescriptorValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattId& aDescriptorId,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
@@ -4516,111 +4516,111 @@ BluetoothDBusService::ReplyToMapSendMess
 void
 BluetoothDBusService::ReplyToMapMessageUpdate(long aMasId, bool aStatus,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerConnectPeripheralInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerDisconnectPeripheralInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerAddServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   uint16_t aHandleCount,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerAddIncludedServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothAttributeHandle& aIncludedServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerAddCharacteristicInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothUuid& aCharacteristicUuid,
   BluetoothGattAttrPerm aPermissions,
   BluetoothGattCharProp aProperties,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerAddDescriptorInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   const BluetoothUuid& aDescriptorUuid,
   BluetoothGattAttrPerm aPermissions,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerRemoveServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerStartServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerStopServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerSendIndicationInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   bool aConfirm,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerSendResponseInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   uint16_t aStatus,
   int32_t aRequestId,
   const BluetoothGattResponse& aRsp,
   BluetoothReplyRunnable* aRunnable)
 {
 }
--- a/dom/bluetooth/bluez/BluetoothDBusService.h
+++ b/dom/bluetooth/bluez/BluetoothDBusService.h
@@ -280,171 +280,171 @@ public:
   SendSinkMessage(const nsAString& aDeviceAddresses,
                   const nsAString& aMessage) override;
 
   virtual nsresult
   SendInputMessage(const nsAString& aDeviceAddresses,
                    const nsAString& aMessage) override;
 
   virtual void
-  StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
+  StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
                       BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  StopLeScanInternal(const nsAString& aAppUuid,
+  StopLeScanInternal(const BluetoothUuid& aAppUuid,
                      BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  ConnectGattClientInternal(const nsAString& aAppUuid,
+  ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
                             const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  DisconnectGattClientInternal(const nsAString& aAppUuid,
+  DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
                                const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  DiscoverGattServicesInternal(const nsAString& aAppUuid,
+  DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStartNotificationsInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServId,
     const BluetoothGattId& aCharId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStopNotificationsInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServId,
     const BluetoothGattId& aCharId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadRemoteRssiInternal(
     int aClientIf, const BluetoothAddress& aDeviceAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientWriteCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattWriteType& aWriteType,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientWriteDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerConnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     uint16_t aHandleCount,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aIncludedServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothUuid& aCharacteristicUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothGattCharProp aProperties,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     const BluetoothUuid& aDescriptorUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendResponseInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendIndicationInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
 private:
   nsresult SendGetPropertyMessage(const nsAString& aPath,
--- a/dom/bluetooth/common/BluetoothService.h
+++ b/dom/bluetooth/common/BluetoothService.h
@@ -184,24 +184,24 @@ public:
    */
   virtual void
   StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Stops an ongoing Bluetooth LE device scan.
    */
   virtual void
-  StopLeScanInternal(const nsAString& aScanUuid,
+  StopLeScanInternal(const BluetoothUuid& aScanUuid,
                      BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Starts a Bluetooth LE device scan.
    */
   virtual void
-  StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
+  StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
                       BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Set a property for the specified object
    *
    * @param aPropName Name of the property
    * @param aValue Boolean value
    * @param aRunnable Runnable to run on async reply
@@ -436,53 +436,53 @@ public:
   virtual nsresult
   SendInputMessage(const nsAString& aDeviceAddresses,
                    const nsAString& aMessage) = 0;
 
   /**
    * Connect to a remote GATT server. (platform specific implementation)
    */
   virtual void
-  ConnectGattClientInternal(const nsAString& aAppUuid,
+  ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
                             const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Disconnect GATT client from a remote GATT server.
    * (platform specific implementation)
    */
   virtual void
-  DisconnectGattClientInternal(const nsAString& aAppUuid,
+  DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
                                const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Discover GATT services, characteristic, descriptors from a remote GATT
    * server. (platform specific implementation)
    */
   virtual void
-  DiscoverGattServicesInternal(const nsAString& aAppUuid,
+  DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Enable notifications of a given GATT characteristic.
    * (platform specific implementation)
    */
   virtual void
-  GattClientStartNotificationsInternal(const nsAString& aAppUuid,
+  GattClientStartNotificationsInternal(const BluetoothUuid& aAppUuid,
                                        const BluetoothGattServiceId& aServId,
                                        const BluetoothGattId& aCharId,
                                        BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Disable notifications of a given GATT characteristic.
    * (platform specific implementation)
    */
   virtual void
-  GattClientStopNotificationsInternal(const nsAString& aAppUuid,
+  GattClientStopNotificationsInternal(const BluetoothUuid& aAppUuid,
                                       const BluetoothGattServiceId& aServId,
                                       const BluetoothGattId& aCharId,
                                       BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Unregister a GATT client. (platform specific implementation)
    */
   virtual void
@@ -498,140 +498,140 @@ public:
                                    BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Read the value of a characteristic on a GATT client.
    * (platform specific implementation)
    */
   virtual void
   GattClientReadCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Write the value of a characteristic on a GATT client.
    * (platform specific implementation)
    */
   virtual void
   GattClientWriteCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattWriteType& aWriteType,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Read the value of a descriptor of a characteristic on a GATT client.
    * (platform specific implementation)
    */
   virtual void
   GattClientReadDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Write the value of a descriptor of a characteristic on a GATT client.
    * (platform specific implementation)
    */
   virtual void
   GattClientWriteDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerConnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Unregister a GATT server. (platform specific implementation)
    */
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     uint16_t aHandleCount,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aIncludedServiceHandle,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothUuid& aCharacteristicUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothGattCharProp aProperties,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     const BluetoothUuid& aDescriptorUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerSendResponseInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerSendIndicationInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   bool
   IsEnabled() const
--- a/dom/bluetooth/common/BluetoothUtils.cpp
+++ b/dom/bluetooth/common/BluetoothUtils.cpp
@@ -240,39 +240,44 @@ UuidToString(const BluetoothUuid& aUuid,
            ntohl(uuid0), ntohs(uuid1),
            ntohs(uuid2), ntohs(uuid3),
            ntohl(uuid4), ntohs(uuid5));
 
   aString.Truncate();
   aString.AssignLiteral(uuidStr);
 }
 
-void
+nsresult
 StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
 {
   uint32_t uuid0, uuid4;
   uint16_t uuid1, uuid2, uuid3, uuid5;
 
-  sscanf(NS_ConvertUTF16toUTF8(aString).get(),
-         "%08x-%04hx-%04hx-%04hx-%08x%04hx",
-         &uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
+  auto res = sscanf(NS_ConvertUTF16toUTF8(aString).get(),
+                    "%08x-%04hx-%04hx-%04hx-%08x%04hx",
+                    &uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
+  if (res == EOF || res < 6) {
+    return NS_ERROR_ILLEGAL_VALUE;
+  }
 
   uuid0 = htonl(uuid0);
   uuid1 = htons(uuid1);
   uuid2 = htons(uuid2);
   uuid3 = htons(uuid3);
   uuid4 = htonl(uuid4);
   uuid5 = htons(uuid5);
 
   memcpy(&aUuid.mUuid[0], &uuid0, sizeof(uint32_t));
   memcpy(&aUuid.mUuid[4], &uuid1, sizeof(uint16_t));
   memcpy(&aUuid.mUuid[6], &uuid2, sizeof(uint16_t));
   memcpy(&aUuid.mUuid[8], &uuid3, sizeof(uint16_t));
   memcpy(&aUuid.mUuid[10], &uuid4, sizeof(uint32_t));
   memcpy(&aUuid.mUuid[14], &uuid5, sizeof(uint16_t));
+
+  return NS_OK;
 }
 
 nsresult
 GenerateUuid(BluetoothUuid &aUuid)
 {
   nsresult rv;
   nsCOMPtr<nsIUUIDGenerator> uuidGenerator =
     do_GetService("@mozilla.org/uuid-generator;1", &rv);
--- a/dom/bluetooth/common/BluetoothUtils.h
+++ b/dom/bluetooth/common/BluetoothUtils.h
@@ -95,17 +95,17 @@ void
 UuidToString(const BluetoothUuid& aUuid, nsAString& aString);
 
 /**
  * Convert xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx uuid string to BluetoothUuid object.
  *
  * Note: This utility function is used by gecko internal only to convert uuid
  * string created by gecko back to BluetoothUuid representation.
  */
-void
+nsresult
 StringToUuid(const nsAString& aString, BluetoothUuid& aUuid);
 
 /**
  * Generate a random uuid.
  *
  * @param aUuid [out] The generated uuid.
  */
 nsresult
--- a/dom/bluetooth/common/webapi/BluetoothAdapter.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothAdapter.cpp
@@ -361,22 +361,26 @@ BluetoothAdapter::Cleanup()
 {
   UnregisterBluetoothSignalHandler(NS_LITERAL_STRING(KEY_ADAPTER), this);
 
   // Stop ongoing LE scans and clear the LeScan handle array
   if (!mLeScanHandleArray.IsEmpty()) {
     BluetoothService* bs = BluetoothService::Get();
     NS_ENSURE_TRUE_VOID(bs);
 
-    nsString uuid;
+    nsString uuidStr;
     for (uint32_t i = 0; i < mLeScanHandleArray.Length(); ++i) {
-      mLeScanHandleArray[i]->GetLeScanUuid(uuid);
+      mLeScanHandleArray[i]->GetLeScanUuid(uuidStr);
       RefPtr<BluetoothVoidReplyRunnable> results =
         new BluetoothVoidReplyRunnable(nullptr);
-      bs->StopLeScanInternal(uuid, results);
+
+      BluetoothUuid uuid;
+      if (NS_SUCCEEDED(StringToUuid(uuidStr, uuid))) {
+        bs->StopLeScanInternal(uuid, results);
+      }
     }
     mLeScanHandleArray.Clear();
   }
 }
 
 BluetoothGattServer*
 BluetoothAdapter::GetGattServer()
 {
@@ -677,26 +681,36 @@ BluetoothAdapter::StartLeScan(const nsTA
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  nsTArray<BluetoothUuid> serviceUuids;
+  serviceUuids.SetLength(aServiceUuids.Length());
+
+  for (size_t i = 0; i < serviceUuids.Length(); ++i) {
+    BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(aServiceUuids[i],
+                                                    serviceUuids[i])),
+                          promise,
+                          NS_ERROR_DOM_OPERATION_ERR);
+  }
+
   BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
                         promise,
                         NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   RefPtr<BluetoothReplyRunnable> result =
     new StartLeScanTask(this, promise, aServiceUuids);
-  bs->StartLeScanInternal(aServiceUuids, result);
+  bs->StartLeScanInternal(serviceUuids, result);
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothAdapter::StopLeScan(BluetoothDiscoveryHandle& aDiscoveryHandle,
                              ErrorResult& aRv)
 {
@@ -716,20 +730,26 @@ BluetoothAdapter::StopLeScan(BluetoothDi
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   // Reject the request if there's no ongoing LE Scan using this handle.
   BT_ENSURE_TRUE_REJECT(mLeScanHandleArray.Contains(&aDiscoveryHandle),
                         promise,
                         NS_ERROR_DOM_BLUETOOTH_DONE);
 
-  nsString scanUuid;
-  aDiscoveryHandle.GetLeScanUuid(scanUuid);
+  nsString scanUuidStr;
+  aDiscoveryHandle.GetLeScanUuid(scanUuidStr);
+
+  BluetoothUuid scanUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(scanUuidStr, scanUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   RefPtr<BluetoothReplyRunnable> result =
-    new StopLeScanTask(this, promise, scanUuid);
+    new StopLeScanTask(this, promise, scanUuidStr);
   bs->StopLeScanInternal(scanUuid, result);
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothAdapter::SetName(const nsAString& aName, ErrorResult& aRv)
 {
--- a/dom/bluetooth/common/webapi/BluetoothGatt.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGatt.cpp
@@ -107,33 +107,38 @@ BluetoothGatt::Connect(ErrorResult& aRv)
   BT_ENSURE_TRUE_REJECT(
     mConnectionState == BluetoothConnectionState::Disconnected,
     promise,
     NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BluetoothAddress deviceAddr;
   BT_ENSURE_TRUE_REJECT(
     NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
     promise,
     NS_ERROR_DOM_OPERATION_ERR);
 
   if (mAppUuid.IsEmpty()) {
     nsresult rv = GenerateUuid(mAppUuid);
     BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv) && !mAppUuid.IsEmpty(),
                           promise,
                           NS_ERROR_DOM_OPERATION_ERR);
     RegisterBluetoothSignalHandler(mAppUuid, this);
   }
 
   UpdateConnectionState(BluetoothConnectionState::Connecting);
   bs->ConnectGattClientInternal(
-    mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
+    appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGatt::Disconnect(ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
@@ -148,25 +153,30 @@ BluetoothGatt::Disconnect(ErrorResult& a
   BT_ENSURE_TRUE_REJECT(
     mConnectionState == BluetoothConnectionState::Connected,
     promise,
     NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BluetoothAddress deviceAddr;
   BT_ENSURE_TRUE_REJECT(
     NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
     promise,
     NS_ERROR_DOM_OPERATION_ERR);
 
   UpdateConnectionState(BluetoothConnectionState::Disconnecting);
   bs->DisconnectGattClientInternal(
-    mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
+    appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 class ReadRemoteRssiTask final : public BluetoothReplyRunnable
 {
 public:
   ReadRemoteRssiTask(Promise* aPromise)
@@ -227,31 +237,36 @@ BluetoothGatt::DiscoverServices(ErrorRes
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BT_ENSURE_TRUE_REJECT(
     mConnectionState == BluetoothConnectionState::Connected &&
     !mDiscoveringServices,
     promise,
     NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   mDiscoveringServices = true;
   mServices.Clear();
   BluetoothGattBinding::ClearCachedServicesValue(this);
 
   bs->DiscoverGattServicesInternal(
-    mAppUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
+    appUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 void
 BluetoothGatt::UpdateConnectionState(BluetoothConnectionState aState)
 {
   BT_LOGR("GATT connection state changes to: %d", int(aState));
--- a/dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
@@ -149,18 +149,24 @@ BluetoothGattCharacteristic::StartNotifi
   BT_ENSURE_TRUE_REJECT(mAttRole == ATT_CLIENT_ROLE,
                         promise,
                         NS_ERROR_UNEXPECTED);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
   BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
+                                                  appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   bs->GattClientStartNotificationsInternal(
-    mService->GetAppUuid(), mService->GetServiceId(), mCharId,
+    appUuid, mService->GetServiceId(), mCharId,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattCharacteristic::StopNotifications(ErrorResult& aRv)
 {
@@ -176,18 +182,24 @@ BluetoothGattCharacteristic::StopNotific
   BT_ENSURE_TRUE_REJECT(mAttRole == ATT_CLIENT_ROLE,
                         promise,
                         NS_ERROR_UNEXPECTED);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
   BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
+                                                  appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   bs->GattClientStopNotificationsInternal(
-    mService->GetAppUuid(), mService->GetServiceId(), mCharId,
+    appUuid, mService->GetServiceId(), mCharId,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 void
 BluetoothGattCharacteristic::AssignDescriptors(
   const nsTArray<BluetoothGattId>& aDescriptorIds)
@@ -357,18 +369,24 @@ BluetoothGattCharacteristic::ReadValue(E
 
   BT_ENSURE_TRUE_REJECT(mProperties & GATT_CHAR_PROP_BIT_READ,
                         promise,
                         NS_ERROR_NOT_AVAILABLE);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
+                                                  appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   bs->GattClientReadCharacteristicValueInternal(
-    mService->GetAppUuid(), mService->GetServiceId(), mCharId,
+    appUuid, mService->GetServiceId(), mCharId,
     new ReadValueTask(this, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattCharacteristic::WriteValue(const ArrayBuffer& aValue,
                                         ErrorResult& aRv)
@@ -400,19 +418,24 @@ BluetoothGattCharacteristic::WriteValue(
                         NS_ERROR_NOT_AVAILABLE);
 
   nsTArray<uint8_t> value;
   value.AppendElements(aValue.Data(), aValue.Length());
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
+                                                  appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   bs->GattClientWriteCharacteristicValueInternal(
-    mService->GetAppUuid(), mService->GetServiceId(),
-    mCharId, mWriteType, value,
+    appUuid, mService->GetServiceId(), mCharId, mWriteType, value,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattCharacteristic::AddDescriptor(const nsAString& aDescriptorUuid,
                                            const GattPermissions& aPermissions,
--- a/dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
@@ -227,26 +227,32 @@ BluetoothGattDescriptor::ReadValue(Error
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(
+                        mCharacteristic->Service()->GetAppUuid(), appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   if (mAttRole == ATT_SERVER_ROLE) {
     promise->MaybeResolve(mValue);
     return promise.forget();
   }
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattClientReadDescriptorValueInternal(
-    mCharacteristic->Service()->GetAppUuid(),
+    appUuid,
     mCharacteristic->Service()->GetServiceId(),
     mCharacteristic->GetCharacteristicId(),
     mDescriptorId,
     new ReadValueTask(this, promise));
 
   return promise.forget();
 }
 
@@ -258,16 +264,22 @@ BluetoothGattDescriptor::WriteValue(
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(
+                        mCharacteristic->Service()->GetAppUuid(), appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   aValue.ComputeLengthAndData();
 
   if (mAttRole == ATT_SERVER_ROLE) {
     mValue.Clear();
     mValue.AppendElements(aValue.Data(), aValue.Length());
 
     promise->MaybeResolve(JS::UndefinedHandleValue);
     return promise.forget();
@@ -275,17 +287,17 @@ BluetoothGattDescriptor::WriteValue(
 
   nsTArray<uint8_t> value;
   value.AppendElements(aValue.Data(), aValue.Length());
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattClientWriteDescriptorValueInternal(
-    mCharacteristic->Service()->GetAppUuid(),
+    appUuid,
     mCharacteristic->Service()->GetServiceId(),
     mCharacteristic->GetCharacteristicId(),
     mDescriptorId,
     value,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
--- a/dom/bluetooth/common/webapi/BluetoothGattServer.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattServer.cpp
@@ -314,56 +314,66 @@ BluetoothGattServer::Connect(const nsASt
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BluetoothAddress address;
   BT_ENSURE_TRUE_REJECT(
     NS_SUCCEEDED(StringToAddress(aAddress, address)),
     promise,
     NS_ERROR_INVALID_ARG);
 
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerConnectPeripheralInternal(
-    mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
+    appUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BluetoothAddress address;
   BT_ENSURE_TRUE_REJECT(
     NS_SUCCEEDED(StringToAddress(aAddress, address)),
     promise,
     NS_ERROR_INVALID_ARG);
 
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerDisconnectPeripheralInternal(
-    mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
+    appUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 class BluetoothGattServer::AddIncludedServiceTask final
   : public BluetoothReplyTaskQueue::SubTask
 {
 public:
@@ -379,18 +389,23 @@ public:
 
   bool Execute() override
   {
     BluetoothService* bs = BluetoothService::Get();
     if (NS_WARN_IF(!bs)) {
       return false;
     }
 
+    BluetoothUuid appUuid;
+    if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
+      return false;
+    }
+
     bs->GattServerAddIncludedServiceInternal(
-      mServer->mAppUuid,
+      appUuid,
       mService->GetServiceHandle(),
       mIncludedService->GetServiceHandle(),
       GetReply());
 
     return true;
   }
 
 private:
@@ -415,20 +430,25 @@ public:
 
   bool Execute() override
   {
     BluetoothService* bs = BluetoothService::Get();
     if (NS_WARN_IF(!bs)) {
       return false;
     }
 
+    BluetoothUuid appUuid;
+    if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
+      return false;
+    }
+
     BluetoothUuid uuid;
     mCharacteristic->GetUuid(uuid);
     bs->GattServerAddCharacteristicInternal(
-      mServer->mAppUuid,
+      appUuid,
       mService->GetServiceHandle(),
       uuid,
       mCharacteristic->GetPermissions(),
       mCharacteristic->GetProperties(),
       GetReply());
 
     return true;
   }
@@ -457,20 +477,25 @@ public:
 
   bool Execute() override
   {
     BluetoothService* bs = BluetoothService::Get();
     if (NS_WARN_IF(!bs)) {
       return false;
     }
 
+    BluetoothUuid appUuid;
+    if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
+      return false;
+    }
+
     BluetoothUuid uuid;
     mDescriptor->GetUuid(uuid);
     bs->GattServerAddDescriptorInternal(
-      mServer->mAppUuid,
+      appUuid,
       mService->GetServiceHandle(),
       mCharacteristic->GetCharacteristicHandle(),
       uuid,
       mDescriptor->GetPermissions(),
       GetReply());
 
     return true;
   }
@@ -496,18 +521,23 @@ public:
 
   bool Execute() override
   {
     BluetoothService* bs = BluetoothService::Get();
     if (NS_WARN_IF(!bs)) {
       return false;
     }
 
+    BluetoothUuid appUuid;
+    if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
+      return false;
+    }
+
     bs->GattServerStartServiceInternal(
-      mServer->mAppUuid,
+      appUuid,
       mService->GetServiceHandle(),
       GetReply());
 
     return true;
   }
 
 private:
   RefPtr<BluetoothGattServer> mServer;
@@ -623,18 +653,24 @@ private:
     mPromise->MaybeResolve(JS::UndefinedHandleValue);
   }
 
   void OnErrorFired() override
   {
     BluetoothService* bs = BluetoothService::Get();
     BT_ENSURE_TRUE_REJECT_VOID(bs, mPromise, NS_ERROR_NOT_AVAILABLE);
 
+    BluetoothUuid appUuid;
+    BT_ENSURE_TRUE_REJECT_VOID(NS_SUCCEEDED(StringToUuid(mServer->mAppUuid,
+                                                         appUuid)),
+                               mPromise,
+                               NS_ERROR_DOM_OPERATION_ERR);
+
     bs->GattServerRemoveServiceInternal(
-      mServer->mAppUuid,
+      appUuid,
       mService->GetServiceHandle(),
       new CancelAddServiceTask(mServer, mService, mPromise));
   }
 
   RefPtr<BluetoothGattServer> mServer;
   RefPtr<BluetoothGattService> mService;
   RefPtr<Promise> mPromise;
 };
@@ -711,17 +747,22 @@ BluetoothGattServer::AddService(Bluetoot
                         promise,
                         NS_ERROR_INVALID_ARG);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   mPendingService = &aService;
 
-  bs->GattServerAddServiceInternal(mAppUuid,
+  BluetoothUuid appUuid;
+  if (NS_FAILED(StringToUuid(mAppUuid, appUuid))) {
+    return false;
+  }
+
+  bs->GattServerAddServiceInternal(appUuid,
                                    mPendingService->GetServiceId(),
                                    mPendingService->GetHandleCount(),
                                    new AddServiceTask(this,
                                                       mPendingService,
                                                       promise));
 
   return promise.forget();
 }
@@ -779,18 +820,23 @@ BluetoothGattServer::RemoveService(Bluet
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
   BT_ENSURE_TRUE_REJECT(mServices.Contains(&aService),
                         promise,
                         NS_ERROR_INVALID_ARG);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   bs->GattServerRemoveServiceInternal(
-    mAppUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
+    appUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
                                                                  &aService,
                                                                  promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::NotifyCharacteristicChanged(
@@ -805,33 +851,38 @@ BluetoothGattServer::NotifyCharacteristi
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BluetoothAddress address;
   BT_ENSURE_TRUE_REJECT(
     NS_SUCCEEDED(StringToAddress(aAddress, address)),
     promise,
     NS_ERROR_INVALID_ARG);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   RefPtr<BluetoothGattService> service = aCharacteristic.Service();
   BT_ENSURE_TRUE_REJECT(service, promise, NS_ERROR_NOT_AVAILABLE);
   BT_ENSURE_TRUE_REJECT(mServices.Contains(service),
                         promise,
                         NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerSendIndicationInternal(
-    mAppUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
+    appUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
     aCharacteristic.GetValue(),
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::SendResponse(const nsAString& aAddress,
@@ -843,16 +894,21 @@ BluetoothGattServer::SendResponse(const 
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothUuid appUuid;
+  BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
+                        promise,
+                        NS_ERROR_DOM_OPERATION_ERR);
+
   BluetoothAddress address;
   BT_ENSURE_TRUE_REJECT(
     NS_SUCCEEDED(StringToAddress(aAddress, address)),
     promise,
     NS_ERROR_INVALID_ARG);
 
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
 
@@ -880,17 +936,17 @@ BluetoothGattServer::SendResponse(const 
     promise->MaybeReject(NS_ERROR_INVALID_ARG);
     return promise.forget();
   }
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerSendResponseInternal(
-    mAppUuid,
+    appUuid,
     address,
     aStatus,
     aRequestId,
     response,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
@@ -158,25 +158,25 @@ void
 BluetoothServiceChildProcess::StartDiscoveryInternal(
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, StartDiscoveryRequest());
 }
 
 void
 BluetoothServiceChildProcess::StopLeScanInternal(
-  const nsAString& aScanUuid,
+  const BluetoothUuid& aScanUuid,
   BluetoothReplyRunnable* aRunnable)
 {
-  SendRequest(aRunnable, StopLeScanRequest(nsString(aScanUuid)));
+  SendRequest(aRunnable, StopLeScanRequest(aScanUuid));
 }
 
 void
 BluetoothServiceChildProcess::StartLeScanInternal(
-  const nsTArray<nsString>& aServiceUuids,
+  const nsTArray<BluetoothUuid>& aServiceUuids,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, StartLeScanRequest(aServiceUuids));
 }
 
 nsresult
 BluetoothServiceChildProcess::SetProperty(BluetoothObjectType aType,
                                           const BluetoothNamedValue& aValue,
@@ -545,56 +545,54 @@ BluetoothServiceChildProcess::SendPlaySt
                                              BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
               SendPlayStatusRequest(aDuration, aPosition, aPlayStatus));
 }
 
 void
 BluetoothServiceChildProcess::ConnectGattClientInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
-  SendRequest(aRunnable, ConnectGattClientRequest(nsString(aAppUuid),
-                                                  aDeviceAddress));
+  SendRequest(aRunnable, ConnectGattClientRequest(aAppUuid, aDeviceAddress));
 }
 
 void
 BluetoothServiceChildProcess::DisconnectGattClientInternal(
-  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
+  const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    DisconnectGattClientRequest(nsString(aAppUuid), aDeviceAddress));
+              DisconnectGattClientRequest(aAppUuid, aDeviceAddress));
 }
 
 void
 BluetoothServiceChildProcess::DiscoverGattServicesInternal(
-  const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
+  const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
 {
-  SendRequest(aRunnable,
-    DiscoverGattServicesRequest(nsString(aAppUuid)));
+  SendRequest(aRunnable, DiscoverGattServicesRequest(aAppUuid));
 }
 
 void
 BluetoothServiceChildProcess::GattClientStartNotificationsInternal(
-  const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
+  const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
   const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattClientStartNotificationsRequest(nsString(aAppUuid), aServId, aCharId));
+    GattClientStartNotificationsRequest(aAppUuid, aServId, aCharId));
 }
 
 void
 BluetoothServiceChildProcess::GattClientStopNotificationsInternal(
-  const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
+  const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
   const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattClientStopNotificationsRequest(nsString(aAppUuid), aServId, aCharId));
+    GattClientStopNotificationsRequest(aAppUuid, aServId, aCharId));
 }
 
 void
 BluetoothServiceChildProcess::UnregisterGattClientInternal(
   int aClientIf, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, UnregisterGattClientRequest(aClientIf));
 }
@@ -605,216 +603,219 @@ BluetoothServiceChildProcess::GattClient
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
               GattClientReadRemoteRssiRequest(aClientIf, aDeviceAddress));
 }
 
 void
 BluetoothServiceChildProcess::GattClientReadCharacteristicValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattClientReadCharacteristicValueRequest(nsString(aAppUuid),
+    GattClientReadCharacteristicValueRequest(aAppUuid,
                                              aServiceId,
                                              aCharacteristicId));
 }
 
 void
 BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattWriteType& aWriteType,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattClientWriteCharacteristicValueRequest(nsString(aAppUuid),
+    GattClientWriteCharacteristicValueRequest(aAppUuid,
                                               aServiceId,
                                               aCharacteristicId,
                                               aWriteType,
                                               aValue));
 }
 
 void
 BluetoothServiceChildProcess::GattClientReadDescriptorValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattId& aDescriptorId,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattClientReadDescriptorValueRequest(nsString(aAppUuid),
+    GattClientReadDescriptorValueRequest(aAppUuid,
                                          aServiceId,
                                          aCharacteristicId,
                                          aDescriptorId));
 }
 
 void
 BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   const BluetoothGattId& aDescriptorId,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattClientWriteDescriptorValueRequest(nsString(aAppUuid),
+    GattClientWriteDescriptorValueRequest(aAppUuid,
                                           aServiceId,
                                           aCharacteristicId,
                                           aDescriptorId,
                                           aValue));
 }
 
 void
 BluetoothServiceChildProcess::GattServerConnectPeripheralInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerConnectPeripheralRequest(nsString(aAppUuid), aAddress));
+    GattServerConnectPeripheralRequest(aAppUuid, aAddress));
 }
 
 void
 BluetoothServiceChildProcess::GattServerDisconnectPeripheralInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerDisconnectPeripheralRequest(nsString(aAppUuid), aAddress));
+    GattServerDisconnectPeripheralRequest(aAppUuid, aAddress));
 }
 
 void
 BluetoothServiceChildProcess::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, UnregisterGattServerRequest(aServerIf));
 }
 
 void
 BluetoothServiceChildProcess::GattServerAddServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   uint16_t aHandleCount,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerAddServiceRequest(nsString(aAppUuid), aServiceId, aHandleCount));
+    GattServerAddServiceRequest(aAppUuid, aServiceId, aHandleCount));
 }
 
 void
 BluetoothServiceChildProcess::GattServerAddIncludedServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothAttributeHandle& aIncludedServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerAddIncludedServiceRequest(nsString(aAppUuid),
+    GattServerAddIncludedServiceRequest(aAppUuid,
                                         aServiceHandle,
                                         aIncludedServiceHandle));
 }
 
 void
 BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothUuid& aCharacteristicUuid,
   BluetoothGattAttrPerm aPermissions,
   BluetoothGattCharProp aProperties,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerAddCharacteristicRequest(nsString(aAppUuid),
+    GattServerAddCharacteristicRequest(aAppUuid,
                                        aServiceHandle,
                                        aCharacteristicUuid,
                                        aPermissions,
                                        aProperties));
 }
 
 void
 BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   const BluetoothUuid& aDescriptorUuid,
   BluetoothGattAttrPerm aPermissions,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerAddDescriptorRequest(nsString(aAppUuid),
+    GattServerAddDescriptorRequest(aAppUuid,
                                    aServiceHandle,
                                    aCharacteristicHandle,
                                    aDescriptorUuid,
                                    aPermissions));
 }
 
 void
 BluetoothServiceChildProcess::GattServerRemoveServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerRemoveServiceRequest(nsString(aAppUuid), aServiceHandle));
+    GattServerRemoveServiceRequest(aAppUuid, aServiceHandle));
 }
 
 void
 BluetoothServiceChildProcess::GattServerStartServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerStartServiceRequest(nsString(aAppUuid), aServiceHandle));
+    GattServerStartServiceRequest(aAppUuid, aServiceHandle));
 }
 
 void
 BluetoothServiceChildProcess::GattServerStopServiceInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerStopServiceRequest(nsString(aAppUuid), aServiceHandle));
+    GattServerStopServiceRequest(aAppUuid, aServiceHandle));
 }
 
 void
 BluetoothServiceChildProcess::GattServerSendResponseInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   uint16_t aStatus,
   int32_t aRequestId,
   const BluetoothGattResponse& aRsp,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerSendResponseRequest(
-      nsString(aAppUuid), aAddress, aStatus, aRequestId, aRsp));
+    GattServerSendResponseRequest(aAppUuid,
+                                  aAddress,
+                                  aStatus,
+                                  aRequestId,
+                                  aRsp));
 }
 
 void
 BluetoothServiceChildProcess::GattServerSendIndicationInternal(
-  const nsAString& aAppUuid,
+  const BluetoothUuid& aAppUuid,
   const BluetoothAddress& aAddress,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   bool aConfirm,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerSendIndicationRequest(nsString(aAppUuid),
+    GattServerSendIndicationRequest(aAppUuid,
                                     aAddress,
                                     aCharacteristicHandle,
                                     aConfirm,
                                     aValue));
 }
 
 nsresult
 BluetoothServiceChildProcess::HandleStartup()
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
@@ -55,21 +55,21 @@ public:
 
   virtual void
   StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  StopLeScanInternal(const nsAString& aScanUuid,
+  StopLeScanInternal(const BluetoothUuid& aScanUuid,
                      BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
+  StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
                       BluetoothReplyRunnable* aRunnable) override;
 
   virtual nsresult
   SetProperty(BluetoothObjectType aType,
               const BluetoothNamedValue& aValue,
               BluetoothReplyRunnable* aRunnable) override;
 
   virtual nsresult
@@ -279,163 +279,163 @@ public:
   SendSinkMessage(const nsAString& aDeviceAddresses,
                   const nsAString& aMessage) override;
 
   virtual nsresult
   SendInputMessage(const nsAString& aDeviceAddresses,
                    const nsAString& aMessage) override;
 
   virtual void
-  ConnectGattClientInternal(const nsAString& aAppUuid,
+  ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
                             const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  DisconnectGattClientInternal(const nsAString& aAppUuid,
+  DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
                                const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
-  DiscoverGattServicesInternal(const nsAString& aAppUuid,
+  DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStartNotificationsInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServId,
     const BluetoothGattId& aCharId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStopNotificationsInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServId,
     const BluetoothGattId& aCharId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadRemoteRssiInternal(int aClientIf,
                                    const BluetoothAddress& aDeviceAddress,
                                    BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientWriteCharacteristicValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattWriteType& aWriteType,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientWriteDescriptorValueInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerConnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     uint16_t aHandleCount,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aIncludedServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothUuid& aCharacteristicUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothGattCharProp aProperties,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     const BluetoothUuid& aDescriptorUuid,
     BluetoothGattAttrPerm aPermissions,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendResponseInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendIndicationInternal(
-    const nsAString& aAppUuid,
+    const BluetoothUuid& aAppUuid,
     const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
 protected:
   BluetoothServiceChildProcess();
--- a/dom/bluetooth/ipc/PBluetooth.ipdl
+++ b/dom/bluetooth/ipc/PBluetooth.ipdl
@@ -57,22 +57,22 @@ struct StartDiscoveryRequest
 };
 
 struct StopDiscoveryRequest
 {
 };
 
 struct StartLeScanRequest
 {
-  nsString[] serviceUuids;
+  BluetoothUuid[] serviceUuids;
 };
 
 struct StopLeScanRequest
 {
-  nsString scanUuid;
+  BluetoothUuid scanUuid;
 };
 
 struct PairRequest
 {
   BluetoothAddress address;
   uint32_t timeoutMS;
 };
 
@@ -270,41 +270,41 @@ struct SendPlayStatusRequest
 {
   int64_t duration;
   int64_t position;
   ControlPlayStatus playStatus;
 };
 
 struct ConnectGattClientRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAddress deviceAddress;
 };
 
 struct DisconnectGattClientRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAddress deviceAddress;
 };
 
 struct DiscoverGattServicesRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
 };
 
 struct GattClientStartNotificationsRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId servId;
   BluetoothGattId charId;
 };
 
 struct GattClientStopNotificationsRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId servId;
   BluetoothGattId charId;
 };
 
 struct UnregisterGattClientRequest
 {
   int clientIf;
 };
@@ -312,126 +312,126 @@ struct UnregisterGattClientRequest
 struct GattClientReadRemoteRssiRequest
 {
   int clientIf;
   BluetoothAddress deviceAddress;
 };
 
 struct GattClientReadCharacteristicValueRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId serviceId;
   BluetoothGattId charId;
 };
 
 struct GattClientWriteCharacteristicValueRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId serviceId;
   BluetoothGattId charId;
   BluetoothGattWriteType writeType;
   uint8_t[] value;
 };
 
 struct GattClientReadDescriptorValueRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId serviceId;
   BluetoothGattId charId;
   BluetoothGattId descId;
 };
 
 struct GattClientWriteDescriptorValueRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId serviceId;
   BluetoothGattId charId;
   BluetoothGattId descId;
   uint8_t[] value;
 };
 
 struct GattServerConnectPeripheralRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAddress address;
 };
 
 struct GattServerDisconnectPeripheralRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAddress address;
 };
 
 struct UnregisterGattServerRequest
 {
   int serverIf;
 };
 
 struct GattServerAddServiceRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothGattServiceId serviceId;
   uint16_t handleCount;
 };
 
 struct GattServerAddIncludedServiceRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAttributeHandle serviceHandle;
   BluetoothAttributeHandle includedServiceHandle;
 };
 
 struct GattServerAddCharacteristicRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAttributeHandle serviceHandle;
   BluetoothUuid characteristicUuid;
   BluetoothGattAttrPerm permissions;
   BluetoothGattCharProp properties;
 };
 
 struct GattServerAddDescriptorRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAttributeHandle serviceHandle;
   BluetoothAttributeHandle characteristicHandle;
   BluetoothUuid descriptorUuid;
   BluetoothGattAttrPerm permissions;
 };
 
 struct GattServerRemoveServiceRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAttributeHandle serviceHandle;
 };
 
 struct GattServerStartServiceRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAttributeHandle serviceHandle;
 };
 
 struct GattServerStopServiceRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAttributeHandle serviceHandle;
 };
 
 struct GattServerSendResponseRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAddress address;
   uint16_t status;
   int32_t requestId;
   BluetoothGattResponse response;
 };
 
 struct GattServerSendIndicationRequest
 {
-  nsString appUuid;
+  BluetoothUuid appUuid;
   BluetoothAddress address;
   BluetoothAttributeHandle characteristicHandle;
   bool confirm;
   uint8_t[] value;
 };
 
 union Request
 {