Bug 1259335 - Part 2: Remove deprecated navigator.battery API and tests. r=baku
authorChris Peterson <cpeterson@mozilla.com>
Mon, 06 Jun 2016 23:10:44 -0700
changeset 300837 69c00649c977ab88b19064b4dda04a90f454526f
parent 300836 c1dd7376263e4b031a77a7ad3f1cedd0a160c8a6
child 300838 8e052220dd9eb6e0f9358a6eea0743f6caa83f64
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1259335
milestone50.0a1
Bug 1259335 - Part 2: Remove deprecated navigator.battery API and tests. r=baku
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/base/nsDeprecatedOperationList.h
dom/battery/test/marionette/manifest.ini
dom/battery/test/marionette/test_battery_status_full.js
dom/battery/test/marionette/test_battery_status_not_charging.js
dom/battery/test/marionette/test_battery_status_unknown.js
dom/battery/test/marionette/test_deprecated_battery_level.js
dom/battery/test/marionette/test_deprecated_battery_status_charging.js
dom/battery/test/marionette/test_deprecated_battery_status_discharging.js
dom/battery/test/marionette/test_deprecated_battery_status_full.js
dom/battery/test/marionette/test_deprecated_battery_status_not_charging.js
dom/battery/test/marionette/test_deprecated_battery_status_unknown.js
dom/battery/test/mochitest.ini
dom/battery/test/test_battery_basics.html
dom/battery/test/test_deprecated_battery_basics.html
dom/locales/en-US/chrome/dom/dom.properties
dom/webidl/Navigator.webidl
toolkit/modules/tests/browser/browser_Battery.js
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -195,17 +195,16 @@ Navigator::Init()
   Preferences::AddUintVarCache(&sMaxVibrateMS,
                                "dom.vibrator.max_vibrate_ms", 10000);
   Preferences::AddUintVarCache(&sMaxVibrateListLen,
                                "dom.vibrator.max_vibrate_list_len", 128);
 }
 
 Navigator::Navigator(nsPIDOMWindowInner* aWindow)
   : mWindow(aWindow)
-  , mBatteryTelemetryReported(false)
 {
   MOZ_ASSERT(aWindow->IsInnerWindow(), "Navigator must get an inner window!");
 }
 
 Navigator::~Navigator()
 {
   Invalidate();
 }
@@ -299,17 +298,16 @@ Navigator::Invalidate()
   }
 
   if (mBatteryManager) {
     mBatteryManager->Shutdown();
     mBatteryManager = nullptr;
   }
 
   mBatteryPromise = nullptr;
-  mBatteryTelemetryReported = false;
 
 #ifdef MOZ_B2G_FM
   if (mFMRadio) {
     mFMRadio->Shutdown();
     mFMRadio = nullptr;
   }
 #endif
 
@@ -1600,45 +1598,16 @@ Navigator::GetBattery(ErrorResult& aRv)
     mBatteryManager->Init();
   }
 
   mBatteryPromise->MaybeResolve(mBatteryManager);
 
   return mBatteryPromise;
 }
 
