Bug 697132 - Use nsCOMPtr constructor. r=Ms2ger
authorKan-Ru Chen <kanru@kanru.info>
Wed, 14 Mar 2012 18:00:29 -0400
changeset 89404 25af1ffbabcee6653351d186d83489030483daa9
parent 89403 dc72c4a740246fcd9662e4507aa7fbf69de0de94
child 89405 0975cabb34e60de276032b29db11165ee3d4474e
push id22251
push userbmo@edmorley.co.uk
push dateThu, 15 Mar 2012 12:49:51 +0000
treeherdermozilla-central@082d016c341f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs697132
milestone14.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 697132 - Use nsCOMPtr constructor. r=Ms2ger
dom/base/Navigator.cpp
dom/power/PowerManagerService.cpp
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -967,18 +967,17 @@ Navigator::GetMozPower(nsIDOMMozPowerMan
   if (!mPowerManager) {
     nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
     NS_ENSURE_TRUE(win, NS_OK);
 
     mPowerManager = new power::PowerManager();
     mPowerManager->Init(win);
   }
 
-  nsCOMPtr<nsIDOMMozPowerManager> power =
-    do_QueryInterface(NS_ISUPPORTS_CAST(nsIDOMMozPowerManager*, mPowerManager));
+  nsCOMPtr<nsIDOMMozPowerManager> power(mPowerManager);
   power.forget(aPower);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Navigator::RequestWakeLock(const nsAString &aTopic, nsIDOMMozWakeLock **aWakeLock)
 {
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -158,18 +158,17 @@ NS_IMETHODIMP
 PowerManagerService::NewWakeLock(const nsAString &aTopic,
                                  nsIDOMWindow *aWindow,
                                  nsIDOMMozWakeLock **aWakeLock)
 {
   nsRefPtr<WakeLock> wakelock = new WakeLock();
   nsresult rv = wakelock->Init(aTopic, aWindow);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<nsIDOMMozWakeLock> wl =
-    do_QueryInterface(NS_ISUPPORTS_CAST(nsIDOMMozWakeLock*, wakelock));
+  nsCOMPtr<nsIDOMMozWakeLock> wl(wakelock);
   wl.forget(aWakeLock);
 
   return NS_OK;
 }
 
 } // power
 } // dom
 } // mozilla