Bug 1300884 - Remove the alarms API; r=fabrice
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 06 Sep 2016 16:28:31 -0400
changeset 313063 b85b4f18f956a51d3b63a73b058006d81aa22624
parent 313062 6d68d4884890523adb0c5179f76f16ff7f5f25b9
child 313064 1b808c63a394eabe5251b3849332d39bb57e753a
push id30669
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 00:56:12 +0000
treeherdermozilla-central@77940cbf0c2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs1300884
milestone51.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 1300884 - Remove the alarms API; r=fabrice
b2g/app/b2g.js
dom/alarm/AlarmDB.jsm
dom/alarm/AlarmHalService.cpp
dom/alarm/AlarmHalService.h
dom/alarm/AlarmService.jsm
dom/alarm/AlarmsManager.js
dom/alarm/AlarmsManager.manifest
dom/alarm/moz.build
dom/alarm/nsIAlarmHalService.idl
dom/alarm/test/chrome.ini
dom/alarm/test/file_empty.html
dom/alarm/test/mochitest.ini
dom/alarm/test/system_message_chrome_script.js
dom/alarm/test/test_alarm_add_data.html
dom/alarm/test/test_alarm_add_date.html
dom/alarm/test/test_alarm_add_respectTimezone.html
dom/alarm/test/test_alarm_change_system_clock.js
dom/alarm/test/test_alarm_non_permitted_app.html
dom/alarm/test/test_alarm_permitted_app.html
dom/alarm/test/test_alarm_remove.html
dom/alarm/test/test_bug1015540.html
dom/alarm/test/test_bug1037079.html
dom/alarm/test/test_bug1090896.html
dom/alarm/test/xpcshell.ini
dom/moz.build
dom/permission/tests/mochitest.ini
dom/permission/tests/test_alarms.html
dom/speakermanager/tests/test_speakermanager.html
dom/webidl/AlarmsManager.webidl
dom/webidl/moz.build
layout/build/nsLayoutModule.cpp
modules/libpref/init/all.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -398,19 +398,16 @@ pref("network.gonk.ms-release-mms-connec
 // Shortnumber matching needed for e.g. Brazil:
 // 03187654321 can be found with 87654321
 pref("dom.phonenumber.substringmatching.BR", 8);
 pref("dom.phonenumber.substringmatching.CO", 10);
 pref("dom.phonenumber.substringmatching.VE", 7);
 pref("dom.phonenumber.substringmatching.CL", 8);
 pref("dom.phonenumber.substringmatching.PE", 7);
 
-// WebAlarms
-pref("dom.mozAlarms.enabled", true);
-
 // NetworkStats
 #ifdef MOZ_WIDGET_GONK
 pref("dom.mozNetworkStats.enabled", true);
 pref("dom.webapps.firstRunWithSIM", true);
 #endif
 
 // ResourceStats
 #ifdef MOZ_WIDGET_GONK
deleted file mode 100644
--- a/dom/alarm/AlarmDB.jsm
+++ /dev/null
@@ -1,140 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-this.EXPORTED_SYMBOLS = ["AlarmDB"];
-
-/* static functions */
-const DEBUG = false;
-
-function debug(aStr) {
-  if (DEBUG)
-    dump("AlarmDB: " + aStr + "\n");
-}
-
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
-
-const ALARMDB_NAME    = "alarms";
-const ALARMDB_VERSION = 1;
-const ALARMSTORE_NAME = "alarms";
-
-this.AlarmDB = function AlarmDB() {
-  debug("AlarmDB()");
-}
-
-AlarmDB.prototype = {
-  __proto__: IndexedDBHelper.prototype,
-
-  init: function init() {
-    debug("init()");
-
-    this.initDBHelper(ALARMDB_NAME, ALARMDB_VERSION, [ALARMSTORE_NAME]);
-  },
-
-  upgradeSchema: function upgradeSchema(aTransaction, aDb,
-                                        aOldVersion, aNewVersion) {
-    debug("upgradeSchema()");
-
-    let objStore =
-      aDb.createObjectStore(ALARMSTORE_NAME,
-                            { keyPath: "id", autoIncrement: true });
-
-    objStore.createIndex("date",           "date",           { unique: false });
-    objStore.createIndex("ignoreTimezone", "ignoreTimezone", { unique: false });
-    objStore.createIndex("timezoneOffset", "timezoneOffset", { unique: false });
-    objStore.createIndex("data",           "data",           { unique: false });
-    objStore.createIndex("pageURL",        "pageURL",        { unique: false });
-    objStore.createIndex("manifestURL",    "manifestURL",    { unique: false });
-
-    debug("Created object stores and indexes");
-  },
-
-  /**
-   * @param aAlarm
-   *        The record to be added.
-   * @param aSuccessCb
-   *        Callback function to invoke with result ID.
-   * @param aErrorCb [optional]
-   *        Callback function to invoke when there was an error.
-   */
-  add: function add(aAlarm, aSuccessCb, aErrorCb) {
-    debug("add()");
-
-    this.newTxn("readwrite", ALARMSTORE_NAME, function txnCb(aTxn, aStore) {
-      debug("Going to add " + JSON.stringify(aAlarm));
-      aStore.put(aAlarm).onsuccess = function setTxnResult(aEvent) {
-        aTxn.result = aEvent.target.result;
-        debug("Request successful. New record ID: " + aTxn.result);
-      };
-    }, aSuccessCb, aErrorCb);
-  },
-
-  /**
-   * @param aId
-   *        The ID of record to be removed.
-   * @param aManifestURL
-   *        The manifest URL of the app that alarm belongs to.
-   *        If null, directly remove the ID record; otherwise,
-   *        need to check if the alarm belongs to this app.
-   * @param aSuccessCb
-   *        Callback function to invoke with result.
-   * @param aErrorCb [optional]
-   *        Callback function to invoke when there was an error.
-   */
-  remove: function remove(aId, aManifestURL, aSuccessCb, aErrorCb) {
-    debug("remove()");
-
-    this.newTxn("readwrite", ALARMSTORE_NAME, function txnCb(aTxn, aStore) {
-      debug("Going to remove " + aId);
-
-      // Look up the existing record and compare the manifestURL
-      // to see if the alarm to be removed belongs to this app.
-      aStore.get(aId).onsuccess = function doRemove(aEvent) {
-        let alarm = aEvent.target.result;
-
-        if (!alarm) {
-          debug("Alarm doesn't exist. No need to remove it.");
-          return;
-        }
-
-        if (aManifestURL && aManifestURL != alarm.manifestURL) {
-          debug("Cannot remove the alarm added by other apps.");
-          return;
-        }
-
-        aStore.delete(aId);
-      };
-    }, aSuccessCb, aErrorCb);
-  },
-
-  /**
-   * @param aManifestURL
-   *        The manifest URL of the app that alarms belong to.
-   *        If null, directly return all alarms; otherwise,
-   *        only return the alarms that belong to this app.
-   * @param aSuccessCb
-   *        Callback function to invoke with result array.
-   * @param aErrorCb [optional]
-   *        Callback function to invoke when there was an error.
-   */
-  getAll: function getAll(aManifestURL, aSuccessCb, aErrorCb) {
-    debug("getAll()");
-
-    this.newTxn("readonly", ALARMSTORE_NAME, function txnCb(aTxn, aStore) {
-      if (!aTxn.result) {
-        aTxn.result = [];
-      }
-
-      let index = aStore.index("manifestURL");
-      index.mozGetAll(aManifestURL).onsuccess = function setTxnResult(aEvent) {
-        aTxn.result = aEvent.target.result;
-        debug("Request successful. Record count: " + aTxn.result.length);
-      };
-    }, aSuccessCb, aErrorCb);
-  }
-};
deleted file mode 100644
--- a/dom/alarm/AlarmHalService.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "AlarmHalService.h"
-
-namespace mozilla {
-namespace dom {
-namespace alarm {
-
-using namespace hal;
-
-NS_IMPL_ISUPPORTS(AlarmHalService, nsIAlarmHalService)
-
-void
-AlarmHalService::Init()
-{
-  mAlarmEnabled = RegisterTheOneAlarmObserver(this);
-  if (!mAlarmEnabled) {
-    return;
-  }
-  RegisterSystemTimezoneChangeObserver(this);
-  RegisterSystemClockChangeObserver(this);
-}
-
-/* virtual */ AlarmHalService::~AlarmHalService()
-{
-  if (mAlarmEnabled) {
-    UnregisterTheOneAlarmObserver();
-    UnregisterSystemTimezoneChangeObserver(this);
-    UnregisterSystemClockChangeObserver(this);
-  }
-}
-
-/* static */ StaticRefPtr<AlarmHalService> AlarmHalService::sSingleton;
-
-/* static */ already_AddRefed<AlarmHalService>
-AlarmHalService::GetInstance()
-{
-  if (!sSingleton) {
-    sSingleton = new AlarmHalService();
-    sSingleton->Init();
-    ClearOnShutdown(&sSingleton);
-  }
-
-  RefPtr<AlarmHalService> service = sSingleton.get();
-  return service.forget();
-}
-
-NS_IMETHODIMP
-AlarmHalService::SetAlarm(int32_t aSeconds, int32_t aNanoseconds, bool* aStatus)
-{
-  if (!mAlarmEnabled) {
-    return NS_ERROR_FAILURE;
-  }
-
-  bool status = hal::SetAlarm(aSeconds, aNanoseconds);
-  if (status) {
-    *aStatus = status;
-    return NS_OK;
-  } else {
-    return NS_ERROR_FAILURE;
-  }
-}
-
-NS_IMETHODIMP
-AlarmHalService::SetAlarmFiredCb(nsIAlarmFiredCb* aAlarmFiredCb)
-{
-  mAlarmFiredCb = aAlarmFiredCb;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-AlarmHalService::SetTimezoneChangedCb(nsITimezoneChangedCb* aTimeZoneChangedCb)
-{
-  mTimezoneChangedCb = aTimeZoneChangedCb;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-AlarmHalService::SetSystemClockChangedCb(
-    nsISystemClockChangedCb* aSystemClockChangedCb)
-{
-  mSystemClockChangedCb = aSystemClockChangedCb;
-  return NS_OK;
-}
-
-void
-AlarmHalService::Notify(const void_t& aVoid)
-{
-  if (!mAlarmFiredCb) {
-    return;
-  }
-  mAlarmFiredCb->OnAlarmFired();
-}
-
-void
-AlarmHalService::Notify(
-  const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
-{
-  if (!mTimezoneChangedCb) {
-    return;
-  }
-  mTimezoneChangedCb->OnTimezoneChanged(
-    aSystemTimezoneChangeInfo.newTimezoneOffsetMinutes());
-}
-
-void
-AlarmHalService::Notify(const int64_t& aClockDeltaMS)
-{
-  if (!mSystemClockChangedCb) {
-    return;
-  }
-  mSystemClockChangedCb->OnSystemClockChanged(aClockDeltaMS);
-}
-
-} // namespace alarm
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/alarm/AlarmHalService.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_alarm_AlarmHalService_h
-#define mozilla_dom_alarm_AlarmHalService_h
-
-#include "base/basictypes.h"
-#include "mozilla/ClearOnShutdown.h"
-#include "mozilla/StaticPtr.h"
-#include "mozilla/Hal.h"
-#include "mozilla/Services.h"
-#include "nsIAlarmHalService.h"
-#include "nsIObserver.h"
-#include "nsIObserverService.h"
-
-namespace mozilla {
-namespace dom {
-namespace alarm {
-
-typedef Observer<void_t> AlarmObserver;
-typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
-typedef Observer<int64_t> SystemClockChangeObserver;
-
-class AlarmHalService : public nsIAlarmHalService,
-                        public AlarmObserver,
-                        public SystemTimezoneChangeObserver,
-                        public SystemClockChangeObserver
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIALARMHALSERVICE
-
-  AlarmHalService()
-    : mAlarmEnabled(false)
-  {}
-
-  void Init();
-
-  static already_AddRefed<AlarmHalService> GetInstance();
-
-  // Implementing hal::AlarmObserver
-  void Notify(const void_t& aVoid) override;
-
-  // Implementing hal::SystemTimezoneChangeObserver
-  void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) override;
-
-  // Implementing hal::SystemClockChangeObserver
-  void Notify(const int64_t& aClockDeltaMS) override;
-
-private:
-  virtual ~AlarmHalService();
-
-  bool mAlarmEnabled;
-  static StaticRefPtr<AlarmHalService> sSingleton;
-
-  nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
-  nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
-  nsCOMPtr<nsISystemClockChangedCb> mSystemClockChangedCb;
-};
-
-} // namespace alarm
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_alarm_AlarmHalService_h
deleted file mode 100644
--- a/dom/alarm/AlarmService.jsm
+++ /dev/null
@@ -1,633 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AlarmDB.jsm");
-Cu.import("resource://gre/modules/Log.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
-
-function getLogger() {
-  var logger = Log.repository.getLogger("AlarmsService");
-  logger.addAppender(new Log.DumpAppender(new Log.BasicFormatter()));
-  logger.level = Log.Level.Debug;
-  return logger;
-}
-
-const logger = getLogger();
-
-/* Only log in B2G */
-function debug(aStr) {
-  AppConstants.MOZ_B2G && logger.debug(aStr);
-}
-
-this.EXPORTED_SYMBOLS = ["AlarmService"];
-
-XPCOMUtils.defineLazyGetter(this, "appsService", function() {
-  return Cc["@mozilla.org/AppsService;1"].getService(Ci.nsIAppsService);
-});
-
-XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
-                                   "@mozilla.org/parentprocessmessagemanager;1",
-                                   "nsIMessageListenerManager");
-
-XPCOMUtils.defineLazyGetter(this, "messenger", function() {
-  return Cc["@mozilla.org/system-message-internal;1"]
-           .getService(Ci.nsISystemMessagesInternal);
-});
-
-XPCOMUtils.defineLazyGetter(this, "powerManagerService", function() {
-  return Cc["@mozilla.org/power/powermanagerservice;1"]
-           .getService(Ci.nsIPowerManagerService);
-});
-
-/**
- * AlarmService provides an API to schedule alarms using the device's RTC.
- *
- * AlarmService is primarily used by the mozAlarms API (navigator.mozAlarms)
- * which uses IPC to communicate with the service.
- *
- * AlarmService can also be used by Gecko code by importing the module and then
- * using AlarmService.add() and AlarmService.remove(). Only Gecko code running
- * in the parent process should do this.
- */
-
-this.AlarmService = {
-  lastChromeId: 0,
-
-  init: function init() {
-    debug("init()");
-
-    Services.obs.addObserver(this, "profile-change-teardown", false);
-    Services.obs.addObserver(this, "webapps-clear-data",false);
-
-    this._currentTimezoneOffset = (new Date()).getTimezoneOffset();
-
-    let alarmHalService = this._alarmHalService =
-      Cc["@mozilla.org/alarmHalService;1"].getService(Ci.nsIAlarmHalService);
-
-    alarmHalService.setAlarmFiredCb(this._onAlarmFired.bind(this));
-    alarmHalService.setTimezoneChangedCb(this._onTimezoneChanged.bind(this));
-    alarmHalService.setSystemClockChangedCb(
-      this._onSystemClockChanged.bind(this));
-
-    // Add the messages to be listened to.
-    this._messages = ["AlarmsManager:GetAll",
-                      "AlarmsManager:Add",
-                      "AlarmsManager:Remove"];
-    this._messages.forEach(function addMessage(msgName) {
-      ppmm.addMessageListener(msgName, this);
-    }.bind(this));
-
-    // Set the indexeddb database.
-    this._db = new AlarmDB();
-    this._db.init();
-
-    // Variable to save alarms waiting to be set.
-    this._alarmQueue = [];
-
-    this._restoreAlarmsFromDb();
-  },
-
-  // Getter/setter to access the current alarm set in system.
-  _alarm: null,
-  get _currentAlarm() {
-    return this._alarm;
-  },
-  set _currentAlarm(aAlarm) {
-    this._alarm = aAlarm;
-    if (!aAlarm) {
-      return;
-    }
-
-    let alarmTimeInMs = this._getAlarmTime(aAlarm);
-    let ns = (alarmTimeInMs % 1000) * 1000000;
-    if (!this._alarmHalService.setAlarm(alarmTimeInMs / 1000, ns)) {
-      throw Components.results.NS_ERROR_FAILURE;
-    }
-  },
-
-  receiveMessage: function receiveMessage(aMessage) {
-    debug("receiveMessage(): " + aMessage.name);
-    let json = aMessage.json;
-
-    // To prevent the hacked child process from sending commands to parent
-    // to schedule alarms, we need to check its permission and manifest URL.
-    if (this._messages.indexOf(aMessage.name) != -1) {
-      if (!aMessage.target.assertPermission("alarms")) {
-        debug("Got message from a child process with no 'alarms' permission.");
-        return null;
-      }
-
-      if (!aMessage.target.assertContainApp(json.manifestURL)) {
-        debug("Got message from a child process containing illegal manifest URL.");
-        return null;
-      }
-    }
-
-    let mm = aMessage.target.QueryInterface(Ci.nsIMessageSender);
-
-    switch (aMessage.name) {
-      case "AlarmsManager:GetAll":
-        this._db.getAll(json.manifestURL,
-          function getAllSuccessCb(aAlarms) {
-            debug("Callback after getting alarms from database: " +
-                  JSON.stringify(aAlarms));
-
-            this._sendAsyncMessage(mm, "GetAll", true, json.requestId, aAlarms);
-          }.bind(this),
-          function getAllErrorCb(aErrorMsg) {
-            this._sendAsyncMessage(mm, "GetAll", false, json.requestId, aErrorMsg);
-          }.bind(this));
-        break;
-
-      case "AlarmsManager:Add":
-        // Prepare a record for the new alarm to be added.
-        let newAlarm = { date: json.date,
-                         ignoreTimezone: json.ignoreTimezone,
-                         data: json.data,
-                         pageURL: json.pageURL,
-                         manifestURL: json.manifestURL };
-
-        this.add(newAlarm, null,
-          // Receives the alarm ID as the last argument.
-          this._sendAsyncMessage.bind(this, mm, "Add", true, json.requestId),
-          // Receives the error message as the last argument.
-          this._sendAsyncMessage.bind(this, mm, "Add", false, json.requestId));
-        break;
-
-      case "AlarmsManager:Remove":
-        this.remove(json.id, json.manifestURL);
-        break;
-
-      default:
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-        break;
-    }
-  },
-
-  _sendAsyncMessage: function _sendAsyncMessage(aMessageManager, aMessageName,
-                                                aSuccess, aRequestId, aData) {
-    debug("_sendAsyncMessage()");
-
-    if (!aMessageManager) {
-      debug("Invalid message manager: null");
-      throw Components.results.NS_ERROR_FAILURE;
-    }
-
-    let json = null;
-    switch (aMessageName) {
-      case "Add":
-        json = aSuccess ?
-          { requestId: aRequestId, id: aData } :
-          { requestId: aRequestId, errorMsg: aData };
-        break;
-
-      case "GetAll":
-        json = aSuccess ?
-          { requestId: aRequestId, alarms: aData } :
-          { requestId: aRequestId, errorMsg: aData };
-        break;
-
-      default:
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-        break;
-    }
-
-    aMessageManager.sendAsyncMessage("AlarmsManager:" + aMessageName +
-                                       ":Return:" + (aSuccess ? "OK" : "KO"),
-                                     json);
-  },
-
-  _removeAlarmFromDb: function _removeAlarmFromDb(aId, aManifestURL,
-                                                  aRemoveSuccessCb) {
-    debug("_removeAlarmFromDb()");
-
-    // If the aRemoveSuccessCb is undefined or null, set a dummy callback for
-    // it which is needed for _db.remove().
-    if (!aRemoveSuccessCb) {
-      aRemoveSuccessCb = function removeSuccessCb() {
-        debug("Remove alarm from DB successfully.");
-      };
-    }
-
-    // Is this a chrome alarm?
-    if (aId < 0) {
-      aRemoveSuccessCb();
-      return;
-    }
-
-    this._db.remove(aId, aManifestURL, aRemoveSuccessCb,
-                    function removeErrorCb(aErrorMsg) {
-                      throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-                    });
-  },
-
-  /**
-   * Create a copy of the alarm that does not expose internal fields to
-   * receivers and sticks to the public |respectTimezone| API rather than the
-   * boolean |ignoreTimezone| field.
-   */
-  _publicAlarm: function _publicAlarm(aAlarm) {
-    let alarm = { "id": aAlarm.id,
-                  "date": aAlarm.date,
-                  "respectTimezone": aAlarm.ignoreTimezone ?
-                                       "ignoreTimezone" : "honorTimezone",
-                  "data": aAlarm.data };
-
-    return alarm;
-  },
-
-  _fireSystemMessage: function _fireSystemMessage(aAlarm) {
-    debug("Fire system message: " + JSON.stringify(aAlarm));
-
-    let manifestURI = Services.io.newURI(aAlarm.manifestURL, null, null);
-    let pageURI = Services.io.newURI(aAlarm.pageURL, null, null);
-
-    messenger.sendMessage("alarm",
-                          this._publicAlarm(aAlarm),
-                          pageURI,
-                          manifestURI);
-  },
-
-  _notifyAlarmObserver: function _notifyAlarmObserver(aAlarm) {
-    debug("_notifyAlarmObserver()");
-
-    let wakeLock = powerManagerService.newWakeLock("cpu");
-
-    let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-    timer.initWithCallback(() => {
-      debug("_notifyAlarmObserver - timeout()");
-      if (aAlarm.manifestURL) {
-        this._fireSystemMessage(aAlarm);
-      } else if (typeof aAlarm.alarmFiredCb === "function") {
-        aAlarm.alarmFiredCb(this._publicAlarm(aAlarm));
-      }
-
-      wakeLock.unlock();
-    }, 0, Ci.nsITimer.TYPE_ONE_SHOT);
-  },
-
-  _onAlarmFired: function _onAlarmFired() {
-    debug("_onAlarmFired()");
-
-    if (this._currentAlarm) {
-      let currentAlarmTime = this._getAlarmTime(this._currentAlarm);
-
-      // If a alarm fired before the actual time that the current
-      // alarm should occur, we reset this current alarm.
-      if (currentAlarmTime > Date.now()) {
-        let currentAlarm = this._currentAlarm;
-        this._currentAlarm = currentAlarm;
-
-        this._debugCurrentAlarm();
-        return;
-      }
-
-      this._removeAlarmFromDb(this._currentAlarm.id, null);
-      // We need to clear the current alarm before notifying because chrome
-      // alarms may add a new alarm during their callback, and we do not want
-      // to clobber it.
-      let firingAlarm = this._currentAlarm;
-      this._currentAlarm = null;
-      this._notifyAlarmObserver(firingAlarm);
-    }
-
-    // Reset the next alarm from the queue.
-    let alarmQueue = this._alarmQueue;
-    while (alarmQueue.length > 0) {
-      let nextAlarm = alarmQueue.shift();
-      let nextAlarmTime = this._getAlarmTime(nextAlarm);
-
-      // If the next alarm has been expired, directly notify the observer.
-      // it instead of setting it.
-      if (nextAlarmTime <= Date.now()) {
-        this._removeAlarmFromDb(nextAlarm.id, null);
-        this._notifyAlarmObserver(nextAlarm);
-      } else {
-        this._currentAlarm = nextAlarm;
-        break;
-      }
-    }
-
-    this._debugCurrentAlarm();
-  },
-
-  _onTimezoneChanged: function _onTimezoneChanged(aTimezoneOffset) {
-    debug("_onTimezoneChanged()");
-
-    this._currentTimezoneOffset = aTimezoneOffset;
-    this._restoreAlarmsFromDb();
-  },
-
-  _onSystemClockChanged: function _onSystemClockChanged(aClockDeltaMS) {
-    debug("_onSystemClockChanged");
-    this._restoreAlarmsFromDb();
-  },
-
-  _restoreAlarmsFromDb: function _restoreAlarmsFromDb() {
-    debug("_restoreAlarmsFromDb()");
-
-    this._db.getAll(null,
-      function getAllSuccessCb(aAlarms) {
-        debug("Callback after getting alarms from database: " +
-              JSON.stringify(aAlarms));
-
-        // Clear any alarms set or queued in the cache if coming from db.
-        let alarmQueue = this._alarmQueue;
-        if (this._currentAlarm) {
-          alarmQueue.unshift(this._currentAlarm);
-          this._currentAlarm = null;
-        }
-        for (let i = 0; i < alarmQueue.length;) {
-          if (alarmQueue[i]['id'] < 0) {
-            ++i;
-            continue;
-          }
-          alarmQueue.splice(i, 1);
-        }
-
-        // Only restore the alarm that's not yet expired; otherwise, remove it
-        // from the database and notify the observer.
-        aAlarms.forEach(function addAlarm(aAlarm) {
-          if ("manifestURL" in aAlarm && aAlarm.manifestURL &&
-              this._getAlarmTime(aAlarm) > Date.now()) {
-            alarmQueue.push(aAlarm);
-          } else {
-            this._removeAlarmFromDb(aAlarm.id, null);
-            this._notifyAlarmObserver(aAlarm);
-          }
-        }.bind(this));
-
-        // Set the next alarm from the queue.
-        if (alarmQueue.length) {
-          alarmQueue.sort(this._sortAlarmByTimeStamps.bind(this));
-          this._currentAlarm = alarmQueue.shift();
-        }
-
-        this._debugCurrentAlarm();
-      }.bind(this),
-      function getAllErrorCb(aErrorMsg) {
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-      });
-  },
-
-  _getAlarmTime: function _getAlarmTime(aAlarm) {
-    // Avoid casting a Date object to a Date again to
-    // preserve milliseconds. See bug 810973.
-    let alarmTime;
-    if (aAlarm.date instanceof Date) {
-      alarmTime = aAlarm.date.getTime();
-    } else {
-      alarmTime = (new Date(aAlarm.date)).getTime();
-    }
-
-    // For an alarm specified with "ignoreTimezone", it must be fired respect
-    // to the user's timezone.  Supposing an alarm was set at 7:00pm at Tokyo,
-    // it must be gone off at 7:00pm respect to Paris' local time when the user
-    // is located at Paris.  We can adjust the alarm UTC time by calculating
-    // the difference of the orginal timezone and the current timezone.
-    if (aAlarm.ignoreTimezone) {
-      alarmTime +=
-        (this._currentTimezoneOffset - aAlarm.timezoneOffset) * 60000;
-    }
-    return alarmTime;
-  },
-
-  _sortAlarmByTimeStamps: function _sortAlarmByTimeStamps(aAlarm1, aAlarm2) {
-    return this._getAlarmTime(aAlarm1) - this._getAlarmTime(aAlarm2);
-  },
-
-  _debugCurrentAlarm: function _debugCurrentAlarm() {
-    debug("Current alarm: " + JSON.stringify(this._currentAlarm));
-    debug("Alarm queue: " + JSON.stringify(this._alarmQueue));
-  },
-
-  /**
-   *
-   * Add a new alarm. This will set the RTC to fire at the selected date and
-   * notify the caller. Notifications are delivered via System Messages if the
-   * alarm is added on behalf of a app. Otherwise aAlarmFiredCb is called.
-   *
-   * @param object aNewAlarm
-   *        Should contain the following literal properties:
-   *          - |date| date: when the alarm should timeout.
-   *          - |ignoreTimezone| boolean: See [1] for the details.
-   *          - |manifestURL| string: Manifest of app on whose behalf the alarm
-   *                                  is added.
-   *          - |pageURL| string: The page in the app that receives the system
-   *                              message.
-   *          - |data| object [optional]: Data that can be stored in DB.
-   * @param function aAlarmFiredCb
-   *        Callback function invoked when the alarm is fired.
-   *        It receives a single argument, the alarm object.
-   *        May be null.
-   * @param function aSuccessCb
-   *        Callback function to receive an alarm ID (number).
-   * @param function aErrorCb
-   *        Callback function to receive an error message (string).
-   * @returns void
-   *
-   * Notes:
-   * [1] https://wiki.mozilla.org/WebAPI/AlarmAPI#Proposed_API
-   */
-
-  add: function(aNewAlarm, aAlarmFiredCb, aSuccessCb, aErrorCb) {
-    debug("add(" + aNewAlarm.date + ")");
-
-    aSuccessCb = aSuccessCb || function() {};
-    aErrorCb = aErrorCb || function() {};
-
-    if (!aNewAlarm) {
-      aErrorCb("alarm is null");
-      return;
-    }
-
-    if (!aNewAlarm.date) {
-      aErrorCb("alarm.date is null");
-      return;
-    }
-
-    aNewAlarm['timezoneOffset'] = this._currentTimezoneOffset;
-
-    if ("manifestURL" in aNewAlarm) {
-      this._db.add(aNewAlarm,
-        function addSuccessCb(aNewId) {
-          debug("Callback after adding alarm in database.");
-          this.processNewAlarm(aNewAlarm, aNewId, aAlarmFiredCb, aSuccessCb);
-        }.bind(this),
-        function addErrorCb(aErrorMsg) {
-          aErrorCb(aErrorMsg);
-        }.bind(this));
-    } else {
-      // alarms without manifests are managed by chrome code. For them we use
-      // negative IDs.
-      this.processNewAlarm(aNewAlarm, --this.lastChromeId, aAlarmFiredCb,
-                           aSuccessCb);
-    }
-  },
-
-  processNewAlarm: function(aNewAlarm, aNewId, aAlarmFiredCb, aSuccessCb) {
-    aNewAlarm['id'] = aNewId;
-
-    // Now that the alarm has been added to the database, we can tack on
-    // the non-serializable callback to the in-memory object.
-    aNewAlarm['alarmFiredCb'] = aAlarmFiredCb;
-
-    // If the new alarm already expired at this moment, we directly
-    // notify this alarm
-    let newAlarmTime = this._getAlarmTime(aNewAlarm);
-    if (newAlarmTime < Date.now()) {
-      aSuccessCb(aNewId);
-      this._removeAlarmFromDb(aNewAlarm.id, null);
-      this._notifyAlarmObserver(aNewAlarm);
-      return;
-    }
-
-    // If there is no alarm being set in system, set the new alarm.
-    if (this._currentAlarm == null) {
-      this._currentAlarm = aNewAlarm;
-      this._debugCurrentAlarm();
-      aSuccessCb(aNewId);
-      return;
-    }
-
-    // If the new alarm is earlier than the current alarm, swap them and
-    // push the previous alarm back to the queue.
-    let alarmQueue = this._alarmQueue;
-    let currentAlarmTime = this._getAlarmTime(this._currentAlarm);
-    if (newAlarmTime < currentAlarmTime) {
-      alarmQueue.unshift(this._currentAlarm);
-      this._currentAlarm = aNewAlarm;
-      this._debugCurrentAlarm();
-      aSuccessCb(aNewId);
-      return;
-    }
-
-    // Push the new alarm in the queue.
-    alarmQueue.push(aNewAlarm);
-    alarmQueue.sort(this._sortAlarmByTimeStamps.bind(this));
-    this._debugCurrentAlarm();
-    aSuccessCb(aNewId);
-  },
-
-  /*
-   * Remove the alarm associated with an ID.
-   *
-   * @param number aAlarmId
-   *        The ID of the alarm to be removed.
-   * @param string aManifestURL
-   *        Manifest URL for application which added the alarm. (Optional)
-   * @returns void
-   */
-  remove: function(aAlarmId, aManifestURL) {
-    debug("remove(" + aAlarmId + ", " + aManifestURL + ")");
-
-    this._removeAlarmFromDb(aAlarmId, aManifestURL,
-      function removeSuccessCb() {
-        debug("Callback after removing alarm from database.");
-
-        // If there are no alarms set, nothing to do.
-        if (!this._currentAlarm) {
-          debug("No alarms set.");
-          return;
-        }
-
-        // Check if the alarm to be removed is in the queue and whether it
-        // belongs to the requesting app.
-        let alarmQueue = this._alarmQueue;
-        if (this._currentAlarm.id != aAlarmId ||
-            this._currentAlarm.manifestURL != aManifestURL) {
-
-          for (let i = 0; i < alarmQueue.length; i++) {
-            if (alarmQueue[i].id == aAlarmId &&
-                alarmQueue[i].manifestURL == aManifestURL) {
-
-              alarmQueue.splice(i, 1);
-              break;
-            }
-          }
-          this._debugCurrentAlarm();
-          return;
-        }
-
-        // The alarm to be removed is the current alarm reset the next alarm
-        // from the queue if any.
-        if (alarmQueue.length) {
-          this._currentAlarm = alarmQueue.shift();
-          this._debugCurrentAlarm();
-          return;
-        }
-
-        // No alarm waiting to be set in the queue.
-        this._currentAlarm = null;
-        this._debugCurrentAlarm();
-      }.bind(this));
-  },
-
-  observe: function(aSubject, aTopic, aData) {
-    debug("observe(): " + aTopic);
-
-    switch (aTopic) {
-      case "profile-change-teardown":
-        this.uninit();
-        break;
-
-      case "webapps-clear-data":
-        let params =
-          aSubject.QueryInterface(Ci.mozIApplicationClearPrivateDataParams);
-        if (!params) {
-          debug("Error! Fail to remove alarms for an uninstalled app.");
-          return;
-        }
-
-        // Only remove alarms for apps.
-        if (params.browserOnly) {
-          return;
-        }
-
-        let manifestURL = appsService.getManifestURLByLocalId(params.appId);
-        if (!manifestURL) {
-          debug("Error! Fail to remove alarms for an uninstalled app.");
-          return;
-        }
-
-        this._db.getAll(manifestURL,
-          function getAllSuccessCb(aAlarms) {
-            aAlarms.forEach(function removeAlarm(aAlarm) {
-              this.remove(aAlarm.id, manifestURL);
-            }, this);
-          }.bind(this),
-          function getAllErrorCb(aErrorMsg) {
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-          });
-        break;
-    }
-  },
-
-  uninit: function uninit() {
-    debug("uninit()");
-
-    Services.obs.removeObserver(this, "profile-change-teardown");
-    Services.obs.removeObserver(this, "webapps-clear-data");
-
-    this._messages.forEach(function(aMsgName) {
-      ppmm.removeMessageListener(aMsgName, this);
-    }.bind(this));
-    ppmm = null;
-
-    if (this._db) {
-      this._db.close();
-    }
-    this._db = null;
-
-    this._alarmHalService = null;
-  }
-}
-
-AlarmService.init();
deleted file mode 100644
--- a/dom/alarm/AlarmsManager.js
+++ /dev/null
@@ -1,227 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/* static functions */
-const DEBUG = false;
-const REQUEST_CPU_LOCK_TIMEOUT = 10 * 1000; // 10 seconds.
-
-function debug(aStr) {
-  if (DEBUG)
-    dump("AlarmsManager: " + aStr + "\n");
-}
-
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gPowerManagerService",
-                                   "@mozilla.org/power/powermanagerservice;1",
-                                   "nsIPowerManagerService");
-
-function AlarmsManager() {
-  debug("Constructor");
-
-  // A <requestId, {cpuLock, timer}> map.
-  this._cpuLockDict = new Map();
-}
-
-AlarmsManager.prototype = {
-  __proto__: DOMRequestIpcHelper.prototype,
-
-  contractID : "@mozilla.org/alarmsManager;1",
-
-  classID : Components.ID("{fea1e884-9b05-11e1-9b64-87a7016c3860}"),
-
-  QueryInterface : XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
-                                          Ci.nsISupportsWeakReference,
-                                          Ci.nsIObserver]),
-
-  add: function add(aDate, aRespectTimezone, aData) {
-    debug("add()");
-
-    if (!this._manifestURL) {
-      debug("Cannot add alarms for non-installed apps.");
-      throw Components.results.NS_ERROR_FAILURE;
-    }
-
-    if (!aDate) {
-      throw Components.results.NS_ERROR_INVALID_ARG;
-    }
-
-    let isIgnoreTimezone = true;
-
-    switch (aRespectTimezone) {
-      case "honorTimezone":
-        isIgnoreTimezone = false;
-        break;
-
-      case "ignoreTimezone":
-        isIgnoreTimezone = true;
-        break;
-
-      default:
-        throw Components.results.NS_ERROR_INVALID_ARG;
-        break;
-    }
-
-    let data = aData;
-    if (aData) {
-      // Run JSON.stringify() in the sand box with the principal of the calling
-      // web page to ensure no cross-origin object is involved. A "Permission
-      // Denied" error will be thrown in case of privilege violation.
-      let sandbox = new Cu.Sandbox(Cu.getWebIDLCallerPrincipal());
-      sandbox.data = aData;
-      data = JSON.parse(Cu.evalInSandbox("JSON.stringify(data)", sandbox));
-    }
-    let request = this.createRequest();
-    let requestId = this.getRequestId(request);
-    this._lockCpuForRequest(requestId);
-    this._cpmm.sendAsyncMessage("AlarmsManager:Add",
-                                { requestId: requestId,
-                                  date: aDate,
-                                  ignoreTimezone: isIgnoreTimezone,
-                                  data: data,
-                                  pageURL: this._pageURL,
-                                  manifestURL: this._manifestURL });
-    return request;
-  },
-
-  remove: function remove(aId) {
-    debug("remove()");
-
-    this._cpmm.sendAsyncMessage("AlarmsManager:Remove",
-                                { id: aId, manifestURL: this._manifestURL });
-  },
-
-  getAll: function getAll() {
-    debug("getAll()");
-
-    let request = this.createRequest();
-    this._cpmm.sendAsyncMessage("AlarmsManager:GetAll",
-                                { requestId: this.getRequestId(request),
-                                  manifestURL: this._manifestURL });
-    return request;
-  },
-
-  receiveMessage: function receiveMessage(aMessage) {
-    debug("receiveMessage(): " + aMessage.name);
-
-    let json = aMessage.json;
-    let request = this.getRequest(json.requestId);
-
-    if (!request) {
-      debug("No request stored! " + json.requestId);
-      return;
-    }
-
-    switch (aMessage.name) {
-      case "AlarmsManager:Add:Return:OK":
-        this._unlockCpuForRequest(json.requestId);
-        Services.DOMRequest.fireSuccess(request, json.id);
-        break;
-
-      case "AlarmsManager:GetAll:Return:OK":
-        // We don't need to expose everything to the web content.
-        let alarms = [];
-        json.alarms.forEach(function trimAlarmInfo(aAlarm) {
-          let alarm = { "id": aAlarm.id,
-                        "date": aAlarm.date,
-                        "respectTimezone": aAlarm.ignoreTimezone ?
-                                             "ignoreTimezone" : "honorTimezone",
-                        "data": aAlarm.data };
-          alarms.push(alarm);
-        });
-
-        Services.DOMRequest.fireSuccess(request,
-                                        Cu.cloneInto(alarms, this._window));
-        break;
-
-      case "AlarmsManager:Add:Return:KO":
-        this._unlockCpuForRequest(json.requestId);
-        Services.DOMRequest.fireError(request, json.errorMsg);
-        break;
-
-      case "AlarmsManager:GetAll:Return:KO":
-        Services.DOMRequest.fireError(request, json.errorMsg);
-        break;
-
-      default:
-        debug("Wrong message: " + aMessage.name);
-        break;
-    }
-
-    this.removeRequest(json.requestId);
-   },
-
-  // nsIDOMGlobalPropertyInitializer implementation
-  init: function init(aWindow) {
-    debug("init()");
-
-    this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
-                   .getService(Ci.nsISyncMessageSender);
-
-    // Add the valid messages to be listened.
-    this.initDOMRequestHelper(aWindow, ["AlarmsManager:Add:Return:OK",
-                                        "AlarmsManager:Add:Return:KO",
-                                        "AlarmsManager:GetAll:Return:OK",
-                                        "AlarmsManager:GetAll:Return:KO"]);
-
-    // Get the manifest URL if this is an installed app
-    let appsService = Cc["@mozilla.org/AppsService;1"]
-                        .getService(Ci.nsIAppsService);
-    let principal = aWindow.document.nodePrincipal;
-    this._pageURL = principal.URI.spec;
-    this._manifestURL = appsService.getManifestURLByLocalId(principal.appId);
-    this._window = aWindow;
-  },
-
-  // Called from DOMRequestIpcHelper.
-  uninit: function uninit() {
-    debug("uninit()");
-  },
-
-  _lockCpuForRequest: function (aRequestId) {
-    if (this._cpuLockDict.has(aRequestId)) {
-      debug('Cpu wakelock for request ' + aRequestId + ' has been acquired. ' +
-            'You may call this function repeatedly or requestId is collision.');
-      return;
-    }
-
-    // Acquire a lock for given request and save for lookup lately.
-    debug('Acquire cpu lock for request ' + aRequestId);
-    let cpuLockInfo = {
-      cpuLock: gPowerManagerService.newWakeLock("cpu"),
-      timer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
-    };
-    this._cpuLockDict.set(aRequestId, cpuLockInfo);
-
-    // Start a timer to prevent from non-responding request.
-    cpuLockInfo.timer.initWithCallback(() => {
-      debug('Request timeout! Release the cpu lock');
-      this._unlockCpuForRequest(aRequestId);
-    }, REQUEST_CPU_LOCK_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT);
-  },
-
-  _unlockCpuForRequest: function(aRequestId) {
-    let cpuLockInfo = this._cpuLockDict.get(aRequestId);
-    if (!cpuLockInfo) {
-      debug('The cpu lock for requestId ' + aRequestId + ' is either invalid ' +
-            'or has been released.');
-      return;
-    }
-
-    // Release the cpu lock and cancel the timer.
-    debug('Release the cpu lock for ' + aRequestId);
-    cpuLockInfo.cpuLock.unlock();
-    cpuLockInfo.timer.cancel();
-    this._cpuLockDict.delete(aRequestId);
-  },
-
-}
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AlarmsManager])
deleted file mode 100644
--- a/dom/alarm/AlarmsManager.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {fea1e884-9b05-11e1-9b64-87a7016c3860} AlarmsManager.js
-contract @mozilla.org/alarmsManager;1 {fea1e884-9b05-11e1-9b64-87a7016c3860}
deleted file mode 100644
--- a/dom/alarm/moz.build
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPIDL_SOURCES += [
-    'nsIAlarmHalService.idl',
-]
-
-XPIDL_MODULE = 'dom_alarm'
-
-EXPORTS.mozilla.dom.alarm += [
-    'AlarmHalService.h',
-]
-
-SOURCES += [
-    'AlarmHalService.cpp',
-]
-
-EXTRA_COMPONENTS += [
-    'AlarmsManager.js',
-    'AlarmsManager.manifest',
-]
-
-EXTRA_JS_MODULES += [
-    'AlarmDB.jsm',
-    'AlarmService.jsm',
-]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-FINAL_LIBRARY = 'xul'
-
-MOCHITEST_MANIFESTS += ['test/mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
-
-XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
deleted file mode 100644
--- a/dom/alarm/nsIAlarmHalService.idl
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-[scriptable, function, uuid(53dec7f9-bb51-4c3a-98ab-80d5d750c9dd)]
-interface nsIAlarmFiredCb : nsISupports
-{
-  void onAlarmFired();
-};
-
-[scriptable, function, uuid(e6662911-c066-4358-9388-8661065c65a2)]
-interface nsITimezoneChangedCb : nsISupports
-{
-  void onTimezoneChanged(in int32_t aTimezoneOffset);
-};
-
-[scriptable, function, uuid(46ece987-a3ec-4124-906f-d99c83296ac6)]
-interface nsISystemClockChangedCb : nsISupports
-{
-  void onSystemClockChanged(in int32_t aClockDeltaMS);
-};
-
-%{C++
-#define NS_ALARMHALSERVICE_CID { 0x7dafea4c, 0x7163, 0x4b70, { 0x95, 0x4e, 0x5a, 0xd4, 0x09, 0x94, 0x83, 0xd7 } }
-#define ALARMHALSERVICE_CONTRACTID "@mozilla.org/alarmHalService;1"
-%}
-
-[scriptable, uuid(35074214-f50d-4f9a-b173-8d564dfa657d)]
-interface nsIAlarmHalService : nsISupports
-{
-  bool setAlarm(in int32_t aSeconds, in int32_t aNanoseconds);
-  void setAlarmFiredCb(in nsIAlarmFiredCb aAlarmFiredCb);
-  void setTimezoneChangedCb(in nsITimezoneChangedCb aTimezoneChangedCb);
-  void setSystemClockChangedCb(in nsISystemClockChangedCb aSystemClockChangedCb);
-};
-
-
-
deleted file mode 100644
--- a/dom/alarm/test/chrome.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-run-if = buildapp == 'b2g' || buildapp == 'mulet'
-support-files =
-  file_empty.html
-  system_message_chrome_script.js
-
-[test_alarm_permitted_app.html]
deleted file mode 100644
--- a/dom/alarm/test/file_empty.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<!DOCTYPE html>
-<html><head></head><body><span id="text">Nothing to see here</span><iframe name="subframe"></iframe></body></html>
deleted file mode 100644
--- a/dom/alarm/test/mochitest.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[DEFAULT]
-run-if = buildapp == 'b2g' || buildapp == 'mulet'
-support-files =
-  file_empty.html
-  system_message_chrome_script.js
-
-[test_alarm_add_data.html]
-[test_alarm_add_date.html]
-[test_alarm_add_respectTimezone.html]
-[test_alarm_non_permitted_app.html]
-[test_alarm_remove.html]
-[test_bug1015540.html]
-[test_bug1037079.html]
-[test_bug1090896.html]
deleted file mode 100644
--- a/dom/alarm/test/system_message_chrome_script.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-'use strict';
-
-var { classes: Cc, interfaces: Ci } = Components;
-
-const systemMessenger = Cc["@mozilla.org/system-message-internal;1"]
-                          .getService(Ci.nsISystemMessagesInternal);
-const ioService = Cc["@mozilla.org/network/io-service;1"]
-                    .getService(Ci.nsIIOService);
-
-addMessageListener("trigger-register-page", function(aData) {
-  systemMessenger.registerPage(aData.type,
-                               ioService.newURI(aData.pageURL, null, null),
-                               ioService.newURI(aData.manifestURL, null, null));
-  sendAsyncMessage("page-registered");
-});
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_add_data.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test data Paramter for Alarm API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  // Verify passing {} for the data paramter
-  function testEmptyObject() {
-    var tomorrow = new Date();
-    tomorrow.setDate(tomorrow.getDate() + 1);
-
-    var data = {};
-
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "honorTimezone", data);
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for tomorrow for empty object test.");
-
-      return testEmptyList();
-    }
-    domRequest.onsuccess = function(e) {
-      var alarmId = e.target.result;
-
-      // Confirm the alarm added has the data we requested
-      var allReq;
-      try {
-        allReq = navigator.mozAlarms.getAll();
-      } catch (e) {
-        ok(false,
-          "Unexpected exception trying to get all alarms for empty object test.");
-
-        return testEmptyList();
-      }
-      allReq.onsuccess = function(ev) {
-        navigator.mozAlarms.remove(alarmId);
-
-        var found = false;
-        ev.target.result.forEach(function(alarm, i, arr) {
-          if (alarm.id == alarmId) {
-            // Found the one we added
-            ok(Object.keys(alarm.data).length === 0,
-               "Empty object passed for data parameter for new alarm.");
-
-            found = true;
-          }
-        });
-
-        if (!found) {
-          ok(false, "Couldn't find alarm that was added for empty object test.");
-        }
-
-        testEmptyList();
-      }
-      allReq.onerror = function(e) {
-        ok(false, "Unable to get all alarms for empty object test.");
-
-        testEmptyList();
-      }
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for tomorrow for empty object test.");
-
-      testEmptyList();
-    };
-
-  }
-
-  // Verify passing [] for the data paramter
-  function testEmptyList() {
-    var tomorrow = new Date();
-    tomorrow.setDate(tomorrow.getDate() + 1);
-
-    var data = [];
-
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "honorTimezone", data);
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for tomorrow for empty list test.");
-
-      return testNull();
-    }
-    domRequest.onsuccess = function(e) {
-      var alarmId = e.target.result;
-
-      // Confirm the alarm added has the data we requested
-      var allReq;
-      try {
-        allReq = navigator.mozAlarms.getAll();
-      } catch (e) {
-        ok(false,
-          "Unexpected exception trying to get all alarms for empty list test.");
-
-        return testNull();
-      }
-      allReq.onsuccess = function(ev) {
-        navigator.mozAlarms.remove(alarmId);
-
-        var found = false;
-        ev.target.result.forEach(function(alarm, i, arr) {
-          if (alarm.id == alarmId) {
-            // Found the one we added
-            ok(alarm.data.length === 0,
-               "Empty list passed for data parameter for new alarm.");
-
-            found = true;
-          }
-        });
-
-        if (!found) {
-          ok(false, "Couldn't find alarm that was added for empty list test.");
-        }
-
-        testNull();
-      }
-      allReq.onerror = function(e) {
-        ok(false, "Unable to get all alarms for empty list test.");
-
-        testNull();
-      }
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for tomorrow for empty list test.");
-
-      testNull();
-    };
-
-  }
-
-  // Verify passing null for the data paramter
-  function testNull() {
-    var tomorrow = new Date();
-    tomorrow.setDate(tomorrow.getDate() + 1);
-
-    var data = null;
-
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "honorTimezone", data);
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for tomorrow for null test.");
-      return SimpleTest.finish();
-    }
-    domRequest.onsuccess = function(e) {
-      var alarmId = e.target.result;
-
-      // Confirm the alarm added has the data we requested
-      var allReq;
-      try {
-        allReq = navigator.mozAlarms.getAll();
-      } catch (e) {
-        ok(false,
-          "Unexpected exception trying to get all alarms for null test.");
-        return SimpleTest.finish();
-      }
-      allReq.onsuccess = function(ev) {
-        navigator.mozAlarms.remove(alarmId);
-
-        var found = false;
-        ev.target.result.forEach(function(alarm, i, arr) {
-          if (alarm.id == alarmId) {
-            // Found the one we added
-            ok(alarm.data === null,
-               "Null passed for data parameter for new alarm.");
-
-            found = true;
-          }
-        });
-
-        if (!found) {
-          ok(false, "Couldn't find alarm that was added for null test.");
-        }
-        SimpleTest.finish();
-      }
-      allReq.onerror = function(e) {
-        ok(false, "Unable to get all alarms for null test.");
-        SimpleTest.finish();
-      }
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for tomorrow for null test.");
-      SimpleTest.finish();
-    };
-
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-        testEmptyObject();
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.expectAssertions(0, 9);
-  SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("alarms", document)) {
-    startTests();
-  } else {
-    // Add the permission and reload the page so it propogates
-    SpecialPowers.addPermission("alarms", true, document);
-    window.location.reload();
-  }
-
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_add_date.html
+++ /dev/null
@@ -1,146 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test date Paramter for Alarm API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  // Verify passing a Date in the future doesn't fail
-  function testFutureDate() {
-    var tomorrow = new Date();
-    tomorrow.setDate(tomorrow.getDate() + 1);
-
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "honorTimezone", {});
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for tomorrow.");
-
-      // Proceed to next test.
-      return testPastDate();
-    }
-    domRequest.onsuccess = function(e) {
-      navigator.mozAlarms.remove(e.target.result);
-      ok(true, "Add alarm for future date.");
-
-      // Awesome, no error so proceed to next test.
-      testPastDate();
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for tomorrow`.");
-
-      // Proceed to next test.
-      testPastDate();
-    };
-  }
-
-  // Verify passing a Date that's already past doesn't fail (it should fire immediately).
-  function testPastDate() {
-    var yesterday = new Date();
-    yesterday.setDate(yesterday.getDate() - 1);
-
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(yesterday, "honorTimezone", {});
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for yesterday.");
-
-      // Move on to the next test.
-      return testNullDate();
-    }
-    domRequest.onsuccess = function(e) {
-      navigator.mozAlarms.remove(e.target.result);
-
-      ok(true, "Should be able to add alarm for already past date, which should fire immediately.");
-
-      // Move on to the next test.
-      testNullDate();
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for yesterday.");
-
-      // Move on to the next test.
-      testNullDate();
-    }
-  }
-
-  // Verify passing null does indeed fail
-  function testNullDate() {
-    try {
-      navigator.mozAlarms.add(null, "honorTimezone", {});
-      ok(false, "Expected an exception to be thrown for alarm with null date.");
-    } catch(e) {
-      ok(true, "Exception thrown for alarm with null date.");
-    }
-
-    // Move on to the next test.
-    testInvalidTimeZone()
-  }
-
-  function testInvalidTimeZone() {
-    try {
-      navigator.mozAlarms.add(new Date(), "badTimeZoneArg", {});
-      ok(false, "Expected an exception to be thrown while testing bad time zone arg.");
-    } catch(e) {
-      ok(true, "Exception thrown while testing bad time zone arg.");
-    }
-    SimpleTest.finish();
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-        testFutureDate();
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.expectAssertions(0, 9);
-  SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("alarms", document)) {
-    startTests();
-  } else {
-    // Add the permissions and reload so they propogate
-    SpecialPowers.addPermission("alarms", true, document);
-    window.location.reload();
-  }
-
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_add_respectTimezone.html
+++ /dev/null
@@ -1,170 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test respectTimezone Parameter for Alarm API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  // Verify passing `honorTimezone` doesn't fail
-  function testHonorTimezone(tomorrow) {
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "honorTimezone", {});
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for tomorrow with `honorTimezone`.");
-      return testIgnoreTimezone(tomorrow);
-    }
-    domRequest.onsuccess = function(e) {
-      navigator.mozAlarms.remove(e.target.result);
-
-      ok(true, "Passing `honorTimezone` for repectTimezone argument.");
-      testIgnoreTimezone(tomorrow);
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for tomorrow with `honorTimezone`.");
-      testIgnoreTimezone(tomorrow);
-    };
-
-  }
-
-  // Verify passing `ignoreTimezone` doesn't fail
-  function testIgnoreTimezone(tomorrow) {
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "ignoreTimezone", {});
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to add alarm for tomorrow with `ignoreTimezone`.");
-      return testBadInput(tomorrow);
-    }
-    domRequest.onsuccess = function(e) {
-      navigator.mozAlarms.remove(e.target.result);
-
-      ok(true, "Passing `ignoreTimezone` for respectTimezone argument.");
-      testBadInput(tomorrow);
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to add alarm for tomorrow with `ignoreTimezone`.");
-      testBadInput(tomorrow);
-    }
-  }
-
-  // Verify passing a string that's not `honorTimezone` or `ignoreTimezone`
-  // does fail
-  function testBadInput(tomorrow) {
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, "badinput", {});
-    } catch (e) {
-      ok(true, "Bad input for repectTimezone does indeed fail.");
-
-      // Errors, as it should. On to the next test.
-      return testNull(tomorrow);
-    }
-    domRequest.onsuccess = function(e) {
-      // Welp, this shouldn't happen
-      ok(false, "Malformed input accepted for `respectTimezone` param.");
-      testNull(tomorrow);
-    };
-  }
-
-  // Verify passing null does indeed fail
-  function testNull(tomorrow) {
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.add(tomorrow, null, {});
-    } catch(e) {
-      ok(true, "Passing null for respectTimezone does indeed fail.");
-
-      // Exception thrown, on to the next test
-      return testMisspelt(tomorrow);
-    }
-    domRequest.onsuccess = function(e) {
-      // Null should not be valid
-      ok(false, "Null should not be accepted as input for `respectTimezone` param.");
-      testMisspelt(tomorrow);
-    };
-  }
-
-  // Verify that misspelling does indeed fail
-  function testMisspelt(tomorrow) {
-    var domRequest;
-    try {
-      // Missing the e in `ignoreTimezone`
-      domRequest = navigator.mozAlarms.add(tomorrow, "ignoreTimzone", {});
-    } catch (e) {
-      ok(true, "Misspelling `ignoreTimezone` does indeed fail.");
-
-      // Exception thrown, all is right in the world.
-      // All done with tests now.
-      return SimpleTest.finish();
-    }
-    domRequest.onsuccess = function(e) {
-      // The misspelled word should not be valid
-      ok(false, "Misspelt parameter should fail.");
-      SimpleTest.finish();
-    };
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-
-        // Arbitrary date to use for tests
-        var tomorrow = new Date();
-        tomorrow.setDate(tomorrow.getDate() + 1);
-
-        // Kick off the tests
-        testHonorTimezone(tomorrow);
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.expectAssertions(0, 9);
-  SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("alarms", document)) {
-    startTests();
-  } else {
-    // Add the permission and reload the page so it propogates
-    SpecialPowers.addPermission("alarms", true, document);
-    window.location.reload();
-  }
-
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_change_system_clock.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Components.utils.import("resource://gre/modules/AlarmService.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gTimeService",
-                                   "@mozilla.org/time/timeservice;1",
-                                   "nsITimeService");
-
-const ALARM_OFFSET = 10000; // 10 seconds.
-const CLOCK_OFFSET = 20000; // 20 seconds.
-const MANIFEST_URL = "http://dummyurl.com/manifest.webapp";
-
-var alarmDate;
-var alarmFired;
-function alarmCb() {
-  alarmFired = true;
-};
-
-function run_test() {
-  do_get_profile();
-  Services.prefs.setBoolPref("dom.mozAlarms.enabled", true);
-  run_next_test();
-}
-
-/* Tests */
-
-add_test(function test_getAll() {
-  do_print("= There should not be any alarm =");
-  AlarmService._db.getAll(MANIFEST_URL, (aAlarms) => {
-    do_check_eq(aAlarms.length, 0);
-    run_next_test();
-  });
-});
-
-add_test(function test_addAlarm() {
-  do_print("= Set alarm =");
-  alarmDate = Date.now() + ALARM_OFFSET;
-  AlarmService.add({
-    date: alarmDate,
-    manifestURL: MANIFEST_URL
-  }, alarmCb, run_next_test, do_throw);
-});
-
-add_test(function test_alarmNotFired() {
-  do_print("= The alarm should be in the DB and pending =");
-  AlarmService._db.getAll(MANIFEST_URL, aAlarms => {
-    do_check_eq(aAlarms.length, 1, "The alarm is in the DB");
-    run_next_test();
-  });
-});
-
-add_test(function test_changeSystemClock() {
-  do_print("= Change system clock =");
-  gTimeService.set(Date.now() + CLOCK_OFFSET);
-  run_next_test();
-});
-
-add_test(function test_alarmFired() {
-  do_print("= The alarm should have been fired and removed from the DB =");
-  do_check_true(alarmFired, "The alarm was fired");
-  AlarmService._db.getAll(MANIFEST_URL, aAlarms => {
-    do_check_eq(aAlarms.length, 0, "No alarms in the DB");
-    run_next_test();
-  });
-});
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_non_permitted_app.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test Non-Permitted Application for Alarm 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">
-
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-if (SpecialPowers.hasPermission("alarms", document)) {
-  SpecialPowers.removePermission("alarms", document);
-  window.location.reload();
-} else {
-  SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
-    SpecialPowers.removePermission("alarms", document);
-    ok(!('mozAlarms' in navigator),
-       "navigator.mozAlarms should not exist without permission");
-    ok(!('AlarmsManager' in window),
-       "Interface AlarmsManager should not exist without permission");
-    SpecialPowers.addPermission("alarms", true, document);
-    SimpleTest.finish();
-  });
-}
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_permitted_app.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test Permitted Application for Alarm API</title>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script type="application/javascript">
-
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-
-SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
-  // mozAlarms is installed on all platforms except Android for the moment.
-  if (navigator.appVersion.indexOf("Android") != -1) {
-    try {
-      todo('mozAlarms' in navigator,
-           "mozAlarms is not allowed on Android for now. TODO Bug 863557.");
-    } catch (e) {
-      todo(!e, "('mozAlarms' in navigator) should not throw exceptions once " +
-               "mozAlarms is installed on Android. TODO Bug 863557. " +
-               "Caught exception: " + e);
-    }
-  } else {
-    ok('AlarmsManager' in window, "Interface AlarmsManager should exist");
-    ok('mozAlarms' in navigator, "navigator.mozAlarms should exist");
-    ok(navigator.mozAlarms instanceof AlarmsManager,
-       "navigator.mozAlarms should be an instance of AlarmsManager");
-  }
-
-  SimpleTest.finish();
-});
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_alarm_remove.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test Adding and Removing Alarms with Alarm API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  function checkNumberOfAlarms(n, cbk) {
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.getAll();
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to get all alarms.");
-      return cbk();
-    }
-    domRequest.onsuccess = function(e) {
-      ok(e.target.result.length === n, "Correct number of alarms set.");
-      cbk();
-    }
-  }
-
-  // Add alarm and then remove it
-  function testAddRemove() {
-    var tomorrow = new Date();
-    tomorrow.setDate(tomorrow.getDate() + 1);
-
-    var domRequest;
-    try {
-      domRequest = navigator.mozAlarms.getAll();
-    } catch (e) {
-      ok(false,
-         "Unexpected exception trying to get all alarms.");
-
-      return SimpleTest.finish();
-    }
-    domRequest.onsuccess = function(e) {
-      var initialAlarmsN = e.target.result.length;
-
-      var dr;
-      try {
-        dr = navigator.mozAlarms.add(tomorrow, "honorTimezone", null);
-      } catch (e) {
-        ok(false,
-           "Unexpected exception trying add alarm.");
-
-        return SimpleTest.finish();
-      }
-      dr.onsuccess = function(ev) {
-        var alarmId = ev.target.result;
-
-        checkNumberOfAlarms(initialAlarmsN + 1, function() {
-          navigator.mozAlarms.remove(alarmId);
-
-          checkNumberOfAlarms(initialAlarmsN, function() {
-            SimpleTest.finish();
-          });
-        });
-      }
-
-    }
-
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-        testAddRemove();
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.expectAssertions(0, 9);
-  SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("alarms", document)) {
-    startTests();
-  } else {
-    // Add the permission and reload so it's propogated
-    SpecialPowers.addPermission("alarms", true, document);
-    window.location.reload();
-  }
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_bug1015540.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test data Paramter of Alarm API for Bug 1015540</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1015540">Bug 1015540</a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  // Verify passing a cross-origin object for the data paramter
-  function testCrossOriginObject() {
-    var tomorrow = new Date();
-    tomorrow.setDate(tomorrow.getDate() + 1);
-
-    var data = document.getElementById('ifr').contentWindow;
-
-    try {
-      navigator.mozAlarms.add(tomorrow, "honorTimezone", data);
-      ok(false, "Adding alarms for cross-origin objects should be prohibited.");
-    } catch (e) {
-      ok(true, "Adding alarms for cross-origin objects is prohibited.");
-    }
-
-    SimpleTest.finish();
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-   	  SpecialPowers.addPermission("alarms", true, document);
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-        testCrossOriginObject();
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  </script>
-</pre>
-<iframe id="ifr" onload="startTests()" src="http://example.org/tests/dom/alarm/test/file_empty.html"></iframe>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_bug1037079.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test time alert is fired for Bug 1037079</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  function registerPage() {
-    var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
-    gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
-      gScript.removeMessageListener("page-registered", pageRegisteredHandler);
-      gScript.destroy();
-      testFireTimeAlert();
-    });
-
-    gScript.sendAsyncMessage("trigger-register-page",
-                             { type: "alarm",
-                               manifestURL: window.location.origin + "/manifest.webapp",
-                               pageURL: window.location.href });
-  }
-
-  function testFireTimeAlert() {
-    var secondsLater = new Date();
-    secondsLater.setSeconds(secondsLater.getSeconds() + 10);
-
-    var domRequest;
-    try {
-      // Set system message handler.
-      navigator.mozSetMessageHandler('alarm', function(message){
-        ok(true, "Time alert has been fired.");
-        SimpleTest.finish();
-      });
-
-      domRequest = navigator.mozAlarms.add(secondsLater, "honorTimezone",
-                                           {type: "timer"});
-    } catch (e) {
-      ok(false, "Unexpected exception trying to set time alert.");
-
-      return SimpleTest.finish();
-    }
-    domRequest.onsuccess = function(e) {
-      ok(true, "Set time alert. Waiting to be fired.");
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to set time alert.");
-
-      SimpleTest.finish();
-    };
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-        registerPage();
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.expectAssertions(0, 9);
-  SimpleTest.waitForExplicitFinish();
-  if (SpecialPowers.hasPermission("alarms", document)) {
-    startTests();
-  } else {
-    // Add the permissions and reload so they propogate
-    SpecialPowers.addPermission("alarms", true, document);
-    window.location.reload();
-  }
-
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/test_bug1090896.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test time alert is fired for Bug 1090896</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  function registerPage() {
-    var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
-    gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
-      gScript.removeMessageListener("page-registered", pageRegisteredHandler);
-      gScript.destroy();
-      testFireTimeAlertWithNoData();
-    });
-
-    gScript.sendAsyncMessage("trigger-register-page",
-                             { type: "alarm",
-                               manifestURL: window.location.origin + "/manifest.webapp",
-                               pageURL: window.location.href });
-  }
-
-  function testFireTimeAlertWithNoData() {
-    var secondsLater = new Date();
-    secondsLater.setSeconds(secondsLater.getSeconds() + 1);
-
-    var domRequest;
-    try {
-      // Set system message handler.
-      navigator.mozSetMessageHandler('alarm', function(message){
-        ok(true, "Time alert has been fired.");
-        SimpleTest.finish();
-      });
-
-      domRequest = navigator.mozAlarms.add(secondsLater, "honorTimezone");
-    } catch (e) {
-      ok(false, "Unexpected exception trying to set time alert. " + e);
-
-      return SimpleTest.finish();
-    }
-    domRequest.onsuccess = function(e) {
-      ok(true, "Set time alert. Waiting to be fired.");
-    };
-    domRequest.onerror = function(e) {
-      ok(false, "Unable to set time alert.");
-
-      SimpleTest.finish();
-    };
-  }
-
-  function startTests() {
-    SpecialPowers.pushPrefEnv({
-      "set": [["dom.mozAlarms.enabled", true]]
-    }, function() {
-      var isAllowedToTest = true;
-
-      if (navigator.appVersion.indexOf("Android") !== -1) {
-        ok(true, "mozAlarms is not allowed on Android for now. " +
-                 "TODO Bug 863557.");
-        isAllowedToTest = false;
-      } else if (SpecialPowers.wrap(document).nodePrincipal.appStatus ==
-                 SpecialPowers.Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-        ok(true, "mozAlarms is not allowed for non-installed apps. " +
-                 "TODO Bug 876981.");
-        isAllowedToTest = false;
-      }
-
-      if (isAllowedToTest) {
-        ok(true, "Start to test...");
-        registerPage();
-      } else {
-        // A sanity check to make sure we must run tests on Firefox OS (B2G).
-        if (navigator.userAgent.indexOf("Mobile") != -1 &&
-            navigator.appVersion.indexOf("Android") == -1) {
-          ok(false, "Should run the test on Firefox OS (B2G)!");
-        }
-
-        SimpleTest.finish();
-      }
-    });
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPermissions([{'type': 'alarms', 'allow': true, 'context': document}], startTests);
-
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/alarm/test/xpcshell.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-head =
-tail =
-
-[test_alarm_change_system_clock.js]
-# This test fails on the ICS emulator. We can enable it once bug 1090359 is fixed.
-skip-if = 1
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -46,17 +46,16 @@ DIRS += [
     'battery',
     'browser-element',
     'cache',
     'canvas',
     'cellbroadcast',
     'contacts',
     'crypto',
     'phonenumberutils',
-    'alarm',
     'devicestorage',
     'encoding',
     'events',
     'fetch',
     'filehandle',
     'filesystem',
     'flyweb',
     'fmradio',
--- a/dom/permission/tests/mochitest.ini
+++ b/dom/permission/tests/mochitest.ini
@@ -1,16 +1,14 @@
 [DEFAULT]
 support-files =
   file_framework.js
   file_shim.html
   file_empty.html
 
-[test_alarms.html]
-skip-if = true
 [test_browser.html]
 skip-if = true
 [test_embed-apps.html]
 skip-if = true || e10s #Bug 931116, b2g desktop specific, initial triage ### Bug 1255339: blacklist because no more mozApps
 [test_idle.html]
 # skip-if = (toolkit == 'gonk' && debug) #debug-only failure
 skip-if = true
 [test_permission_basics.html]
deleted file mode 100644
--- a/dom/permission/tests/test_alarms.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=815105
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 815105 </title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815105">Mozilla Bug 815105 </a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script type="application/javascript;version=1.8" src="file_framework.js"></script>
-<script type="application/javascript;version=1.8">
-var gData = [
-  {
-    perm: ["alarms"],
-    // AlarmsManager is not enabled on Android yet
-    // exception on accessing AlarmsManager
-    // See bug 863557
-    skip: ["Android"],
-    obj: "mozAlarms",
-    webidl: "AlarmsManager",
-    settings: [["dom.mozAlarms.enabled", true]],
-  },
-]
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/speakermanager/tests/test_speakermanager.html
+++ b/dom/speakermanager/tests/test_speakermanager.html
@@ -32,17 +32,17 @@
   }
 
   function startTests() {
     // Currently applicable only on FxOS
     if (navigator.userAgent.indexOf("Mobile") != -1 &&
         navigator.appVersion.indexOf("Android") == -1) {
       testObject();
     } else {
-      ok(true, "mozAlarms on Firefox OS only.");
+      ok(true, "MozSpeakerManager on Firefox OS only.");
       SimpleTest.finish();
     }
   }
 
   SimpleTest.waitForExplicitFinish();
   SpecialPowers.pushPermissions(
     [{ "type": "speaker-control", "allow": 1, "context": document }],
     startTests);
deleted file mode 100644
--- a/dom/webidl/AlarmsManager.webidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * https://wiki.mozilla.org/WebAPI/AlarmAPI
- */
-
-[NavigatorProperty="mozAlarms",
- JSImplementation="@mozilla.org/alarmsManager;1",
- Pref="dom.mozAlarms.enabled",
- ChromeOnly]
-interface AlarmsManager {
-  DOMRequest getAll();
-  [UnsafeInPrerendering]
-  DOMRequest add(any date, DOMString respectTimezone, optional any data);
-  [UnsafeInPrerendering]
-  void remove(unsigned long id);
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -916,17 +916,12 @@ if CONFIG['MOZ_B2G']:
         'Apps.webidl',
         'Identity.webidl',
         'MozApplicationEvent.webidl'
     ]
     GENERATED_EVENTS_WEBIDL_FILES += [
         'MozApplicationEvent.webidl'
     ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
-    WEBIDL_FILES += [
-        'AlarmsManager.webidl',
-    ]
-
 if CONFIG['ACCESSIBILITY']:
     WEBIDL_FILES += [
         'AccessibleNode.webidl',
     ]
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -200,27 +200,25 @@ static void Shutdown();
 #include "nsICellBroadcastService.h"
 #include "nsIIccService.h"
 #include "nsISmsService.h"
 #include "nsIMmsService.h"
 #include "nsIMobileConnectionService.h"
 #include "nsIMobileMessageService.h"
 #include "nsIMobileMessageDatabaseService.h"
 #include "nsIPowerManagerService.h"
-#include "nsIAlarmHalService.h"
 #include "nsIMediaManager.h"
 #include "mozilla/dom/nsMixedContentBlocker.h"
 
 #include "AudioChannelService.h"
 #include "mozilla/net/WebSocketEventService.h"
 
 #include "mozilla/dom/FlyWebService.h"
 
 #include "mozilla/dom/power/PowerManagerService.h"
-#include "mozilla/dom/alarm/AlarmHalService.h"
 #include "mozilla/dom/time/TimeService.h"
 #include "StreamingProtocolService.h"
 
 #include "nsIPresentationService.h"
 #include "nsITelephonyService.h"
 #include "nsIVoicemailService.h"
 
 #include "mozilla/dom/TVServiceFactory.h"
@@ -246,17 +244,16 @@ static void Shutdown();
 
 #ifdef MOZ_B2G
 #include "nsIHardwareKeyHandler.h"
 #include "mozilla/HardwareKeyHandler.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
-using mozilla::dom::alarm::AlarmHalService;
 using mozilla::dom::power::PowerManagerService;
 using mozilla::dom::quota::QuotaManagerService;
 using mozilla::dom::workers::ServiceWorkerManager;
 using mozilla::dom::workers::WorkerDebuggerManager;
 using mozilla::dom::UDPSocketChild;
 using mozilla::dom::time::TimeService;
 using mozilla::net::StreamingProtocolControllerService;
 using mozilla::gmp::GeckoMediaPluginService;
@@ -356,18 +353,16 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIIccService, NS_CreateIccService)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMmsService, NS_CreateMmsService)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageService,
                                          NS_CreateMobileMessageService)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageDatabaseService,
                                          NS_CreateMobileMessageDatabaseService)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
                                          PowerManagerService::GetInstance)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIAlarmHalService,
-                                         AlarmHalService::GetInstance)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITimeService,
                                          TimeService::GetInstance)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIStreamingProtocolControllerService,
                                          StreamingProtocolControllerService::GetInstance)
 
 #ifdef MOZ_WIDGET_GONK
 #ifndef DISABLE_MOZ_RIL_GEOLOC
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIGeolocationProvider,
@@ -828,17 +823,16 @@ NS_DEFINE_NAMED_CID(NS_VOICEMAIL_SERVICE
 NS_DEFINE_NAMED_CID(NS_MOBILE_CONNECTION_SERVICE_CID);
 NS_DEFINE_NAMED_CID(SMS_SERVICE_CID);
 NS_DEFINE_NAMED_CID(ICC_SERVICE_CID);
 NS_DEFINE_NAMED_CID(MMS_SERVICE_CID);
 NS_DEFINE_NAMED_CID(MOBILE_MESSAGE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(MOBILE_MESSAGE_DATABASE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
 NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_ALARMHALSERVICE_CID);
 NS_DEFINE_NAMED_CID(UDPSOCKETCHILD_CID);
 NS_DEFINE_NAMED_CID(NS_TIMESERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_MEDIASTREAMCONTROLLERSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID);
 #ifdef MOZ_WEBSPEECH_TEST_BACKEND
 NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID);
 #endif
 #ifdef MOZ_WEBSPEECH_POCKETSPHINX
@@ -1130,17 +1124,16 @@ static const mozilla::Module::CIDEntry k
   { &kCELLBROADCAST_SERVICE_CID, false, nullptr, nsICellBroadcastServiceConstructor },
   { &kSMS_SERVICE_CID, false, nullptr, nsISmsServiceConstructor },
   { &kICC_SERVICE_CID, false, nullptr, nsIIccServiceConstructor },
   { &kMMS_SERVICE_CID, false, nullptr, nsIMmsServiceConstructor },
   { &kMOBILE_MESSAGE_SERVICE_CID, false, nullptr, nsIMobileMessageServiceConstructor },
   { &kMOBILE_MESSAGE_DATABASE_SERVICE_CID, false, nullptr, nsIMobileMessageDatabaseServiceConstructor },
   { &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, Module::ALLOW_IN_GPU_PROCESS },
   { &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor },
-  { &kNS_ALARMHALSERVICE_CID, false, nullptr, nsIAlarmHalServiceConstructor },
   { &kUDPSOCKETCHILD_CID, false, nullptr, UDPSocketChildConstructor },
   { &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor },
   { &kNS_TIMESERVICE_CID, false, nullptr, nsITimeServiceConstructor },
   { &kNS_MEDIASTREAMCONTROLLERSERVICE_CID, false, nullptr, nsIStreamingProtocolControllerServiceConstructor },
 #if defined(MOZ_WIDGET_GONK) && !defined(DISABLE_MOZ_RIL_GEOLOC)
   { &kGONK_GPS_GEOLOCATION_PROVIDER_CID, false, nullptr, nsIGeolocationProviderConstructor },
 #endif
   { &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor },
@@ -1294,17 +1287,16 @@ static const mozilla::Module::ContractID
   { CELLBROADCAST_SERVICE_CONTRACTID, &kCELLBROADCAST_SERVICE_CID },
   { SMS_SERVICE_CONTRACTID, &kSMS_SERVICE_CID },
   { ICC_SERVICE_CONTRACTID, &kICC_SERVICE_CID },
   { MMS_SERVICE_CONTRACTID, &kMMS_SERVICE_CID },
   { MOBILE_MESSAGE_SERVICE_CONTRACTID, &kMOBILE_MESSAGE_SERVICE_CID },
   { MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID, &kMOBILE_MESSAGE_DATABASE_SERVICE_CID },
   { POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, Module::ALLOW_IN_GPU_PROCESS },
   { OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID },
-  { ALARMHALSERVICE_CONTRACTID, &kNS_ALARMHALSERVICE_CID },
   { "@mozilla.org/udp-socket-child;1", &kUDPSOCKETCHILD_CID },
   { TIMESERVICE_CONTRACTID, &kNS_TIMESERVICE_CID },
   { MEDIASTREAMCONTROLLERSERVICE_CONTRACTID, &kNS_MEDIASTREAMCONTROLLERSERVICE_CID },
 #if defined(MOZ_WIDGET_GONK) && !defined(DISABLE_MOZ_RIL_GEOLOC)
   { GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID, &kGONK_GPS_GEOLOCATION_PROVIDER_CID },
 #endif
   { MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID },
 #ifdef ACCESSIBILITY
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4737,19 +4737,16 @@ pref("dom.sms.requestStatusReport", true
 pref("dom.sms.defaultServiceId", 0);
 // MobileMessage GetMessages/GetThreads read ahead aggressiveness.
 //
 // positive: finite read-ahead entries,
 // 0: don't read ahead unless explicitly requested, (default)
 // negative: read ahead all IDs if possible.
 pref("dom.sms.maxReadAheadEntries", 0);
 
-// WebAlarms
-pref("dom.mozAlarms.enabled", false);
-
 // Push
 
 pref("dom.push.enabled", false);
 
 pref("dom.push.loglevel", "error");
 
 pref("dom.push.serverURL", "wss://push.services.mozilla.com/");
 pref("dom.push.userAgentID", "");