Bug 952453 - Remove mozNotification API; r=mattn r=baku draft
authorKyle Machulis <kyle@nonpolynomial.com>
Fri, 05 Jan 2018 13:28:24 -0800
changeset 716473 d86a08b3045e38a606b31250ddde2899ea6512da
parent 716325 81362f7306fe413b19fdba27cd0e9a5525d902e1
child 716474 6ade2e2343f0a0056190b364ea1f494b00beb758
push id94457
push userbmo:kyle@nonpolynomial.com
push dateFri, 05 Jan 2018 22:34:19 +0000
reviewersmattn, baku
bugs952453
milestone59.0a1
Bug 952453 - Remove mozNotification API; r=mattn r=baku MozReview-Commit-ID: 3TMxnPRSh1j
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/notification/DesktopNotification.cpp
dom/notification/DesktopNotification.h
dom/notification/moz.build
dom/notification/test/chrome/chrome.ini
dom/notification/test/chrome/test_notification_system_principal.xul
dom/notification/test/mochitest/create_notification.html
dom/notification/test/mochitest/mochitest.ini
dom/notification/test/mochitest/test_notification_tag.html
dom/tests/mochitest/general/test_interfaces.js
dom/tests/mochitest/notification/desktop-notification/create_notification.html
dom/tests/mochitest/notification/desktop-notification/moz.build
dom/tests/mochitest/notification/desktop-notification/notification_common.js
dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html
dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html
dom/tests/mochitest/notification/desktop-notification/test_leak_windowClose.html
dom/tests/mochitest/notification/desktop-notification/test_notification_tag.html
dom/tests/mochitest/notification/desktop-notification/test_system_principal.xul
dom/webidl/DesktopNotification.webidl
dom/webidl/Navigator.webidl
dom/webidl/moz.build
modules/libpref/init/all.js
widget/cocoa/OSXNotificationCenter.h
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -8,17 +8,16 @@
 #include "base/basictypes.h"
 
 #include "Navigator.h"
 #include "nsIXULAppInfo.h"
 #include "nsPluginArray.h"
 #include "nsMimeTypeArray.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/BodyExtractor.h"
-#include "mozilla/dom/DesktopNotification.h"
 #include "mozilla/dom/FetchBinding.h"
 #include "mozilla/dom/File.h"
 #include "nsGeolocation.h"
 #include "nsIClassOfService.h"
 #include "nsIHttpProtocolHandler.h"
 #include "nsIContentPolicy.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsContentPolicyUtils.h"
@@ -190,17 +189,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Na
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMimeTypes)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryPromise)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStorageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCredentials)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaDevices)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTimeManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
@@ -233,21 +231,16 @@ Navigator::Invalidate()
   mStorageManager = nullptr;
 
   // If there is a page transition, make sure delete the geolocation object.
   if (mGeolocation) {
     mGeolocation->Shutdown();
     mGeolocation = nullptr;
   }
 
-  if (mNotification) {
-    mNotification->Shutdown();
-    mNotification = nullptr;
-  }
-
   if (mBatteryManager) {
     mBatteryManager->Shutdown();
     mBatteryManager = nullptr;
   }
 
   mBatteryPromise = nullptr;
 
   if (mConnection) {
@@ -1311,32 +1304,16 @@ Navigator::MozGetUserMediaDevices(const 
     return;
   }
 
   MediaManager* manager = MediaManager::Get();
   aRv = manager->GetUserMediaDevices(mWindow, aConstraints, onsuccess, onerror,
                                      aInnerWindowID, aCallID);
 }
 
