Bug 703568 - Disable Battery API by default in Firefox 10. r=sicking a=clegnitto
authorMounir Lamouri <mounir.lamouri@gmail.com>
Tue, 29 Nov 2011 17:59:02 +0100
changeset 81417 17b974e76fddcc8daf1dd875e0a2ade1a594d4a0
parent 81416 a3c26d14bbb222bbe933f1a134228bff36550778
child 81418 53b1db0a0d4b6b0e63e0c7a534fc21974a14a7ee
push id434
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 12:10:54 +0000
treeherdermozilla-beta@bddb6ed8dd47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, clegnitto
bugs703568
milestone10.0a2
Bug 703568 - Disable Battery API by default in Firefox 10. r=sicking a=clegnitto
dom/battery/BatteryManager.cpp
dom/battery/test/test_battery_basics.html
modules/libpref/src/init/all.js
--- a/dom/battery/BatteryManager.cpp
+++ b/dom/battery/BatteryManager.cpp
@@ -190,14 +190,14 @@ BatteryManager::Notify(const hal::Batter
   if (previousLevel != mLevel) {
     DispatchTrustedEventToSelf(LEVELCHANGE_EVENT_NAME);
   }
 }
 
 /* static */ bool
 BatteryManager::HasSupport()
 {
-  return Preferences::GetBool("dom.battery.enabled", true);
+  return Preferences::GetBool("dom.battery.enabled", false);
 }
 
 } // namespace battery
 } // namespace dom
 } // namespace mozilla
--- a/dom/battery/test/test_battery_basics.html
+++ b/dom/battery/test/test_battery_basics.html
@@ -9,18 +9,14 @@
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Battery API **/
 
-ok('mozBattery' in navigator, "navigator.mozBattery should exist");
-
-var battery = navigator.mozBattery;
-is(battery.level, 1.0, "Default battery level should be 1.0");
-is(battery.charging, true, "Default charging value should be true");
+ok(!('mozBattery' in navigator), "navigator.mozBattery shouldn't exist");
 
 </script>
 </pre>
 </body>
 </html>
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -3372,9 +3372,9 @@ pref("full-screen-api.warning.enabled", 
 // Time limit, in milliseconds, for nsEventStateManager::IsHandlingUserInput().
 // Used to detect long running handlers of user-generated events.
 pref("dom.event.handling-user-input-time-limit", 1000);
  
 //3D Transforms
 pref("layout.3d-transforms.enabled", true);
 
 // Battery API
-pref("dom.battery.enabled", true);
+pref("dom.battery.enabled", false);