Backed out changeset 89c64eb24508 (bug 1181479)
authorBruce Sun <brsun@mozilla.com>
Wed, 23 Sep 2015 13:44:02 +0800
changeset 297331 e67c69fc15a153abdf34619ac8d282c8034d4ef5
parent 297330 302e3afc26b5e5d09e2848e89b2015313ccf0e78
child 297332 72b0e3dd91eebb97bd907edd04291e730816490f
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1181479
milestone44.0a1
backs out89c64eb24508e349c3f6cc950ed6fb9ebbd6ead2
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 89c64eb24508 (bug 1181479)
dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp
dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h
dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h
dom/bluetooth/bluedroid/BluetoothGattManager.cpp
dom/bluetooth/bluedroid/BluetoothGattManager.h
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
dom/bluetooth/bluez/BluetoothDBusService.cpp
dom/bluetooth/bluez/BluetoothDBusService.h
dom/bluetooth/common/BluetoothCommon.h
dom/bluetooth/common/BluetoothInterface.cpp
dom/bluetooth/common/BluetoothInterface.h
dom/bluetooth/common/BluetoothReplyRunnable.cpp
dom/bluetooth/common/BluetoothReplyRunnable.h
dom/bluetooth/common/BluetoothService.h
dom/bluetooth/common/BluetoothUtils.cpp
dom/bluetooth/common/BluetoothUtils.h
dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
dom/bluetooth/common/webapi/BluetoothGattCharacteristic.h
dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
dom/bluetooth/common/webapi/BluetoothGattDescriptor.h
dom/bluetooth/common/webapi/BluetoothGattServer.cpp
dom/bluetooth/common/webapi/BluetoothGattServer.h
dom/bluetooth/common/webapi/BluetoothGattService.cpp
dom/bluetooth/common/webapi/BluetoothGattService.h
dom/bluetooth/ipc/BluetoothMessageUtils.h
dom/bluetooth/ipc/BluetoothParent.cpp
dom/bluetooth/ipc/BluetoothParent.h
dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
dom/bluetooth/ipc/BluetoothServiceChildProcess.h
dom/bluetooth/ipc/BluetoothTypes.ipdlh
dom/bluetooth/ipc/PBluetooth.ipdl
dom/webidl/BluetoothGattCharacteristic.webidl
dom/webidl/BluetoothGattDescriptor.webidl
dom/webidl/BluetoothGattServer.webidl
dom/webidl/BluetoothGattService.webidl
--- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp
@@ -757,193 +757,191 @@ BluetoothDaemonGattModule::ServerDisconn
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerAddServiceCmd(
-  int aServerIf, const BluetoothGattServiceId& aServiceId, uint16_t aNumHandles,
+  int aServerIf, const BluetoothGattServiceId& aServiceId, int aNumHandles,
   BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_ADD_SERVICE,
                         4 + // Server Interface
                         18 + // Service ID
                         4)); // Number of Handles
 
   nsresult rv = PackPDU(PackConversion<int, int32_t>(aServerIf), aServiceId,
-                        PackConversion<uint16_t, int32_t>(aNumHandles), *pdu);
+                        PackConversion<int, int32_t>(aNumHandles), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerAddIncludedServiceCmd(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle,
+  int aServerIf, int aServiceHandle, int aIncludedServiceHandle,
   BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_ADD_INCLUDED_SERVICE,
                         4 + // Server Interface
                         4 + // Service Handle
                         4)); // Included Service Handle
 
   nsresult rv = PackPDU(PackConversion<int, int32_t>(aServerIf),
-                        aServiceHandle, aIncludedServiceHandle, *pdu);
+                        PackConversion<int, int32_t>(aServiceHandle),
+                        PackConversion<int, int32_t>(aIncludedServiceHandle),
+                        *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerAddCharacteristicCmd(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aUuid, BluetoothGattCharProp aProperties,
-  BluetoothGattAttrPerm aPermissions, BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, const BluetoothUuid& aUuid,
+  BluetoothGattCharProp aProperties, BluetoothGattAttrPerm aPermissions,
+  BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_ADD_CHARACTERISTIC,
                         4 + // Server Interface
                         4 + // Service Handle
                         16 + // UUID
                         4 + // Properties
                         4)); // Permissions
 
-  nsresult rv = PackPDU(
-    PackConversion<int, int32_t>(aServerIf), aServiceHandle, aUuid,
-    PackConversion<BluetoothGattCharProp, int32_t>(aProperties),
-    PackConversion<BluetoothGattAttrPerm, int32_t>(aPermissions), *pdu);
+  nsresult rv = PackPDU(PackConversion<int, int32_t>(aServerIf),
+                        PackConversion<int, int32_t>(aServiceHandle),
+                        aUuid, aProperties, aPermissions, *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerAddDescriptorCmd(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aUuid, BluetoothGattAttrPerm aPermissions,
-  BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, const BluetoothUuid& aUuid,
+  BluetoothGattAttrPerm aPermissions, BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_ADD_DESCRIPTOR,
                         4 + // Server Interface
                         4 + // Service Handle
                         16 + // UUID
                         4)); // Permissions
 
-  nsresult rv = PackPDU(
-    PackConversion<int, int32_t>(aServerIf), aServiceHandle, aUuid,
-    PackConversion<BluetoothGattAttrPerm, int32_t>(aPermissions), *pdu);
+  nsresult rv = PackPDU(PackConversion<int, int32_t>(aServerIf),
+                        PackConversion<int, int32_t>(aServiceHandle),
+                        aUuid, aPermissions, *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerStartServiceCmd(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothTransport aTransport, BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, BluetoothTransport aTransport,
+  BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_START_SERVICE,
                         4 + // Server Interface
                         4 + // Service Handle
                         4)); // Transport
 
   nsresult rv = PackPDU(
-    PackConversion<int, int32_t>(aServerIf), aServiceHandle,
+    PackConversion<int, int32_t>(aServerIf),
+    PackConversion<int, int32_t>(aServiceHandle),
     PackConversion<BluetoothTransport, int32_t>(aTransport), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerStopServiceCmd(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_STOP_SERVICE,
                         4 + // Server Interface
                         4)); // Service Handle
 