-battery::BatteryManager*
-Navigator::GetDeprecatedBattery(ErrorResult& aRv)
-{
-  if (!mBatteryManager) {
-    if (!mWindow) {
-      aRv.Throw(NS_ERROR_UNEXPECTED);
-      return nullptr;
-    }
-    NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr);
-
-    mBatteryManager = new battery::BatteryManager(mWindow);
-    mBatteryManager->Init();
-  }
-
-  nsIDocument* doc = mWindow->GetDoc();
-  if (doc) {
-    doc->WarnOnceAbout(nsIDocument::eNavigatorBattery);
-  }
-
-  // Is this the first time this page has accessed navigator.battery?
-  if (!mBatteryTelemetryReported) {
-    // sample value 0 = navigator.battery
-    Telemetry::Accumulate(Telemetry::BATTERY_STATUS_COUNT, 0);
-    mBatteryTelemetryReported = true;
-  }
-
-  return mBatteryManager;
-}
-
 already_AddRefed<Promise>
 Navigator::PublishServer(const nsAString& aName,
                          const FlyWebPublishOptions& aOptions,
                          ErrorResult& aRv)
 {
   RefPtr<FlyWebService> service = FlyWebService::GetOrCreate();
   if (!service) {
     aRv.Throw(NS_ERROR_FAILURE);
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -162,17 +162,16 @@ public:
   void RegisterContentHandler(const nsAString& aMIMEType, const nsAString& aURL,
                               const nsAString& aTitle, ErrorResult& aRv);
   nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv);
   nsPluginArray* GetPlugins(ErrorResult& aRv);
   Permissions* GetPermissions(ErrorResult& aRv);
   // The XPCOM GetDoNotTrack is ok
   Geolocation* GetGeolocation(ErrorResult& aRv);
   Promise* GetBattery(ErrorResult& aRv);
-  battery::BatteryManager* GetDeprecatedBattery(ErrorResult& aRv);
 
   already_AddRefed<Promise> PublishServer(const nsAString& aName,
                                           const FlyWebPublishOptions& aOptions,
                                           ErrorResult& aRv);
   static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue);
 
   static nsresult GetPlatform(nsAString& aPlatform,
                               bool aUsePrefOverriddenValue);
@@ -398,16 +397,14 @@ private:
   RefPtr<time::TimeManager> mTimeManager;
   RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
   RefPtr<DeviceStorageAreaListener> mDeviceStorageAreaListener;
   RefPtr<Presentation> mPresentation;
 
   nsTArray<RefPtr<Promise> > mVRGetDevicesPromises;
   nsTArray<uint32_t> mRequestedVibrationPattern;
-
-  bool mBatteryTelemetryReported;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_Navigator_h
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -41,10 +41,9 @@ DEPRECATED_OPERATION(Window_Controllers)
 DEPRECATED_OPERATION(ImportXULIntoContent)
 DEPRECATED_OPERATION(PannerNodeDoppler)
 DEPRECATED_OPERATION(NavigatorGetUserMedia)
 DEPRECATED_OPERATION(WebrtcDeprecatedPrefix)
 DEPRECATED_OPERATION(RTCPeerConnectionGetStreams)
 DEPRECATED_OPERATION(AppCache)
 DEPRECATED_OPERATION(PrefixedFullscreenAPI)
 DEPRECATED_OPERATION(LenientSetter)
-DEPRECATED_OPERATION(NavigatorBattery)
 DEPRECATED_OPERATION(FileLastModifiedDate)
--- a/dom/battery/test/marionette/manifest.ini
+++ b/dom/battery/test/marionette/manifest.ini
@@ -2,14 +2,8 @@
 run-if = buildapp == 'b2g'
 
 [test_battery_level.js]
 [test_battery_status_charging.js]
 [test_battery_status_discharging.js]
 [test_battery_status_full.js]
 [test_battery_status_not_charging.js]
 [test_battery_status_unknown.js]
-[test_deprecated_battery_level.js]
-[test_deprecated_battery_status_charging.js]
-[test_deprecated_battery_status_discharging.js]
-[test_deprecated_battery_status_full.js]
-[test_deprecated_battery_status_not_charging.js]
-[test_deprecated_battery_status_unknown.js]
--- a/dom/battery/test/marionette/test_battery_status_full.js
+++ b/dom/battery/test/marionette/test_battery_status_full.js
@@ -1,14 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 MARIONETTE_TIMEOUT = 10000;
 