-DesktopNotificationCenter*
-Navigator::GetMozNotification(ErrorResult& aRv)
-{
-  if (mNotification) {
-    return mNotification;
-  }
-
-  if (!mWindow || !mWindow->GetDocShell()) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  mNotification = new DesktopNotificationCenter(mWindow);
-  return mNotification;
-}
-
 //*****************************************************************************
 //    Navigator::nsINavigatorBattery
 //*****************************************************************************
 
 Promise*
 Navigator::GetBattery(ErrorResult& aRv)
 {
   if (mBatteryPromise) {
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -54,17 +54,16 @@ namespace dom {
 class Permissions;
 
 namespace battery {
 class BatteryManager;
 } // namespace battery
 
 class Promise;
 
-class DesktopNotificationCenter;
 class MozIdleObserver;
 class Gamepad;
 class GamepadServiceTest;
 class NavigatorUserMediaSuccessCallback;
 class NavigatorUserMediaErrorCallback;
 class MozGetUserMediaDevicesSuccessCallback;
 
 namespace network {
@@ -173,17 +172,16 @@ public:
   uint64_t HardwareConcurrency();
   bool TaintEnabled()
   {
     return false;
   }
   void AddIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
   void RemoveIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
 
-  DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv);
   already_AddRefed<LegacyMozTCPSocket> MozTCPSocket();
   network::Connection* GetConnection(ErrorResult& aRv);
   MediaDevices* GetMediaDevices(ErrorResult& aRv);
 
   void GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads, ErrorResult& aRv);
   GamepadServiceTest* RequestGamepadServiceTest();
   already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
   void GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const;
@@ -270,17 +268,16 @@ private:
                           BodyExtractorBase* aBody,
                           BeaconType aType,
                           ErrorResult& aRv);
 
   RefPtr<nsMimeTypeArray> mMimeTypes;
   RefPtr<nsPluginArray> mPlugins;
   RefPtr<Permissions> mPermissions;
   RefPtr<Geolocation> mGeolocation;
-  RefPtr<DesktopNotificationCenter> mNotification;
   RefPtr<battery::BatteryManager> mBatteryManager;
   RefPtr<Promise> mBatteryPromise;
   RefPtr<network::Connection> mConnection;
   RefPtr<CredentialsContainer> mCredentials;
   RefPtr<MediaDevices> mMediaDevices;
   RefPtr<time::TimeManager> mTimeManager;
   RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
deleted file mode 100644
--- a/dom/notification/DesktopNotification.cpp
+++ /dev/null
@@ -1,332 +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 "mozilla/dom/DesktopNotification.h"
-#include "mozilla/dom/DesktopNotificationBinding.h"
-#include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
-#include "mozilla/dom/ToJSValue.h"
-#include "mozilla/EventStateManager.h"
-#include "nsComponentManagerUtils.h"
-#include "nsContentPermissionHelper.h"
-#include "nsXULAppAPI.h"
-#include "mozilla/dom/PBrowserChild.h"
-#include "mozilla/Preferences.h"
-#include "nsGlobalWindow.h"
-#include "nsIScriptSecurityManager.h"
-#include "nsServiceManagerUtils.h"
-#include "PermissionMessageUtils.h"
-#include "nsILoadContext.h"
-
-namespace mozilla {
-namespace dom {
-
-/*
- * Simple Request
- */
-class DesktopNotificationRequest : public nsIContentPermissionRequest
-                                 , public Runnable
-{
-  virtual ~DesktopNotificationRequest()
-  {
-  }
-
-  nsCOMPtr<nsIContentPermissionRequester> mRequester;
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSICONTENTPERMISSIONREQUEST
-
-  explicit DesktopNotificationRequest(DesktopNotification* aNotification)
-    : Runnable("dom::DesktopNotificationRequest")
-    , mDesktopNotification(aNotification)
-  {
-    mRequester = new nsContentPermissionRequester(mDesktopNotification->GetOwner());
-  }
-
-  NS_IMETHOD Run() override
-  {
-    nsCOMPtr<nsPIDOMWindowInner> window = mDesktopNotification->GetOwner();
-    nsContentPermissionUtils::AskPermission(this, window);
-    return NS_OK;
-  }
-
-  RefPtr<DesktopNotification> mDesktopNotification;
-};
-
-/* ------------------------------------------------------------------------ */
-/* AlertServiceObserver                                                     */
-/* ------------------------------------------------------------------------ */
-
-NS_IMPL_ISUPPORTS(AlertServiceObserver, nsIObserver)
-
-/* ------------------------------------------------------------------------ */
-/* DesktopNotification                                                      */
-/* ------------------------------------------------------------------------ */
-
-uint32_t DesktopNotification::sCount = 0;
-
-nsresult
-DesktopNotification::PostDesktopNotification()
-{
-  if (!mObserver) {
-    mObserver = new AlertServiceObserver(this);
-  }
-
-  nsCOMPtr<nsIAlertsService> alerts = do_GetService("@mozilla.org/alerts-service;1");
-  if (!alerts) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  // Generate a unique name (which will also be used as a cookie) because
-  // the nsIAlertsService will coalesce notifications with the same name.
-  // In the case of IPC, the parent process will use the cookie to map
-  // to nsIObservers, thus cookies must be unique to differentiate observers.
-  nsString uniqueName = NS_LITERAL_STRING("desktop-notification:");
-  uniqueName.AppendInt(sCount++);
-  nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
-  if (!owner) {
-    return NS_ERROR_FAILURE;
-  }
-  nsCOMPtr<nsIDocument> doc = owner->GetDoc();
-  nsIPrincipal* principal = doc->NodePrincipal();
-  nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
-  bool inPrivateBrowsing = loadContext && loadContext->UsePrivateBrowsing();
-  nsCOMPtr<nsIAlertNotification> alert =
-    do_CreateInstance(ALERT_NOTIFICATION_CONTRACTID);
-  NS_ENSURE_TRUE(alert, NS_ERROR_FAILURE);
-  nsresult rv = alert->Init(uniqueName, mIconURL, mTitle,
-                            mDescription,
-                            true,
-                            uniqueName,
-                            NS_LITERAL_STRING("auto"),
-                            EmptyString(),
-                            EmptyString(),
-                            principal,
-                            inPrivateBrowsing,
-                            false /* requireInteraction */);
-  NS_ENSURE_SUCCESS(rv, rv);
-  return alerts->ShowAlert(alert, mObserver);
-}
-
-DesktopNotification::DesktopNotification(const nsAString & title,
-                                         const nsAString & description,
-                                         const nsAString & iconURL,
-                                         nsPIDOMWindowInner* aWindow,
-                                         bool aIsHandlingUserInput,
-                                         nsIPrincipal* principal)
-  : DOMEventTargetHelper(aWindow)
-  , mTitle(title)
-  , mDescription(description)
-  , mIconURL(iconURL)
-  , mPrincipal(principal)
-  , mIsHandlingUserInput(aIsHandlingUserInput)
-  , mAllow(false)
-  , mShowHasBeenCalled(false)
-{
-  if (Preferences::GetBool("notification.disabled", false)) {
-    return;
-  }
-
-  // If we are in testing mode (running mochitests, for example)
-  // and we are suppose to allow requests, then just post an allow event.
-  if (Preferences::GetBool("notification.prompt.testing", false) &&
-      Preferences::GetBool("notification.prompt.testing.allow", true)) {
-    mAllow = true;
-  }
-}
-
-void
-DesktopNotification::Init()
-{
-  RefPtr<DesktopNotificationRequest> request = new DesktopNotificationRequest(this);
-
-  NS_DispatchToMainThread(request);
-}
-
-DesktopNotification::~DesktopNotification()
-{
-  if (mObserver) {
-    mObserver->Disconnect();
-  }
-}
-
-void
-DesktopNotification::DispatchNotificationEvent(const nsString& aName)
-{
-  if (NS_FAILED(CheckInnerWindowCorrectness())) {
-    return;
-  }
-
-  RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
-  // it doesn't bubble, and it isn't cancelable
-  event->InitEvent(aName, false, false);
-  event->SetTrusted(true);
-  bool dummy;
-  DispatchEvent(event, &dummy);
-}
-
-nsresult
-DesktopNotification::SetAllow(bool aAllow)
-{
-  mAllow = aAllow;
-
-  // if we have called Show() already, lets go ahead and post a notification
-  if (mShowHasBeenCalled && aAllow) {
-    return PostDesktopNotification();
-  }
-
-  return NS_OK;
-}
-
-void
-DesktopNotification::HandleAlertServiceNotification(const char *aTopic)
-{
-  if (NS_FAILED(CheckInnerWindowCorrectness())) {
-    return;
-  }
-
-  if (!strcmp("alertclickcallback", aTopic)) {
-    DispatchNotificationEvent(NS_LITERAL_STRING("click"));
-  } else if (!strcmp("alertfinished", aTopic)) {
-    DispatchNotificationEvent(NS_LITERAL_STRING("close"));
-  }
-}
-
-void
-DesktopNotification::Show(ErrorResult& aRv)
-{
-  mShowHasBeenCalled = true;
-
-  if (!mAllow) {
-    return;
-  }
-
-  aRv = PostDesktopNotification();
-}
-
-JSObject*
-DesktopNotification::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return DesktopNotificationBinding::Wrap(aCx, this, aGivenProto);
-}
-
-/* ------------------------------------------------------------------------ */
-/* DesktopNotificationCenter                                                */
-/* ------------------------------------------------------------------------ */
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(DesktopNotificationCenter)
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DesktopNotificationCenter)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DesktopNotificationCenter)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DesktopNotificationCenter)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-already_AddRefed<DesktopNotification>
-DesktopNotificationCenter::CreateNotification(const nsAString& aTitle,
-                                              const nsAString& aDescription,
-                                              const nsAString& aIconURL)
-{
-  MOZ_ASSERT(mOwner);
-
-  RefPtr<DesktopNotification> notification =
-    new DesktopNotification(aTitle,
-                            aDescription,
-                            aIconURL,
-                            mOwner,
-                            EventStateManager::IsHandlingUserInput(),
-                            mPrincipal);
-  notification->Init();
-  return notification.forget();
-}
-
-JSObject*
-DesktopNotificationCenter::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return DesktopNotificationCenterBinding::Wrap(aCx, this, aGivenProto);
-}
-
-/* ------------------------------------------------------------------------ */
-/* DesktopNotificationRequest                                               */
-/* ------------------------------------------------------------------------ */
-
-NS_IMPL_ISUPPORTS_INHERITED(DesktopNotificationRequest, Runnable,
-                            nsIContentPermissionRequest)
-
-NS_IMETHODIMP
-DesktopNotificationRequest::GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
-{
-  if (!mDesktopNotification) {
-    return NS_ERROR_NOT_INITIALIZED;
-  }
-
-  NS_IF_ADDREF(*aRequestingPrincipal = mDesktopNotification->mPrincipal);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::GetWindow(mozIDOMWindow** aRequestingWindow)
-{
-  if (!mDesktopNotification) {
-    return NS_ERROR_NOT_INITIALIZED;
-  }
-
-  NS_IF_ADDREF(*aRequestingWindow = mDesktopNotification->GetOwner());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::GetElement(nsIDOMElement * *aElement)
-{
-  NS_ENSURE_ARG_POINTER(aElement);
-  *aElement = nullptr;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::GetIsHandlingUserInput(bool *aIsHandlingUserInput)
-{
-  *aIsHandlingUserInput = mDesktopNotification->mIsHandlingUserInput;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::Cancel()
-{
-  nsresult rv = mDesktopNotification->SetAllow(false);
-  mDesktopNotification = nullptr;
-  return rv;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::Allow(JS::HandleValue aChoices)
-{
-  MOZ_ASSERT(aChoices.isUndefined());
-  nsresult rv = mDesktopNotification->SetAllow(true);
-  mDesktopNotification = nullptr;
-  return rv;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::GetRequester(nsIContentPermissionRequester** aRequester)
-{
-  NS_ENSURE_ARG_POINTER(aRequester);
-
-  nsCOMPtr<nsIContentPermissionRequester> requester = mRequester;
-  requester.forget(aRequester);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DesktopNotificationRequest::GetTypes(nsIArray** aTypes)
-{
-  nsTArray<nsString> emptyOptions;
-  return nsContentPermissionUtils::CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
-                                                         NS_LITERAL_CSTRING("unused"),
-                                                         emptyOptions,
-                                                         aTypes);
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/notification/DesktopNotification.h
+++ /dev/null
@@ -1,178 +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_DesktopNotification_h
-#define mozilla_dom_DesktopNotification_h
-
-#include "nsIPrincipal.h"
-#include "nsIAlertsService.h"
-#include "nsIContentPermissionPrompt.h"
-
-#include "nsIObserver.h"
-#include "nsString.h"
-#include "nsWeakPtr.h"
-#include "nsCycleCollectionParticipant.h"
-#include "nsIDOMWindow.h"
-#include "nsIScriptObjectPrincipal.h"
-
-#include "nsIDOMEvent.h"
-
-#include "mozilla/Attributes.h"
-#include "mozilla/DOMEventTargetHelper.h"
-#include "mozilla/ErrorResult.h"
-#include "nsWrapperCache.h"
-
-
-namespace mozilla {
-namespace dom {
-
-class AlertServiceObserver;
-class DesktopNotification;
-
-/*
- * DesktopNotificationCenter
- * Object hangs off of the navigator object and hands out DesktopNotification objects
- */
-class DesktopNotificationCenter final : public nsISupports,
-                                        public nsWrapperCache
-{
-public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DesktopNotificationCenter)
-
-  explicit DesktopNotificationCenter(nsPIDOMWindowInner* aWindow)
-  {
-    MOZ_ASSERT(aWindow);
-    mOwner = aWindow;
-
-    nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
-    MOZ_ASSERT(sop);
-
-    mPrincipal = sop->GetPrincipal();
-    MOZ_ASSERT(mPrincipal);
-  }
-
-  void Shutdown() {
-    mOwner = nullptr;
-  }
-
-  nsPIDOMWindowInner* GetParentObject() const
-  {
-    return mOwner;
-  }
-
-  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
-  already_AddRefed<DesktopNotification>
-  CreateNotification(const nsAString& title,
-                     const nsAString& description,
-                     const nsAString& iconURL);
-
-private:
-  virtual ~DesktopNotificationCenter()
-  {
-  }
-
-  nsCOMPtr<nsPIDOMWindowInner> mOwner;
-  nsCOMPtr<nsIPrincipal> mPrincipal;
-};
-
-class DesktopNotificationRequest;
-
-class DesktopNotification final : public DOMEventTargetHelper
-{
-  friend class DesktopNotificationRequest;
-
-public:
-
-  DesktopNotification(const nsAString& aTitle,
-                      const nsAString& aDescription,
-                      const nsAString& aIconURL,
-                      nsPIDOMWindowInner* aWindow,
-                      bool aIsHandlingUserInput,
-                      nsIPrincipal* principal);
-
-  virtual ~DesktopNotification();
-
-  void Init();
-
-  /*
-   * PostDesktopNotification
-   * Uses alert service to display a notification
-   */
-  nsresult PostDesktopNotification();
-
-  nsresult SetAllow(bool aAllow);
-
-  /*
-   * Creates and dispatches a dom event of type aName
-   */
-  void DispatchNotificationEvent(const nsString& aName);
-
-  void HandleAlertServiceNotification(const char *aTopic);
-
-  // WebIDL
-
-  nsPIDOMWindowInner* GetParentObject() const
-  {
-    return GetOwner();
-  }
-
-  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
-  void Show(ErrorResult& aRv);
-
-  IMPL_EVENT_HANDLER(click)
-  IMPL_EVENT_HANDLER(close)
-
-protected:
-
-  nsString mTitle;
-  nsString mDescription;
-  nsString mIconURL;
-
-  RefPtr<AlertServiceObserver> mObserver;
-  nsCOMPtr<nsIPrincipal> mPrincipal;
-  bool mIsHandlingUserInput;
-  bool mAllow;
-  bool mShowHasBeenCalled;
-
-  static uint32_t sCount;
-};
-
-class AlertServiceObserver: public nsIObserver
-{
- public:
-  NS_DECL_ISUPPORTS
-
-  explicit AlertServiceObserver(DesktopNotification* notification)
-    : mNotification(notification) {}
-
-  void Disconnect() { mNotification = nullptr; }
-
-  NS_IMETHOD
-  Observe(nsISupports* aSubject,
-          const char* aTopic,
-          const char16_t* aData) override
-  {
-
-    // forward to parent
-    if (mNotification) {
-      mNotification->HandleAlertServiceNotification(aTopic);
-    }
-    return NS_OK;
-  };
-
- private:
-  virtual ~AlertServiceObserver() {}
-
-  DesktopNotification* mNotification;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif /* mozilla_dom_DesktopNotification_h */
--- a/dom/notification/moz.build
+++ b/dom/notification/moz.build
@@ -12,34 +12,34 @@ EXTRA_COMPONENTS += [
     'NotificationStorage.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'NotificationDB.jsm'
 ]
 
 EXPORTS.mozilla.dom += [
-    'DesktopNotification.h',
     'Notification.h',
     'NotificationEvent.h',
 ]
 
 UNIFIED_SOURCES += [
-    'DesktopNotification.cpp',
     'Notification.cpp',
     'NotificationEvent.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/ipc',
     '/dom/workers',
 ]
 
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
 MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome/chrome.ini']
+
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
new file mode 100644
--- /dev/null
+++ b/dom/notification/test/chrome/chrome.ini
@@ -0,0 +1,1 @@
+[test_notification_system_principal.xul]
\ No newline at end of file
rename from dom/tests/mochitest/notification/desktop-notification/test_system_principal.xul
rename to dom/notification/test/chrome/test_notification_system_principal.xul
rename from dom/tests/mochitest/notification/desktop-notification/create_notification.html
rename to dom/notification/test/mochitest/create_notification.html
--- a/dom/notification/test/mochitest/mochitest.ini
+++ b/dom/notification/test/mochitest/mochitest.ini
@@ -1,10 +1,12 @@
 [DEFAULT]
 
 support-files =
+  create_notification.html
   MockServices.js
   NotificationTest.js
 
 [test_notification_basics.html]
 [test_notification_storage.html]
 [test_bug931307.html]
 skip-if = (os == 'android') # Bug 1258975 on android.
+[test_notification_tag.html]
\ No newline at end of file
rename from dom/tests/mochitest/notification/desktop-notification/test_notification_tag.html
rename to dom/notification/test/mochitest/test_notification_tag.html
--- a/dom/tests/mochitest/general/test_interfaces.js
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -266,20 +266,16 @@ var interfaceNamesInGlobalScope =
     "DataTransfer",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DataTransferItem",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DataTransferItemList",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DelayNode",
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    "DesktopNotification",
-// IMPORTANT: Do not change this list without review from a DOM peer!
-    "DesktopNotificationCenter",
-// IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceLightEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceMotionEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceOrientationEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceProximityEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
deleted file mode 100644
--- a/dom/tests/mochitest/notification/desktop-notification/moz.build
+++ /dev/null
@@ -1,6 +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/.
-
deleted file mode 100644
--- a/dom/tests/mochitest/notification/desktop-notification/notification_common.js
+++ /dev/null
@@ -1,70 +0,0 @@
-const MOCK_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{48068bc2-40ab-4904-8afd-4cdfb3a385f3}");
-const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
-
-const MOCK_SYSTEM_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{e86d888c-e41b-4b78-9104-2f2742a532de}");
-const SYSTEM_ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/system-alerts-service;1";
-
-var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager.
-  QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar);
-
-var mockAlertsService = {
-  showAlert: function(alert, alertListener) {
-    // probably should do this async....
-    SpecialPowers.wrap(alertListener).observe(null, "alertshow", alert.cookie);
-
-    if (SpecialPowers.getBoolPref("notification.prompt.testing.click_on_notification") == true) {
-       SpecialPowers.wrap(alertListener).observe(null, "alertclickcallback", alert.cookie);
-    }
-
-    SpecialPowers.wrap(alertListener).observe(null, "alertfinished", alert.cookie);
-  },
-
-  showAlertNotification: function(imageUrl, title, text, textClickable,
-                                  cookie, alertListener, name, bidi,
-                                  lang, data) {
-    return this.showAlert({
-      cookie: cookie
-    }, alertListener);
-  },
-
-  QueryInterface: function(aIID) {
-    if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
-        SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
-      return this;
-    }
-    throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
-  },
-
-  createInstance: function(aOuter, aIID) {
-    if (aOuter != null) {
-      throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
-    }
-    return this.QueryInterface(aIID);
-  }
-};
-mockAlertsService = SpecialPowers.wrapCallbackObject(mockAlertsService);
-
-function setup_notifications(allowPrompt, forceClick, callback) {
-  SpecialPowers.pushPrefEnv({'set': [["notification.prompt.testing", true],
-                                     ["notification.prompt.testing.allow", allowPrompt],
-                                     ["notification.prompt.testing.click_on_notification", forceClick]]},
-                            callback);
-
-  registrar.registerFactory(MOCK_SYSTEM_ALERTS_CID, "system alerts service",
-                            SYSTEM_ALERTS_SERVICE_CONTRACT_ID,
-                            mockAlertsService);
-
-  registrar.registerFactory(MOCK_ALERTS_CID, "alerts service",
-                            ALERTS_SERVICE_CONTRACT_ID,
-                            mockAlertsService);
-}
-
-function reset_notifications() {
-  registrar.unregisterFactory(MOCK_SYSTEM_ALERTS_CID, mockAlertsService);
-  registrar.unregisterFactory(MOCK_ALERTS_CID, mockAlertsService);
-}
-
-function is_feature_enabled() {
-  return navigator.mozNotification && SpecialPowers.getBoolPref("notification.feature.enabled");
-}
-
deleted file mode 100644
--- a/dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=573588
--->
-<head>
-  <title>Basic functional test</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="notification_common.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=573588">Basic property tests</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-</pre>
-<script type="text/javascript">
-  if (is_feature_enabled()) {
-    SimpleTest.waitForExplicitFinish();
-
-    function showNotifications() {
-      ok(navigator.mozNotification, "test for notification.");
-
-      var notification = navigator.mozNotification.createNotification("test", "test");
-      ok(notification, "test to ensure we can create a notification");
-
-      notification.onclose = function() {
-        ok(true, "notification was display and is now closing");
-        reset_notifications();
-        SimpleTest.finish();
-      };
-
-      notification.onclick = function() {
-        ok(false, "Click should not have been called.");
-        reset_notifications();
-        SimpleTest.finish();
-      };
-
-      notification.show();
-    }
-
-    setup_notifications(true, false, showNotifications);
-  } else {
-    ok(true, "Desktop notifications not enabled.");
-  }
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=573588
--->
-<head>
-  <title>Basic functional test</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="notification_common.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=573588">Basic property tests</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-</pre>
-<script type="text/javascript">
-  if (is_feature_enabled()) {
-    SimpleTest.waitForExplicitFinish();
-
-    var click_was_called = false;
-
-    function showNotifications() {
-      ok(navigator.mozNotification, "test for notification.");
-
-      var notification = navigator.mozNotification.createNotification("test", "test");
-      ok(notification, "test to ensure we can create a notification");
-
-      notification.onclose = function() {
-        ok(true, "notification was display and is now closing");
-        ok(click_was_called, "was notification clicked?");
-
-        reset_notifications();
-        SimpleTest.finish();
-      };
-
-      notification.onclick = function() {
-        ok(true, "Click was called.  Good.");
-        click_was_called = true;
-      };
-
-      notification.show();
-    }
-
-    setup_notifications(true, true, showNotifications);
-  } else {
-    ok(true, "Desktop notifications not enabled.");
-  }
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/tests/mochitest/notification/desktop-notification/test_leak_windowClose.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=605309
--->
-<head>
-  <title>Test for leak when window closes</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="notification_common.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-
-<script>
-if (is_feature_enabled()) {
-    SimpleTest.waitForExplicitFinish();
-
-    function boom()
-    {
-        document.documentElement.focus();
-        var x = navigator.mozNotification;
-        document.documentElement.addEventListener('', function(){x});
-        ok(true, "load callback called");
-        SimpleTest.finish();
-    }
-
-    window.addEventListener("load", boom);
-} else {
-    ok(true, "Desktop notifications not enabled.");
-}
-</script>
-</head>
-<body>
-<p> I like to write tests </p>
-</body>
-</html>
deleted file mode 100644
--- a/dom/webidl/DesktopNotification.webidl
+++ /dev/null
@@ -1,26 +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/.
- */
-
-interface MozObserver;
-
-[HeaderFile="mozilla/dom/DesktopNotification.h"]
-interface DesktopNotificationCenter
-{
-  [NewObject]
-  DesktopNotification createNotification(DOMString title,
-                                         DOMString description,
-                                         optional DOMString iconURL = "");
-};
-
-interface DesktopNotification : EventTarget
-{
-  [Throws]
-  void show();
-
-  attribute EventHandler onclick;
-
-  attribute EventHandler onclose;
-};
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -195,22 +195,16 @@ partial interface Navigator {
 
   /**
    * Navigator requests to remove an idle observer from the existing window.
    */
   [Throws, ChromeOnly]
   void removeIdleObserver(MozIdleObserver aIdleObserver);
 };
 
-// nsIDOMNavigatorDesktopNotification
-partial interface Navigator {
-  [Throws, Pref="notification.feature.enabled", UnsafeInPrerendering]
-  readonly attribute DesktopNotificationCenter mozNotification;
-};
-
 // NetworkInformation
 partial interface Navigator {
   [Throws, Pref="dom.netinfo.enabled"]
   readonly attribute NetworkInformation connection;
 };
 
 // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
 partial interface Navigator {
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -92,19 +92,16 @@ with Files("DecoderDoctorNotification.we
     BUG_COMPONENT = ("Core", "Audio/Video: Playback")
 
 with Files("DelayNode.webidl"):
     BUG_COMPONENT = ("Core", "Web Audio")
 
 with Files("DynamicsCompressorNode.webidl"):
     BUG_COMPONENT = ("Core", "Web Audio")
 
-with Files("DesktopNotification.webidl"):
-    BUG_COMPONENT = ("Toolkit", "Notifications and Alerts")
-
 with Files("FakePluginTagInit.webidl"):
     BUG_COMPONENT = ("Core", "Plug-ins")
 
 with Files("Flex.webidl"):
     BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
 
 with Files("FocusEvent.webidl"):
     BUG_COMPONENT = ("Core", "DOM: Events")
@@ -473,17 +470,16 @@ WEBIDL_FILES = [
     'CSSValueList.webidl',
     'CustomElementRegistry.webidl',
     'DataTransfer.webidl',
     'DataTransferItem.webidl',
     'DataTransferItemList.webidl',
     'DecoderDoctorNotification.webidl',
     'DedicatedWorkerGlobalScope.webidl',
     'DelayNode.webidl',
-    'DesktopNotification.webidl',
     'DeviceMotionEvent.webidl',
     'Directory.webidl',
     'Document.webidl',
     'DocumentFragment.webidl',
     'DocumentTimeline.webidl',
     'DocumentType.webidl',
     'DOMCursor.webidl',
     'DOMError.webidl',
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5019,19 +5019,16 @@ pref("extensions.webcompat-reporter.newI
 pref("extensions.webcompat-reporter.enabled", true);
 #else
 pref("extensions.webcompat-reporter.enabled", false);
 #endif
 
 pref("network.buffer.cache.count", 24);
 pref("network.buffer.cache.size",  32768);
 
-// Desktop Notification
-pref("notification.feature.enabled", false);
-
 // Web Notification
 pref("dom.webnotifications.enabled", true);
 pref("dom.webnotifications.serviceworker.enabled", true);
 pref("dom.webnotifications.requireinteraction.count", 3);
 #ifdef NIGHTLY_BUILD
 pref("dom.webnotifications.requireinteraction.enabled", true);
 #else
 pref("dom.webnotifications.requireinteraction.enabled", false);
--- a/widget/cocoa/OSXNotificationCenter.h
+++ b/widget/cocoa/OSXNotificationCenter.h
@@ -8,16 +8,21 @@
 
 #import <Foundation/Foundation.h>
 #include "nsIAlertsService.h"
 #include "imgINotificationObserver.h"
 #include "nsITimer.h"
 #include "nsTArray.h"
 #include "mozilla/RefPtr.h"
 
+// mozNotificationCenterDelegate is used to access the macOS notification
+// center. It is not related to the DesktopNotificationCenter object, which was
+// removed in bug 952453. While there are no direct references to this class
+// elsewhere, removing this will cause push notifications on macOS to stop
+// working.
 @class mozNotificationCenterDelegate;
 
 #if !defined(MAC_OS_X_VERSION_10_8) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8)
 typedef NSInteger NSUserNotificationActivationType;
 #endif
 
 namespace mozilla {