-  nsresult rv = PackPDU(
-    PackConversion<int, int32_t>(aServerIf), aServiceHandle, *pdu);
+  nsresult rv = PackPDU(PackConversion<int, int32_t>(aServerIf),
+                        PackConversion<int, int32_t>(aServiceHandle), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return NS_OK;
 }
 
 nsresult
 BluetoothDaemonGattModule::ServerDeleteServiceCmd(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoPtr<DaemonSocketPDU> pdu(
     new DaemonSocketPDU(SERVICE_ID, OPCODE_SERVER_DELETE_SERVICE,
                         4 + // Server Interface
                         4)); // Service Handle
 
-  nsresult rv = PackPDU(
-    PackConversion<int, int32_t>(aServerIf), aServiceHandle, *pdu);
+  nsresult rv = PackPDU(PackConversion<int, int32_t>(aServerIf),
+                        PackConversion<int, int32_t>(aServiceHandle), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
@@ -2693,111 +2691,107 @@ BluetoothDaemonGattInterface::Disconnect
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 /* Add a services / a characteristic / a descriptor */
 void
 BluetoothDaemonGattInterface::AddService(
-  int aServerIf, const BluetoothGattServiceId& aServiceId, uint16_t aNumHandles,
+  int aServerIf, const BluetoothGattServiceId& aServiceId, int aNumHandles,
   BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerAddServiceCmd(
     aServerIf, aServiceId, aNumHandles, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 void
 BluetoothDaemonGattInterface::AddIncludedService(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle,
+  int aServerIf, int aServiceHandle, int aIncludedServiceHandle,
   BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerAddIncludedServiceCmd(
     aServerIf, aServiceHandle, aIncludedServiceHandle, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 void
 BluetoothDaemonGattInterface::AddCharacteristic(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aUuid, BluetoothGattCharProp aProperties,
-  BluetoothGattAttrPerm aPermissions, BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, const BluetoothUuid& aUuid,
+  BluetoothGattCharProp aProperties, BluetoothGattAttrPerm aPermissions,
+  BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerAddCharacteristicCmd(
     aServerIf, aServiceHandle, aUuid, aProperties, aPermissions, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 void
 BluetoothDaemonGattInterface::AddDescriptor(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aUuid, BluetoothGattAttrPerm aPermissions,
-  BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, const BluetoothUuid& aUuid,
+  BluetoothGattAttrPerm aPermissions, BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerAddDescriptorCmd(
     aServerIf, aServiceHandle, aUuid, aPermissions, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 /* Start / Stop / Delete a service */
 void
 BluetoothDaemonGattInterface::StartService(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothTransport aTransport, BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, BluetoothTransport aTransport,
+  BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerStartServiceCmd(
     aServerIf, aServiceHandle, aTransport, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 void
 BluetoothDaemonGattInterface::StopService(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerStopServiceCmd(aServerIf, aServiceHandle, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
   }
 }
 
 void
 BluetoothDaemonGattInterface::DeleteService(
-  int aServerIf, const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothGattResultHandler* aRes)
+  int aServerIf, int aServiceHandle, BluetoothGattResultHandler* aRes)
 {
   MOZ_ASSERT(mModule);
 
   nsresult rv = mModule->ServerDeleteServiceCmd(
     aServerIf, aServiceHandle, aRes);
 
   if (NS_FAILED(rv)) {
     DispatchError(aRes, rv);
--- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h
@@ -242,54 +242,50 @@ public:
     int aServerIf,
     const nsAString& aBdAddr,
     int aConnId,
     BluetoothGattResultHandler* aRes);
 
   /* Add a services / a characteristic / a descriptor */
   nsresult ServerAddServiceCmd(int aServerIf,
                                const BluetoothGattServiceId& aServiceId,
-                               uint16_t aNumHandles,
+                               int aNumHandles,
                                BluetoothGattResultHandler* aRes);
 
-  nsresult ServerAddIncludedServiceCmd(
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothGattResultHandler* aRes);
+  nsresult ServerAddIncludedServiceCmd(int aServerIf,
+                                       int aServiceHandle,
+                                       int aIncludedServiceHandle,
+                                       BluetoothGattResultHandler* aRes);
 
-  nsresult ServerAddCharacteristicCmd(
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aUuid,
-    BluetoothGattCharProp aProperties,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattResultHandler* aRes);
+  nsresult ServerAddCharacteristicCmd(int aServerIf,
+                                      int aServiceHandle,
+                                      const BluetoothUuid& aUuid,
+                                      BluetoothGattCharProp aProperties,
+                                      BluetoothGattAttrPerm aPermissions,
+                                      BluetoothGattResultHandler* aRes);
 
-  nsresult ServerAddDescriptorCmd(
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattResultHandler* aRes);
+  nsresult ServerAddDescriptorCmd(int aServerIf,
+                                  int aServiceHandle,
+                                  const BluetoothUuid& aUuid,
+                                  BluetoothGattAttrPerm aPermissions,
+                                  BluetoothGattResultHandler* aRes);
 
   /* Start / Stop / Delete a service */
   nsresult ServerStartServiceCmd(int aServerIf,
-                                 const BluetoothAttributeHandle& aServiceHandle,
+                                 int aServiceHandle,
                                  BluetoothTransport aTransport,
                                  BluetoothGattResultHandler* aRes);
 
   nsresult ServerStopServiceCmd(int aServerIf,
-                                const BluetoothAttributeHandle& aServiceHandle,
+                                int aServiceHandle,
                                 BluetoothGattResultHandler* aRes);
 
-  nsresult ServerDeleteServiceCmd(
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothGattResultHandler* aRes);
+  nsresult ServerDeleteServiceCmd(int aServerIf,
+                                  int aServiceHandle,
+                                  BluetoothGattResultHandler* aRes);
 
   /* Send an indication or a notification */
   nsresult ServerSendIndicationCmd(int aServerIf,
                                    int aAttributeHandle,
                                    int aConnId,
                                    int aLength,
                                    bool aConfirm,
                                    uint8_t* aValue,
@@ -601,61 +597,50 @@ protected:
   typedef mozilla::ipc::DaemonNotificationRunnable4<
     NotificationHandlerWrapper, void,
     int, int, bool, nsString,
     int, int, bool, const nsAString&>
     ServerConnectionNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable4<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothGattServiceId, BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothGattServiceId&,
-    const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, BluetoothGattServiceId, int,
+    BluetoothGattStatus, int, const BluetoothGattServiceId&, int>
     ServerServiceAddedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable4<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothAttributeHandle,
-    BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothAttributeHandle&,
-    const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, int, int>
     ServerIncludedServiceAddedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable5<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothUuid, BluetoothAttributeHandle,
-    BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothUuid&,
-    const BluetoothAttributeHandle&, const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, BluetoothUuid, int, int,
+    BluetoothGattStatus, int, const BluetoothUuid&, int, int>
     ServerCharacteristicAddedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable5<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothUuid, BluetoothAttributeHandle,
-    BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothUuid&,
-    const BluetoothAttributeHandle&, const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, BluetoothUuid, int, int,
+    BluetoothGattStatus, int, const BluetoothUuid&, int, int>
     ServerDescriptorAddedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable3<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, int>
     ServerServiceStartedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable3<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, int>
     ServerServiceStoppedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable3<
     NotificationHandlerWrapper, void,
-    BluetoothGattStatus, int, BluetoothAttributeHandle,
-    BluetoothGattStatus, int, const BluetoothAttributeHandle&>
+    BluetoothGattStatus, int, int>
     ServerServiceDeletedNotification;
 
   typedef mozilla::ipc::DaemonNotificationRunnable6<
     NotificationHandlerWrapper, void,
     int, int, nsString, int, int, bool,
     int, int, const nsAString&, int, int, bool>
     ServerRequestReadNotification;
 
@@ -939,44 +924,44 @@ public:
   void DisconnectPeripheral(int aServerIf,
                             const nsAString& aBdAddr,
                             int aConnId,
                             BluetoothGattResultHandler* aRes) override;
 
   /* Add a services / a characteristic / a descriptor */
   void AddService(int aServerIf,
                   const BluetoothGattServiceId& aServiceId,
-                  uint16_t aNumHandles,
+                  int aNumHandles,
                   BluetoothGattResultHandler* aRes) override;
   void AddIncludedService(int aServerIf,
-                          const BluetoothAttributeHandle& aServiceHandle,
-                          const BluetoothAttributeHandle& aIncludedServiceHandle,
+                          int aServiceHandle,
+                          int aIncludedServiceHandle,
                           BluetoothGattResultHandler* aRes) override;
   void AddCharacteristic(int aServerIf,
-                         const BluetoothAttributeHandle& aServiceHandle,
+                         int aServiceHandle,
                          const BluetoothUuid& aUuid,
                          BluetoothGattCharProp aProperties,
                          BluetoothGattAttrPerm aPermissions,
                          BluetoothGattResultHandler* aRes) override;
   void AddDescriptor(int aServerIf,
-                     const BluetoothAttributeHandle& aServiceHandle,
+                     int aServiceHandle,
                      const BluetoothUuid& aUuid,
                      BluetoothGattAttrPerm aPermissions,
                      BluetoothGattResultHandler* aRes) override;
 
   /* Start / Stop / Delete a service */
   void StartService(int aServerIf,
-                    const BluetoothAttributeHandle& aServiceHandle,
+                    int aServiceHandle,
                     BluetoothTransport aTransport,
                     BluetoothGattResultHandler* aRes) override;
   void StopService(int aServerIf,
-                   const BluetoothAttributeHandle& aServiceHandle,
+                   int aServiceHandle,
                    BluetoothGattResultHandler* aRes) override;
   void DeleteService(int aServerIf,
-                     const BluetoothAttributeHandle& aServiceHandle,
+                     int aServiceHandle,
                      BluetoothGattResultHandler* aRes) override;
 
   /* Send an indication or a notification */
   void SendIndication(
     int aServerIf,
     int aAttributeHandle,
     int aConnId,
     const nsTArray<uint8_t>& aValue,
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
@@ -462,27 +462,16 @@ Convert(uint8_t aIn, BluetoothStatus& aO
         aIn >= MOZ_ARRAY_LENGTH(sStatus), uint8_t, BluetoothStatus)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sStatus[aIn];
   return NS_OK;
 }
 
 nsresult
-Convert(int32_t aIn, BluetoothAttributeHandle& aOut)
-{
-  if (NS_WARN_IF(aIn < 0x0000) || NS_WARN_IF(aIn > 0xFFFF)) {
-    aOut.mHandle = 0x0000; // silences compiler warning
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-  aOut.mHandle = static_cast<uint16_t>(aIn);
-  return NS_OK;
-}
-
-nsresult
 Convert(int32_t aIn, BluetoothGattStatus& aOut)
 {
   /* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
   static const BluetoothGattStatus sGattStatus[] = {
     [0x0000] = GATT_STATUS_SUCCESS,
     [0x0001] = GATT_STATUS_INVALID_HANDLE,
     [0x0002] = GATT_STATUS_READ_NOT_PERMITTED,
     [0x0003] = GATT_STATUS_WRITE_NOT_PERMITTED,
@@ -641,23 +630,16 @@ Convert(const BluetoothAddress& aIn, nsA
   }
 
   aOut = NS_ConvertUTF8toUTF16(str);
 
   return NS_OK;
 }
 
 nsresult
-Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut)
-{
-  aOut = static_cast<int32_t>(aIn.mHandle);
-  return NS_OK;
-}
-
-nsresult
 Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut)
 {
   static const uint8_t sValue[] = {
     [AVRCP_EVENT_PLAY_STATUS_CHANGED] = 0x01,
     [AVRCP_EVENT_TRACK_CHANGE] = 0x02,
     [AVRCP_EVENT_TRACK_REACHED_END] = 0x03,
     [AVRCP_EVENT_TRACK_REACHED_START] = 0x04,
     [AVRCP_EVENT_PLAY_POS_CHANGED] = 0x05,
@@ -1094,22 +1076,16 @@ Convert(const ConvertArray<Tin>& aIn, To
 
 nsresult
 PackPDU(const BluetoothAddress& aIn, DaemonSocketPDU& aPDU)
 {
   return PackPDU(PackArray<uint8_t>(aIn.mAddr, sizeof(aIn.mAddr)), aPDU);
 }
 
 nsresult
-PackPDU(const BluetoothAttributeHandle& aIn, DaemonSocketPDU& aPDU)
-{
-  return PackPDU(PackConversion<BluetoothAttributeHandle, int32_t>(aIn), aPDU);
-}
-
-nsresult
 PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn,
         DaemonSocketPDU& aPDU)
 {
   size_t i;
 
   for (i = 0; i < aIn.mLength; ++i) {
     nsresult rv = PackPDU(aIn.mAttr[i], aPDU);
     if (NS_FAILED(rv)) {
@@ -1476,23 +1452,16 @@ UnpackPDU(DaemonSocketPDU& aPDU, Bluetoo
 
 nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAclState& aOut)
 {
   return UnpackPDU(aPDU, UnpackConversion<uint8_t, BluetoothAclState>(aOut));
 }
 
 nsresult
-UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAttributeHandle& aOut)
-{
-  return UnpackPDU(
-    aPDU, UnpackConversion<int32_t, BluetoothAttributeHandle>(aOut));
-}
-
-nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpEvent& aOut)
 {
   return UnpackPDU(
     aPDU, UnpackConversion<uint8_t, BluetoothAvrcpEvent>(aOut));
 }
 
 nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut)
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h
@@ -194,19 +194,16 @@ Convert(uint8_t aIn, BluetoothScanMode& 
 
 nsresult
 Convert(uint8_t aIn, BluetoothSspVariant& aOut);
 
 nsresult
 Convert(uint8_t aIn, BluetoothStatus& aOut);
 
 nsresult
-Convert(int32_t aIn, BluetoothAttributeHandle& aOut);
-
-nsresult
 Convert(int32_t aIn, BluetoothGattStatus& aOut);
 
 nsresult
 Convert(const nsAString& aIn, BluetoothAddress& aOut);
 
 nsresult
 Convert(const nsAString& aIn, BluetoothPinCode& aOut);
 
@@ -218,19 +215,16 @@ Convert(const nsAString& aIn, BluetoothS
 
 nsresult
 Convert(BluetoothAclState aIn, bool& aOut);
 
 nsresult
 Convert(const BluetoothAddress& aIn, nsAString& aOut);
 
 nsresult
-Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut);
-
-nsresult
 Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut);
 
 nsresult
 Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut);
 
 nsresult
 Convert(BluetoothAvrcpPlayerAttribute aIn, uint8_t& aOut);
 
@@ -300,19 +294,16 @@ Convert(nsresult aIn, BluetoothStatus& a
 //
 // Packing
 //
 
 nsresult
 PackPDU(const BluetoothAddress& aIn, DaemonSocketPDU& aPDU);
 
 nsresult
-PackPDU(const BluetoothAttributeHandle& aIn, DaemonSocketPDU& aPDU);
-
-nsresult
 PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn,
         DaemonSocketPDU& aPDU);
 
 nsresult
 PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn,
         DaemonSocketPDU& aPDU);
 
 nsresult
@@ -435,19 +426,16 @@ UnpackPDU(DaemonSocketPDU& aPDU, Bluetoo
 
 inline nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAddress& aOut)
 {
   return aPDU.Read(aOut.mAddr, sizeof(aOut.mAddr));
 }
 
 nsresult
-UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAttributeHandle& aOut);
-
-nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpEvent& aOut);
 
 nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut);
 
 nsresult
 UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut);
 
--- a/dom/bluetooth/bluedroid/BluetoothGattManager.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothGattManager.cpp
@@ -201,102 +201,33 @@ public:
 
 private:
   ~BluetoothGattClient()
   { }
 };
 
 NS_IMPL_ISUPPORTS0(BluetoothGattClient)
 
-struct BluetoothGattServerAddServiceState
-{
-  BluetoothGattServiceId mServiceId;
-  uint16_t mHandleCount;
-  nsRefPtr<BluetoothReplyRunnable> mRunnable;
-
-  void Assign(const BluetoothGattServiceId& aServiceId,
-              uint16_t aHandleCount,
-              BluetoothReplyRunnable* aRunnable)
-  {
-    mServiceId = aServiceId;
-    mHandleCount = aHandleCount;
-    mRunnable = aRunnable;
-  }
-
-  void Reset()
-  {
-    memset(&mServiceId, 0, sizeof(mServiceId));
-    mHandleCount = 0;
-    mRunnable = nullptr;
-  }
-};
-
-struct BluetoothGattServerAddDescriptorState
-{
-  BluetoothAttributeHandle mServiceHandle;
-  BluetoothAttributeHandle mCharacteristicHandle;
-  BluetoothUuid mDescriptorUuid;
-  nsRefPtr<BluetoothReplyRunnable> mRunnable;
-
-  void Assign(const BluetoothAttributeHandle& aServiceHandle,
-              const BluetoothAttributeHandle& aCharacteristicHandle,
-              const BluetoothUuid& aDescriptorUuid,
-              BluetoothReplyRunnable* aRunnable)
-  {
-    mServiceHandle = aServiceHandle;
-    mCharacteristicHandle = aCharacteristicHandle;
-    mDescriptorUuid = aDescriptorUuid;
-    mRunnable = aRunnable;
-  }
-
-  void Reset()
-  {
-    memset(&mServiceHandle, 0, sizeof(mServiceHandle));
-    memset(&mCharacteristicHandle, 0, sizeof(mCharacteristicHandle));
-    memset(&mDescriptorUuid, 0, sizeof(mDescriptorUuid));
-    mRunnable = nullptr;
-  }
-};
-
 class BluetoothGattServer final : public nsISupports
 {
 public:
   NS_DECL_ISUPPORTS
 
   BluetoothGattServer(const nsAString& aAppUuid)
   : mAppUuid(aAppUuid)
   , mServerIf(0)
-  , mIsRegistering(false)
   { }
 
   nsString mAppUuid;
   int mServerIf;
 
-  /*
-   * Some actions will trigger the registration procedure:
-   *  - Connect the GATT server to a peripheral client
-   *  - Add a service to the GATT server
-   * These actions will be taken only after the registration has been done
-   * successfully. If the registration fails, all the existing actions above
-   * should be rejected.
-   */
-  bool mIsRegistering;
-
   nsRefPtr<BluetoothReplyRunnable> mConnectPeripheralRunnable;
   nsRefPtr<BluetoothReplyRunnable> mDisconnectPeripheralRunnable;
   nsRefPtr<BluetoothReplyRunnable> mUnregisterServerRunnable;
 
-  BluetoothGattServerAddServiceState mAddServiceState;
-  nsRefPtr<BluetoothReplyRunnable> mAddIncludedServiceRunnable;
-  nsRefPtr<BluetoothReplyRunnable> mAddCharacteristicRunnable;
-  BluetoothGattServerAddDescriptorState mAddDescriptorState;
-  nsRefPtr<BluetoothReplyRunnable> mRemoveServiceRunnable;
-  nsRefPtr<BluetoothReplyRunnable> mStartServiceRunnable;
-  nsRefPtr<BluetoothReplyRunnable> mStopServiceRunnable;
-
   // Map connection id from device address
   nsDataHashtable<nsStringHashKey, int> mConnectionMap;
 private:
   ~BluetoothGattServer()
   { }
 };
 
 NS_IMPL_ISUPPORTS0(BluetoothGattServer)
@@ -1463,50 +1394,33 @@ BluetoothGattManager::WriteDescriptorVal
 class BluetoothGattManager::RegisterServerResultHandler final
   : public BluetoothGattResultHandler
 {
 public:
   RegisterServerResultHandler(BluetoothGattServer* aServer)
   : mServer(aServer)
   {
     MOZ_ASSERT(mServer);
-    MOZ_ASSERT(!mServer->mIsRegistering);
-
-    mServer->mIsRegistering = true;
   }
 
-  /*
-   * Some actions will trigger the registration procedure. These actions will
-   * be taken only after the registration has been done successfully.
-   * If the registration fails, all the existing actions above should be
-   * rejected.
-   */
   void OnError(BluetoothStatus aStatus) override
   {
     BT_WARNING("BluetoothGattServerInterface::RegisterServer failed: %d",
                (int)aStatus);
 
     BluetoothService* bs = BluetoothService::Get();
     NS_ENSURE_TRUE_VOID(bs);
 
     // Reject the connect request
     if (mServer->mConnectPeripheralRunnable) {
       DispatchReplyError(mServer->mConnectPeripheralRunnable,
                          NS_LITERAL_STRING("Register GATT server failed"));
       mServer->mConnectPeripheralRunnable = nullptr;
     }
 
-    // Reject the add service request
-    if (mServer->mAddServiceState.mRunnable) {
-      DispatchReplyError(mServer->mAddServiceState.mRunnable,
-                         NS_LITERAL_STRING("Register GATT server failed"));
-      mServer->mAddServiceState.Reset();
-    }
-
-    mServer->mIsRegistering = false;
     sServers->RemoveElement(mServer);
   }
 
 private:
   nsRefPtr<BluetoothGattServer> mServer;
 };
 
 class BluetoothGattManager::ConnectPeripheralResultHandler final
@@ -1590,19 +1504,17 @@ BluetoothGattManager::ConnectPeripheral(
 
   if (server->mServerIf > 0) {
     sBluetoothGattInterface->ConnectPeripheral(
       server->mServerIf,
       aAddress,
       true, // direct connect
       TRANSPORT_AUTO,
       new ConnectPeripheralResultHandler(server, aAddress));
-  } else if (!server->mIsRegistering) { /* avoid triggering another registration
-                                         * procedure if there is an on-going one
-                                         * already */
+  } else {
     BluetoothUuid uuid;
     StringToUuid(aAppUuid, uuid);
 
     // connect will be proceeded after server registered
     sBluetoothGattInterface->RegisterServer(
       uuid, new RegisterServerResultHandler(server));
   }
 }
@@ -1746,487 +1658,16 @@ BluetoothGattManager::UnregisterServer(i
   nsRefPtr<BluetoothGattServer> server = (*sServers)[index];
   server->mUnregisterServerRunnable = aRunnable;
 
   sBluetoothGattInterface->UnregisterServer(
     aServerIf,
     new UnregisterServerResultHandler(server));
 }
 
-class BluetoothGattManager::ServerAddServiceResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerAddServiceResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::ServerAddService failed: %d",
-               (int)aStatus);
-    MOZ_ASSERT(mServer->mAddServiceState.mRunnable);
-
-    DispatchReplyError(mServer->mAddServiceState.mRunnable,
-                       NS_LITERAL_STRING("ServerAddService failed"));
-    mServer->mAddServiceState.Reset();
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerAddService(
-  const nsAString& aAppUuid,
-  const BluetoothGattServiceId& aServiceId,
-  uint16_t aHandleCount,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (index == sServers->NoIndex) {
-    index = sServers->Length();
-    sServers->AppendElement(new BluetoothGattServer(aAppUuid));
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if there is an ongoing add service request.
-  if (server->mAddServiceState.mRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mAddServiceState.Assign(aServiceId, aHandleCount, aRunnable);
-
-  if (server->mServerIf > 0) {
-    sBluetoothGattInterface->AddService(
-      server->mServerIf,
-      aServiceId,
-      aHandleCount,
-      new ServerAddServiceResultHandler(server));
-  } else if (!server->mIsRegistering) { /* avoid triggering another registration
-                                         * procedure if there is an on-going one
-                                         * already */
-    BluetoothUuid uuid;
-    StringToUuid(aAppUuid, uuid);
-
-    // add service will be proceeded after server registered
-    sBluetoothGattInterface->RegisterServer(
-      uuid, new RegisterServerResultHandler(server));
-  }
-}
-
-class BluetoothGattManager::ServerAddIncludedServiceResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerAddIncludedServiceResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::AddIncludedService failed: %d",
-               (int)aStatus);
-
-    // Reject the add included service request
-    if (mServer->mAddIncludedServiceRunnable) {
-      DispatchReplyError(mServer->mAddIncludedServiceRunnable,
-                         NS_LITERAL_STRING("Add GATT included service failed"));
-      mServer->mAddIncludedServiceRunnable = nullptr;
-    }
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerAddIncludedService(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (NS_WARN_IF(index == sServers->NoIndex)) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if the service has not been registered successfully.
-  if (!server->mServerIf) {
-    DispatchReplyError(aRunnable, STATUS_NOT_READY);
-    return;
-  }
-  // Reject the request if there is an ongoing add included service request.
-  if (server->mAddIncludedServiceRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mAddIncludedServiceRunnable = aRunnable;
-
-  sBluetoothGattInterface->AddIncludedService(
-    server->mServerIf,
-    aServiceHandle,
-    aIncludedServiceHandle,
-    new ServerAddIncludedServiceResultHandler(server));
-}
-
-class BluetoothGattManager::ServerAddCharacteristicResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerAddCharacteristicResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::AddCharacteristic failed: %d",
-               (int)aStatus);
-
-    // Reject the add characteristic request
-    if (mServer->mAddCharacteristicRunnable) {
-      DispatchReplyError(mServer->mAddCharacteristicRunnable,
-                         NS_LITERAL_STRING("Add GATT characteristic failed"));
-      mServer->mAddCharacteristicRunnable = nullptr;
-    }
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerAddCharacteristic(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aCharacteristicUuid,
-  BluetoothGattAttrPerm aPermissions,
-  BluetoothGattCharProp aProperties,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (NS_WARN_IF(index == sServers->NoIndex)) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if the service has not been registered successfully.
-  if (!server->mServerIf) {
-    DispatchReplyError(aRunnable, STATUS_NOT_READY);
-    return;
-  }
-  // Reject the request if there is an ongoing add characteristic request.
-  if (server->mAddCharacteristicRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mAddCharacteristicRunnable = aRunnable;
-
-  sBluetoothGattInterface->AddCharacteristic(
-    server->mServerIf,
-    aServiceHandle,
-    aCharacteristicUuid,
-    aPermissions,
-    aProperties,
-    new ServerAddCharacteristicResultHandler(server));
-}
-
-class BluetoothGattManager::ServerAddDescriptorResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerAddDescriptorResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::AddDescriptor failed: %d",
-               (int)aStatus);
-
-    // Reject the add descriptor request
-    if (mServer->mAddDescriptorState.mRunnable) {
-      DispatchReplyError(mServer->mAddDescriptorState.mRunnable,
-                         NS_LITERAL_STRING("Add GATT descriptor failed"));
-      mServer->mAddDescriptorState.Reset();
-    }
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerAddDescriptor(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aCharacteristicHandle,
-  const BluetoothUuid& aDescriptorUuid,
-  BluetoothGattAttrPerm aPermissions,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (NS_WARN_IF(index == sServers->NoIndex)) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if the service has not been registered successfully.
-  if (!server->mServerIf) {
-    DispatchReplyError(aRunnable, STATUS_NOT_READY);
-    return;
-  }
-  // Reject the request if there is an ongoing add descriptor request.
-  if (server->mAddDescriptorState.mRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mAddDescriptorState.Assign(aServiceHandle,
-                                     aCharacteristicHandle,
-                                     aDescriptorUuid,
-                                     aRunnable);
-
-  sBluetoothGattInterface->AddDescriptor(
-    server->mServerIf,
-    aServiceHandle,
-    aDescriptorUuid,
-    aPermissions,
-    new ServerAddDescriptorResultHandler(server));
-}
-
-class BluetoothGattManager::ServerRemoveDescriptorResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerRemoveDescriptorResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::RemoveService failed: %d",
-               (int)aStatus);
-
-    // Reject the remove service request
-    if (mServer->mRemoveServiceRunnable) {
-      DispatchReplyError(mServer->mRemoveServiceRunnable,
-                         NS_LITERAL_STRING("Remove GATT service failed"));
-      mServer->mRemoveServiceRunnable = nullptr;
-    }
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerRemoveService(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (NS_WARN_IF(index == sServers->NoIndex)) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if the service has not been registered successfully.
-  if (!server->mServerIf) {
-    DispatchReplyError(aRunnable, STATUS_NOT_READY);
-    return;
-  }
-  // Reject the request if there is an ongoing remove service request.
-  if (server->mRemoveServiceRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mRemoveServiceRunnable = aRunnable;
-
-  sBluetoothGattInterface->DeleteService(
-    server->mServerIf,
-    aServiceHandle,
-    new ServerRemoveDescriptorResultHandler(server));
-}
-
-class BluetoothGattManager::ServerStartServiceResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerStartServiceResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::StartService failed: %d",
-               (int)aStatus);
-
-    // Reject the remove service request
-    if (mServer->mStartServiceRunnable) {
-      DispatchReplyError(mServer->mStartServiceRunnable,
-                         NS_LITERAL_STRING("Start GATT service failed"));
-      mServer->mStartServiceRunnable = nullptr;
-    }
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerStartService(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (NS_WARN_IF(index == sServers->NoIndex)) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if the service has not been registered successfully.
-  if (!server->mServerIf) {
-    DispatchReplyError(aRunnable, STATUS_NOT_READY);
-    return;
-  }
-  // Reject the request if there is an ongoing start service request.
-  if (server->mStartServiceRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mStartServiceRunnable = aRunnable;
-
-  sBluetoothGattInterface->StartService(
-    server->mServerIf,
-    aServiceHandle,
-    TRANSPORT_AUTO,
-    new ServerStartServiceResultHandler(server));
-}
-
-class BluetoothGattManager::ServerStopServiceResultHandler final
-  : public BluetoothGattResultHandler
-{
-public:
-  ServerStopServiceResultHandler(BluetoothGattServer* aServer)
-  : mServer(aServer)
-  {
-    MOZ_ASSERT(mServer);
-  }
-
-  void OnError(BluetoothStatus aStatus) override
-  {
-    BT_WARNING("BluetoothGattServerInterface::StopService failed: %d",
-               (int)aStatus);
-
-    // Reject the remove service request
-    if (mServer->mStopServiceRunnable) {
-      DispatchReplyError(mServer->mStopServiceRunnable,
-                         NS_LITERAL_STRING("Stop GATT service failed"));
-      mServer->mStopServiceRunnable = nullptr;
-    }
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-};
-
-void
-BluetoothGattManager::ServerStopService(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aRunnable);
-
-  ENSURE_GATT_INTF_IS_READY_VOID(aRunnable);
-
-  size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
-  if (NS_WARN_IF(index == sServers->NoIndex)) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  // Reject the request if the service has not been registered successfully.
-  if (!server->mServerIf) {
-    DispatchReplyError(aRunnable, STATUS_NOT_READY);
-    return;
-  }
-  // Reject the request if there is an ongoing stop service request.
-  if (server->mStopServiceRunnable) {
-    DispatchReplyError(aRunnable, STATUS_BUSY);
-    return;
-  }
-
-  server->mStopServiceRunnable = aRunnable;
-
-  sBluetoothGattInterface->StopService(
-    server->mServerIf,
-    aServiceHandle,
-    new ServerStopServiceResultHandler(server));
-}
-
 //
 // Notification Handlers
 //
 void
 BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
                                                  int aClientIf,
                                                  const BluetoothUuid& aAppUuid)
 {
@@ -2971,64 +2412,48 @@ BluetoothGattManager::ReadRemoteRssiNoti
   }
 }
 
 void
 BluetoothGattManager::ListenNotification(BluetoothGattStatus aStatus,
                                          int aServerIf)
 { }
 
-/*
- * Some actions will trigger the registration procedure. These actions will
- * be taken only after the registration has been done successfully.
- * If the registration fails, all the existing actions above should be
- * rejected.
- */
 void
 BluetoothGattManager::RegisterServerNotification(BluetoothGattStatus aStatus,
                                                  int aServerIf,
                                                  const BluetoothUuid& aAppUuid)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsString uuid;
   UuidToString(aAppUuid, uuid);
 
   size_t index = sServers->IndexOf(uuid, 0 /* Start */, UuidComparator());
   NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
 
   nsRefPtr<BluetoothGattServer> server = (*sServers)[index];
 
-  server->mIsRegistering = false;
-
   BluetoothService* bs = BluetoothService::Get();
-  if (!bs || aStatus != GATT_STATUS_SUCCESS) {
+  NS_ENSURE_TRUE_VOID(bs);
+
+  if (aStatus != GATT_STATUS_SUCCESS) {
     BT_LOGD("RegisterServer failed: serverIf = %d, status = %d, appUuid = %s",
              aServerIf, aStatus, NS_ConvertUTF16toUTF8(uuid).get());
 
     if (server->mConnectPeripheralRunnable) {
       // Reject the connect peripheral request
       DispatchReplyError(
         server->mConnectPeripheralRunnable,
         NS_LITERAL_STRING(
           "ConnectPeripheral failed due to registration failed"));
       server->mConnectPeripheralRunnable = nullptr;
     }
 
-    if (server->mAddServiceState.mRunnable) {
-      // Reject the add service request
-      DispatchReplyError(
-        server->mAddServiceState.mRunnable,
-        NS_LITERAL_STRING(
-          "AddService failed due to registration failed"));
-      server->mAddServiceState.Reset();
-    }
-
     sServers->RemoveElement(server);
-    return;
   }
 
   server->mServerIf = aServerIf;
 
   // Notify BluetoothGattServer to update the serverIf
   bs->DistributeSignal(
     NS_LITERAL_STRING("ServerRegistered"),
     uuid, BluetoothValue(uint32_t(aServerIf)));
@@ -3036,24 +2461,16 @@ BluetoothGattManager::RegisterServerNoti
   if (server->mConnectPeripheralRunnable) {
     // Only one entry exists in the map during first connect peripheral request
     nsString deviceAddr(server->mConnectionMap.Iter().Key());
 
     sBluetoothGattInterface->ConnectPeripheral(
       aServerIf, deviceAddr, true /* direct connect */, TRANSPORT_AUTO,
       new ConnectPeripheralResultHandler(server, deviceAddr));
   }
-
-  if (server->mAddServiceState.mRunnable) {
-    sBluetoothGattInterface->AddService(
-      server->mServerIf,
-      server->mAddServiceState.mServiceId,
-      server->mAddServiceState.mHandleCount,
-      new ServerAddServiceResultHandler(server));
-  }
 }
 
 void
 BluetoothGattManager::ConnectionNotification(int aConnId,
                                              int aServerIf,
                                              bool aConnected,
                                              const nsAString& aBdAddr)
 {
@@ -3099,263 +2516,16 @@ BluetoothGattManager::ConnectionNotifica
     } else {
       DispatchReplyError(server->mDisconnectPeripheralRunnable,
                          NS_LITERAL_STRING("DisconnectPeripheral failed"));
     }
     server->mDisconnectPeripheralRunnable = nullptr;
   }
 }
 
-void
-BluetoothGattManager::ServiceAddedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothGattServiceId& aServiceId,
-  const BluetoothAttributeHandle& aServiceHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  BluetoothService* bs = BluetoothService::Get();
-  if (!bs || aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mAddServiceState.mRunnable) {
-      DispatchReplyError(server->mAddServiceState.mRunnable,
-                         NS_LITERAL_STRING("ServiceAddedNotification failed"));
-      server->mAddServiceState.Reset();
-    }
-    return;
-  }
-
-  // Notify BluetoothGattServer to update service handle
-  InfallibleTArray<BluetoothNamedValue> props;
-  AppendNamedValue(props, "ServiceId", aServiceId);
-  AppendNamedValue(props, "ServiceHandle", aServiceHandle);
-  bs->DistributeSignal(NS_LITERAL_STRING("ServiceHandleUpdated"),
-                       server->mAppUuid,
-                       BluetoothValue(props));
-
-  if (server->mAddServiceState.mRunnable) {
-    DispatchReplySuccess(server->mAddServiceState.mRunnable);
-    server->mAddServiceState.Reset();
-  }
-}
-
-void
-BluetoothGattManager::IncludedServiceAddedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  if (aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mAddIncludedServiceRunnable) {
-      DispatchReplyError(
-        server->mAddIncludedServiceRunnable,
-        NS_LITERAL_STRING("IncludedServiceAddedNotification failed"));
-      server->mAddIncludedServiceRunnable = nullptr;
-    }
-    return;
-  }
-
-  if (server->mAddIncludedServiceRunnable) {
-    DispatchReplySuccess(server->mAddIncludedServiceRunnable);
-    server->mAddIncludedServiceRunnable = nullptr;
-  }
-}
-
-void
-BluetoothGattManager::CharacteristicAddedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothUuid& aCharId,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aCharacteristicHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  BluetoothService* bs = BluetoothService::Get();
-  if (!bs || aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mAddCharacteristicRunnable) {
-      DispatchReplyError(
-        server->mAddCharacteristicRunnable,
-        NS_LITERAL_STRING("CharacteristicAddedNotification failed"));
-      server->mAddCharacteristicRunnable = nullptr;
-    }
-    return;
-  }
-
-  // Notify BluetoothGattServer to update characteristic handle
-  InfallibleTArray<BluetoothNamedValue> props;
-  AppendNamedValue(props, "CharacteristicUuid", aCharId);
-  AppendNamedValue(props, "ServiceHandle", aServiceHandle);
-  AppendNamedValue(props, "CharacteristicHandle", aCharacteristicHandle);
-  bs->DistributeSignal(NS_LITERAL_STRING("CharacteristicHandleUpdated"),
-                       server->mAppUuid,
-                       BluetoothValue(props));
-
-  if (server->mAddCharacteristicRunnable) {
-    DispatchReplySuccess(server->mAddCharacteristicRunnable);
-    server->mAddCharacteristicRunnable = nullptr;
-  }
-}
-
-void
-BluetoothGattManager::DescriptorAddedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothUuid& aCharId,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aDescriptorHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-  MOZ_ASSERT(aServiceHandle == server->mAddDescriptorState.mServiceHandle);
-
-  BluetoothService* bs = BluetoothService::Get();
-  if (!bs || aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mAddDescriptorState.mRunnable) {
-      DispatchReplyError(
-        server->mAddDescriptorState.mRunnable,
-        NS_LITERAL_STRING("DescriptorAddedNotification failed"));
-      server->mAddDescriptorState.Reset();
-    }
-    return;
-  }
-
-  // Notify BluetoothGattServer to update descriptor handle
-  InfallibleTArray<BluetoothNamedValue> props;
-  AppendNamedValue(props, "CharacteristicUuid", aCharId);
-  AppendNamedValue(props, "ServiceHandle", aServiceHandle);
-  AppendNamedValue(props, "CharacteristicHandle",
-    server->mAddDescriptorState.mCharacteristicHandle);
-  AppendNamedValue(props, "DescriptorHandle", aDescriptorHandle);
-  bs->DistributeSignal(NS_LITERAL_STRING("DescriptorHandleUpdated"),
-                       server->mAppUuid,
-                       BluetoothValue(props));
-
-  if (server->mAddDescriptorState.mRunnable) {
-    DispatchReplySuccess(server->mAddDescriptorState.mRunnable);
-    server->mAddDescriptorState.Reset();
-  }
-}
-
-void
-BluetoothGattManager::ServiceStartedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  if (aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mStartServiceRunnable) {
-      DispatchReplyError(
-        server->mStartServiceRunnable,
-        NS_LITERAL_STRING("ServiceStartedNotification failed"));
-      server->mStartServiceRunnable = nullptr;
-    }
-    return;
-  }
-
-  if (server->mStartServiceRunnable) {
-    DispatchReplySuccess(server->mStartServiceRunnable);
-    server->mStartServiceRunnable = nullptr;
-  }
-}
-
-void
-BluetoothGattManager::ServiceStoppedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  if (aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mStopServiceRunnable) {
-      DispatchReplyError(
-        server->mStopServiceRunnable,
-        NS_LITERAL_STRING("ServiceStoppedNotification failed"));
-      server->mStopServiceRunnable = nullptr;
-    }
-    return;
-  }
-
-  if (server->mStopServiceRunnable) {
-    DispatchReplySuccess(server->mStopServiceRunnable);
-    server->mStopServiceRunnable = nullptr;
-  }
-}
-
-void
-BluetoothGattManager::ServiceDeletedNotification(
-  BluetoothGattStatus aStatus,
-  int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  size_t index = sServers->IndexOf(aServerIf, 0 /* Start */,
-                                   InterfaceIdComparator());
-  NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
-
-  nsRefPtr<BluetoothGattServer> server = sServers->ElementAt(index);
-
-  if (aStatus != GATT_STATUS_SUCCESS) {
-    if (server->mRemoveServiceRunnable) {
-      DispatchReplyError(
-        server->mRemoveServiceRunnable,
-        NS_LITERAL_STRING("ServiceStoppedNotification failed"));
-      server->mRemoveServiceRunnable = nullptr;
-    }
-    return;
-  }
-
-  if (server->mRemoveServiceRunnable) {
-    DispatchReplySuccess(server->mRemoveServiceRunnable);
-    server->mRemoveServiceRunnable = nullptr;
-  }
-}
-
 BluetoothGattManager::BluetoothGattManager()
 { }
 
 BluetoothGattManager::~BluetoothGattManager()
 {
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   NS_ENSURE_TRUE_VOID(obs);
   if (NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID))) {
--- a/dom/bluetooth/bluedroid/BluetoothGattManager.h
+++ b/dom/bluetooth/bluedroid/BluetoothGattManager.h
@@ -98,59 +98,16 @@ public:
   void DisconnectPeripheral(
     const nsAString& aAppUuid,
     const nsAString& aAddress,
     BluetoothReplyRunnable* aRunnable);
 
   void UnregisterServer(int aServerIf,
                         BluetoothReplyRunnable* aRunnable);
 
-  void ServerAddService(
-    const nsAString& aAppUuid,
-    const BluetoothGattServiceId& aServiceId,
-    uint16_t aHandleCount,
-    BluetoothReplyRunnable* aRunnable);
-
-  void ServerAddIncludedService(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothReplyRunnable* aRunnable);
-
-  void ServerAddCharacteristic(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aCharacteristicUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattCharProp aProperties,
-    BluetoothReplyRunnable* aRunnable);
-
-  void ServerAddDescriptor(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle,
-    const BluetoothUuid& aDescriptorUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothReplyRunnable* aRunnable);
-
-  void ServerRemoveService(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable);
-
-  void ServerStartService(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable);
-
-  void ServerStopService(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable);
-
 private:
   ~BluetoothGattManager();
 
   class CleanupResultHandler;
   class CleanupResultHandlerRunnable;
   class InitGattResultHandler;
   class RegisterClientResultHandler;
   class UnregisterClientResultHandler;
@@ -167,23 +124,16 @@ private:
   class ReadDescriptorValueResultHandler;
   class WriteDescriptorValueResultHandler;
   class ScanDeviceTypeResultHandler;
 
   class RegisterServerResultHandler;
   class ConnectPeripheralResultHandler;
   class DisconnectPeripheralResultHandler;
   class UnregisterServerResultHandler;
-  class ServerAddServiceResultHandler;
-  class ServerAddIncludedServiceResultHandler;
-  class ServerAddCharacteristicResultHandler;
-  class ServerAddDescriptorResultHandler;
-  class ServerRemoveDescriptorResultHandler;
-  class ServerStartServiceResultHandler;
-  class ServerStopServiceResultHandler;
 
   BluetoothGattManager();
 
   void HandleShutdown();
 
   void RegisterClientNotification(BluetoothGattStatus aStatus,
                                   int aClientIf,
                                   const BluetoothUuid& aAppUuid) override;
@@ -272,62 +222,14 @@ private:
                                   int aServerIf,
                                   const BluetoothUuid& aAppUuid) override;
 
   void ConnectionNotification(int aConnId,
                               int aServerIf,
                               bool aConnected,
                               const nsAString& aBdAddr) override;
 
