Backed out changeset 7bb636bd183b (bug 1250106) for test_deprecated_battery_basics.html failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Mon, 07 Mar 2016 17:03:16 -0800
changeset 338020 fb5b94df3eca18d57dd685e325294d5a5b88e072
parent 338019 0e4c29a5ea1568f9ddaee553ca2f45111ecb27ef
child 338021 6312f4020b6d91372c9b4f69e5fa1c02bc1148ef
push id12405
push usercku@mozilla.com
push dateTue, 08 Mar 2016 03:35:29 +0000
bugs1250106
milestone47.0a1
backs out7bb636bd183b96f1c61ee24cd67da024d699c69c
Backed out changeset 7bb636bd183b (bug 1250106) for test_deprecated_battery_basics.html failures CLOSED TREE MozReview-Commit-ID: GuZQHh8G8YC
dom/battery/BatteryManager.cpp
--- a/dom/battery/BatteryManager.cpp
+++ b/dom/battery/BatteryManager.cpp
@@ -135,29 +135,25 @@ BatteryManager::UpdateFromBatteryInfo(co
 
   // Round to the nearest ten percent for non-chrome and non-certified apps
   nsIDocument* doc = GetOwner()->GetDoc();
   uint16_t status = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
   if (doc) {
     doc->NodePrincipal()->GetAppStatus(&status);
   }
 
-  mCharging = aBatteryInfo.charging();
-  mRemainingTime = aBatteryInfo.remainingTime();
-
   if (!nsContentUtils::IsChromeDoc(doc) &&
       status != nsIPrincipal::APP_STATUS_CERTIFIED)
   {
     mLevel = lround(mLevel * 10.0) / 10.0;
-    if (mLevel == 1.0) {
-      mCharging = false;
-      mRemainingTime = kDefaultRemainingTime;
-    }
   }
 
+  mCharging = aBatteryInfo.charging();
+  mRemainingTime = aBatteryInfo.remainingTime();
+
   // Add some guards to make sure the values are coherent.
   if (mLevel == 1.0 && mCharging == true &&
       mRemainingTime != kDefaultRemainingTime) {
     mRemainingTime = kDefaultRemainingTime;
     NS_ERROR("Battery API: When charging and level at 1.0, remaining time "
              "should be 0. Please fix your backend!");
   }
 }