Bug 1041440: Create Promise using |Promise::Create|, r=btian
authorThomas Zimmermann <tdz@users.sourceforge.net>
Mon, 21 Jul 2014 12:41:29 +0200
changeset 217206 753d801d019a4508cb7e92c172d175bccbd09041
parent 217205 2165a6295412f700353e4dae1be0155b438fdb0a
child 217207 9397d4794199879c95363b379484cc724d443d48
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbtian
bugs1041440
milestone33.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 1041440: Create Promise using |Promise::Create|, r=btian This patch fixes a call to the private constructor of |Promise|.
dom/bluetooth2/BluetoothAdapter.cpp
--- a/dom/bluetooth2/BluetoothAdapter.cpp
+++ b/dom/bluetooth2/BluetoothAdapter.cpp
@@ -452,17 +452,20 @@ BluetoothAdapter::StartDiscovery(ErrorRe
 already_AddRefed<Promise>
 BluetoothAdapter::StopDiscovery(ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
-  nsRefPtr<Promise> promise = new Promise(global);
+  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
+  if (aRv.Failed()) {
+    return nullptr;
+  }
 
   /**
    * Ensure
    * - adapter is discovering,
    * - adapter is already enabled, and
    * - BluetoothService is available
    */
   BT_ENSURE_TRUE_RESOLVE(mDiscovering, JS::UndefinedHandleValue);