-  void
-  ServiceAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothGattServiceId& aServiceId,
-    const BluetoothAttributeHandle& aServiceHandle) override;
-
-  void
-  IncludedServiceAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle) override;
-
-  void
-  CharacteristicAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothUuid& aCharId,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle) override;
-
-  void
-  DescriptorAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothUuid& aCharId,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aDescriptorHandle) override;
-
-  void
-  ServiceStartedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle) override;
-
-  void
-  ServiceStoppedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle) override;
-
-  void
-  ServiceDeletedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle) override;
-
   static bool mInShutdown;
 };
 
 END_BLUETOOTH_NAMESPACE
 
 #endif // mozilla_dom_bluetooth_bluedroid_BluetoothGattManager_h
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
@@ -598,149 +598,16 @@ BluetoothServiceBluedroid::UnregisterGat
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   gatt->UnregisterServer(aServerIf, aRunnable);
 }
 
-void
-BluetoothServiceBluedroid::GattServerAddServiceInternal(
-  const nsAString& 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);
-
-  gatt->ServerAddService(aAppUuid, aServiceId, aHandleCount, aRunnable);
-}
-
-void
-BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
-  const nsAString& 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);
-
-  gatt->ServerAddIncludedService(aAppUuid,
-                                 aServiceHandle,
-                                 aIncludedServiceHandle,
-                                 aRunnable);
-}
-
-void
-BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
-  const nsAString& 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);
-
-  gatt->ServerAddCharacteristic(aAppUuid,
-                                aServiceHandle,
-                                aCharacteristicUuid,
-                                aPermissions,
-                                aProperties,
-                                aRunnable);
-}
-
-void
-BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
-  const nsAString& 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);
-
-  gatt->ServerAddDescriptor(aAppUuid,
-                            aServiceHandle,
-                            aCharacteristicHandle,
-                            aDescriptorUuid,
-                            aPermissions,
-                            aRunnable);
-}
-
-void
-BluetoothServiceBluedroid::GattServerRemoveServiceInternal(
-  const nsAString& 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);
-
-  gatt->ServerRemoveService(aAppUuid, aServiceHandle, aRunnable);
-}
-
-void
-BluetoothServiceBluedroid::GattServerStartServiceInternal(
-  const nsAString& 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);
-
-  gatt->ServerStartService(aAppUuid, aServiceHandle, aRunnable);
-}
-
-void
-BluetoothServiceBluedroid::GattServerStopServiceInternal(
-  const nsAString& 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);
-
-  gatt->ServerStopService(aAppUuid, aServiceHandle, aRunnable);
-}
-
 nsresult
 BluetoothServiceBluedroid::GetAdaptersInternal(
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   /**
    * Wrap BluetoothValue =
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
@@ -305,66 +305,16 @@ public:
     const nsAString& aAppUuid,
     const nsAString& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
-  virtual void
-  GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothGattServiceId& aServiceId,
-    uint16_t aHandleCount,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aCharacteristicUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattCharProp aProperties,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle,
-    const BluetoothUuid& aDescriptorUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
   //
   // Bluetooth notifications
   //
 
   virtual void AdapterStateChangedNotification(bool aState) override;
   virtual void AdapterPropertiesNotification(
     BluetoothStatus aStatus, int aNumProperties,
     const BluetoothProperty* aProperties) override;
--- a/dom/bluetooth/bluez/BluetoothDBusService.cpp
+++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp
@@ -4433,72 +4433,8 @@ BluetoothDBusService::GattServerDisconne
 {
 }
 
 void
 BluetoothDBusService::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
 }
-
-void
-BluetoothDBusService::GattServerAddServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothGattServiceId& aServiceId,
-  uint16_t aHandleCount,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
-
-void
-BluetoothDBusService::GattServerAddIncludedServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
-
-void
-BluetoothDBusService::GattServerAddCharacteristicInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aCharacteristicUuid,
-  BluetoothGattAttrPerm aPermissions,
-  BluetoothGattCharProp aProperties,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
-
-void
-BluetoothDBusService::GattServerAddDescriptorInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aCharacteristicHandle,
-  const BluetoothUuid& aDescriptorUuid,
-  BluetoothGattAttrPerm aPermissions,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
-
-void
-BluetoothDBusService::GattServerRemoveServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
-
-void
-BluetoothDBusService::GattServerStartServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
-
-void
-BluetoothDBusService::GattServerStopServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-}
--- a/dom/bluetooth/bluez/BluetoothDBusService.h
+++ b/dom/bluetooth/bluez/BluetoothDBusService.h
@@ -316,66 +316,16 @@ public:
     const nsAString& aAppUuid,
     const nsAString& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
-  virtual void
-  GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothGattServiceId& aServiceId,
-    uint16_t aHandleCount,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aCharacteristicUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattCharProp aProperties,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle,
-    const BluetoothUuid& aDescriptorUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
 private:
   nsresult SendGetPropertyMessage(const nsAString& aPath,
                                   const char* aInterface,
                                   void (*aCB)(DBusMessage *, void *),
                                   BluetoothReplyRunnable* aRunnable);
 
   nsresult SendDiscoveryMessage(const char* aMessageName,
                                 BluetoothReplyRunnable* aRunnable);
--- a/dom/bluetooth/common/BluetoothCommon.h
+++ b/dom/bluetooth/common/BluetoothCommon.h
@@ -107,78 +107,16 @@ extern bool gBluetoothDebugFlag;
   } while(0)
 
 /**
  * Reject |promise| with |ret| if nsresult |rv| is not successful.
  */
 #define BT_ENSURE_SUCCESS_REJECT(rv, promise, ret)                   \
   BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv), promise, ret)
 
-/**
- * Resolve |promise| with |value| and return |ret| if |x| is false.
- */
-#define BT_ENSURE_TRUE_RESOLVE_RETURN(x, promise, value, ret)        \
-  do {                                                               \
-    if (MOZ_UNLIKELY(!(x))) {                                        \
-      BT_LOGR("BT_ENSURE_TRUE_RESOLVE_RETURN(" #x ") failed");       \
-      (promise)->MaybeResolve(value);                                \
-      return ret;                                                    \
-    }                                                                \
-  } while(0)
-
-/**
- * Resolve |promise| with |value| and return if |x| is false.
- */
-#define BT_ENSURE_TRUE_RESOLVE_VOID(x, promise, value)               \
-  do {                                                               \
-    if (MOZ_UNLIKELY(!(x))) {                                        \
-      BT_LOGR("BT_ENSURE_TRUE_RESOLVE_VOID(" #x ") failed");         \
-      (promise)->MaybeResolve(value);                                \
-      return;                                                        \
-    }                                                                \
-  } while(0)
-
-/**
- * Reject |promise| with |value| and return |ret| if |x| is false.
- */
-#define BT_ENSURE_TRUE_REJECT_RETURN(x, promise, value, ret)         \
-  do {                                                               \
-    if (MOZ_UNLIKELY(!(x))) {                                        \
-      BT_LOGR("BT_ENSURE_TRUE_REJECT_RETURN(" #x ") failed");        \
-      (promise)->MaybeReject(value);                                 \
-      return ret;                                                    \
-    }                                                                \
-  } while(0)
-
-/**
- * Reject |promise| with |value| and return if |x| is false.
- */
-#define BT_ENSURE_TRUE_REJECT_VOID(x, promise, value)                \
-  do {                                                               \
-    if (MOZ_UNLIKELY(!(x))) {                                        \
-      BT_LOGR("BT_ENSURE_TRUE_REJECT_VOID(" #x ") failed");          \
-      (promise)->MaybeReject(value);                                 \
-      return;                                                        \
-    }                                                                \
-  } while(0)
-
-/**
- * Reject |promise| with |value| and return |ret| if nsresult |rv|
- * is not successful.
- */
-#define BT_ENSURE_SUCCESS_REJECT_RETURN(rv, promise, value, ret)     \
-  BT_ENSURE_TRUE_REJECT_RETURN(NS_SUCCEEDED(rv), promise, value, ret)
-
-/**
- * Reject |promise| with |value| and return if nsresult |rv|
- * is not successful.
- */
-#define BT_ENSURE_SUCCESS_REJECT_VOID(rv, promise, value)            \
-  BT_ENSURE_TRUE_REJECT_VOID(NS_SUCCEEDED(rv), promise, value)
-
 #define BEGIN_BLUETOOTH_NAMESPACE \
   namespace mozilla { namespace dom { namespace bluetooth {
 #define END_BLUETOOTH_NAMESPACE \
   } /* namespace bluetooth */ } /* namespace dom */ } /* namespace mozilla */
 #define USING_BLUETOOTH_NAMESPACE \
   using namespace mozilla::dom::bluetooth;
 
 #define KEY_LOCAL_AGENT       "/B2G/bluetooth/agent"
@@ -658,21 +596,16 @@ struct BluetoothAvrcpNotificationParam {
 };
 
 struct BluetoothAvrcpPlayerSettings {
   uint8_t mNumAttr;
   uint8_t mIds[256];
   uint8_t mValues[256];
 };
 
-enum BluetoothAttRole {
-  ATT_SERVER_ROLE,
-  ATT_CLIENT_ROLE
-};
-
 enum BluetoothGattStatus {
   GATT_STATUS_SUCCESS,
   GATT_STATUS_INVALID_HANDLE,
   GATT_STATUS_READ_NOT_PERMITTED,
   GATT_STATUS_WRITE_NOT_PERMITTED,
   GATT_STATUS_INVALID_PDU,
   GATT_STATUS_INSUFFICIENT_AUTHENTICATION,
   GATT_STATUS_REQUEST_NOT_SUPPORTED,
@@ -840,24 +773,11 @@ enum BluetoothGapDataType {
   GAP_INCOMPLETE_UUID32  = 0X04, // Incomplete List of 32-bit Service Class UUIDs
   GAP_COMPLETE_UUID32    = 0X05, // Complete List of 32-bit Service Class UUIDs┬╗
   GAP_INCOMPLETE_UUID128 = 0X06, // Incomplete List of 128-bit Service Class UUIDs
   GAP_COMPLETE_UUID128   = 0X07, // Complete List of 128-bit Service Class UUIDs
   GAP_SHORTENED_NAME     = 0X08, // Shortened Local Name
   GAP_COMPLETE_NAME      = 0X09, // Complete Local Name
 };
 
-struct BluetoothAttributeHandle {
-  uint16_t mHandle;
-
-  BluetoothAttributeHandle()
-    : mHandle(0x0000)
-  { }
-
-  bool operator==(const BluetoothAttributeHandle& aOther) const
-  {
-    return mHandle == aOther.mHandle;
-  }
-};
-
 END_BLUETOOTH_NAMESPACE
 
 #endif // mozilla_dom_bluetooth_BluetoothCommon_h
--- a/dom/bluetooth/common/BluetoothInterface.cpp
+++ b/dom/bluetooth/common/BluetoothInterface.cpp
@@ -584,57 +584,50 @@ BluetoothGattNotificationHandler::Regist
 void
 BluetoothGattNotificationHandler::ConnectionNotification(
   int aConnId, int aServerIf, bool aConnected, const nsAString& aBdAddr)
 { }
 
 void
 BluetoothGattNotificationHandler::ServiceAddedNotification(
   BluetoothGattStatus aStatus, int aServerIf,
-  const BluetoothGattServiceId& aServiceId,
-  const BluetoothAttributeHandle& aServiceHandle)
+  const BluetoothGattServiceId& aServiceId, int aServiceHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::IncludedServiceAddedNotification(
-  BluetoothGattStatus aStatus, int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle)
+  BluetoothGattStatus aStatus, int aServerIf, int aServiceHandle,
+  int aIncludedServiceHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::CharacteristicAddedNotification(
   BluetoothGattStatus aStatus, int aServerIf, const BluetoothUuid& aCharId,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aCharacteristicHandle)
+  int aServiceHandle, int aCharacteristicHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::DescriptorAddedNotification(
   BluetoothGattStatus aStatus, int aServerIf, const BluetoothUuid& aCharId,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aDescriptorHandle)
+  int aServiceHandle, int aDescriptorHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::ServiceStartedNotification(
-  BluetoothGattStatus aStatus, int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle)
+  BluetoothGattStatus aStatus, int aServerIf, int aServiceHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::ServiceStoppedNotification(
-  BluetoothGattStatus aStatus, int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle)
+  BluetoothGattStatus aStatus, int aServerIf, int aServiceHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::ServiceDeletedNotification(
-  BluetoothGattStatus aStatus, int aServerIf,
-  const BluetoothAttributeHandle& aServiceHandle)
+  BluetoothGattStatus aStatus, int aServerIf, int aServiceHandle)
 { }
 
 void
 BluetoothGattNotificationHandler::RequestReadNotification(
   int aConnId, int aTransId, const nsAString& aBdAddr, int aAttributeHandle,
   int aOffset, bool aIsLong)
 { }
 
--- a/dom/bluetooth/common/BluetoothInterface.h
+++ b/dom/bluetooth/common/BluetoothInterface.h
@@ -564,55 +564,52 @@ public:
                          int aServerIf,
                          bool aConnected,
                          const nsAString& aBdAddr);
 
   virtual void
   ServiceAddedNotification(BluetoothGattStatus aStatus,
                            int aServerIf,
                            const BluetoothGattServiceId& aServiceId,
-                           const BluetoothAttributeHandle& aServiceHandle);
+                           int aServiceHandle);
 
   virtual void
-  IncludedServiceAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle);
+  IncludedServiceAddedNotification(BluetoothGattStatus aStatus,
+                                   int aServerIf,
+                                   int aServiceHandle,
+                                   int aIncludedServiceHandle);
 
   virtual void
-  CharacteristicAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothUuid& aCharId,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle);
+  CharacteristicAddedNotification(BluetoothGattStatus aStatus,
+                                  int aServerIf,
+                                  const BluetoothUuid& aCharId,
+                                  int aServiceHandle,
+                                  int aCharacteristicHandle);
 
   virtual void
-  DescriptorAddedNotification(
-    BluetoothGattStatus aStatus,
-    int aServerIf,
-    const BluetoothUuid& aCharId,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aDescriptorHandle);
+  DescriptorAddedNotification(BluetoothGattStatus aStatus,
+                              int aServerIf,
+                              const BluetoothUuid& aCharId,
+                              int aServiceHandle,
+                              int aDescriptorHandle);
 
   virtual void
   ServiceStartedNotification(BluetoothGattStatus aStatus,
                              int aServerIf,
-                             const BluetoothAttributeHandle& aServiceHandle);
+                             int aServiceHandle);
 
   virtual void
   ServiceStoppedNotification(BluetoothGattStatus aStatus,
                              int aServerIf,
-                             const BluetoothAttributeHandle& aServiceHandle);
+                             int aServiceHandle);
 
   virtual void
   ServiceDeletedNotification(BluetoothGattStatus aStatus,
                              int aServerIf,
-                             const BluetoothAttributeHandle& aServiceHandle);
+                             int aServiceHandle);
 
   virtual void
   RequestReadNotification(int aConnId,
                           int aTransId,
                           const nsAString& aBdAddr,
                           int aAttributeHandle,
                           int aOffset,
                           bool aIsLong);
@@ -869,45 +866,44 @@ public:
   virtual void DisconnectPeripheral(int aServerIf,
                                     const nsAString& aBdAddr,
                                     int aConnId,
                                     BluetoothGattResultHandler* aRes) = 0;
 
   /* Add a services / a characteristic / a descriptor */
   virtual void AddService(int aServerIf,
                           const BluetoothGattServiceId& aServiceId,
-                          uint16_t aNumHandles,
+                          int aNumHandles,
                           BluetoothGattResultHandler* aRes) = 0;
-  virtual void AddIncludedService(
-    int aServerIf,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothGattResultHandler* aRes) = 0;
+  virtual void AddIncludedService(int aServerIf,
+                                  int aServiceHandle,
+                                  int aIncludedServiceHandle,
+                                  BluetoothGattResultHandler* aRes) = 0;
   virtual void AddCharacteristic(int aServerIf,
-                                 const BluetoothAttributeHandle& aServiceHandle,
+                                 int aServiceHandle,
                                  const BluetoothUuid& aUuid,
                                  BluetoothGattCharProp aProperties,
                                  BluetoothGattAttrPerm aPermissions,
                                  BluetoothGattResultHandler* aRes) = 0;
   virtual void AddDescriptor(int aServerIf,
-                             const BluetoothAttributeHandle& aServiceHandle,
+                             int aServiceHandle,
                              const BluetoothUuid& aUuid,
                              BluetoothGattAttrPerm aPermissions,
                              BluetoothGattResultHandler* aRes) = 0;
 
   /* Start / Stop / Delete a service */
   virtual void StartService(int aServerIf,
-                            const BluetoothAttributeHandle& aServiceHandle,
+                            int aServiceHandle,
                             BluetoothTransport aTransport,
                             BluetoothGattResultHandler* aRes) = 0;
   virtual void StopService(int aServerIf,
-                           const BluetoothAttributeHandle& aServiceHandle,
+                           int aServiceHandle,
                            BluetoothGattResultHandler* aRes) = 0;
   virtual void DeleteService(int aServerIf,
-                             const BluetoothAttributeHandle& aServiceHandle,
+                             int aServiceHandle,
                              BluetoothGattResultHandler* aRes) = 0;
 
   /* Send an indication or a notification */
   virtual void SendIndication(int aServerIf,
                               int aAttributeHandle,
                               int aConnId,
                               const nsTArray<uint8_t>& aValue,
                               bool aConfirm, /* true: indication */
--- a/dom/bluetooth/common/BluetoothReplyRunnable.cpp
+++ b/dom/bluetooth/common/BluetoothReplyRunnable.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "base/basictypes.h"
 #include "BluetoothReplyRunnable.h"
-#include "BluetoothUtils.h"
 #include "DOMRequest.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "mozilla/dom/Promise.h"
 #include "nsServiceManagerUtils.h"
 
 using namespace mozilla::dom;
 
@@ -54,17 +53,16 @@ BluetoothReplyRunnable::FireReplySuccess
     return rs->FireSuccessAsync(mDOMRequest, aVal);
   }
 
   // Promise
   if (mPromise) {
     mPromise->MaybeResolve(aVal);
   }
 