-var battery = window.navigator.battery;
+var battery;
 var fromStatus = "full";
 var fromCharging = true;
 
 function verifyInitialState() {
   window.navigator.getBattery().then(function (b) {
     battery = b;
     ok(battery, "battery");
     ok(battery.charging, "battery.charging");
--- a/dom/battery/test/marionette/test_battery_status_not_charging.js
+++ b/dom/battery/test/marionette/test_battery_status_not_charging.js
@@ -1,14 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 MARIONETTE_TIMEOUT = 10000;
 
-var battery = window.navigator.battery;
+var battery;
 var fromStatus = "not-charging";
 var fromCharging = false;
 
 function verifyInitialState() {
   window.navigator.getBattery().then(function (b) {
     battery = b;
     ok(battery, "battery");
     ok(battery.charging, "battery.charging");
--- a/dom/battery/test/marionette/test_battery_status_unknown.js
+++ b/dom/battery/test/marionette/test_battery_status_unknown.js
@@ -1,14 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 MARIONETTE_TIMEOUT = 10000;
 
-var battery = window.navigator.battery;
+var battery;
 var fromStatus = "unknown";
 var fromCharging = false;
 
 function verifyInitialState() {
   window.navigator.getBattery().then(function (b) {
     battery = b;
     ok(battery, "battery");
     ok(battery.charging, "battery.charging");
deleted file mode 100644
--- a/dom/battery/test/marionette/test_deprecated_battery_level.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = window.navigator.battery;
-
-function verifyInitialState() {
-  ok(battery, "battery");
-  is(battery.level, 0.5, "battery.level");
-  runEmulatorCmd("power display", function (result) {
-    is(result.pop(), "OK", "power display successful");
-    ok(result.indexOf("capacity: 50") !== -1, "power capacity");
-    setUp();
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = unexpectedEvent;
-  battery.onlevelchange = unexpectedEvent;
-  levelUp();
-}
-
-function changeCapacity(capacity, changeExpected, nextFunction) {
-  log("Changing power capacity to " + capacity);
-  if (changeExpected) {
-    battery.onlevelchange = function (event) {
-     battery.onlevelchange = unexpectedEvent;
-     is(event.type, "levelchange", "event.type");
-     is(battery.level, capacity / 100, "battery.level");
-     nextFunction();
-    };
-    runEmulatorCmd("power capacity " + capacity);
-  }
-  else {
-    runEmulatorCmd("power capacity " + capacity, function () {
-      is(battery.level, capacity / 100, "battery.level");
-      nextFunction();
-    });
-  }
-}
-
-function levelUp() {
-  changeCapacity("90", true, levelDown);
-}
-
-function levelDown() {
-  changeCapacity("10", true, levelSame);
-}
-
-function levelSame() {
-  changeCapacity("10", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = null;
-  battery.onlevelchange = function () {
-    battery.onlevelchange = null;
-    finish();
-  };
-  runEmulatorCmd("power capacity 50");
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_deprecated_battery_status_charging.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = window.navigator.battery;
-var fromStatus = "charging";
-var fromCharging = true;
-
-function verifyInitialState() {
-  ok(battery, "battery");
-  ok(battery.charging, "battery.charging");
-  runEmulatorCmd("power display", function (result) {
-    is(result.pop(), "OK", "power display successful");
-    ok(result.indexOf("status: Charging") !== -1, "power status charging");
-    setUp();
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = unexpectedEvent;
-  battery.onlevelchange = unexpectedEvent;
-  toDischarging();
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = null;
-  battery.onlevelchange = null;
-  finish();
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_deprecated_battery_status_discharging.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = window.navigator.battery;
-var fromStatus = "discharging";
-var fromCharging = false;
-
-function verifyInitialState() {
-  ok(battery, "battery");
-  ok(battery.charging, "battery.charging");
-  runEmulatorCmd("power display", function (result) {
-    is(result.pop(), "OK", "power display successful");
-    ok(result.indexOf("status: Charging") !== -1, "power status charging");
-    setUp();
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = unexpectedEvent;
-    toCharging();
-  };
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = null;
-    finish();
-  };
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging");
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_deprecated_battery_status_full.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = window.navigator.battery;
-var fromStatus = "full";
-var fromCharging = true;
-
-function verifyInitialState() {
-  ok(battery, "battery");
-  ok(battery.charging, "battery.charging");
-  runEmulatorCmd("power display", function (result) {
-    is(result.pop(), "OK", "power display successful");
-    ok(result.indexOf("status: Charging") !== -1, "power status charging");
-    setUp();
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = unexpectedEvent;
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus, toCharging);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toDischarging);
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = null;
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging", finish);
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_deprecated_battery_status_not_charging.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = window.navigator.battery;
-var fromStatus = "not-charging";
-var fromCharging = false;
-
-function verifyInitialState() {
-  ok(battery, "battery");
-  ok(battery.charging, "battery.charging");
-  runEmulatorCmd("power display", function (result) {
-    is(result.pop(), "OK", "power display successful");
-    ok(result.indexOf("status: Charging") !== -1, "power status charging");
-    setUp();
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = unexpectedEvent;
-    toCharging();
-  };
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toDischarging);
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = null;
-    finish();
-  };
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging");
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_deprecated_battery_status_unknown.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = window.navigator.battery;
-var fromStatus = "unknown";
-var fromCharging = false;
-
-function verifyInitialState() {
-  ok(battery, "battery");
-  ok(battery.charging, "battery.charging");
-  runEmulatorCmd("power display", function (result) {
-    is(result.pop(), "OK", "power display successful");
-    ok(result.indexOf("status: Charging") !== -1, "power status charging");
-    setUp();
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = unexpectedEvent;
-    toCharging();
-  };
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toDischarging);
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = null;
-    finish();
-  };
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging");
-}
-
-verifyInitialState();
--- a/dom/battery/test/mochitest.ini
+++ b/dom/battery/test/mochitest.ini
@@ -1,8 +1,6 @@
 [test_battery_basics.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 [test_battery_charging.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 [test_battery_discharging.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
-[test_deprecated_battery_basics.html]
-skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
--- a/dom/battery/test/test_battery_basics.html
+++ b/dom/battery/test/test_battery_basics.html
@@ -7,20 +7,23 @@
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
+"use strict";
+
 SimpleTest.waitForExplicitFinish();
 
 /** Test for Battery API **/
 ok("getBattery" in navigator, "navigator.getBattery should exist");
+ok(!("battery" in navigator), "navigator.battery should not exist");
 
 navigator.getBattery().then(function (battery) {
   ok(battery.level >= 0.0 && battery.level <= 1.0, "Battery level " + battery.level + " should be in the range [0.0, 1.0]");
 
   SpecialPowers.pushPrefEnv({"set": [["dom.battery.test.default", true]]}, function () {
     ok(battery.charging, "Battery should be charging by default");
     is(battery.chargingTime, 0, "Battery chargingTime " + battery.chargingTime + " should be zero by default");
     is(battery.dischargingTime, Infinity, "Battery dischargingTime should be Infinity by default");
deleted file mode 100644
--- a/dom/battery/test/test_deprecated_battery_basics.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for Battery API</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Battery API **/
-ok("battery" in navigator, "navigator.battery should exist");
-
-var battery = navigator.battery;
-ok(battery.level >= 0.0 && battery.level <= 1.0, "Battery level " + battery.level + " should be in the range [0.0, 1.0]");
-
-if (battery.charging) {
-  ok(battery.chargingTime >= 0, "Battery chargingTime " + battery.chargingTime + " should be nonnegative when charging");
-  is(battery.dischargingTime, Infinity, "Battery dischargingTime should be Infinity when charging");
-} else {
-  is(battery.chargingTime, Infinity, "Battery chargingTime should be Infinity when discharging");
-  ok(battery.dischargingTime > 0, "Battery dischargingTime " + battery.dischargingTime + " should be positive when discharging");
-}
-
-</script>
-</pre>
-</body>
-</html>
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -223,10 +223,9 @@ TargetPrincipalDoesNotMatch=Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘%S’) does not match the recipient window’s origin (‘%S’).
 # LOCALIZATION NOTE: Do not translate 'youtube'. %S values are origins, like https://domain.com:port
 RewriteYoutubeEmbed=Rewriting old-style Youtube Flash embed (%S) to iframe embed (%S). Please update page to use iframe instead of embed/object, if possible.
 # LOCALIZATION NOTE: Do not translate 'youtube'. %S values are origins, like https://domain.com:port
 RewriteYoutubeEmbedInvalidQuery=Rewriting old-style Youtube Flash embed (%S) to iframe embed (%S). Query was invalid and removed from URL. Please update page to use iframe instead of embed/object, if possible.
 # LOCALIZATION NOTE: Do not translate "ServiceWorker". %1$S is the ServiceWorker scope URL. %2$S is an error string.
 PushMessageDecryptionFailure=The ServiceWorker for scope ‘%1$S’ encountered an error decrypting a push message: ‘%2$S’. For help with encryption, please see https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Using_the_Push_API#Encryption
 # LOCALIZATION NOTE: %1$S is the type of a DOM event. 'passive' is a literal parameter from the DOM spec.
 PreventDefaultFromPassiveListenerWarning=Ignoring ‘preventDefault()’ call on event of type ‘%1$S’ from a listener registered as ‘passive’.
-NavigatorBatteryWarning=navigator.battery is deprecated. Use navigator.getBattery() instead.
 FileLastModifiedDateWarning=File.lastModifiedDate is deprecated. Use File.lastModified instead.
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -127,21 +127,16 @@ interface NavigatorGeolocation {
   readonly attribute Geolocation geolocation;
 };
 Navigator implements NavigatorGeolocation;
 
 // http://www.w3.org/TR/battery-status/#navigatorbattery-interface
 partial interface Navigator {
   [Throws, Pref="dom.battery.enabled"]
   Promise<BatteryManager> getBattery();
-  // Deprecated. Use getBattery() instead.
-  // XXXbz Per spec this should be non-nullable, but we return null in
-  // torn-down windows.  See bug 884925.
-  [Throws, Pref="dom.battery.enabled", BinaryName="deprecatedBattery"]
-  readonly attribute BatteryManager? battery;
 };
 
 partial interface Navigator {
   [NewObject, Pref="dom.flyweb.enabled"]
   Promise<FlyWebPublishedServer> publishServer(DOMString name,
                                                optional FlyWebPublishOptions options);
 };
 
--- a/toolkit/modules/tests/browser/browser_Battery.js
+++ b/toolkit/modules/tests/browser/browser_Battery.js
@@ -5,40 +5,16 @@
 var imported = Components.utils.import("resource://gre/modules/Battery.jsm", this);
 Cu.import("resource://gre/modules/Services.jsm", this);
 
 function test() {
   waitForExplicitFinish();
 
   is(imported.Debugging.fake, false, "Battery spoofing is initially false")
 
-  // begin deprecated battery API testing
-  for (let k of ["charging", "chargingTime", "dischargingTime", "level"]) {
-    Assert.throws(() => Battery[k] = 10, "Setting battery " + k + "preference without spoofing enabled should throw");
-    ok(Battery[k] == Services.appShell.hiddenDOMWindow.navigator.battery[k], "Battery "+ k + " is correctly set");
-  }
-  imported.Debugging.fake = true;
-
-  Battery.charging = true;
-  Battery.chargingTime = 100;
-  Battery.level = 0.5;
-  ok(Battery.charging, "Test for charging setter");
-  is(Battery.chargingTime, 100, "Test for chargingTime setter");
-  is(Battery.level, 0.5, "Test for level setter");
-
-  Battery.charging = false;
-  Battery.dischargingTime = 50;
-  Battery.level = 0.7;
-  ok(!Battery.charging, "Test for charging setter");
-  is(Battery.dischargingTime, 50, "Test for dischargingTime setter");
-  is(Battery.level, 0.7, "Test for level setter");
-
-  imported.Debugging.fake = false;
-  // end deprecated battery API testing
-
   GetBattery().then(function (battery) {
     for (let k of ["charging", "chargingTime", "dischargingTime", "level"]) {
       let backup = battery[k];
       battery[k] = "__magic__";
       is(battery[k], backup, "Setting battery " + k + "preference without spoofing enabled should fail");
     }
 
     imported.Debugging.fake = true;