Bug 842948 - Patch 6: Implement dictionaries, r=echou
authorGina Yeh <gyeh@mozilla.com>
Mon, 29 Jul 2013 17:32:35 +0800
changeset 152615 64dfe43d269fb21f30926485ecb87df2122cb0a3
parent 152614 63e223a89cdae0aeecba827b9e0c7fc69d6de440
child 152616 7246ac13cd4bce8a4b145fbb82d80f6dc0c0e61e
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs842948
milestone25.0a1
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
Bug 842948 - Patch 6: Implement dictionaries, r=echou
dom/bluetooth/BluetoothAdapter.cpp
dom/bluetooth/BluetoothService.h
dom/bluetooth/MediaMetaData.cpp
dom/bluetooth/MediaMetaData.h
dom/bluetooth/MediaPlayStatus.cpp
dom/bluetooth/MediaPlayStatus.h
dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
dom/bluetooth/ipc/BluetoothServiceChildProcess.h
dom/bluetooth/ipc/PBluetooth.ipdl
dom/bluetooth/linux/BluetoothDBusService.cpp
dom/bluetooth/linux/BluetoothDBusService.h
dom/bluetooth/moz.build
js/xpconnect/src/dictionary_helper_gen.conf
--- a/dom/bluetooth/BluetoothAdapter.cpp
+++ b/dom/bluetooth/BluetoothAdapter.cpp
@@ -1,36 +1,37 @@
 /* -*- 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/. */
 
 #include "base/basictypes.h"
-#include "BluetoothAdapter.h"
-#include "BluetoothDevice.h"
-#include "BluetoothReplyRunnable.h"
-#include "BluetoothService.h"
-#include "BluetoothUtils.h"
 #include "GeneratedEvents.h"
-
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 #include "nsDOMClassInfo.h"
 #include "nsIDOMBluetoothDeviceEvent.h"
 #include "nsTArrayHelpers.h"
-#include "DictionaryHelpers.h"
 #include "DOMRequest.h"
 #include "nsThreadUtils.h"
 
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/LazyIdleThread.h"
 #include "mozilla/Util.h"
 
+#include "BluetoothAdapter.h"
+#include "BluetoothDevice.h"
+#include "BluetoothReplyRunnable.h"
+#include "BluetoothService.h"
+#include "BluetoothUtils.h"
+#include "MediaMetaData.h"
+#include "MediaPlayStatus.h"
+
 using namespace mozilla;
 
 USING_BLUETOOTH_NAMESPACE
 
 DOMCI_DATA(BluetoothAdapter, BluetoothAdapter)
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(BluetoothAdapter,
                                                nsDOMEventTargetHelper)