-  OnSuccessFired();
   return NS_OK;
 }
 
 nsresult
 BluetoothReplyRunnable::FireErrorString()
 {
   // DOMRequest
   if (mDOMRequest) {
@@ -77,17 +75,16 @@ BluetoothReplyRunnable::FireErrorString(
 
   // Promise
   if (mPromise) {
     nsresult rv =
       NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_BLUETOOTH, mErrorStatus);
     mPromise->MaybeReject(rv);
   }
 
-  OnErrorFired();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BluetoothReplyRunnable::Run()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mReply);
@@ -116,202 +113,16 @@ BluetoothReplyRunnable::Run()
              "BluetoothReplyRunnable::ReleaseMembers()!");
   MOZ_ASSERT(!mPromise,
              "mPromise is still alive! Deriving class should call "
              "BluetoothReplyRunnable::ReleaseMembers()!");
 
   return rv;
 }
 
-void
-BluetoothReplyRunnable::OnSuccessFired()
-{}
-
-void
-BluetoothReplyRunnable::OnErrorFired()
-{}
-
 BluetoothVoidReplyRunnable::BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq,
                                                        Promise* aPromise)
   : BluetoothReplyRunnable(aReq, aPromise)
 {}
 
 BluetoothVoidReplyRunnable::~BluetoothVoidReplyRunnable()
 {}
 
-BluetoothReplyTaskQueue::SubReplyRunnable::SubReplyRunnable(
-  nsIDOMDOMRequest* aReq,
-  Promise* aPromise,
-  BluetoothReplyTaskQueue* aRootQueue)
-  : BluetoothReplyRunnable(aReq, aPromise)
-  , mRootQueue(aRootQueue)
-{}
-
-BluetoothReplyTaskQueue::SubReplyRunnable::~SubReplyRunnable()
-{}
-
-BluetoothReplyTaskQueue*
-BluetoothReplyTaskQueue::SubReplyRunnable::GetRootQueue() const
-{
-  return mRootQueue;
-}
-
-void
-BluetoothReplyTaskQueue::SubReplyRunnable::OnSuccessFired()
-{
-  mRootQueue->OnSubReplySuccessFired(this);
-}
-
-void
-BluetoothReplyTaskQueue::SubReplyRunnable::OnErrorFired()
-{
-  mRootQueue->OnSubReplyErrorFired(this);
-}
-
-BluetoothReplyTaskQueue::VoidSubReplyRunnable::VoidSubReplyRunnable(
-  nsIDOMDOMRequest* aReq,
-  Promise* aPromise,
-  BluetoothReplyTaskQueue* aRootQueue)
-  : BluetoothReplyTaskQueue::SubReplyRunnable(aReq, aPromise, aRootQueue)
-{}
-
-BluetoothReplyTaskQueue::VoidSubReplyRunnable::~VoidSubReplyRunnable()
-{}
-
-bool
-BluetoothReplyTaskQueue::VoidSubReplyRunnable::ParseSuccessfulReply(
-  JS::MutableHandle<JS::Value> aValue)
-{
-  aValue.setUndefined();
-  return true;
-}
-
-BluetoothReplyTaskQueue::SubTask::SubTask(
-  BluetoothReplyTaskQueue* aRootQueue,
-  SubReplyRunnable* aReply)
-  : mRootQueue(aRootQueue)
-  , mReply(aReply)
-{
-  if (!mReply) {
-    mReply = new VoidSubReplyRunnable(nullptr, nullptr, mRootQueue);
-  }
-}
-
-BluetoothReplyTaskQueue::SubTask::~SubTask()
-{}
-
-BluetoothReplyTaskQueue*
-BluetoothReplyTaskQueue::SubTask::GetRootQueue() const
-{
-  return mRootQueue;
-}
-
-BluetoothReplyTaskQueue::SubReplyRunnable*
-BluetoothReplyTaskQueue::SubTask::GetReply() const
-{
-  return mReply;
-}
-
-BluetoothReplyTaskQueue::BluetoothReplyTaskQueue(
-  BluetoothReplyRunnable* aReply)
-  : mReply(aReply)
-{}
-
-BluetoothReplyTaskQueue::~BluetoothReplyTaskQueue()
-{
-  Clear();
-}
-
-void
-BluetoothReplyTaskQueue::AppendTask(already_AddRefed<SubTask> aTask)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsRefPtr<SubTask> task(aTask);
-
-  if (task) {
-    mTasks.AppendElement(task.forget());
-  }
-}
-
-NS_IMETHODIMP
-BluetoothReplyTaskQueue::Run()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!mTasks.IsEmpty()) {
-    nsRefPtr<SubTask> task = mTasks[0];
-    mTasks.RemoveElementAt(0);
-
-    MOZ_ASSERT(task);
-
-    if (!task->Execute()) {
-      FireErrorReply();
-    }
-  }
-
-  return NS_OK;
-}
-
-void
-BluetoothReplyTaskQueue::OnSubReplySuccessFired(SubReplyRunnable* aSubReply)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aSubReply);
-
-  if (mTasks.IsEmpty()) {
-    FireSuccessReply();
-  } else {
-    if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(this)))) {
-      FireErrorReply();
-    }
-  }
-}
-
-void
-BluetoothReplyTaskQueue::OnSubReplyErrorFired(SubReplyRunnable* aSubReply)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aSubReply);
-
-  FireErrorReply();
-}
-
-void
-BluetoothReplyTaskQueue::FireSuccessReply()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (mReply) {
-    DispatchReplySuccess(mReply);
-  }
-  OnSuccessFired();
-  Clear();
-}
-
-void
-BluetoothReplyTaskQueue::FireErrorReply()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (mReply) {
-    DispatchReplyError(mReply, STATUS_FAIL);
-  }
-  OnErrorFired();
-  Clear();
-}
-
-void
-BluetoothReplyTaskQueue::OnSuccessFired()
-{}
-
-void
-BluetoothReplyTaskQueue::OnErrorFired()
-{}
-
-void
-BluetoothReplyTaskQueue::Clear()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  mReply = nullptr;
-  mTasks.Clear();
-}
--- a/dom/bluetooth/common/BluetoothReplyRunnable.h
+++ b/dom/bluetooth/common/BluetoothReplyRunnable.h
@@ -52,19 +52,16 @@ protected:
   // header. We assume we'll only be running this once and it should die on
   // scope out of Run() anyways.
   nsAutoPtr<BluetoothReply> mReply;
 
 private:
   nsresult FireReplySuccess(JS::Handle<JS::Value> aVal);
   nsresult FireErrorString();
 
-  virtual void OnSuccessFired();
-  virtual void OnErrorFired();
-
   /**
    * Either mDOMRequest or mPromise is not nullptr to reply applications
    * success or error string. One special case is internal IPC that require
    * neither mDOMRequest nor mPromise to reply applications.
    * E.g., GetAdaptersTask triggered by BluetoothManager
    *
    * TODO: remove mDOMRequest once all methods adopt Promise.
    */
@@ -86,112 +83,11 @@ protected:
   virtual bool
   ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue) override
   {
     aValue.setUndefined();
     return true;
   }
 };
 
-class BluetoothReplyTaskQueue : public nsRunnable
-{
-public:
-  NS_DECL_NSIRUNNABLE
-
-  class SubReplyRunnable : public BluetoothReplyRunnable
-  {
-  public:
-    SubReplyRunnable(nsIDOMDOMRequest* aReq,
-                     Promise* aPromise,
-                     BluetoothReplyTaskQueue* aRootQueue);
-    ~SubReplyRunnable();
-
-    BluetoothReplyTaskQueue* GetRootQueue() const;
-
-  private:
-    virtual void OnSuccessFired() override;
-    virtual void OnErrorFired() override;
-
-    nsRefPtr<BluetoothReplyTaskQueue> mRootQueue;
-  };
-  friend class BluetoothReplyTaskQueue::SubReplyRunnable;
-
-  class VoidSubReplyRunnable : public SubReplyRunnable
-  {
-  public:
-    VoidSubReplyRunnable(nsIDOMDOMRequest* aReq,
-                         Promise* aPromise,
-                         BluetoothReplyTaskQueue* aRootQueue);
-    ~VoidSubReplyRunnable();
-
-  protected:
-    virtual bool ParseSuccessfulReply(
-      JS::MutableHandle<JS::Value> aValue) override;
-  };
-
-  class SubTask
-  {
-    NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SubTask)
-  public:
-    SubTask(BluetoothReplyTaskQueue* aRootQueue,
-            SubReplyRunnable* aReply);
-
-    BluetoothReplyTaskQueue* GetRootQueue() const;
-    SubReplyRunnable* GetReply() const;
-
-    /*
-     * Use SubReplyRunnable as the reply runnable to execute the task.
-     *
-     * Example:
-     * <pre>
-     * <code>
-     * bool SomeInheritedSubTask::Execute()
-     * {
-     *   BluetoothService* bs = BluetoothService::Get();
-     *   if (!bs) {
-     *     return false;
-     *   }
-     *   bs->DoSomethingInternal(
-     *     aSomeParameter,
-     *     new SomeInheritedSubReplyRunnable(aSomeDOMRequest,
-     *                                       aSomePromise,
-     *                                       GetRootQueue()));
-     *   return true;
-     * }
-     * </code>
-     * </pre>
-     */
-    virtual bool Execute() = 0;
-
-  protected:
-    virtual ~SubTask();
-
-  private:
-    nsRefPtr<BluetoothReplyTaskQueue> mRootQueue;
-    nsRefPtr<SubReplyRunnable> mReply;
-  };
-
-  BluetoothReplyTaskQueue(BluetoothReplyRunnable* aReply);
-
-  void AppendTask(already_AddRefed<SubTask> aTask);
-
-protected:
-  ~BluetoothReplyTaskQueue();
-
-  void FireSuccessReply();
-  void FireErrorReply();
-
-private:
-  void Clear();
-
-  void OnSubReplySuccessFired(SubReplyRunnable* aSubReply);
-  void OnSubReplyErrorFired(SubReplyRunnable* aSubReply);
-
-  virtual void OnSuccessFired();
-  virtual void OnErrorFired();
-
-  nsRefPtr<BluetoothReplyRunnable> mReply;
-  nsTArray<nsRefPtr<SubTask>> mTasks;
-};
-
 END_BLUETOOTH_NAMESPACE
 
 #endif // mozilla_dom_bluetooth_BluetoothReplyRunnable_h
--- a/dom/bluetooth/common/BluetoothService.h
+++ b/dom/bluetooth/common/BluetoothService.h
@@ -503,66 +503,16 @@ public:
 
   /**
    * Unregister a GATT server. (platform specific implementation)
    */
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) = 0;
 
-  virtual void
-  GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothGattServiceId& aServiceId,
-    uint16_t aHandleCount,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
-  virtual void
-  GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
-  virtual void
-  GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aCharacteristicUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattCharProp aProperties,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
-  virtual void
-  GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle,
-    const BluetoothUuid& aDescriptorUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
-  virtual void
-  GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
-  virtual void
-  GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
-  virtual void
-  GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) = 0;
-
   bool
   IsEnabled() const
   {
     return mEnabled;
   }
 
   bool
   IsToggling() const;
--- a/dom/bluetooth/common/BluetoothUtils.cpp
+++ b/dom/bluetooth/common/BluetoothUtils.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BluetoothUtils.h"
 #include "BluetoothReplyRunnable.h"
 #include "BluetoothService.h"
 #include "jsapi.h"
-#include "mozilla/dom/BluetoothGattCharacteristicBinding.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "nsContentUtils.h"
 #include "nsISystemMessagesInternal.h"
 #include "nsIUUIDGenerator.h"
 #include "nsServiceManagerUtils.h"
 #include "nsXULAppAPI.h"
 
@@ -87,112 +86,16 @@ GenerateUuid(nsAString &aUuidString)
 
   // Remove {} and the null terminator
   aUuidString.Assign(Substring(uuidString, 1, NSID_LENGTH - 3));
 
   return NS_OK;
 }
 
 void
-GattPermissionsToDictionary(BluetoothGattAttrPerm aBits,
-                            GattPermissions& aPermissions)
-{
-  aPermissions.mRead = aBits & GATT_ATTR_PERM_BIT_READ;
-  aPermissions.mReadEncrypted = aBits & GATT_ATTR_PERM_BIT_READ_ENCRYPTED;
-  aPermissions.mReadEncryptedMITM =
-    aBits & GATT_ATTR_PERM_BIT_READ_ENCRYPTED_MITM;
-  aPermissions.mWrite = aBits & GATT_ATTR_PERM_BIT_WRITE;
-  aPermissions.mWriteEncrypted = aBits & GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED;
-  aPermissions.mWriteEncryptedMITM =
-    aBits & GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED_MITM;
-  aPermissions.mWriteSigned = aBits & GATT_ATTR_PERM_BIT_WRITE_SIGNED;
-  aPermissions.mWriteSignedMITM = aBits & GATT_ATTR_PERM_BIT_WRITE_SIGNED_MITM;
-}
-
-void
-GattPermissionsToBits(const GattPermissions& aPermissions,
-                      BluetoothGattAttrPerm& aBits)
-{
-  aBits = BLUETOOTH_EMPTY_GATT_ATTR_PERM;
-
-  if (aPermissions.mRead) {
-    aBits |= GATT_ATTR_PERM_BIT_READ;
-  }
-  if (aPermissions.mReadEncrypted) {
-    aBits |= GATT_ATTR_PERM_BIT_READ_ENCRYPTED;
-  }
-  if (aPermissions.mReadEncryptedMITM) {
-    aBits |= GATT_ATTR_PERM_BIT_READ_ENCRYPTED_MITM;
-  }
-  if (aPermissions.mWrite) {
-    aBits |= GATT_ATTR_PERM_BIT_WRITE;
-  }
-  if (aPermissions.mWriteEncrypted) {
-    aBits |= GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED;
-  }
-  if (aPermissions.mWriteEncryptedMITM) {
-    aBits |= GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED_MITM;
-  }
-  if (aPermissions.mWriteSigned) {
-    aBits |= GATT_ATTR_PERM_BIT_WRITE_SIGNED;
-  }
-  if (aPermissions.mWriteSignedMITM) {
-    aBits |= GATT_ATTR_PERM_BIT_WRITE_SIGNED_MITM;
-  }
-}
-
-void
-GattPropertiesToDictionary(BluetoothGattCharProp aBits,
-                           GattCharacteristicProperties& aProperties)
-{
-  aProperties.mBroadcast = aBits & GATT_CHAR_PROP_BIT_BROADCAST;
-  aProperties.mRead = aBits & GATT_CHAR_PROP_BIT_READ;
-  aProperties.mWriteNoResponse = aBits & GATT_CHAR_PROP_BIT_WRITE_NO_RESPONSE;
-  aProperties.mWrite = aBits & GATT_CHAR_PROP_BIT_WRITE;
-  aProperties.mNotify = aBits & GATT_CHAR_PROP_BIT_NOTIFY;
-  aProperties.mIndicate = aBits & GATT_CHAR_PROP_BIT_INDICATE;
-  aProperties.mSignedWrite = aBits & GATT_CHAR_PROP_BIT_SIGNED_WRITE;
-  aProperties.mExtendedProps = aBits & GATT_CHAR_PROP_BIT_EXTENDED_PROPERTIES;
-}
-
-void
-GattPropertiesToBits(const GattCharacteristicProperties& aProperties,
-                     BluetoothGattCharProp& aBits)
-{
-  aBits = BLUETOOTH_EMPTY_GATT_CHAR_PROP;
-
-  if (aProperties.mBroadcast) {
-    aBits |= GATT_CHAR_PROP_BIT_BROADCAST;
-  }
-  if (aProperties.mRead) {
-    aBits |= GATT_CHAR_PROP_BIT_READ;
-  }
-  if (aProperties.mWriteNoResponse) {
-    aBits |= GATT_CHAR_PROP_BIT_WRITE_NO_RESPONSE;
-  }
-  if (aProperties.mWrite) {
-    aBits |= GATT_CHAR_PROP_BIT_WRITE;
-  }
-  if (aProperties.mNotify) {
-    aBits |= GATT_CHAR_PROP_BIT_NOTIFY;
-  }
-  if (aProperties.mIndicate) {
-    aBits |= GATT_CHAR_PROP_BIT_INDICATE;
-  }
-  if (aProperties.mSignedWrite) {
-    aBits |= GATT_CHAR_PROP_BIT_SIGNED_WRITE;
-  }
-  if (aProperties.mExtendedProps) {
-    aBits |= GATT_CHAR_PROP_BIT_EXTENDED_PROPERTIES;
-  }
-}
-
-
-
-void
 GeneratePathFromGattId(const BluetoothGattId& aId,
                        nsAString& aPath)
 {
   nsString uuidStr;
   UuidToString(aId.mUuid, uuidStr);
 
   aPath.Assign(uuidStr);
   aPath.AppendLiteral("_");
--- a/dom/bluetooth/common/BluetoothUtils.h
+++ b/dom/bluetooth/common/BluetoothUtils.h
@@ -5,23 +5,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_bluetooth_BluetoothUtils_h
 #define mozilla_dom_bluetooth_BluetoothUtils_h
 
 #include "BluetoothCommon.h"
 #include "js/TypeDecls.h"
 
-namespace mozilla {
-namespace dom {
-class GattPermissions;
-class GattCharacteristicProperties;
-}
-}
-
 BEGIN_BLUETOOTH_NAMESPACE
 
 class BluetoothNamedValue;
 class BluetoothReplyRunnable;
 class BluetoothValue;
 
 //
 // BluetoothUuid <-> uuid string conversion
@@ -48,58 +41,16 @@ StringToUuid(const nsAString& aString, B
 /**
  * Generate a random uuid.
  *
  * @param aUuidString [out] String to store the generated uuid.
  */
 nsresult
 GenerateUuid(nsAString &aUuidString);
 
-/**
- * Convert BluetoothGattAttrPerm bit masks to GattPermissions object.
- *
- * @param aBits [in] BluetoothGattAttrPerm bit masks.
- * @param aPermissions [out] GattPermissions object.
- */
-void
-GattPermissionsToDictionary(BluetoothGattAttrPerm aBits,
-                            GattPermissions& aPermissions);
-
-/**
- * Convert GattPermissions object to BluetoothGattAttrPerm bit masks.
- *
- * @param aPermissions [in] GattPermissions object.
- * @param aBits [out] BluetoothGattAttrPerm bit masks.
- */
-void
-GattPermissionsToBits(const GattPermissions& aPermissions,
-                      BluetoothGattAttrPerm& aBits);
-
-/**
- * Convert BluetoothGattCharProp bit masks to GattCharacteristicProperties
- * object.
- *
- * @param aBits [in] BluetoothGattCharProp bit masks.
- * @param aProperties [out] GattCharacteristicProperties object.
- */
-void
-GattPropertiesToDictionary(BluetoothGattCharProp aBits,
-                           GattCharacteristicProperties& aProperties);
-
-/**
- * Convert GattCharacteristicProperties object to BluetoothGattCharProp bit
- * masks.
- *
- * @param aProperties [in] GattCharacteristicProperties object.
- * @param aBits [out] BluetoothGattCharProp bit masks.
- */
-void
-GattPropertiesToBits(const GattCharacteristicProperties& aProperties,
-                     BluetoothGattCharProp& aBits);
-
 //
 // Generate bluetooth signal path from GattId
 //
 
 /**
  * Generate bluetooth signal path from a GattId.
  *
  * @param aId   [in] GattId value to convert.
--- a/dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
@@ -5,16 +5,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BluetoothReplyRunnable.h"
 #include "BluetoothService.h"
 #include "BluetoothUtils.h"
 #include "mozilla/dom/BluetoothGattCharacteristicBinding.h"
 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
 #include "mozilla/dom/bluetooth/BluetoothGattCharacteristic.h"
+#include "mozilla/dom/bluetooth/BluetoothGattDescriptor.h"
 #include "mozilla/dom/bluetooth/BluetoothGattService.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "mozilla/dom/Promise.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 USING_BLUETOOTH_NAMESPACE
@@ -49,89 +50,37 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCA
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothGattCharacteristic)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothGattCharacteristic)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothGattCharacteristic)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-/*
- * "A characteristic definition shall contain a characteristic declaration, a
- *  Characteristic Value declaration and may contain characteristic descriptor
- *  declarations."
- *  ...
- * "Each declaration above is contained in a separate Attribute. Two required
- *  declarations are the characteristic declaration and the Characteristic
- *  Value declaration."
- * -- Bluetooth Core Specification version 4.2, Volume 3, Part G, Section 3.3
- */
-const uint16_t BluetoothGattCharacteristic::sHandleCount = 2;
-
-// Constructor of BluetoothGattCharacteristic in ATT client role
 BluetoothGattCharacteristic::BluetoothGattCharacteristic(
   nsPIDOMWindow* aOwner,
   BluetoothGattService* aService,
   const BluetoothGattCharAttribute& aChar)
   : mOwner(aOwner)
   , mService(aService)
   , mCharId(aChar.mId)
-  , mPermissions(BLUETOOTH_EMPTY_GATT_ATTR_PERM)
   , mProperties(aChar.mProperties)
   , mWriteType(aChar.mWriteType)
-  , mAttRole(ATT_CLIENT_ROLE)
-  , mActive(true)
 {
   MOZ_ASSERT(aOwner);
   MOZ_ASSERT(mService);
 
   UuidToString(mCharId.mUuid, mUuidStr);
 
   // Generate bluetooth signal path of this characteristic to applications
   nsString path;
   GeneratePathFromGattId(mCharId, path);
   RegisterBluetoothSignalHandler(path, this);
 }
 
-
-// Constructor of BluetoothGattCharacteristic in ATT server role
-BluetoothGattCharacteristic::BluetoothGattCharacteristic(
-  nsPIDOMWindow* aOwner,
-  BluetoothGattService* aService,
-  const nsAString& aCharacteristicUuid,
-  const GattPermissions& aPermissions,
-  const GattCharacteristicProperties& aProperties,
-  const ArrayBuffer& aValue)
-  : mOwner(aOwner)
-  , mService(aService)
-  , mUuidStr(aCharacteristicUuid)
-  , mPermissions(BLUETOOTH_EMPTY_GATT_ATTR_PERM)
-  , mProperties(BLUETOOTH_EMPTY_GATT_CHAR_PROP)
-  , mWriteType(GATT_WRITE_TYPE_NORMAL)
-  , mAttRole(ATT_SERVER_ROLE)
-  , mActive(false)
-{
-  MOZ_ASSERT(aOwner);
-  MOZ_ASSERT(aService);
-
-  // UUID
-  memset(&mCharId, 0, sizeof(mCharId));
-  StringToUuid(aCharacteristicUuid, mCharId.mUuid);
-
-  // permissions
-  GattPermissionsToBits(aPermissions, mPermissions);
-
-  // properties
-  GattPropertiesToBits(aProperties, mProperties);
-
-  // value
-  aValue.ComputeLengthAndData();
-  mValue.AppendElements(aValue.Data(), aValue.Length());
-}
-
 BluetoothGattCharacteristic::~BluetoothGattCharacteristic()
 {
   nsString path;
   GeneratePathFromGattId(mCharId, path);
   UnregisterBluetoothSignalHandler(path, this);
 }
 
 already_AddRefed<Promise>
@@ -141,20 +90,16 @@ BluetoothGattCharacteristic::StartNotifi
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsRefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
-  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);
 
   bs->GattClientStartNotificationsInternal(
     mService->GetAppUuid(), mService->GetServiceId(), mCharId,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
@@ -168,20 +113,16 @@ BluetoothGattCharacteristic::StopNotific
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsRefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
-  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);
 
   bs->GattClientStopNotificationsInternal(
     mService->GetAppUuid(), mService->GetServiceId(), mCharId,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
@@ -206,71 +147,30 @@ BluetoothGattCharacteristic::HandleChara
   const BluetoothValue& aValue)
 {
   MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfuint8_t);
 
   mValue = aValue.get_ArrayOfuint8_t();
 }
 
 void
-BluetoothGattCharacteristic::AssignCharacteristicHandle(
-  const BluetoothAttributeHandle& aCharacteristicHandle)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-  MOZ_ASSERT(!mActive);
-  MOZ_ASSERT(!mCharacteristicHandle.mHandle);
-
-  mCharacteristicHandle = aCharacteristicHandle;
-  mActive = true;
-}
-
-void
-BluetoothGattCharacteristic::AssignDescriptorHandle(
-  const BluetoothUuid& aDescriptorUuid,
-  const BluetoothAttributeHandle& aDescriptorHandle)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-  MOZ_ASSERT(mActive);
-
-  size_t index = mDescriptors.IndexOf(aDescriptorUuid);
-  NS_ENSURE_TRUE_VOID(index != mDescriptors.NoIndex);
-  mDescriptors[index]->AssignDescriptorHandle(aDescriptorHandle);
-}
-
-void
 BluetoothGattCharacteristic::Notify(const BluetoothSignal& aData)
 {
   BT_LOGD("[D] %s", NS_ConvertUTF16toUTF8(aData.name()).get());
   NS_ENSURE_TRUE_VOID(mSignalRegistered);
 
   BluetoothValue v = aData.value();
   if (aData.name().EqualsLiteral("CharacteristicValueUpdated")) {
     HandleCharacteristicValueUpdated(v);
   } else {
     BT_WARNING("Not handling GATT Characteristic signal: %s",
                NS_ConvertUTF16toUTF8(aData.name()).get());
   }
 }
 
-void
-BluetoothGattCharacteristic::GetUuid(BluetoothUuid& aUuid) const
-{
-  aUuid = mCharId.mUuid;
-}
-
-uint16_t
-BluetoothGattCharacteristic::GetHandleCount() const
-{
-  uint16_t count = sHandleCount;
-  for (size_t i = 0; i < mDescriptors.Length(); ++i) {
-    count += mDescriptors[i]->GetHandleCount();
-  }
-  return count;
-}
-
 JSObject*
 BluetoothGattCharacteristic::WrapObject(JSContext* aContext,
                                         JS::Handle<JSObject*> aGivenProto)
 {
   return BluetoothGattCharacteristicBinding::Wrap(aContext, this, aGivenProto);
 }
 
 void
@@ -278,27 +178,29 @@ BluetoothGattCharacteristic::GetValue(JS
                                       JS::MutableHandle<JSObject*> aValue) const
 {
   aValue.set(mValue.IsEmpty()
              ? nullptr
              : ArrayBuffer::Create(cx, mValue.Length(), mValue.Elements()));
 }
 
 void
-BluetoothGattCharacteristic::GetPermissions(
-  GattPermissions& aPermissions) const
+BluetoothGattCharacteristic::GetProperties(
+  mozilla::dom::GattCharacteristicProperties& aProperties) const
 {
-  GattPermissionsToDictionary(mPermissions, aPermissions);
-}
-
-void
-BluetoothGattCharacteristic::GetProperties(
-  GattCharacteristicProperties& aProperties) const
-{
-  GattPropertiesToDictionary(mProperties, aProperties);
+  aProperties.mBroadcast = mProperties & GATT_CHAR_PROP_BIT_BROADCAST;
+  aProperties.mRead = mProperties & GATT_CHAR_PROP_BIT_READ;
+  aProperties.mWriteNoResponse =
+    mProperties & GATT_CHAR_PROP_BIT_WRITE_NO_RESPONSE;
+  aProperties.mWrite = mProperties & GATT_CHAR_PROP_BIT_WRITE;
+  aProperties.mNotify = mProperties & GATT_CHAR_PROP_BIT_NOTIFY;
+  aProperties.mIndicate = mProperties & GATT_CHAR_PROP_BIT_INDICATE;
+  aProperties.mSignedWrite = mProperties & GATT_CHAR_PROP_BIT_SIGNED_WRITE;
+  aProperties.mExtendedProps =
+    mProperties & GATT_CHAR_PROP_BIT_EXTENDED_PROPERTIES;
 }
 
 class ReadValueTask final : public BluetoothReplyRunnable
 {
 public:
   ReadValueTask(BluetoothGattCharacteristic* aCharacteristic, Promise* aPromise)
     : BluetoothReplyRunnable(nullptr, aPromise)
     , mCharacteristic(aCharacteristic)
@@ -394,44 +296,8 @@ BluetoothGattCharacteristic::WriteValue(
 
   bs->GattClientWriteCharacteristicValueInternal(
     mService->GetAppUuid(), mService->GetServiceId(),
     mCharId, mWriteType, value,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
-
-already_AddRefed<Promise>
-BluetoothGattCharacteristic::AddDescriptor(const nsAString& aDescriptorUuid,
-                                           const GattPermissions& aPermissions,
-                                           const ArrayBuffer& aValue,
-                                           ErrorResult& aRv)
-{
-  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
-  if (!global) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
-  NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
-
-  BT_ENSURE_TRUE_REJECT(mAttRole == ATT_SERVER_ROLE,
-                        promise,
-                        NS_ERROR_UNEXPECTED);
-
-  /* The characteristic should not be actively acting with the Bluetooth
-   * backend. Otherwise, descriptors cannot be added into the characteristic. */
-  BT_ENSURE_TRUE_REJECT(!mActive, promise, NS_ERROR_UNEXPECTED);
-
-  nsRefPtr<BluetoothGattDescriptor> descriptor =
-    new BluetoothGattDescriptor(GetParentObject(),
-                                this,
-                                aDescriptorUuid,
-                                aPermissions,
-                                aValue);
-
-  mDescriptors.AppendElement(descriptor);
-  promise->MaybeResolve(descriptor);
-
-  return promise.forget();
-}
--- a/dom/bluetooth/common/webapi/BluetoothGattCharacteristic.h
+++ b/dom/bluetooth/common/webapi/BluetoothGattCharacteristic.h
@@ -58,83 +58,53 @@ public:
 
   int InstanceId() const
   {
     return mCharId.mInstanceId;
   }
 
   void GetValue(JSContext* cx, JS::MutableHandle<JSObject*> aValue) const;
 
-  void GetPermissions(GattPermissions& aPermissions) const;
-
   void GetProperties(GattCharacteristicProperties& aProperties) const;
 
   /****************************************************************************
    * Methods (Web API Implementation)
    ***************************************************************************/
   already_AddRefed<Promise> ReadValue(ErrorResult& aRv);
   already_AddRefed<Promise> WriteValue(const ArrayBuffer& aValue,
                                        ErrorResult& aRv);
+
+  /****************************************************************************
+   * Methods (Web API Implementation)
+   ***************************************************************************/
   already_AddRefed<Promise> StartNotifications(ErrorResult& aRv);
   already_AddRefed<Promise> StopNotifications(ErrorResult& aRv);
-  already_AddRefed<Promise> AddDescriptor(const nsAString& aDescriptorUuid,
-                                          const GattPermissions& aPermissions,
-                                          const ArrayBuffer& aValue,
-                                          ErrorResult& aRv);
 
   /****************************************************************************
    * Others
    ***************************************************************************/
   const BluetoothGattId& GetCharacteristicId() const
   {
     return mCharId;
   }
 
   void Notify(const BluetoothSignal& aData); // BluetoothSignalObserver
 
-  const BluetoothAttributeHandle& GetCharacteristicHandle() const
-  {
-    return mCharacteristicHandle;
-  }
-
-  void GetUuid(BluetoothUuid& aUuid) const;
-
   nsPIDOMWindow* GetParentObject() const
   {
      return mOwner;
   }
 
-  BluetoothGattAttrPerm GetPermissions() const
-  {
-    return mPermissions;
-  }
-
-  BluetoothGattCharProp GetProperties() const
-  {
-    return mProperties;
-  }
-
-  uint16_t GetHandleCount() const;
-
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
-  // Constructor of BluetoothGattCharacteristic in ATT client role
   BluetoothGattCharacteristic(nsPIDOMWindow* aOwner,
                               BluetoothGattService* aService,
                               const BluetoothGattCharAttribute& aChar);
 
-  // Constructor of BluetoothGattCharacteristic in ATT server role
-  BluetoothGattCharacteristic(nsPIDOMWindow* aOwner,
-                              BluetoothGattService* aService,
-                              const nsAString& aCharacteristicUuid,
-                              const GattPermissions& aPermissions,
-                              const GattCharacteristicProperties& aProperties,
-                              const ArrayBuffer& aValue);
-
 private:
   ~BluetoothGattCharacteristic();
 
   /**
    * Add newly discovered GATT descriptors into mDescriptors and update the
    * cache value of mDescriptors.
    *
    * @param aDescriptorIds [in] An array of BluetoothGattId for each descriptor
@@ -144,53 +114,16 @@ private:
 
   /**
    * Update the value of this characteristic.
    *
    * @param aValue [in] BluetoothValue which contains an uint8_t array.
    */
   void HandleCharacteristicValueUpdated(const BluetoothValue& aValue);
 
-  /**
-   * Assign the handle value for this GATT characteristic. This function would
-   * be called only after a valid handle value is retrieved from the Bluetooth
-   * backend.
-   *
-   * @param aCharacteristicHandle [in] The handle value of this GATT
-   *                                   characteristic.
-   */
-  void AssignCharacteristicHandle(
-    const BluetoothAttributeHandle& aCharacteristicHandle);
-
-  /**
-   * Assign the handle value for one of the descriptor within this GATT
-   * characteristic. This function would be called only after a valid handle
-   * value is retrieved from the Bluetooth backend.
-   *
-   * @param aDescriptorUuid [in] BluetoothUuid of the target GATT descriptor.
-   * @param aDescriptorHandle [in] The handle value of the target GATT
-   *                               descriptor.
-   */
-  void AssignDescriptorHandle(
-    const BluetoothUuid& aDescriptorUuid,
-    const BluetoothAttributeHandle& aDescriptorHandle);
-
-  /**
-   * Examine whether this GATT characteristic can react with the Bluetooth
-   * backend.
-   *
-   * @return true if this characteristic can react with the Bluetooth backend;
-   *         false if this characteristic cannot react with the Bluetooth
-   *         backend.
-   */
-  bool IsActivated() const
-  {
-    return mActive;
-  }
-
   /****************************************************************************
    * Variables
    ***************************************************************************/
   nsCOMPtr<nsPIDOMWindow> mOwner;
 
   /**
    * Service that this characteristic belongs to.
    */
@@ -214,60 +147,24 @@ private:
   nsString mUuidStr;
 
   /**
    * Value of this GATT characteristic.
    */
   nsTArray<uint8_t> mValue;
 
   /**
-   * Permissions of this GATT characteristic.
-   */
-  BluetoothGattAttrPerm mPermissions;
-
-  /**
    * Properties of this GATT characteristic.
    */
   BluetoothGattCharProp mProperties;
 
   /**
    * Write type of this GATT characteristic.
    */
   BluetoothGattWriteType mWriteType;
-
-  /**
-   * ATT role of this GATT characteristic.
-   */
-  const BluetoothAttRole mAttRole;
-
-  /**
-   * Activeness of this GATT characteristic.
-   *
-   * True means this service does react with the Bluetooth backend. False means
-   * this characteristic doesn't react with the Bluetooth backend. The value
-   * should be true if |mAttRole| equals |ATT_CLIENT_ROLE| because the
-   * characteristic instance could be created only when the Bluetooth backend
-   * has found one GATT characteristic. The value would be false at the
-   * beginning if |mAttRole| equals |ATT_SERVER_ROLE|. Then the value would
-   * become true later if the corresponding GATT service has been added into
-   * Bluetooth backend.
-   */
-  bool mActive;
-
-  /**
-   * Handle of this GATT characteristic.
-   *
-   * The value is only valid if |mAttRole| equals |ATT_SERVER_ROLE|.
-   */
-  BluetoothAttributeHandle mCharacteristicHandle;
-
-  /**
-   * Total count of handles of this GATT characteristic itself.
-   */
-  static const uint16_t sHandleCount;
 };
 
 END_BLUETOOTH_NAMESPACE
 
 /**
  * Explicit Specialization of Function Templates
  *
  * Allows customizing the template code for a given set of template arguments.
@@ -283,54 +180,9 @@ public:
   bool Equals(
     const nsRefPtr<mozilla::dom::bluetooth::BluetoothGattCharacteristic>& aChar,
     const mozilla::dom::bluetooth::BluetoothGattId& aCharId) const
   {
     return aChar->GetCharacteristicId() == aCharId;
   }
 };
 
-/**
- * Explicit Specialization of Function Templates
- *
- * Allows customizing the template code for a given set of template arguments.
- * With this function template, nsTArray can handle comparison between
- * 'nsRefPtr<BluetoothGattCharacteristic>' and 'BluetoothUuid' properly,
- * including IndexOf() and Contains();
- */
-template <>
-class nsDefaultComparator <
-  nsRefPtr<mozilla::dom::bluetooth::BluetoothGattCharacteristic>,
-  mozilla::dom::bluetooth::BluetoothUuid> {
-public:
-  bool Equals(
-    const nsRefPtr<mozilla::dom::bluetooth::BluetoothGattCharacteristic>& aChar,
-    const mozilla::dom::bluetooth::BluetoothUuid& aUuid) const
-  {
-    mozilla::dom::bluetooth::BluetoothUuid uuid;
-    aChar->GetUuid(uuid);
-    return uuid == aUuid;
-  }
-};
-
-/**
- * Explicit Specialization of Function Templates
- *
- * Allows customizing the template code for a given set of template arguments.
- * With this function template, nsTArray can handle comparison between
- * 'nsRefPtr<BluetoothGattCharacteristic>' and 'BluetoothAttributeHandle'
- * properly, including IndexOf() and Contains();
- */
-template <>
-class nsDefaultComparator <
-  nsRefPtr<mozilla::dom::bluetooth::BluetoothGattCharacteristic>,
-  mozilla::dom::bluetooth::BluetoothAttributeHandle> {
-public:
-  bool Equals(
-    const nsRefPtr<mozilla::dom::bluetooth::BluetoothGattCharacteristic>& aChar,
-    const mozilla::dom::bluetooth::BluetoothAttributeHandle& aCharacteristicHandle)
-    const
-  {
-    return aChar->GetCharacteristicHandle() == aCharacteristicHandle;
-  }
-};
-
 #endif // mozilla_dom_bluetooth_BluetoothGattCharacteristic_h
--- a/dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
@@ -2,17 +2,16 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BluetoothReplyRunnable.h"
 #include "BluetoothService.h"
 #include "BluetoothUtils.h"
-#include "mozilla/dom/BluetoothGattCharacteristicBinding.h"
 #include "mozilla/dom/BluetoothGattDescriptorBinding.h"
 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
 #include "mozilla/dom/bluetooth/BluetoothGattCharacteristic.h"
 #include "mozilla/dom/bluetooth/BluetoothGattDescriptor.h"
 #include "mozilla/dom/bluetooth/BluetoothGattService.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 
 using namespace mozilla;
@@ -48,70 +47,35 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCA
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothGattDescriptor)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothGattDescriptor)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothGattDescriptor)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-const uint16_t BluetoothGattDescriptor::sHandleCount = 1;
-
-// Constructor of BluetoothGattDescriptor in ATT client role
 BluetoothGattDescriptor::BluetoothGattDescriptor(
   nsPIDOMWindow* aOwner,
   BluetoothGattCharacteristic* aCharacteristic,
   const BluetoothGattId& aDescriptorId)
   : mOwner(aOwner)
   , mCharacteristic(aCharacteristic)
   , mDescriptorId(aDescriptorId)
-  , mPermissions(BLUETOOTH_EMPTY_GATT_ATTR_PERM)
-  , mAttRole(ATT_CLIENT_ROLE)
-  , mActive(true)
 {
   MOZ_ASSERT(aOwner);
   MOZ_ASSERT(aCharacteristic);
 
   UuidToString(mDescriptorId.mUuid, mUuidStr);
 
   // Generate bluetooth signal path of this descriptor to applications
   nsString path;
   GeneratePathFromGattId(mDescriptorId, path);
   RegisterBluetoothSignalHandler(path, this);
 }
 
-// Constructor of BluetoothGattDescriptor in ATT server role
-BluetoothGattDescriptor::BluetoothGattDescriptor(
-  nsPIDOMWindow* aOwner,
-  BluetoothGattCharacteristic* aCharacteristic,
-  const nsAString& aDescriptorUuid,
-  const GattPermissions& aPermissions,
-  const ArrayBuffer& aValue)
-  : mOwner(aOwner)
-  , mCharacteristic(aCharacteristic)
-  , mUuidStr(aDescriptorUuid)
-  , mPermissions(BLUETOOTH_EMPTY_GATT_ATTR_PERM)
-  , mAttRole(ATT_SERVER_ROLE)
-  , mActive(false)
-{
-  MOZ_ASSERT(aOwner);
-  MOZ_ASSERT(aCharacteristic);
-
-  // UUID
-  memset(&mDescriptorId, 0, sizeof(mDescriptorId));
-  StringToUuid(aDescriptorUuid, mDescriptorId.mUuid);
-
-  // permissions
-  GattPermissionsToBits(aPermissions, mPermissions);
-
-  // value
-  aValue.ComputeLengthAndData();
-  mValue.AppendElements(aValue.Data(), aValue.Length());
-}
-
 BluetoothGattDescriptor::~BluetoothGattDescriptor()
 {
   nsString path;
   GeneratePathFromGattId(mDescriptorId, path);
   UnregisterBluetoothSignalHandler(path, this);
 }
 
 void
@@ -119,70 +83,46 @@ BluetoothGattDescriptor::HandleDescripto
   const BluetoothValue& aValue)
 {
   MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfuint8_t);
 
   mValue = aValue.get_ArrayOfuint8_t();
 }
 
 void
-BluetoothGattDescriptor::AssignDescriptorHandle(
-  const BluetoothAttributeHandle& aDescriptorHandle)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-  MOZ_ASSERT(!mActive);
-  MOZ_ASSERT(!mDescriptorHandle.mHandle);
-
-  mDescriptorHandle = aDescriptorHandle;
-  mActive = true;
-}
-
-void
 BluetoothGattDescriptor::Notify(const BluetoothSignal& aData)
 {
   BT_LOGD("[D] %s", NS_ConvertUTF16toUTF8(aData.name()).get());
   NS_ENSURE_TRUE_VOID(mSignalRegistered);
 
   BluetoothValue v = aData.value();
   if (aData.name().EqualsLiteral("DescriptorValueUpdated")) {
     HandleDescriptorValueUpdated(v);
   } else {
     BT_WARNING("Not handling GATT Descriptor signal: %s",
                NS_ConvertUTF16toUTF8(aData.name()).get());
   }
 }
 
-void
-BluetoothGattDescriptor::GetUuid(BluetoothUuid& aUuid) const
-{
-  aUuid = mDescriptorId.mUuid;
-}
-
 JSObject*
 BluetoothGattDescriptor::WrapObject(JSContext* aContext,
                                     JS::Handle<JSObject*> aGivenProto)
 {
   return BluetoothGattDescriptorBinding::Wrap(aContext, this, aGivenProto);
 }
 
 void
 BluetoothGattDescriptor::GetValue(JSContext* cx,
                                   JS::MutableHandle<JSObject*> aValue) const
 {
   aValue.set(mValue.IsEmpty()
              ? nullptr
              : ArrayBuffer::Create(cx, mValue.Length(), mValue.Elements()));
 }
 