@@ -833,17 +834,17 @@ BluetoothAdapter::IsScoConnected(nsIDOMD
   req.forget(aRequest);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BluetoothAdapter::SendMediaMetaData(const JS::Value& aOptions,
                                     nsIDOMDOMRequest** aRequest)
 {
-  idl::MediaMetaData metadata;
+  MediaMetaData metadata;
 
   nsresult rv;
   nsIScriptContext* sc = GetContextForEventHandlers(&rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   AutoPushJSContext cx(sc->GetNativeContext());
   rv = metadata.Init(cx, &aOptions);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -852,33 +853,33 @@ BluetoothAdapter::SendMediaMetaData(cons
   rv = PrepareDOMRequest(GetOwner(), getter_AddRefs(req));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsRefPtr<BluetoothReplyRunnable> results =
     new BluetoothVoidReplyRunnable(req);
 
   BluetoothService* bs = BluetoothService::Get();
   NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);
-  bs->SendMetaData(metadata.title,
-                   metadata.artist,
-                   metadata.album,
-                   metadata.mediaNumber,
-                   metadata.totalMediaCount,
-                   metadata.duration,
+  bs->SendMetaData(metadata.mTitle,
+                   metadata.mArtist,
+                   metadata.mAlbum,
+                   metadata.mMediaNumber,
+                   metadata.mTotalMediaCount,
+                   metadata.mDuration,
                    results);
 
   req.forget(aRequest);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BluetoothAdapter::SendMediaPlayStatus(const JS::Value& aOptions,
                                       nsIDOMDOMRequest** aRequest)
 {
-  idl::MediaPlayStatus status;
+  MediaPlayStatus status;
 
   nsresult rv;
   nsIScriptContext* sc = GetContextForEventHandlers(&rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   AutoPushJSContext cx(sc->GetNativeContext());
   rv = status.Init(cx, &aOptions);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -887,18 +888,18 @@ BluetoothAdapter::SendMediaPlayStatus(co
   rv = PrepareDOMRequest(GetOwner(), getter_AddRefs(req));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsRefPtr<BluetoothReplyRunnable> results =
     new BluetoothVoidReplyRunnable(req);
 
   BluetoothService* bs = BluetoothService::Get();
   NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);
-  bs->SendPlayStatus(status.duration,
-                     status.position,
-                     status.playStatus,
+  bs->SendPlayStatus(status.mDuration,
+                     status.mPosition,
+                     status.mPlayStatus,
                      results);
 
   req.forget(aRequest);
   return NS_OK;
 }
 
 NS_IMPL_EVENT_HANDLER(BluetoothAdapter, devicefound)
--- a/dom/bluetooth/BluetoothService.h
+++ b/dom/bluetooth/BluetoothService.h
@@ -269,24 +269,24 @@ public:
 
   virtual void
   IsScoConnected(BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   SendMetaData(const nsAString& aTitle,
                const nsAString& aArtist,
                const nsAString& aAlbum,
-               uint32_t aMediaNumber,
-               uint32_t aTotalMediaCount,
-               uint32_t aDuration,
+               int64_t aMediaNumber,
+               int64_t aTotalMediaCount,
+               int64_t aDuration,
                BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
-  SendPlayStatus(uint32_t aDuration,
-                 uint32_t aPosition,
+  SendPlayStatus(int64_t aDuration,
+                 int64_t aPosition,
                  const nsAString& aPlayStatus,
                  BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   UpdatePlayStatus(uint32_t aDuration,
                    uint32_t aPosition,
                    ControlPlayStatus aPlayStatus) = 0;
 
new file mode 100644
--- /dev/null
+++ b/dom/bluetooth/MediaMetaData.cpp
@@ -0,0 +1,83 @@
+/* -*- 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/ */
+
+#include "BluetoothCommon.h"
+#include "MediaMetaData.h"
+
+#include "nsCxPusher.h"
+#include "nsContentUtils.h"
+#include "nsJSUtils.h"
+#include "nsThreadUtils.h"
+
+using namespace mozilla;
+USING_BLUETOOTH_NAMESPACE
+
+MediaMetaData::MediaMetaData() : mDuration(-1)
+                               , mMediaNumber(-1)
+                               , mTotalMediaCount(-1)
+{
+}
+
+nsresult
+MediaMetaData::Init(JSContext* aCx, const jsval* aVal)
+{
+  MOZ_ASSERT(NS_IsMainThread());
+
+  if (!aCx || !aVal) {
+    return NS_OK;
+  }
+
+  if (!aVal->isObject()) {
+    return aVal->isNullOrUndefined() ? NS_OK : NS_ERROR_TYPE_ERR;
+  }
+
+  JS::RootedObject obj(aCx, &aVal->toObject());
+  nsCxPusher pusher;
+  pusher.Push(aCx);
+  JSAutoCompartment ac(aCx, obj);
+
+  JS::Value value;
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mAlbum", &value));
+  if (JSVAL_IS_STRING(value)) {
+    nsDependentJSString jsString;
+    NS_ENSURE_STATE(jsString.init(aCx, value.toString()));
+    mAlbum = jsString;
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mArtist", &value));
+  if (JSVAL_IS_STRING(value)) {
+    nsDependentJSString jsString;
+    NS_ENSURE_STATE(JSVAL_IS_STRING(value));
+    NS_ENSURE_STATE(jsString.init(aCx, value.toString()));
+    mArtist = jsString;
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mDuration", &value));
+  if (JSVAL_IS_INT(value)) {
+    NS_ENSURE_STATE(JS_ValueToInt64(aCx, value, &mDuration));
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mMediaNumber", &value));
+  if (JSVAL_IS_INT(value)) {
+    NS_ENSURE_STATE(JS_ValueToInt64(aCx, value, &mMediaNumber));
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mTitle", &value));
+  if (JSVAL_IS_STRING(value)) {
+    nsDependentJSString jsString;
+    NS_ENSURE_STATE(JSVAL_IS_STRING(value));
+    NS_ENSURE_STATE(jsString.init(aCx, value.toString()));
+    mTitle = jsString;
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mTotalMediaCount", &value));
+  if (JSVAL_IS_INT(value)) {
+    NS_ENSURE_STATE(JS_ValueToInt64(aCx, value, &mTotalMediaCount));
+  }
+
+  return NS_OK;
+}
+
new file mode 100644
--- /dev/null
+++ b/dom/bluetooth/MediaMetaData.h
@@ -0,0 +1,32 @@
+/* -*- 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/. */
+
+#ifndef mozilla_dom_bluetooth_mediametadata_h__
+#define mozilla_dom_bluetooth_mediametadata_h__
+
+#include "jsapi.h"
+#include "nsString.h"
+
+BEGIN_BLUETOOTH_NAMESPACE
+
+class MediaMetaData
+{
+public:
+  MediaMetaData();
+
+  nsresult Init(JSContext* aCx, const jsval* aVal);
+
+  nsString mAlbum;
+  nsString mArtist;
+  int64_t mDuration;
+  int64_t mMediaNumber;
+  nsString mTitle;
+  int64_t mTotalMediaCount;
+};
+
+END_BLUETOOTH_NAMESPACE
+
+#endif
new file mode 100644
--- /dev/null
+++ b/dom/bluetooth/MediaPlayStatus.cpp
@@ -0,0 +1,62 @@
+/* -*- 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/ */
+
+#include "BluetoothCommon.h"
+#include "MediaPlayStatus.h"
+
+#include "nsContentUtils.h"
+#include "nsCxPusher.h"
+#include "nsJSUtils.h"
+#include "nsThreadUtils.h"
+
+using namespace mozilla;
+USING_BLUETOOTH_NAMESPACE
+
+MediaPlayStatus::MediaPlayStatus() : mDuration(-1)
+                                     , mPosition(-1)
+{
+}
+
+nsresult
+MediaPlayStatus::Init(JSContext* aCx, const jsval* aVal)
+{
+  MOZ_ASSERT(NS_IsMainThread());
+
+  if (!aCx || !aVal) {
+    return NS_OK;
+  }
+
+  if (!aVal->isObject()) {
+    return aVal->isNullOrUndefined() ? NS_OK : NS_ERROR_TYPE_ERR;
+  }
+
+  JS::RootedObject obj(aCx, &aVal->toObject());
+  nsCxPusher pusher;
+  pusher.Push(aCx);
+  JSAutoCompartment ac(aCx, obj);
+
+  JS::Value value;
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mDuration", &value));
+  if (JSVAL_IS_INT(value)) {
+    NS_ENSURE_STATE(JS_ValueToInt64(aCx, value, &mDuration));
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mPlayStatus", &value));
+  if (JSVAL_IS_STRING(value)) {
+    nsDependentJSString jsString;
+    NS_ENSURE_STATE(JSVAL_IS_STRING(value));
+    NS_ENSURE_STATE(jsString.init(aCx, value.toString()));
+    mPlayStatus = jsString;
+  }
+
+  NS_ENSURE_STATE(JS_GetProperty(aCx, obj, "mPosition", &value));
+  if (JSVAL_IS_INT(value)) {
+    NS_ENSURE_STATE(JS_ValueToInt64(aCx, value, &mPosition));
+  }
+
+  return NS_OK;
+}
+
new file mode 100644
--- /dev/null
+++ b/dom/bluetooth/MediaPlayStatus.h
@@ -0,0 +1,29 @@
+/* -*- 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/. */
+
+#ifndef mozilla_dom_bluetooth_mediaplaystatus_h__
+#define mozilla_dom_bluetooth_mediaplaystatus_h__
+
+#include "jsapi.h"
+#include "nsString.h"
+
+BEGIN_BLUETOOTH_NAMESPACE
+
+class MediaPlayStatus
+{
+public:
+  MediaPlayStatus();
+
+  nsresult Init(JSContext* aCx, const jsval* aVal);
+
+  int64_t mDuration;
+  nsString mPlayStatus;
+  int64_t mPosition;
+};
+
+END_BLUETOOTH_NAMESPACE
+
+#endif
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
@@ -338,30 +338,30 @@ BluetoothServiceChildProcess::IsScoConne
 {
   SendRequest(aRunnable, IsScoConnectedRequest());
 }
 
 void
 BluetoothServiceChildProcess::SendMetaData(const nsAString& aTitle,
                                            const nsAString& aArtist,
                                            const nsAString& aAlbum,
-                                           uint32_t aMediaNumber,
-                                           uint32_t aTotalMediaCount,
-                                           uint32_t aDuration,
+                                           int64_t aMediaNumber,
+                                           int64_t aTotalMediaCount,
+                                           int64_t aDuration,
                                            BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
               SendMetaDataRequest(nsString(aTitle), nsString(aArtist),
                                   nsString(aAlbum), aMediaNumber,
                                   aTotalMediaCount, aDuration));
 }
 
 void
-BluetoothServiceChildProcess::SendPlayStatus(uint32_t aDuration,
-                                             uint32_t aPosition,
+BluetoothServiceChildProcess::SendPlayStatus(int64_t aDuration,
+                                             int64_t aPosition,
                                              const nsAString& aPlayStatus,
                                              BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
               SendPlayStatusRequest(aDuration, aPosition,
                                     nsString(aPlayStatus)));
 }
 
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
@@ -151,24 +151,24 @@ public:
 
   virtual void
   IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual void
   SendMetaData(const nsAString& aTitle,
                const nsAString& aArtist,
                const nsAString& aAlbum,
-               uint32_t aMediaNumber,
-               uint32_t aTotalMediaCount,
-               uint32_t aDuration,
+               int64_t aMediaNumber,
+               int64_t aTotalMediaCount,
+               int64_t aDuration,
                BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual void
-  SendPlayStatus(uint32_t aDuration,
-                 uint32_t aPosition,
+  SendPlayStatus(int64_t aDuration,
+                 int64_t aPosition,
                  const nsAString& aPlayStatus,
                  BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual void
   UpdatePlayStatus(uint32_t aDuration,
                    uint32_t aPosition,
                    ControlPlayStatus aPlayStatus) MOZ_OVERRIDE;
 
--- a/dom/bluetooth/ipc/PBluetooth.ipdl
+++ b/dom/bluetooth/ipc/PBluetooth.ipdl
@@ -141,25 +141,25 @@ struct IsScoConnectedRequest
 {
 };
 
 struct SendMetaDataRequest
 {
   nsString title;
   nsString artist;
   nsString album;
-  uint32_t mediaNumber;
-  uint32_t totalMediaCount;
-  uint32_t duration;
+  int64_t mediaNumber;
+  int64_t totalMediaCount;
+  int64_t duration;
 };
 
 struct SendPlayStatusRequest
 {
-  uint32_t duration;
-  uint32_t position;
+  int64_t duration;
+  int64_t position;
   nsString playStatus;
 };
 
 union Request
 {
   DefaultAdapterPathRequest;
   SetPropertyRequest;
   GetPropertyRequest;
--- a/dom/bluetooth/linux/BluetoothDBusService.cpp
+++ b/dom/bluetooth/linux/BluetoothDBusService.cpp
@@ -2877,19 +2877,19 @@ BluetoothDBusService::IsScoConnected(Blu
   DispatchBluetoothReply(aRunnable,
                          hfp->IsScoConnected(), EmptyString());
 }
 
 void
 BluetoothDBusService::SendMetaData(const nsAString& aTitle,
                                    const nsAString& aArtist,
                                    const nsAString& aAlbum,
-                                   uint32_t aMediaNumber,
-                                   uint32_t aTotalMediaCount,
-                                   uint32_t aDuration,
+                                   int64_t aMediaNumber,
+                                   int64_t aTotalMediaCount,
+                                   int64_t aDuration,
                                    BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!IsReady()) {
     NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
     DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
     return;
@@ -2911,20 +2911,29 @@ BluetoothDBusService::SendMetaData(const
   nsAutoString address;
   a2dp->GetAddress(address);
   nsString objectPath =
     GetObjectPathFromAddress(sAdapterPath, address);
 
   nsCString tempTitle = NS_ConvertUTF16toUTF8(aTitle);
   nsCString tempArtist = NS_ConvertUTF16toUTF8(aArtist);
   nsCString tempAlbum = NS_ConvertUTF16toUTF8(aAlbum);
-  nsCString tempMediaNumber, tempTotalMediaCount, tempDuration;
-  tempMediaNumber.AppendInt(aMediaNumber);
-  tempTotalMediaCount.AppendInt(aTotalMediaCount);
-  tempDuration.AppendInt(aDuration);
+
+  nsCString tempMediaNumber = EmptyCString();
+  nsCString tempTotalMediaCount = EmptyCString();
+  nsCString tempDuration = EmptyCString();
+  if (aMediaNumber >= 0) {
+    tempMediaNumber.AppendInt(aMediaNumber);
+  }
+  if (aTotalMediaCount >= 0) {
+    tempTotalMediaCount.AppendInt(aTotalMediaCount);
+  }
+  if (aDuration >= 0) {
+    tempDuration.AppendInt(aDuration);
+  }
 
   const char* title = tempTitle.get();
   const char* album = tempAlbum.get();
   const char* artist = tempArtist.get();
   const char* mediaNumber = tempMediaNumber.get();
   const char* totalMediaCount = tempTotalMediaCount.get();
   const char* duration = tempDuration.get();
 
@@ -2979,18 +2988,18 @@ PlayStatusStringToControlPlayStatus(cons
   } else if (aPlayStatus.EqualsLiteral("ERROR")) {
     playStatus = ControlPlayStatus::PLAYSTATUS_ERROR;
   }
 
   return playStatus;
 }
 
 void
-BluetoothDBusService::SendPlayStatus(uint32_t aDuration,
-                                     uint32_t aPosition,
+BluetoothDBusService::SendPlayStatus(int64_t aDuration,
+                                     int64_t aPosition,
                                      const nsAString& aPlayStatus,
                                      BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!IsReady()) {
     NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
     DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
@@ -2998,16 +3007,24 @@ BluetoothDBusService::SendPlayStatus(uin
   }
 
   ControlPlayStatus playStatus =
     PlayStatusStringToControlPlayStatus(aPlayStatus);
   if (playStatus == ControlPlayStatus::PLAYSTATUS_UNKNOWN) {
     DispatchBluetoothReply(aRunnable, BluetoothValue(),
                            NS_LITERAL_STRING("Invalid play status"));
     return;
+  } else if (aDuration < 0) {
+    DispatchBluetoothReply(aRunnable, BluetoothValue(),
+                           NS_LITERAL_STRING("Invalid duration"));
+    return;
+  } else if (aPosition < 0) {
+    DispatchBluetoothReply(aRunnable, BluetoothValue(),
+                           NS_LITERAL_STRING("Invalid position"));
+    return;
   }
 
   BluetoothA2dpManager* a2dp = BluetoothA2dpManager::Get();
   NS_ENSURE_TRUE_VOID(a2dp);
 
   if (!a2dp->IsConnected()) {
     DispatchBluetoothReply(aRunnable, BluetoothValue(),
                            NS_LITERAL_STRING(ERR_A2DP_IS_DISCONNECTED));
--- a/dom/bluetooth/linux/BluetoothDBusService.h
+++ b/dom/bluetooth/linux/BluetoothDBusService.h
@@ -137,24 +137,24 @@ public:
 
   virtual void
   IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual void
   SendMetaData(const nsAString& aTitle,
                const nsAString& aArtist,
                const nsAString& aAlbum,
-               uint32_t aMediaNumber,
-               uint32_t aTotalMediaCount,
-               uint32_t aDuration,
+               int64_t aMediaNumber,
+               int64_t aTotalMediaCount,
+               int64_t aDuration,
                BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual void
-  SendPlayStatus(uint32_t aDuration,
-                 uint32_t aPosition,
+  SendPlayStatus(int64_t aDuration,
+                 int64_t aPosition,
                  const nsAString& aPlayStatus,
                  BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual void
   UpdatePlayStatus(uint32_t aDuration,
                    uint32_t aPosition,
                    ControlPlayStatus aPlayStatus) MOZ_OVERRIDE;
 
--- a/dom/bluetooth/moz.build
+++ b/dom/bluetooth/moz.build
@@ -37,16 +37,18 @@ if CONFIG['MOZ_B2G_BT']:
         'BluetoothServiceChildProcess.cpp',
         'BluetoothUnixSocketConnector.cpp',
         'BluetoothA2dpManager.cpp',
         'BluetoothHfpManager.cpp',
         'BluetoothOppManager.cpp',
         'ObexBase.cpp',
         'BluetoothUuid.cpp',
         'BluetoothSocket.cpp',
+        'MediaMetaData.cpp',
+        'MediaPlayStatus.cpp'
     ]
 
     if CONFIG['MOZ_B2G_RIL']:
         CPP_SOURCES += [
             'BluetoothTelephonyListener.cpp',
         ]
 
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
--- a/js/xpconnect/src/dictionary_helper_gen.conf
+++ b/js/xpconnect/src/dictionary_helper_gen.conf
@@ -8,19 +8,17 @@ dictionaries = [
      [ 'GeoPositionOptions', 'nsIDOMGeoGeolocation.idl' ],
      [ 'DOMFileMetadataParameters', 'nsIDOMLockedFile.idl' ],
      [ 'CameraSize', 'nsIDOMCameraManager.idl' ],
      [ 'CameraRegion', 'nsIDOMCameraManager.idl' ],
      [ 'CameraPosition', 'nsIDOMCameraManager.idl' ],
      [ 'CameraSelector', 'nsIDOMCameraManager.idl' ],
      [ 'CameraRecordingOptions', 'nsIDOMCameraManager.idl' ],
      [ 'SmsThreadListItem', 'nsIMobileMessageCallback.idl' ],
-     [ 'MmsAttachment', 'nsIDOMMozMmsMessage.idl' ],
-     [ 'MediaMetaData', 'nsIDOMBluetoothAdapter.idl'],
-     [ 'MediaPlayStatus', 'nsIDOMBluetoothAdapter.idl']
+     [ 'MmsAttachment', 'nsIDOMMozMmsMessage.idl' ]
    ]
 
 # include file names
 special_includes = [
     'nsContentUtils.h',
     'xpcprivate.h',
     'XPCQuickStubs.h',
     'nsIDOMApplicationRegistry.h',