-void
-BluetoothGattDescriptor::GetPermissions(GattPermissions& aPermissions) const
-{
-  GattPermissionsToDictionary(mPermissions, aPermissions);
-}
-
 class ReadValueTask final : public BluetoothReplyRunnable
 {
 public:
   ReadValueTask(BluetoothGattDescriptor* aDescriptor, Promise* aPromise)
     : BluetoothReplyRunnable(nullptr, aPromise)
     , mDescriptor(aDescriptor)
   {
     MOZ_ASSERT(aDescriptor);
--- a/dom/bluetooth/common/webapi/BluetoothGattDescriptor.h
+++ b/dom/bluetooth/common/webapi/BluetoothGattDescriptor.h
@@ -11,33 +11,25 @@
 #include "mozilla/dom/BluetoothGattDescriptorBinding.h"
 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/TypedArray.h"
 #include "nsCOMPtr.h"
 #include "nsWrapperCache.h"
 #include "nsPIDOMWindow.h"
 
-namespace mozilla {
-namespace dom {
-struct GattPermissions;
-}
-}
-
 BEGIN_BLUETOOTH_NAMESPACE
 
 class BluetoothGattCharacteristic;
 class BluetoothSignal;
-class BluetoothValue;
 
 class BluetoothGattDescriptor final : public nsISupports
                                     , public nsWrapperCache
                                     , public BluetoothSignalObserver
 {
-  friend class BluetoothGattCharacteristic;
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BluetoothGattDescriptor)
 
   /****************************************************************************
    * Attribute Getters
    ***************************************************************************/
   BluetoothGattCharacteristic* Characteristic() const
@@ -47,104 +39,50 @@ public:
 
   void GetUuid(nsString& aUuidStr) const
   {
     aUuidStr = mUuidStr;
   }
 
   void GetValue(JSContext* cx, JS::MutableHandle<JSObject*> aValue) const;
 
-  void GetPermissions(GattPermissions& aPermissions) const;
-
   /****************************************************************************
    * Methods (Web API Implementation)
    ***************************************************************************/
   already_AddRefed<Promise> ReadValue(ErrorResult& aRv);
   already_AddRefed<Promise> WriteValue(
     const RootedTypedArray<ArrayBuffer>& aValue, ErrorResult& aRv);
 
   /****************************************************************************
    * Others
    ***************************************************************************/
   void Notify(const BluetoothSignal& aData); // BluetoothSignalObserver
 
-  const BluetoothAttributeHandle& GetDescriptorHandle() const
-  {
-    return mDescriptorHandle;
-  }
-
   nsPIDOMWindow* GetParentObject() const
   {
      return mOwner;
   }
 
-  void GetUuid(BluetoothUuid& aUuid) const;
-
-  BluetoothGattAttrPerm GetPermissions() const
-  {
-    return mPermissions;
-  }
-
-  uint16_t GetHandleCount() const
-  {
-    return sHandleCount;
-  }
-
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
-  // Constructor of BluetoothGattDescriptor in ATT client role
   BluetoothGattDescriptor(nsPIDOMWindow* aOwner,
                           BluetoothGattCharacteristic* aCharacteristic,
                           const BluetoothGattId& aDescriptorId);
 
-  // Constructor of BluetoothGattDescriptor in ATT server role
-  BluetoothGattDescriptor(nsPIDOMWindow* aOwner,
-                          BluetoothGattCharacteristic* aCharacteristic,
-                          const nsAString& aDescriptorUuid,
-                          const GattPermissions& aPermissions,
-                          const ArrayBuffer& aValue);
-
 private:
   ~BluetoothGattDescriptor();
 
   /**
    * Update the value of this descriptor.
    *
    * @param aValue [in] BluetoothValue which contains an uint8_t array.
    */
   void HandleDescriptorValueUpdated(const BluetoothValue& aValue);
 
-  /**
-   * Assign AppUuid of this GATT descriptor.
-   *
-   * @param aAppUuid The value of AppUuid.
-   */
-  void AssignAppUuid(const nsAString& aAppUuid);
-
-  /**
-   * Assign the handle value for this GATT descriptor. This function would be
-   * called only after a valid handle value is retrieved from the Bluetooth
-   * backend.
-   *
-   * @param aDescriptorHandle [in] The handle value of this GATT descriptor.
-   */
-  void AssignDescriptorHandle(const BluetoothAttributeHandle& aDescriptorHandle);
-
-  /**
-   * Examine whether this GATT descriptor can react with the Bluetooth backend.
-   *
-   * @return true if this descriptor can react with the Bluetooth backend;
-   *         false if this descriptor cannot react with the Bluetooth backend.
-   */
-  bool IsActivated() const
-  {
-    return mActive;
-  }
-
   /****************************************************************************
    * Variables
    ***************************************************************************/
   nsCOMPtr<nsPIDOMWindow> mOwner;
 
   /**
    * Characteristic that this descriptor belongs to.
    */
@@ -161,71 +99,13 @@ private:
    * UUID string of this GATT descriptor.
    */
   nsString mUuidStr;
 
   /**
    * Value of this GATT descriptor.
    */
   nsTArray<uint8_t> mValue;
-
-  /**
-   * Permissions of this GATT descriptor.
-   */
-  BluetoothGattAttrPerm mPermissions;
-
-  /**
-   * ATT role of this GATT descriptor.
-   */
-  const BluetoothAttRole mAttRole;
-
-  /**
-   * Activeness of this GATT descriptor.
-   *
-   * True means this service does react with the Bluetooth backend. False means
-   * this descriptor doesn't react with the Bluetooth backend. The value should
-   * be true if |mAttRole| equals |ATT_CLIENT_ROLE| because the descriptor
-   * instance could be created only when the Bluetooth backend has found one
-   * GATT descriptor. The value would be false at the beginning if |mAttRole|
-   * equals |ATT_SERVER_ROLE|. Then the value would become true later if the
-   * corresponding GATT service has been added into Bluetooth backend.
-   */
-  bool mActive;
-
-  /**
-   * Handle of this GATT descriptor.
-   *
-   * The value is only valid if |mAttRole| equals |ATT_SERVER_ROLE|.
-   */
-  BluetoothAttributeHandle mDescriptorHandle;
-
-  /**
-   * Total count of handles of this GATT descriptor itself.
-   */
-  static const uint16_t sHandleCount;
 };
 
 END_BLUETOOTH_NAMESPACE
 
-/**
- * Explicit Specialization of Function Templates
- *
- * Allows customizing the template code for a given set of template arguments.
- * With this function template, nsTArray can handle comparison between
- * 'nsRefPtr<BluetoothGattDescriptor>' and 'BluetoothUuid' properly,
- * including IndexOf() and Contains();
- */
-template <>
-class nsDefaultComparator <
-  nsRefPtr<mozilla::dom::bluetooth::BluetoothGattDescriptor>,
-  mozilla::dom::bluetooth::BluetoothUuid> {
-public:
-  bool Equals(
-    const nsRefPtr<mozilla::dom::bluetooth::BluetoothGattDescriptor>& aDesc,
-    const mozilla::dom::bluetooth::BluetoothUuid& aUuid) const
-  {
-    mozilla::dom::bluetooth::BluetoothUuid uuid;
-    aDesc->GetUuid(uuid);
-    return uuid == aUuid;
-  }
-};
-
 #endif // mozilla_dom_bluetooth_BluetoothGattDescriptor_h
--- a/dom/bluetooth/common/webapi/BluetoothGattServer.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattServer.cpp
@@ -17,138 +17,50 @@ using namespace mozilla::dom;
 
 USING_BLUETOOTH_NAMESPACE
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(BluetoothGattServer)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(BluetoothGattServer,
                                                 DOMEventTargetHelper)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mServices)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingService)
 
   /**
    * Unregister the bluetooth signal handler after unlinked.
    *
    * This is needed to avoid ending up with exposing a deleted object to JS or
    * accessing deleted objects while receiving signals from parent process
    * after unlinked. Please see Bug 1138267 for detail informations.
    */
   UnregisterBluetoothSignalHandler(tmp->mAppUuid, tmp);
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(BluetoothGattServer,
                                                   DOMEventTargetHelper)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServices)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingService)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BluetoothGattServer)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(BluetoothGattServer, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(BluetoothGattServer, DOMEventTargetHelper)
 
 BluetoothGattServer::BluetoothGattServer(nsPIDOMWindow* aOwner)
   : mOwner(aOwner)
   , mServerIf(0)
   , mValid(true)
-{
-  if (NS_SUCCEEDED(GenerateUuid(mAppUuid)) && !mAppUuid.IsEmpty()) {
-    RegisterBluetoothSignalHandler(mAppUuid, this);
-  }
-  if (!mSignalRegistered) {
-    Invalidate();
-  }
-}
+{ }
 
 BluetoothGattServer::~BluetoothGattServer()
 {
   Invalidate();
 }
 
 void
-BluetoothGattServer::HandleServiceHandleUpdated(const BluetoothValue& aValue)
-{
-  MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
-  const InfallibleTArray<BluetoothNamedValue>& arr =
-    aValue.get_ArrayOfBluetoothNamedValue();
-
-  MOZ_ASSERT(arr.Length() == 2 &&
-    arr[0].value().type() == BluetoothValue::TBluetoothGattServiceId &&
-    arr[1].value().type() == BluetoothValue::TBluetoothAttributeHandle);
-
-  BluetoothGattServiceId serviceId =
-    arr[0].value().get_BluetoothGattServiceId();
-  BluetoothAttributeHandle serviceHandle =
-    arr[1].value().get_BluetoothAttributeHandle();
-
-  NS_ENSURE_TRUE_VOID(mPendingService);
-  NS_ENSURE_TRUE_VOID(mPendingService->GetServiceId() == serviceId);
-  mPendingService->AssignServiceHandle(serviceHandle);
-}
-
-void
-BluetoothGattServer::HandleCharacteristicHandleUpdated(
-  const BluetoothValue& aValue)
-{
-  MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
-  const InfallibleTArray<BluetoothNamedValue>& arr =
-    aValue.get_ArrayOfBluetoothNamedValue();
-
-  MOZ_ASSERT(arr.Length() == 3 &&
-    arr[0].value().type() == BluetoothValue::TBluetoothUuid &&
-    arr[1].value().type() == BluetoothValue::TBluetoothAttributeHandle &&
-    arr[2].value().type() == BluetoothValue::TBluetoothAttributeHandle);
-
-  BluetoothUuid characteristicUuid =
-    arr[0].value().get_BluetoothUuid();
-  BluetoothAttributeHandle serviceHandle =
-    arr[1].value().get_BluetoothAttributeHandle();
-  BluetoothAttributeHandle characteristicHandle =
-    arr[2].value().get_BluetoothAttributeHandle();
-
-  NS_ENSURE_TRUE_VOID(mPendingService);
-  NS_ENSURE_TRUE_VOID(mPendingService->GetServiceHandle() == serviceHandle);
-  mPendingService->AssignCharacteristicHandle(characteristicUuid,
-                                              characteristicHandle);
-}
-
-void
-BluetoothGattServer::HandleDescriptorHandleUpdated(
-  const BluetoothValue& aValue)
-{
-  MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
-  const InfallibleTArray<BluetoothNamedValue>& arr =
-    aValue.get_ArrayOfBluetoothNamedValue();
-
-  MOZ_ASSERT(arr.Length() == 4 &&
-    arr[0].value().type() == BluetoothValue::TBluetoothUuid &&
-    arr[1].value().type() == BluetoothValue::TBluetoothAttributeHandle &&
-    arr[2].value().type() == BluetoothValue::TBluetoothAttributeHandle &&
-    arr[3].value().type() == BluetoothValue::TBluetoothAttributeHandle);
-
-  BluetoothUuid descriptorUuid =
-    arr[0].value().get_BluetoothUuid();
-  BluetoothAttributeHandle serviceHandle =
-    arr[1].value().get_BluetoothAttributeHandle();
-  BluetoothAttributeHandle characteristicHandle =
-    arr[2].value().get_BluetoothAttributeHandle();
-  BluetoothAttributeHandle descriptorHandle =
-    arr[3].value().get_BluetoothAttributeHandle();
-
-  NS_ENSURE_TRUE_VOID(mPendingService);
-  NS_ENSURE_TRUE_VOID(mPendingService->GetServiceHandle() == serviceHandle);
-  mPendingService->AssignDescriptorHandle(descriptorUuid,
-                                          characteristicHandle,
-                                          descriptorHandle);
-}
-
-void
 BluetoothGattServer::Notify(const BluetoothSignal& aData)
 {
   BT_LOGD("[GattServer] %s", NS_ConvertUTF16toUTF8(aData.name()).get());
   NS_ENSURE_TRUE_VOID(mSignalRegistered);
 
   BluetoothValue v = aData.value();
   if (aData.name().EqualsLiteral("ServerRegistered")) {
     MOZ_ASSERT(v.type() == BluetoothValue::Tuint32_t);
@@ -168,22 +80,16 @@ BluetoothGattServer::Notify(const Blueto
     init.mStatus = arr[0].value().get_bool();
     init.mAddress = arr[1].value().get_nsString();
 
     nsRefPtr<BluetoothStatusChangedEvent> event =
       BluetoothStatusChangedEvent::Constructor(
         this, NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID), init);
 
     DispatchTrustedEvent(event);
-  } else if (aData.name().EqualsLiteral("ServiceHandleUpdated")) {
-    HandleServiceHandleUpdated(v);
-  } else if (aData.name().EqualsLiteral("CharacteristicHandleUpdated")) {
-    HandleCharacteristicHandleUpdated(v);
-  } else if (aData.name().EqualsLiteral("DescriptorHandleUpdated")) {
-    HandleDescriptorHandleUpdated(v);
   } else {
     BT_WARNING("Not handling GATT signal: %s",
                NS_ConvertUTF16toUTF8(aData.name()).get());
   }
 }
 
 JSObject*
 BluetoothGattServer::WrapObject(JSContext* aContext,
@@ -198,31 +104,25 @@ BluetoothGattServer::DisconnectFromOwner
   DOMEventTargetHelper::DisconnectFromOwner();
   Invalidate();
 }
 
 void
 BluetoothGattServer::Invalidate()
 {
   mValid = false;
-  mServices.Clear();
-  mPendingService = nullptr;
 
   BluetoothService* bs = BluetoothService::Get();
   NS_ENSURE_TRUE_VOID(bs);
 
   if (mServerIf > 0) {
-    bs->UnregisterGattServerInternal(mServerIf,
-                                     new BluetoothVoidReplyRunnable(nullptr,
-                                                                    nullptr));
+    bs->UnregisterGattServerInternal(mServerIf, nullptr);
   }
 
-  if (!mAppUuid.IsEmpty() && mSignalRegistered) {
-    UnregisterBluetoothSignalHandler(mAppUuid, this);
-  }
+  UnregisterBluetoothSignalHandler(mAppUuid, this);
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::Connect(const nsAString& aAddress, ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
@@ -231,16 +131,24 @@ BluetoothGattServer::Connect(const nsASt
 
   nsRefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  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);
+  }
+
   bs->GattServerConnectPeripheralInternal(
     mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
@@ -258,437 +166,8 @@ BluetoothGattServer::Disconnect(const ns
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerDisconnectPeripheralInternal(
     mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
-
-class BluetoothGattServer::AddIncludedServiceTask final
-  : public BluetoothReplyTaskQueue::SubTask
-{
-public:
-  AddIncludedServiceTask(BluetoothReplyTaskQueue* aRootQueue,
-                         BluetoothGattServer* aServer,
-                         BluetoothGattService* aService,
-                         BluetoothGattService* aIncludedService)
-    : BluetoothReplyTaskQueue::SubTask(aRootQueue, nullptr)
-    , mServer(aServer)
-    , mService(aService)
-    , mIncludedService(aIncludedService)
-  { }
-
-  bool Execute() override
-  {
-    BluetoothService* bs = BluetoothService::Get();
-    if (NS_WARN_IF(!bs)) {
-      return false;
-    }
-
-    bs->GattServerAddIncludedServiceInternal(
-      mServer->mAppUuid,
-      mService->GetServiceHandle(),
-      mIncludedService->GetServiceHandle(),
-      GetReply());
-
-    return true;
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-  nsRefPtr<BluetoothGattService> mIncludedService;
-};
-
-class BluetoothGattServer::AddCharacteristicTask final
-  : public BluetoothReplyTaskQueue::SubTask
-{
-public:
-  AddCharacteristicTask(BluetoothReplyTaskQueue* aRootQueue,
-                        BluetoothGattServer* aServer,
-                        BluetoothGattService* aService,
-                        BluetoothGattCharacteristic* aCharacteristic)
-    : BluetoothReplyTaskQueue::SubTask(aRootQueue, nullptr)
-    , mServer(aServer)
-    , mService(aService)
-    , mCharacteristic(aCharacteristic)
-  { }
-
-  bool Execute() override
-  {
-    BluetoothService* bs = BluetoothService::Get();
-    if (NS_WARN_IF(!bs)) {
-      return false;
-    }
-
-    BluetoothUuid uuid;
-    mCharacteristic->GetUuid(uuid);
-    bs->GattServerAddCharacteristicInternal(
-      mServer->mAppUuid,
-      mService->GetServiceHandle(),
-      uuid,
-      mCharacteristic->GetPermissions(),
-      mCharacteristic->GetProperties(),
-      GetReply());
-
-    return true;
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-  nsRefPtr<BluetoothGattCharacteristic> mCharacteristic;
-};
-
-class BluetoothGattServer::AddDescriptorTask final
-  : public BluetoothReplyTaskQueue::SubTask
-{
-public:
-  AddDescriptorTask(BluetoothReplyTaskQueue* aRootQueue,
-                    BluetoothGattServer* aServer,
-                    BluetoothGattService* aService,
-                    BluetoothGattCharacteristic* aCharacteristic,
-                    BluetoothGattDescriptor* aDescriptor)
-    : BluetoothReplyTaskQueue::SubTask(aRootQueue, nullptr)
-    , mServer(aServer)
-    , mService(aService)
-    , mCharacteristic(aCharacteristic)
-    , mDescriptor(aDescriptor)
-  { }
-
-  bool Execute() override
-  {
-    BluetoothService* bs = BluetoothService::Get();
-    if (NS_WARN_IF(!bs)) {
-      return false;
-    }
-
-    BluetoothUuid uuid;
-    mDescriptor->GetUuid(uuid);
-    bs->GattServerAddDescriptorInternal(
-      mServer->mAppUuid,
-      mService->GetServiceHandle(),
-      mCharacteristic->GetCharacteristicHandle(),
-      uuid,
-      mDescriptor->GetPermissions(),
-      GetReply());
-
-    return true;
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-  nsRefPtr<BluetoothGattCharacteristic> mCharacteristic;
-  nsRefPtr<BluetoothGattDescriptor> mDescriptor;
-};
-
-class BluetoothGattServer::StartServiceTask final
-  : public BluetoothReplyTaskQueue::SubTask
-{
-public:
-  StartServiceTask(BluetoothReplyTaskQueue* aRootQueue,
-                   BluetoothGattServer* aServer,
-                   BluetoothGattService* aService)
-    : BluetoothReplyTaskQueue::SubTask(aRootQueue, nullptr)
-    , mServer(aServer)
-    , mService(aService)
-  { }
-
-  bool Execute() override
-  {
-    BluetoothService* bs = BluetoothService::Get();
-    if (NS_WARN_IF(!bs)) {
-      return false;
-    }
-
-    bs->GattServerStartServiceInternal(
-      mServer->mAppUuid,
-      mService->GetServiceHandle(),
-      GetReply());
-
-    return true;
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-};
-
-/*
- * CancelAddServiceTask is used when failing to completely add a service. No
- * matter CancelAddServiceTask executes successfully or not, the promose should
- * be rejected because we fail to adding the service eventually.
- */
-class BluetoothGattServer::CancelAddServiceTask final
-  : public BluetoothVoidReplyRunnable
-{
-public:
-  CancelAddServiceTask(BluetoothGattServer* aServer,
-                       BluetoothGattService* aService,
-                       Promise* aPromise)
-    : BluetoothVoidReplyRunnable(nullptr, nullptr)
-      /* aPromise is not managed by BluetoothVoidReplyRunnable. It would be
-       * rejected after this task has been executed anyway. */
-    , mServer(aServer)
-    , mService(aService)
-    , mPromise(aPromise)
-  {
-    MOZ_ASSERT(mPromise);
-  }
-
-  void ReleaseMembers() override
-  {
-    BluetoothVoidReplyRunnable::ReleaseMembers();
-    mServer = nullptr;
-    mService = nullptr;
-    mPromise = nullptr;
-  }
-
-private:
-  void OnSuccessFired() override
-  {
-    mServer->mPendingService = nullptr;
-    mPromise->MaybeReject(NS_ERROR_FAILURE);
-  }
-
-  void OnErrorFired() override
-  {
-    mServer->mPendingService = nullptr;
-    mPromise->MaybeReject(NS_ERROR_FAILURE);
-  }
-
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-  nsRefPtr<Promise> mPromise;
-};
-
-class BluetoothGattServer::AddServiceTaskQueue final
-  : public BluetoothReplyTaskQueue
-{
-public:
-  AddServiceTaskQueue(BluetoothGattServer* aServer,
-                      BluetoothGattService* aService,
-                      Promise* aPromise)
-    : BluetoothReplyTaskQueue(nullptr)
-    , mServer(aServer)
-    , mService(aService)
-    , mPromise(aPromise)
-  {
-    /* add included services */
-    nsTArray<nsRefPtr<BluetoothGattService>> includedServices;
-    mService->GetIncludedServices(includedServices);
-    for (size_t i = 0; i < includedServices.Length(); ++i) {
-      nsRefPtr<SubTask> includedServiceTask =
-        new AddIncludedServiceTask(this, mServer, mService, includedServices[i]);
-      AppendTask(includedServiceTask.forget());
-    }
-
-    /* add characteristics */
-    nsTArray<nsRefPtr<BluetoothGattCharacteristic>> characteristics;
-    mService->GetCharacteristics(characteristics);
-    for (size_t i = 0; i < characteristics.Length(); ++i) {
-      nsRefPtr<SubTask> characteristicTask =
-        new AddCharacteristicTask(this, mServer, mService, characteristics[i]);
-      AppendTask(characteristicTask.forget());
-
-      /* add descriptors */
-      nsTArray<nsRefPtr<BluetoothGattDescriptor>> descriptors;
-      characteristics[i]->GetDescriptors(descriptors);
-      for (size_t j = 0; j < descriptors.Length(); ++j) {
-        nsRefPtr<SubTask> descriptorTask =
-          new AddDescriptorTask(this,
-                                mServer,
-                                mService,
-                                characteristics[i],
-                                descriptors[j]);
-
-        AppendTask(descriptorTask.forget());
-      }
-    }
-
-    /* start service */
-    nsRefPtr<SubTask> startTask = new StartServiceTask(this, mServer, mService);
-    AppendTask(startTask.forget());
-  }
-
-protected:
-  virtual ~AddServiceTaskQueue()
-  { }
-
-private:
-  void OnSuccessFired() override
-  {
-    mServer->mPendingService = nullptr;
-    mServer->mServices.AppendElement(mService);
-    mPromise->MaybeResolve(JS::UndefinedHandleValue);
-  }
-
-  void OnErrorFired() override
-  {
-    BluetoothService* bs = BluetoothService::Get();
-    BT_ENSURE_TRUE_REJECT_VOID(bs, mPromise, NS_ERROR_NOT_AVAILABLE);
-
-    bs->GattServerRemoveServiceInternal(
-      mServer->mAppUuid,
-      mService->GetServiceHandle(),
-      new CancelAddServiceTask(mServer, mService, mPromise));
-  }
-
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-  nsRefPtr<Promise> mPromise;
-};
-
-class BluetoothGattServer::AddServiceTask final
-  : public BluetoothVoidReplyRunnable
-{
-public:
-  AddServiceTask(BluetoothGattServer* aServer,
-                 BluetoothGattService* aService,
-                 Promise* aPromise)
-    : BluetoothVoidReplyRunnable(nullptr, nullptr)
-      /* aPromise is not managed by BluetoothVoidReplyRunnable. It would be
-       * passed to other tasks after this task executes successfully. */
-    , mServer(aServer)
-    , mService(aService)
-    , mPromise(aPromise)
-  {
-    MOZ_ASSERT(mServer);
-    MOZ_ASSERT(mService);
-    MOZ_ASSERT(mPromise);
-  }
-
-  void ReleaseMembers() override
-  {
-    BluetoothReplyRunnable::ReleaseMembers();
-    mServer = nullptr;
-    mService = nullptr;
-    mPromise = nullptr;
-  }
-
-private:
-  virtual void OnSuccessFired() override
-  {
-    mService->AssignAppUuid(mServer->mAppUuid);
-
-    nsRefPtr<nsRunnable> runnable = new AddServiceTaskQueue(mServer,
-                                                            mService,
-                                                            mPromise);
-    nsresult rv = NS_DispatchToMainThread(runnable.forget());
-
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      mServer->mPendingService = nullptr;
-      mPromise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
-    }
-  }
-
-  virtual void OnErrorFired() override
-  {
-    mServer->mPendingService = nullptr;
-    mPromise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
-  }
-
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-  nsRefPtr<Promise> mPromise;
-};
-
-already_AddRefed<Promise>
-BluetoothGattServer::AddService(BluetoothGattService& aService,
-                                ErrorResult& aRv)
-{
-  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
-  if (!global) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
-  NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
-
-  BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
-  BT_ENSURE_TRUE_REJECT(!aService.IsActivated(),
-                        promise,
-                        NS_ERROR_INVALID_ARG);
-
-  BluetoothService* bs = BluetoothService::Get();
-  BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
-
-  mPendingService = &aService;
-
-  bs->GattServerAddServiceInternal(mAppUuid,
-                                   mPendingService->GetServiceId(),
-                                   mPendingService->GetHandleCount(),
-                                   new AddServiceTask(this,
-                                                      mPendingService,
-                                                      promise));
-
-  return promise.forget();
-}
-
-class BluetoothGattServer::RemoveServiceTask final
-  : public BluetoothReplyRunnable
-{
-public:
-  RemoveServiceTask(BluetoothGattServer* aServer,
-                    BluetoothGattService* aService,
-                    Promise* aPromise)
-    : BluetoothReplyRunnable(nullptr, aPromise)
-    , mServer(aServer)
-    , mService(aService)
-  {
-    MOZ_ASSERT(mServer);
-    MOZ_ASSERT(mService);
-  }
-
-  void ReleaseMembers() override
-  {
-    BluetoothReplyRunnable::ReleaseMembers();
-    mServer = nullptr;
-    mService = nullptr;
-  }
-
-protected:
-  bool ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue) override
-  {
-    aValue.setUndefined();
-
-    mServer->mServices.RemoveElement(mService);
-
-    return true;
-  }
-
-private:
-  nsRefPtr<BluetoothGattServer> mServer;
-  nsRefPtr<BluetoothGattService> mService;
-};
-
-already_AddRefed<Promise>
-BluetoothGattServer::RemoveService(BluetoothGattService& aService,
-                                   ErrorResult& aRv)
-{
-  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
-  if (!global) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
-  NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
-
-  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);
-
-  bs->GattServerRemoveServiceInternal(
-    mAppUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
-                                                                 &aService,
-                                                                 promise));
-
-  return promise.forget();
-}
--- a/dom/bluetooth/common/webapi/BluetoothGattServer.h
+++ b/dom/bluetooth/common/webapi/BluetoothGattServer.h
@@ -5,18 +5,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_bluetooth_BluetoothGattServer_h
 #define mozilla_dom_bluetooth_BluetoothGattServer_h
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/BluetoothGattServerBinding.h"
 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
-#include "mozilla/dom/bluetooth/BluetoothGattService.h"
-#include "mozilla/dom/Promise.h"
 #include "nsCOMPtr.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 class Promise;
 }
 }
@@ -31,38 +29,29 @@ class BluetoothGattServer final : public
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BluetoothGattServer,
                                            DOMEventTargetHelper)
 
   /****************************************************************************
    * Attribute Getters
    ***************************************************************************/
-  void GetServices(
-    nsTArray<nsRefPtr<BluetoothGattService>>& aServices) const
-  {
-    aServices = mServices;
-  }
 
   /****************************************************************************
    * Event Handlers
    ***************************************************************************/
   IMPL_EVENT_HANDLER(connectionstatechanged);
 
   /****************************************************************************
    * Methods (Web API Implementation)
    ***************************************************************************/
   already_AddRefed<Promise> Connect(
     const nsAString& aAddress, ErrorResult& aRv);
   already_AddRefed<Promise> Disconnect(
     const nsAString& aAddress, ErrorResult& aRv);
-  already_AddRefed<Promise> AddService(BluetoothGattService& aService,
-                                       ErrorResult& aRv);
-  already_AddRefed<Promise> RemoveService(BluetoothGattService& aService,
-                                          ErrorResult& aRv);
 
   /****************************************************************************
    * Others
    ***************************************************************************/
   void Notify(const BluetoothSignal& aData); // BluetoothSignalObserver
 
   nsPIDOMWindow* GetParentObject() const
   {
@@ -79,38 +68,16 @@ public:
    * If the BluetoothAdapter turns off, existing BluetoothGattServer instances
    * should stop working till the end of life.
    */
   void Invalidate();
 
 private:
   ~BluetoothGattServer();
 
-  class AddIncludedServiceTask;
-  class AddCharacteristicTask;
-  class AddDescriptorTask;
-  class StartServiceTask;
-  class CancelAddServiceTask;
-  class AddServiceTaskQueue;
-  class AddServiceTask;
-  class RemoveServiceTask;
-
-  friend class AddIncludedServiceTask;
-  friend class AddCharacteristicTask;
-  friend class AddDescriptorTask;
-  friend class StartServiceTask;
-  friend class CancelAddServiceTask;
-  friend class AddServiceTaskQueue;
-  friend class AddServiceTask;
-  friend class RemoveServiceTask;
-
-  void HandleServiceHandleUpdated(const BluetoothValue& aValue);
-  void HandleCharacteristicHandleUpdated(const BluetoothValue& aValue);
-  void HandleDescriptorHandleUpdated(const BluetoothValue& aValue);
-
   /****************************************************************************
    * Variables
    ***************************************************************************/
   nsCOMPtr<nsPIDOMWindow> mOwner;
 
   /**
    * Random generated UUID of this GATT client.
    */
@@ -118,23 +85,13 @@ private:
 
   /**
    * Id of the GATT server interface given by bluetooth stack.
    * 0 if the interface is not registered yet, nonzero otherwise.
    */
   int mServerIf;
 
   bool mValid;
-
-  /**
-   * Array of services for this server.
-   */
-  nsTArray<nsRefPtr<BluetoothGattService>> mServices;
-
-  /**
-   * The service that is being added to this server.
-   */
-  nsRefPtr<BluetoothGattService> mPendingService;
 };
 
 END_BLUETOOTH_NAMESPACE
 
 #endif // mozilla_dom_bluetooth_BluetoothGattServer_h
--- a/dom/bluetooth/common/webapi/BluetoothGattService.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattService.cpp
@@ -24,48 +24,29 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Bl
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothGattService)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothGattService)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothGattService)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-const uint16_t BluetoothGattService::sHandleCount = 1;
-
-// Constructor of BluetoothGattService in ATT client role
 BluetoothGattService::BluetoothGattService(
   nsPIDOMWindow* aOwner, const nsAString& aAppUuid,
   const BluetoothGattServiceId& aServiceId)
   : mOwner(aOwner)
   , mAppUuid(aAppUuid)
   , mServiceId(aServiceId)
-  , mAttRole(ATT_CLIENT_ROLE)
-  , mActive(true)
 {
   MOZ_ASSERT(aOwner);
   MOZ_ASSERT(!mAppUuid.IsEmpty());
 
   UuidToString(mServiceId.mId.mUuid, mUuidStr);
 }
 
-// Constructor of BluetoothGattService in ATT server role
-BluetoothGattService::BluetoothGattService(
-  nsPIDOMWindow* aOwner,
-  const BluetoothGattServiceInit& aInit)
-  : mOwner(aOwner)
-  , mUuidStr(aInit.mUuid)
-  , mAttRole(ATT_SERVER_ROLE)
-  , mActive(false)
-{
-  memset(&mServiceId, 0, sizeof(mServiceId));
-  StringToUuid(aInit.mUuid, mServiceId.mId.mUuid);
-  mServiceId.mIsPrimary = aInit.mIsPrimary;
-}
-
 BluetoothGattService::~BluetoothGattService()
 {
 }
 
 void
 BluetoothGattService::AssignIncludedServices(
   const nsTArray<BluetoothGattServiceId>& aServiceIds)
 {
@@ -99,161 +80,14 @@ BluetoothGattService::AssignDescriptors(
   size_t index = mCharacteristics.IndexOf(aCharacteristicId);
   NS_ENSURE_TRUE_VOID(index != mCharacteristics.NoIndex);
 
   nsRefPtr<BluetoothGattCharacteristic> characteristic =
     mCharacteristics.ElementAt(index);
   characteristic->AssignDescriptors(aDescriptorIds);
 }
 
-void
-BluetoothGattService::AssignAppUuid(const nsAString& aAppUuid)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-
-  mAppUuid = aAppUuid;
-}
-
-void
-BluetoothGattService::AssignServiceHandle(
-  const BluetoothAttributeHandle& aServiceHandle)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-  MOZ_ASSERT(!mActive);
-  MOZ_ASSERT(!mServiceHandle.mHandle);
-
-  mServiceHandle = aServiceHandle;
-  mActive = true;
-}
-
-void
-BluetoothGattService::AssignCharacteristicHandle(
-  const BluetoothUuid& aCharacteristicUuid,
-  const BluetoothAttributeHandle& aCharacteristicHandle)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-  MOZ_ASSERT(mActive);
-
-  size_t index = mCharacteristics.IndexOf(aCharacteristicUuid);
-  NS_ENSURE_TRUE_VOID(index != mCharacteristics.NoIndex);
-  mCharacteristics[index]->AssignCharacteristicHandle(aCharacteristicHandle);
-}
-
-void
-BluetoothGattService::AssignDescriptorHandle(
-  const BluetoothUuid& aDescriptorUuid,
-  const BluetoothAttributeHandle& aCharacteristicHandle,
-  const BluetoothAttributeHandle& aDescriptorHandle)
-{
-  MOZ_ASSERT(mAttRole == ATT_SERVER_ROLE);
-  MOZ_ASSERT(mActive);
-
-  size_t index = mCharacteristics.IndexOf(aCharacteristicHandle);
-  NS_ENSURE_TRUE_VOID(index != mCharacteristics.NoIndex);
-  mCharacteristics[index]->AssignDescriptorHandle(aDescriptorUuid,
-                                                  aDescriptorHandle);
-}
-
-uint16_t
-BluetoothGattService::GetHandleCount() const
-{
-  uint16_t count = sHandleCount;
-  for (size_t i = 0; i < mCharacteristics.Length(); ++i) {
-    count += mCharacteristics[i]->GetHandleCount();
-  }
-  return count;
-}
-
 JSObject*
 BluetoothGattService::WrapObject(JSContext* aContext,
                                  JS::Handle<JSObject*> aGivenProto)
 {
   return BluetoothGattServiceBinding::Wrap(aContext, this, aGivenProto);
 }
-
-already_AddRefed<BluetoothGattService>
-BluetoothGattService::Constructor(const GlobalObject& aGlobal,
-                                  const BluetoothGattServiceInit& aInit,
-                                  ErrorResult& aRv)
-{
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
-  if (!window) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsRefPtr<BluetoothGattService> service = new BluetoothGattService(window,
-                                                                    aInit);
-
-  return service.forget();
-}
-
-already_AddRefed<Promise>
-BluetoothGattService::AddCharacteristic(
-  const nsAString& aCharacteristicUuid,
-  const GattPermissions& aPermissions,
-  const GattCharacteristicProperties& aProperties,
-  const ArrayBuffer& aValue,
-  ErrorResult& aRv)
-{
-  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
-  if (!global) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
-  NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
-
-  BT_ENSURE_TRUE_REJECT(mAttRole == ATT_SERVER_ROLE,
-                        promise,
-                        NS_ERROR_UNEXPECTED);
-
-  /* The service should not be actively acting with the Bluetooth backend.
-   * Otherwise, characteristics cannot be added into the service. */
-  BT_ENSURE_TRUE_REJECT(!mActive, promise, NS_ERROR_UNEXPECTED);
-
-  nsRefPtr<BluetoothGattCharacteristic> characteristic =
-    new BluetoothGattCharacteristic(GetParentObject(),
-                                    this,
-                                    aCharacteristicUuid,
-                                    aPermissions,
-                                    aProperties,
-                                    aValue);
-
-  mCharacteristics.AppendElement(characteristic);
-  promise->MaybeResolve(characteristic);
-
-  return promise.forget();
-}
-
-already_AddRefed<Promise>
-BluetoothGattService::AddIncludedService(BluetoothGattService& aIncludedService,
-                                         ErrorResult& aRv)
-{
-  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
-  if (!global) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
-  NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
-
-  BT_ENSURE_TRUE_REJECT(mAttRole == ATT_SERVER_ROLE,
-                        promise,
-                        NS_ERROR_UNEXPECTED);
-
-  /* The service should not be actively acting with the Bluetooth backend.
-   * Otherwise, included services cannot be added into the service. */
-  BT_ENSURE_TRUE_REJECT(!mActive, promise, NS_ERROR_UNEXPECTED);
-
-  /* The included service itself should be actively acting with the Bluetooth
-   * backend. Otherwise, that service cannot be included by any services. */
-  BT_ENSURE_TRUE_REJECT(aIncludedService.mActive,
-                        promise,
-                        NS_ERROR_UNEXPECTED);
-
-  mIncludedServices.AppendElement(&aIncludedService);
-  promise->MaybeResolve(JS::UndefinedHandleValue);
-
-  return promise.forget();
-}
--- a/dom/bluetooth/common/webapi/BluetoothGattService.h
+++ b/dom/bluetooth/common/webapi/BluetoothGattService.h
@@ -20,17 +20,16 @@ BEGIN_BLUETOOTH_NAMESPACE
 class BluetoothGatt;
 class BluetoothSignal;
 class BluetoothValue;
 
 class BluetoothGattService final : public nsISupports
                                  , public nsWrapperCache
 {
   friend class BluetoothGatt;
-  friend class BluetoothGattServer;
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BluetoothGattService)
 
   /****************************************************************************
    * Attribute Getters
    ***************************************************************************/
   bool IsPrimary() const
@@ -56,67 +55,39 @@ public:
 
   void GetCharacteristics(
     nsTArray<nsRefPtr<BluetoothGattCharacteristic>>& aCharacteristics) const
   {
     aCharacteristics = mCharacteristics;
   }
 
   /****************************************************************************
-   * Methods (Web API Implementation)
-   ***************************************************************************/
-  static already_AddRefed<BluetoothGattService> Constructor(
-    const GlobalObject& aGlobal,
-    const BluetoothGattServiceInit& aInit,
-    ErrorResult& aRv);
-  already_AddRefed<Promise> AddCharacteristic(
-    const nsAString& aCharacteristicUuid,
-    const GattPermissions& aPermissions,
-    const GattCharacteristicProperties& aProperties,
-    const ArrayBuffer& aValue,
-    ErrorResult& aRv);
-  already_AddRefed<Promise> AddIncludedService(
-    BluetoothGattService& aIncludedService,
-    ErrorResult& aRv);
-
-  /****************************************************************************
    * Others
    ***************************************************************************/
   const nsAString& GetAppUuid() const
   {
     return mAppUuid;
   }
 
   const BluetoothGattServiceId& GetServiceId() const
   {
     return mServiceId;
   }
 
-  const BluetoothAttributeHandle& GetServiceHandle() const
-  {
-    return mServiceHandle;
-  }
-
   nsPIDOMWindow* GetParentObject() const
   {
      return mOwner;
   }
 
-  uint16_t GetHandleCount() const;
-
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
-  // Constructor of BluetoothGattService in ATT client role
   BluetoothGattService(nsPIDOMWindow* aOwner,
                        const nsAString& aAppUuid,
                        const BluetoothGattServiceId& aServiceId);
-  // Constructor of BluetoothGattService in ATT server role
-  BluetoothGattService(nsPIDOMWindow* aOwner,
-                       const BluetoothGattServiceInit& aInit);
 
 private:
   ~BluetoothGattService();
 
   /**
    * Add newly discovered GATT included services into mIncludedServices and
    * update the cache value of mIncludedServices.
    *
@@ -146,71 +117,16 @@ private:
    * @param aDescriptorIds [in] An array of BluetoothGattId for each descriptor
    *                            that belongs to the characteristic referred by
    *                            aCharacteristicId.
    */
   void AssignDescriptors(
     const BluetoothGattId& aCharacteristicId,
     const nsTArray<BluetoothGattId>& aDescriptorIds);
 
-  /**
-   * Assign AppUuid of this GATT service.
-   *
-   * @param aAppUuid The value of AppUuid.
-   */
-  void AssignAppUuid(const nsAString& aAppUuid);
-
-  /**
-   * Assign the handle value for this GATT service. This function would be
-   * called only after a valid handle value is retrieved from the Bluetooth
-   * backend.
-   *
-   * @param aServiceHandle [in] The handle value of this GATT service.
-   */
-  void AssignServiceHandle(const BluetoothAttributeHandle& aServiceHandle);
-
-  /**
-   * Assign the handle value for one of the characteristic within this GATT
-   * service. This function would be called only after a valid handle value is
-   * retrieved from the Bluetooth backend.
-   *
-   * @param aCharacteristicUuid [in] BluetoothUuid of this GATT characteristic.
-   * @param aCharacteristicHandle [in] The handle value of this GATT
-   *                                   characteristic.
-   */
-  void AssignCharacteristicHandle(
-    const BluetoothUuid& aCharacteristicUuid,
-    const BluetoothAttributeHandle& aCharacteristicHandle);
-
-  /**
-   * Assign the handle value for one of the descriptor within this GATT
-   * service. This function would be called only after a valid handle value is
-   * retrieved from the Bluetooth backend.
-   *
-   * @param aDescriptorUuid [in] BluetoothUuid of this GATT descriptor.
-   * @param aCharacteristicHandle [in] The handle value of this GATT
-   *                                   characteristic.
-   * @param aDescriptorHandle [in] The handle value of this GATT descriptor.
-   */
-  void AssignDescriptorHandle(
-    const BluetoothUuid& aDescriptorUuid,
-    const BluetoothAttributeHandle& aCharacteristicHandle,
-    const BluetoothAttributeHandle& aDescriptorHandle);
-
-  /**
-   * Examine whether this GATT service can react with the Bluetooth backend.
-   *
-   * @return true if this service can react with the Bluetooth backend; false
-   *         if this service cannot react with the Bluetooth backend.
-   */
-  bool IsActivated() const
-  {
-    return mActive;
-  }
-
   /****************************************************************************
    * Variables
    ***************************************************************************/
   nsCOMPtr<nsPIDOMWindow> mOwner;
 
   /**
    * UUID of the GATT client.
    */
@@ -233,46 +149,16 @@ private:
    * Array of discovered included services for this service.
    */
   nsTArray<nsRefPtr<BluetoothGattService>> mIncludedServices;
 
   /**
    * Array of discovered characteristics for this service.
    */
   nsTArray<nsRefPtr<BluetoothGattCharacteristic>> mCharacteristics;
-
-  /**
-   * ATT role of this GATT service.
-   */
-  const BluetoothAttRole mAttRole;
-
-  /**
-   * Activeness of this GATT service.
-   *
-   * True means this service does react with the Bluetooth backend. False means
-   * this service doesn't react with the Bluetooth backend. The value should be
-   * true if |mAttRole| equals |ATT_CLIENT_ROLE| because the service instance
-   * could be created only when the Bluetooth backend has found one GATT
-   * service. The value would be false at the beginning if |mAttRole| equals
-   * |ATT_SERVER_ROLE|. Then the value would become true later if this GATT
-   * service has been added into Bluetooth backend.
-   */
-  bool mActive;
-
-  /**
-   * Handle of this GATT service.
-   *
-   * The value is only valid if |mAttRole| equals |ATT_SERVER_ROLE|.
-   */
-  BluetoothAttributeHandle mServiceHandle;
-
-  /**
-   * Total count of handles of this GATT service itself.
-   */
-  static const uint16_t sHandleCount;
 };
 
 END_BLUETOOTH_NAMESPACE
 
 /**
  * Explicit Specialization of Function Templates
  *
  * Allows customizing the template code for a given set of template arguments.
@@ -288,31 +174,9 @@ public:
   bool Equals(
     const nsRefPtr<mozilla::dom::bluetooth::BluetoothGattService>& aService,
     const mozilla::dom::bluetooth::BluetoothGattServiceId& aServiceId) const
   {
     return aService->GetServiceId() == aServiceId;
   }
 };
 
-/**
- * Explicit Specialization of Function Templates
- *
- * Allows customizing the template code for a given set of template arguments.
- * With this function template, nsTArray can handle comparison between
- * 'nsRefPtr<BluetoothGattService>' and 'BluetoothAttributeHandle' properly,
- * including IndexOf() and Contains();
- */
-template <>
-class nsDefaultComparator <
-  nsRefPtr<mozilla::dom::bluetooth::BluetoothGattService>,
-  mozilla::dom::bluetooth::BluetoothAttributeHandle> {
-public:
-  bool Equals(
-    const nsRefPtr<mozilla::dom::bluetooth::BluetoothGattService>& aService,
-    const mozilla::dom::bluetooth::BluetoothAttributeHandle& aServiceHandle)
-    const
-  {
-    return aService->GetServiceHandle() == aServiceHandle;
-  }
-};
-
 #endif // mozilla_dom_bluetooth_BluetoothGattService_h
--- a/dom/bluetooth/ipc/BluetoothMessageUtils.h
+++ b/dom/bluetooth/ipc/BluetoothMessageUtils.h
@@ -131,31 +131,11 @@ struct ParamTraits<mozilla::dom::bluetoo
         !ReadParam(aMsg, aIter, &(aResult->mWriteType))) {
       return false;
     }
 
     return true;
   }
 };
 
-template <>
-struct ParamTraits<mozilla::dom::bluetooth::BluetoothAttributeHandle>
-{
-  typedef mozilla::dom::bluetooth::BluetoothAttributeHandle paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam)
-  {
-    WriteParam(aMsg, aParam.mHandle);
-  }
-
-  static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
-  {
-    if (!ReadParam(aMsg, aIter, &(aResult->mHandle))) {
-      return false;
-    }
-
-    return true;
-  }
-};
-
 } // namespace IPC
 
 #endif // mozilla_dom_bluetooth_ipc_BluetoothMessageUtils_h
--- a/dom/bluetooth/ipc/BluetoothParent.cpp
+++ b/dom/bluetooth/ipc/BluetoothParent.cpp
@@ -295,32 +295,16 @@ BluetoothParent::RecvPBluetoothRequestCo
     case Request::TGattServerConnectPeripheralRequest:
       return actor->DoRequest(
         aRequest.get_GattServerConnectPeripheralRequest());
     case Request::TGattServerDisconnectPeripheralRequest:
       return actor->DoRequest(
         aRequest.get_GattServerDisconnectPeripheralRequest());
     case Request::TUnregisterGattServerRequest:
       return actor->DoRequest(aRequest.get_UnregisterGattServerRequest());
-    case Request::TGattServerAddServiceRequest:
-      return actor->DoRequest(aRequest.get_GattServerAddServiceRequest());
-    case Request::TGattServerAddIncludedServiceRequest:
-      return actor->DoRequest(
-               aRequest.get_GattServerAddIncludedServiceRequest());
-    case Request::TGattServerAddCharacteristicRequest:
-      return actor->DoRequest(
-               aRequest.get_GattServerAddCharacteristicRequest());
-    case Request::TGattServerAddDescriptorRequest:
-      return actor->DoRequest(aRequest.get_GattServerAddDescriptorRequest());
-    case Request::TGattServerRemoveServiceRequest:
-      return actor->DoRequest(aRequest.get_GattServerRemoveServiceRequest());
-    case Request::TGattServerStartServiceRequest:
-      return actor->DoRequest(aRequest.get_GattServerStartServiceRequest());
-    case Request::TGattServerStopServiceRequest:
-      return actor->DoRequest(aRequest.get_GattServerStopServiceRequest());
     default:
       MOZ_CRASH("Unknown type!");
   }
 
   MOZ_CRASH("Should never get here!");
 }
 
 PBluetoothRequestParent*
@@ -1034,126 +1018,8 @@ BluetoothRequestParent::DoRequest(const 
   MOZ_ASSERT(mService);
   MOZ_ASSERT(mRequestType == Request::TUnregisterGattServerRequest);
 
   mService->UnregisterGattServerInternal(aRequest.serverIf(),
                                          mReplyRunnable.get());
 
   return true;
 }
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerAddServiceRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerAddServiceRequest);
-
-  mService->GattServerAddServiceInternal(aRequest.appUuid(),
-                                         aRequest.serviceId(),
-                                         aRequest.handleCount(),
-                                         mReplyRunnable.get());
-
-  return true;
-}
-
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerAddIncludedServiceRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerAddIncludedServiceRequest);
-
-  mService->GattServerAddIncludedServiceInternal(
-    aRequest.appUuid(),
-    aRequest.serviceHandle(),
-    aRequest.includedServiceHandle(),
-    mReplyRunnable.get());
-
-  return true;
-}
-
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerAddCharacteristicRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerAddCharacteristicRequest);
-
-  mService->GattServerAddCharacteristicInternal(
-    aRequest.appUuid(),
-    aRequest.serviceHandle(),
-    aRequest.characteristicUuid(),
-    aRequest.permissions(),
-    aRequest.properties(),
-    mReplyRunnable.get());
-
-  return true;
-}
-
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerAddDescriptorRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerAddDescriptorRequest);
-
-  mService->GattServerAddDescriptorInternal(
-    aRequest.appUuid(),
-    aRequest.serviceHandle(),
-    aRequest.characteristicHandle(),
-    aRequest.descriptorUuid(),
-    aRequest.permissions(),
-    mReplyRunnable.get());
-
-  return true;
-}
-
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerRemoveServiceRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerRemoveServiceRequest);
-
-  mService->GattServerRemoveServiceInternal(
-    aRequest.appUuid(),
-    aRequest.serviceHandle(),
-    mReplyRunnable.get());
-
-  return true;
-}
-
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerStartServiceRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerStartServiceRequest);
-
-  mService->GattServerStartServiceInternal(
-    aRequest.appUuid(),
-    aRequest.serviceHandle(),
-    mReplyRunnable.get());
-
-  return true;
-}
-
-bool
-BluetoothRequestParent::DoRequest(
-  const GattServerStopServiceRequest& aRequest)
-{
-  MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType ==
-             Request::TGattServerStopServiceRequest);
-
-  mService->GattServerStopServiceInternal(
-    aRequest.appUuid(),
-    aRequest.serviceHandle(),
-    mReplyRunnable.get());
-
-  return true;
-}
--- a/dom/bluetooth/ipc/BluetoothParent.h
+++ b/dom/bluetooth/ipc/BluetoothParent.h
@@ -274,34 +274,13 @@ protected:
   bool
   DoRequest(const GattServerConnectPeripheralRequest& aRequest);
 
   bool
   DoRequest(const GattServerDisconnectPeripheralRequest& aRequest);
 
   bool
   DoRequest(const UnregisterGattServerRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerAddServiceRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerAddIncludedServiceRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerAddCharacteristicRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerAddDescriptorRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerRemoveServiceRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerStartServiceRequest& aRequest);
-
-  bool
-  DoRequest(const GattServerStopServiceRequest& aRequest);
 };
 
 END_BLUETOOTH_NAMESPACE
 
 #endif // mozilla_dom_bluetooth_ipc_BluetoothParent_h
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
@@ -622,104 +622,16 @@ BluetoothServiceChildProcess::GattServer
 
 void
 BluetoothServiceChildProcess::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, UnregisterGattServerRequest(aServerIf));
 }
 
-void
-BluetoothServiceChildProcess::GattServerAddServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothGattServiceId& aServiceId,
-  uint16_t aHandleCount,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerAddServiceRequest(nsString(aAppUuid), aServiceId, aHandleCount));
-}
-
-void
-BluetoothServiceChildProcess::GattServerAddIncludedServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aIncludedServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerAddIncludedServiceRequest(nsString(aAppUuid),
-                                        aServiceHandle,
-                                        aIncludedServiceHandle));
-}
-
-void
-BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothUuid& aCharacteristicUuid,
-  BluetoothGattAttrPerm aPermissions,
-  BluetoothGattCharProp aProperties,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerAddCharacteristicRequest(nsString(aAppUuid),
-                                       aServiceHandle,
-                                       aCharacteristicUuid,
-                                       aPermissions,
-                                       aProperties));
-}
-
-void
-BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  const BluetoothAttributeHandle& aCharacteristicHandle,
-  const BluetoothUuid& aDescriptorUuid,
-  BluetoothGattAttrPerm aPermissions,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerAddDescriptorRequest(nsString(aAppUuid),
-                                   aServiceHandle,
-                                   aCharacteristicHandle,
-                                   aDescriptorUuid,
-                                   aPermissions));
-}
-
-void
-BluetoothServiceChildProcess::GattServerRemoveServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerRemoveServiceRequest(nsString(aAppUuid), aServiceHandle));
-}
-
-void
-BluetoothServiceChildProcess::GattServerStartServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerStartServiceRequest(nsString(aAppUuid), aServiceHandle));
-}
-
-void
-BluetoothServiceChildProcess::GattServerStopServiceInternal(
-  const nsAString& aAppUuid,
-  const BluetoothAttributeHandle& aServiceHandle,
-  BluetoothReplyRunnable* aRunnable)
-{
-  SendRequest(aRunnable,
-    GattServerStopServiceRequest(nsString(aAppUuid), aServiceHandle));
-}
-
 nsresult
 BluetoothServiceChildProcess::HandleStartup()
 {
   // Don't need to do anything here for startup since our Create function takes
   // care of the actor machinery.
   return NS_OK;
 }
 
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
@@ -309,66 +309,16 @@ public:
     const nsAString& aAppUuid,
     const nsAString& aAddress,
     BluetoothReplyRunnable* aRunnable);
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
-  virtual void
-  GattServerAddServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothGattServiceId& aServiceId,
-    uint16_t aHandleCount,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddIncludedServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aIncludedServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddCharacteristicInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothUuid& aCharacteristicUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothGattCharProp aProperties,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerAddDescriptorInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    const BluetoothAttributeHandle& aCharacteristicHandle,
-    const BluetoothUuid& aDescriptorUuid,
-    BluetoothGattAttrPerm aPermissions,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerRemoveServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerStartServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
-  virtual void
-  GattServerStopServiceInternal(
-    const nsAString& aAppUuid,
-    const BluetoothAttributeHandle& aServiceHandle,
-    BluetoothReplyRunnable* aRunnable) override;
-
 protected:
   BluetoothServiceChildProcess();
   virtual ~BluetoothServiceChildProcess();
 
   void
   NoteDeadActor();
 
   void
--- a/dom/bluetooth/ipc/BluetoothTypes.ipdlh
+++ b/dom/bluetooth/ipc/BluetoothTypes.ipdlh
@@ -1,34 +1,26 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-using mozilla::dom::bluetooth::BluetoothAttributeHandle
-  from "mozilla/dom/bluetooth/BluetoothCommon.h";
-using mozilla::dom::bluetooth::BluetoothGattAttrPerm
-  from "mozilla/dom/bluetooth/BluetoothCommon.h";
 using mozilla::dom::bluetooth::BluetoothGattCharAttribute
   from "mozilla/dom/bluetooth/BluetoothCommon.h";
-using mozilla::dom::bluetooth::BluetoothGattCharProp
-  from "mozilla/dom/bluetooth/BluetoothCommon.h";
 using mozilla::dom::bluetooth::BluetoothGattId
   from "mozilla/dom/bluetooth/BluetoothCommon.h";
 using mozilla::dom::bluetooth::BluetoothGattServiceId
   from "mozilla/dom/bluetooth/BluetoothCommon.h";
 using mozilla::dom::bluetooth::BluetoothGattWriteType
   from "mozilla/dom/bluetooth/BluetoothCommon.h";
 using mozilla::dom::bluetooth::BluetoothSspVariant
   from "mozilla/dom/bluetooth/BluetoothCommon.h";
 using mozilla::dom::bluetooth::BluetoothStatus
   from "mozilla/dom/bluetooth/BluetoothCommon.h";
-using mozilla::dom::bluetooth::BluetoothUuid
-  from "mozilla/dom/bluetooth/BluetoothCommon.h";
 
 namespace mozilla {
 namespace dom {
 namespace bluetooth {
 
 /**
  * Value structure for returns from bluetooth. Currently modeled after dbus
  * returns, which can be a 32-bit int, an UTF16 string, a bool, or an array of
@@ -45,18 +37,16 @@ union BluetoothValue
   uint8_t[];
   uint32_t[];
   BluetoothNamedValue[];
   BluetoothGattId;
   BluetoothGattId[];
   BluetoothGattServiceId;
   BluetoothGattServiceId[];
   BluetoothGattCharAttribute[];
-  BluetoothAttributeHandle;
-  BluetoothUuid;
 };
 
 /**
  * Key-value pair for dicts returned by the bluetooth backend. Used for things
  * like property updates, where the property will have a name and a type.
  */
 struct BluetoothNamedValue
 {
--- a/dom/bluetooth/ipc/PBluetooth.ipdl
+++ b/dom/bluetooth/ipc/PBluetooth.ipdl
@@ -304,66 +304,16 @@ struct GattServerDisconnectPeripheralReq
   nsString address;
 };
 
 struct UnregisterGattServerRequest
 {
   int serverIf;
 };
 
-struct GattServerAddServiceRequest
-{
-  nsString appUuid;
-  BluetoothGattServiceId serviceId;
-  uint16_t handleCount;
-};
-
-struct GattServerAddIncludedServiceRequest
-{
-  nsString appUuid;
-  BluetoothAttributeHandle serviceHandle;
-  BluetoothAttributeHandle includedServiceHandle;
-};
-
-struct GattServerAddCharacteristicRequest
-{
-  nsString appUuid;
-  BluetoothAttributeHandle serviceHandle;
-  BluetoothUuid characteristicUuid;
-  BluetoothGattAttrPerm permissions;
-  BluetoothGattCharProp properties;
-};
-
-struct GattServerAddDescriptorRequest
-{
-  nsString appUuid;
-  BluetoothAttributeHandle serviceHandle;
-  BluetoothAttributeHandle characteristicHandle;
-  BluetoothUuid descriptorUuid;
-  BluetoothGattAttrPerm permissions;
-};
-
-struct GattServerRemoveServiceRequest
-{
-  nsString appUuid;
-  BluetoothAttributeHandle serviceHandle;
-};
-
-struct GattServerStartServiceRequest
-{
-  nsString appUuid;
-  BluetoothAttributeHandle serviceHandle;
-};
-
-struct GattServerStopServiceRequest
-{
-  nsString appUuid;
-  BluetoothAttributeHandle serviceHandle;
-};
-
 union Request
 {
   GetAdaptersRequest;
   StartBluetoothRequest;
   StopBluetoothRequest;
   SetPropertyRequest;
   GetPropertyRequest;
   StartDiscoveryRequest;
@@ -407,23 +357,16 @@ union Request
   GattClientReadRemoteRssiRequest;
   GattClientReadCharacteristicValueRequest;
   GattClientWriteCharacteristicValueRequest;
   GattClientReadDescriptorValueRequest;
   GattClientWriteDescriptorValueRequest;
   GattServerConnectPeripheralRequest;
   GattServerDisconnectPeripheralRequest;
   UnregisterGattServerRequest;
-  GattServerAddServiceRequest;
-  GattServerAddIncludedServiceRequest;
-  GattServerAddCharacteristicRequest;
-  GattServerAddDescriptorRequest;
-  GattServerRemoveServiceRequest;
-  GattServerStartServiceRequest;
-  GattServerStopServiceRequest;
 };
 
 protocol PBluetooth
 {
   manager PContent;
   manages PBluetoothRequest;
 
   /**
--- a/dom/webidl/BluetoothGattCharacteristic.webidl
+++ b/dom/webidl/BluetoothGattCharacteristic.webidl
@@ -1,78 +1,45 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 dictionary GattCharacteristicProperties
 {
-  boolean broadcast = false;
-  boolean read = false;
-  boolean writeNoResponse = false;
-  boolean write = false;
-  boolean notify = false;
-  boolean indicate = false;
-  boolean signedWrite = false;
-  boolean extendedProps = false;
+  required boolean broadcast;
+  required boolean read;
+  required boolean writeNoResponse;
+  required boolean write;
+  required boolean notify;
+  required boolean indicate;
+  required boolean signedWrite;
+  required boolean extendedProps;
 };
 
-dictionary GattPermissions
-{
-  boolean read = false;
-  boolean readEncrypted = false;
-  boolean readEncryptedMITM = false;
-  boolean write = false;
-  boolean writeEncrypted = false;
-  boolean writeEncryptedMITM = false;
-  boolean writeSigned = false;
-  boolean writeSignedMITM = false;
-};
-
-/**
- * BluetoothGattCharacteristic could be in the server role as a characteristic
- * provided by a local GATT server, or in the client role as a characteristic
- * provided by a remote GATT server.
- */
 [CheckAnyPermissions="bluetooth"]
 interface BluetoothGattCharacteristic
 {
   readonly attribute BluetoothGattService                   service;
   [Cached, Pure]
   readonly attribute sequence<BluetoothGattDescriptor>      descriptors;
 
   readonly attribute DOMString                              uuid;
   readonly attribute unsigned short                         instanceId;
   readonly attribute ArrayBuffer?                           value;
   [Cached, Constant]
-  readonly attribute GattPermissions                        permissions;
-  [Cached, Constant]
   readonly attribute GattCharacteristicProperties           properties;
 
   [NewObject]
   Promise<ArrayBuffer>  readValue();
   [NewObject]
   Promise<void>         writeValue(ArrayBuffer value);
 
   /**
    * Start or stop subscribing notifications of this characteristic from the
    * remote GATT server.
-   *
-   * This API will be rejected if this characteristic is in the server role.
    */
   [NewObject]
   Promise<void> startNotifications();
   [NewObject]
   Promise<void> stopNotifications();
-
-  /**
-   * Add a BLE descriptor to the local GATT characteristic.
-   *
-   * The promise will be rejected if this characteristic is in the client role
-   * since a GATT client is not allowed to manipulate the descriptor list in a
-   * remote GATT server.
-   */
-  [NewObject]
-  Promise<BluetoothGattDescriptor> addDescriptor(DOMString uuid,
-                                                 GattPermissions permissions,
-                                                 ArrayBuffer value);
 };
--- a/dom/webidl/BluetoothGattDescriptor.webidl
+++ b/dom/webidl/BluetoothGattDescriptor.webidl
@@ -1,25 +1,18 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/**
- * BluetoothGattDescriptor could be in the server role as a descriptor provided
- * by a local GATT server, or in the client role as a descriptor provided by a
- * remote GATT server.
- */
 [CheckAnyPermissions="bluetooth"]
 interface BluetoothGattDescriptor
 {
   readonly attribute BluetoothGattCharacteristic            characteristic;
   readonly attribute DOMString                              uuid;
   readonly attribute ArrayBuffer?                           value;
-  [Cached, Constant]
-  readonly attribute GattPermissions                        permissions;
 
   [NewObject]
   Promise<ArrayBuffer>  readValue();
   [NewObject]
   Promise<void>         writeValue(ArrayBuffer value);
 };
--- a/dom/webidl/BluetoothGattServer.webidl
+++ b/dom/webidl/BluetoothGattServer.webidl
@@ -2,43 +2,22 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [CheckAnyPermissions="bluetooth"]
 interface BluetoothGattServer : EventTarget
 {
-  [Cached, Pure]
-  readonly attribute sequence<BluetoothGattService> services;
-
   // Fired when a remote device has been connected/disconnected
   attribute EventHandler  onconnectionstatechanged;
 
   /**
    * Connect/Disconnect to the remote BLE device with the target address.
    *
    * Promise will be rejected if the local GATT server is busy connecting or
    * disconnecting to other devices.
    */
   [NewObject]
   Promise<void> connect(DOMString address);
   [NewObject]
   Promise<void> disconnect(DOMString address);
-
-  /**
-   * Add a BLE service to the local GATT server.
-   *
-   * This API will be rejected if this service has been added to the GATT
-   * server.
-   */
-  [NewObject]
-  Promise<void> addService(BluetoothGattService service);
-
-  /**
-   * Remove a BLE service to the local GATT server.
-   *
-   * This API will be rejected if this service does not exist in the GATT
-   * server.
-   */
-  [NewObject]
-  Promise<void> removeService(BluetoothGattService service);
 };
--- a/dom/webidl/BluetoothGattService.webidl
+++ b/dom/webidl/BluetoothGattService.webidl
@@ -1,54 +1,18 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/**
- * BluetoothGattService could be in the server role as a service provided by a
- * local GATT server, or in the client role as a service provided by a remote
- * GATT server.
- */
-[CheckAnyPermissions="bluetooth", Constructor(BluetoothGattServiceInit init)]
+[CheckAnyPermissions="bluetooth"]
 interface BluetoothGattService
 {
   [Cached, Pure]
   readonly attribute sequence<BluetoothGattCharacteristic>  characteristics;
   [Cached, Pure]
   readonly attribute sequence<BluetoothGattService>         includedServices;
 
   readonly attribute boolean                                isPrimary;
   readonly attribute DOMString                              uuid;
   readonly attribute unsigned short                         instanceId;
-
-  /**
-   * Add a BLE characteristic to the local GATT service.
-   *
-   * This API will be rejected if this service is in the client role since a
-   * GATT client is not allowed to manipulate the characteristic list in a
-   * remote GATT server.
-   */
-  [NewObject]
-  Promise<BluetoothGattCharacteristic> addCharacteristic(
-    DOMString uuid,
-    GattPermissions permissions,
-    GattCharacteristicProperties properties,
-    ArrayBuffer value);
-
-  /**
-   * Add a BLE included service to the local GATT service.
-   *
-   * This API will be rejected if this service is in the client role since a
-   * GATT client is not allowed to manipulate the included service list in a
-   * remote GATT server. The included service to be added should be an existing
-   * service of the same GATT server. Otherwise this API will be rejected.
-   */
-  [NewObject]
-  Promise<void> addIncludedService(BluetoothGattService service);
 };
-
-dictionary BluetoothGattServiceInit
-{
-  boolean isPrimary = false;
-  DOMString uuid = "";
-};
\ No newline at end of file