Backed out 4 changesets (bug 1155505) for win2012 build bustages CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Wed, 03 Oct 2018 09:16:27 +0300
changeset 487679 10b62fac52698573bba71b4622e3a35ba2edb181
parent 487678 af0781ab02a6be8c152aa2b0dbad7b2313da3811
child 487681 f7fd7d2cbc2ef4737be60b0ec5d432ba4fccaee2
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
bugs1155505
milestone64.0a1
backs outaf0781ab02a6be8c152aa2b0dbad7b2313da3811
f5e706d5a1433a95a8d3015c684cfef10c13e850
5400ec20792c04d86c825e7debdcddd6f1e3b5f5
82e129f7545e704a77b3a8530124670e409b747f
Backed out 4 changesets (bug 1155505) for win2012 build bustages CLOSED TREE Backed out changeset af0781ab02a6 (bug 1155505) Backed out changeset f5e706d5a143 (bug 1155505) Backed out changeset 5400ec20792c (bug 1155505) Backed out changeset 82e129f7545e (bug 1155505)
browser/components/shell/nsWindowsShellService.cpp
modules/libpref/init/all.js
toolkit/library/moz.build
widget/windows/ToastNotification.cpp
widget/windows/ToastNotification.h
widget/windows/ToastNotificationHandler.cpp
widget/windows/ToastNotificationHandler.h
widget/windows/WinUtils.cpp
widget/windows/WinUtils.h
widget/windows/moz.build
widget/windows/nsWidgetFactory.cpp
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -4,19 +4,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsWindowsShellService.h"
 
 #include "BinaryPath.h"
 #include "city.h"
 #include "imgIContainer.h"
 #include "imgIRequest.h"
+#include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsIContent.h"
 #include "nsIImageLoadingContent.h"
+#include "nsIOutputStream.h"
 #include "nsIPrefService.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
 #include "nsShellService.h"
 #include "nsIProcess.h"
@@ -39,17 +41,16 @@
 #undef _WIN32_WINNT
 #endif
 #define _WIN32_WINNT 0x0600
 #define INITGUID
 #undef NTDDI_VERSION
 #define NTDDI_VERSION NTDDI_WIN8
 // Needed for access to IApplicationActivationManager
 #include <shlobj.h>
-#include "WinUtils.h"
 
 #include <mbstring.h>
 #include <shlwapi.h>
 
 #include <lm.h>
 #undef ACCESS_READ
 
 #ifndef MAX_BUF
@@ -61,17 +62,17 @@
 
 #define REG_FAILED(val) \
   (val != ERROR_SUCCESS)
 
 #define APP_REG_NAME_BASE L"Firefox-"
 
 using mozilla::IsWin8OrLater;
 using namespace mozilla;
-using namespace mozilla::widget;
+using namespace mozilla::gfx;
 
 NS_IMPL_ISUPPORTS(nsWindowsShellService, nsIShellService)
 
 static nsresult
 OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
 {
   const nsString &flatName = PromiseFlatString(aKeyName);
 
@@ -479,16 +480,105 @@ nsWindowsShellService::SetDefaultBrowser
     // Reset the number of times the dialog should be shown
     // before it is silenced.
     (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0);
   }
 
   return rv;
 }
 
+static nsresult
+WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
+{
+  nsresult rv;
+
+  RefPtr<SourceSurface> surface =
+    aImage->GetFrame(imgIContainer::FRAME_FIRST,
+                     imgIContainer::FLAG_SYNC_DECODE);
+  NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE);
+
+  // For either of the following formats we want to set the biBitCount member
+  // of the BITMAPINFOHEADER struct to 32, below. For that value the bitmap
+  // format defines that the A8/X8 WORDs in the bitmap byte stream be ignored
+  // for the BI_RGB value we use for the biCompression member.
+  MOZ_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8A8 ||
+             surface->GetFormat() == SurfaceFormat::B8G8R8X8);
+
+  RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
+  NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
+
+  int32_t width = dataSurface->GetSize().width;
+  int32_t height = dataSurface->GetSize().height;
+  int32_t bytesPerPixel = 4 * sizeof(uint8_t);
+  uint32_t bytesPerRow = bytesPerPixel * width;
+
+  // initialize these bitmap structs which we will later
+  // serialize directly to the head of the bitmap file
+  BITMAPINFOHEADER bmi;
+  bmi.biSize = sizeof(BITMAPINFOHEADER);
+  bmi.biWidth = width;
+  bmi.biHeight = height;
+  bmi.biPlanes = 1;
+  bmi.biBitCount = (WORD)bytesPerPixel*8;
+  bmi.biCompression = BI_RGB;
+  bmi.biSizeImage = bytesPerRow * height;
+  bmi.biXPelsPerMeter = 0;
+  bmi.biYPelsPerMeter = 0;
+  bmi.biClrUsed = 0;
+  bmi.biClrImportant = 0;
+
+  BITMAPFILEHEADER bf;
+  bf.bfType = 0x4D42; // 'BM'
+  bf.bfReserved1 = 0;
+  bf.bfReserved2 = 0;
+  bf.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
+  bf.bfSize = bf.bfOffBits + bmi.biSizeImage;
+
+  // get a file output stream
+  nsCOMPtr<nsIOutputStream> stream;
+  rv = NS_NewLocalFileOutputStream(getter_AddRefs(stream), aFile);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  DataSourceSurface::MappedSurface map;
+  if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
+    return NS_ERROR_FAILURE;
+  }
+
+  // write the bitmap headers and rgb pixel data to the file
+  rv = NS_ERROR_FAILURE;
+  if (stream) {
+    uint32_t written;
+    stream->Write((const char*)&bf, sizeof(BITMAPFILEHEADER), &written);
+    if (written == sizeof(BITMAPFILEHEADER)) {
+      stream->Write((const char*)&bmi, sizeof(BITMAPINFOHEADER), &written);
+      if (written == sizeof(BITMAPINFOHEADER)) {
+        // write out the image data backwards because the desktop won't
+        // show bitmaps with negative heights for top-to-bottom
+        uint32_t i = map.mStride * height;
+        do {
+          i -= map.mStride;
+          stream->Write(((const char*)map.mData) + i, bytesPerRow, &written);
+          if (written == bytesPerRow) {
+            rv = NS_OK;
+          } else {
+            rv = NS_ERROR_FAILURE;
+            break;
+          }
+        } while (i != 0);
+      }
+    }
+
+    stream->Close();
+  }
+
+  dataSurface->Unmap();
+
+  return rv;
+}
+
 NS_IMETHODIMP
 nsWindowsShellService::SetDesktopBackground(dom::Element* aElement,
                                             int32_t aPosition,
                                             const nsACString& aImageName)
 {
   if (!aElement || !aElement->IsHTMLElement(nsGkAtoms::img)) {
     // XXX write background loading stuff!
     return NS_ERROR_NOT_AVAILABLE;
@@ -538,17 +628,17 @@ nsWindowsShellService::SetDesktopBackgro
   rv = file->Append(fileLeafName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString path;
   rv = file->GetPath(path);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // write the bitmap to a file in the profile directory
-  rv = WinUtils::WriteBitmap(file, container);
+  rv = WriteBitmap(file, container);
 
   // if the file was written successfully, set it as the system wallpaper
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIWindowsRegKey> regKey =
       do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = regKey->Create(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5085,28 +5085,17 @@ pref("network.buffer.cache.size",  32768
 pref("dom.webnotifications.requireinteraction.count", 3);
 
 // Show favicons in web notifications.
 pref("alerts.showFavicons", false);
 
 // Whether to use platform-specific backends for showing desktop notifications.
 // If no such backend is available, or if the pref is false, then XUL
 // notifications are used.
-
-// Linux and macOS turn on system level notification as default, but Windows is
-// Nightly only due to unstable yet.
-#if defined(XP_WIN)
-#if defined(NIGHTLY_BUILD)
 pref("alerts.useSystemBackend", true);
-#else
-pref("alerts.useSystemBackend", false);
-#endif
-#else
-pref("alerts.useSystemBackend", true);
-#endif
 
 // DOM full-screen API.
 pref("full-screen-api.enabled", false);
 pref("full-screen-api.allow-trusted-requests-only", true);
 // whether to prevent the top level widget from going fullscreen
 pref("full-screen-api.ignore-widgets", false);
 pref("full-screen-api.pointer-lock.enabled", true);
 // transition duration of fade-to-black and fade-from-black, unit: ms
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -309,22 +309,16 @@ if CONFIG['OS_ARCH'] == 'WINNT':
         'wbemuuid',
         'wintrust',
         'wtsapi32',
         'locationapi',
         'sapi',
         'dxguid',
         'dhcpcsvc',
     ]
-
-    if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
-        OS_LIBS += [
-            'runtimeobject',
-        ]
-
     if CONFIG['ACCESSIBILITY']:
         OS_LIBS += [
             'oleacc',
         ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     OS_LIBS += [
         'usp10',
deleted file mode 100644
--- a/widget/windows/ToastNotification.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sts=2 sw=2 et cin: */
-/* 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 "ToastNotification.h"
-
-#include "mozilla/WindowsVersion.h"
-#include "nsComponentManagerUtils.h"
-#include "nsCOMPtr.h"
-#include "nsIObserverService.h"
-#include "nsString.h"
-#include "nsThreadUtils.h"
-#include "ToastNotificationHandler.h"
-#include "WinTaskbar.h"
-
-
-namespace mozilla {
-namespace widget {
-
-NS_IMPL_ISUPPORTS(ToastNotification, nsIAlertsService, nsIObserver, nsISupportsWeakReference)
-
-ToastNotification::ToastNotification()
-= default;
-
-ToastNotification::~ToastNotification()
-= default;
-
-nsresult
-ToastNotification::Init()
-{
-  if (!IsWin8OrLater()) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsAutoString uid;
-  if (NS_WARN_IF(!WinTaskbar::GetAppUserModelID(uid))) {
-    // Windows Toast Notification requires AppId
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsresult rv = NS_NewNamedThread("ToastBgThread", getter_AddRefs(mBackgroundThread));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsCOMPtr<nsIObserverService> obsServ =
-      do_GetService("@mozilla.org/observer-service;1");
-  if (obsServ) {
-    obsServ->AddObserver(this, "quit-application", true);
-  }
-
-  return NS_OK;
-}
-
-nsresult
-ToastNotification::BackgroundDispatch(nsIRunnable* runnable)
-{
-  return mBackgroundThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
-}
-
-NS_IMETHODIMP
-ToastNotification::Observe(nsISupports *aSubject, const char *aTopic,
-                           const char16_t *aData)
-{
-  // Got quit-application
-  // The handlers destructors will do the right thing (de-register with Windows).
-  mActiveHandlers.Clear();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ToastNotification::ShowAlertNotification(const nsAString & aImageUrl,
-                                         const nsAString & aAlertTitle,
-                                         const nsAString & aAlertText,
-                                         bool aAlertTextClickable,
-                                         const nsAString & aAlertCookie,
-                                         nsIObserver * aAlertListener,
-                                         const nsAString & aAlertName,
-                                         const nsAString & aBidi,
-                                         const nsAString & aLang,
-                                         const nsAString & aData,
-                                         nsIPrincipal * aPrincipal,
-                                         bool aInPrivateBrowsing,
-                                         bool aRequireInteraction)
-{
-  nsCOMPtr<nsIAlertNotification> alert =
-    do_CreateInstance(ALERT_NOTIFICATION_CONTRACTID);
-  if (NS_WARN_IF(!alert)) {
-    return NS_ERROR_FAILURE;
-  }
-  nsresult rv = alert->Init(aAlertName, aImageUrl, aAlertTitle,
-                            aAlertText, aAlertTextClickable,
-                            aAlertCookie, aBidi, aLang, aData,
-                            aPrincipal, aInPrivateBrowsing,
-                            aRequireInteraction);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  return ShowAlert(alert, aAlertListener);
-}
-
-NS_IMETHODIMP
-ToastNotification::ShowPersistentNotification(const nsAString& aPersistentData,
-                                              nsIAlertNotification* aAlert,
-                                              nsIObserver* aAlertListener)
-{
-  return ShowAlert(aAlert, aAlertListener);
-}
-
-NS_IMETHODIMP
-ToastNotification::ShowAlert(nsIAlertNotification* aAlert,
-                             nsIObserver* aAlertListener)
-{
-  if (NS_WARN_IF(!aAlert)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  nsAutoString cookie;
-  nsresult rv = aAlert->GetCookie(cookie);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsAutoString name;
-  rv = aAlert->GetName(name);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsAutoString title;
-  rv = aAlert->GetTitle(title);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsAutoString text;
-  rv = aAlert->GetText(text);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  bool textClickable;
-  rv = aAlert->GetTextClickable(&textClickable);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsAutoString hostPort;
-  rv = aAlert->GetSource(hostPort);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  RefPtr<ToastNotificationHandler> handler =
-    new ToastNotificationHandler(this, aAlertListener, name, cookie, title,
-                                 text, hostPort, textClickable);
-  mActiveHandlers.Put(name, handler);
-
-  rv = handler->InitAlertAsync(aAlert);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    mActiveHandlers.Remove(name);
-    return rv;
-  }
-
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ToastNotification::CloseAlert(const nsAString& aAlertName,
-                              nsIPrincipal* aPrincipal)
-{
-  RefPtr<ToastNotificationHandler> handler;
-  if (NS_WARN_IF(!mActiveHandlers.Get(aAlertName, getter_AddRefs(handler)))) {
-    return NS_OK;
-  }
-  mActiveHandlers.Remove(aAlertName);
-  return NS_OK;
-}
-
-bool
-ToastNotification::IsActiveHandler(const nsAString& aAlertName,
-                                   ToastNotificationHandler* aHandler)
-{
-  RefPtr<ToastNotificationHandler> handler;
-  if (NS_WARN_IF(!mActiveHandlers.Get(aAlertName, getter_AddRefs(handler)))) {
-    return false;
-  }
-  return handler == aHandler;
-}
-
-void
-ToastNotification::RemoveHandler(const nsAString& aAlertName,
-                                 ToastNotificationHandler* aHandler)
-{
-  // The alert may have been replaced; only remove it from the active
-  // handlers map if it's the same.
-  if (IsActiveHandler(aAlertName, aHandler)) {
-    // Terrible things happen if the destructor of a handler is called inside
-    // the hashtable .Remove() method. Wait until we have returned from there.
-    RefPtr<ToastNotificationHandler> kungFuDeathGrip(aHandler);
-    mActiveHandlers.Remove(aAlertName);
-  }
-}
-
-} // namespace widget
-} // namespace mozilla
deleted file mode 100644
--- a/widget/windows/ToastNotification.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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/. */
-
-#ifndef ToastNotification_h__
-#define ToastNotification_h__
-
-#include "nsIAlertsService.h"
-#include "nsIObserver.h"
-#include "nsIThread.h"
-#include "nsRefPtrHashtable.h"
-#include "nsWeakReference.h"
-
-namespace mozilla {
-namespace widget {
-
-class ToastNotificationHandler;
-
-class ToastNotification final : public nsIAlertsService,
-                                public nsIObserver,
-                                public nsSupportsWeakReference
-{
-public:
-  NS_DECL_NSIALERTSSERVICE
-  NS_DECL_NSIOBSERVER
-  NS_DECL_ISUPPORTS
-
-  ToastNotification();
-
-  nsresult Init();
-
-  bool IsActiveHandler(const nsAString& aAlertName,
-                       ToastNotificationHandler* aHandler);
-  void RemoveHandler(const nsAString& aAlertName,
-                     ToastNotificationHandler* aHandler);
-
-  nsresult BackgroundDispatch(nsIRunnable* runnable);
-
-protected:
-  virtual ~ToastNotification();
-
-  nsRefPtrHashtable<nsStringHashKey, ToastNotificationHandler> mActiveHandlers;
-
-  nsCOMPtr<nsIThread> mBackgroundThread;
-};
-
-} // widget
-} // mozilla
-
-#endif
deleted file mode 100644
--- a/widget/windows/ToastNotificationHandler.cpp
+++ /dev/null
@@ -1,575 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sts=2 sw=2 et cin: */
-/* 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 "ToastNotificationHandler.h"
-
-#include "imgIRequest.h"
-#include "mozilla/gfx/2D.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsIStringBundle.h"
-#include "nsIURI.h"
-#include "nsIUUIDGenerator.h"
-#include "nsNetUtil.h"
-#include "nsProxyRelease.h"
-#include "WinTaskbar.h"
-#include "WinUtils.h"
-
-#include "ToastNotification.h"
-
-namespace mozilla {
-namespace widget {
-
-typedef ABI::Windows::Foundation::ITypedEventHandler<
-  ABI::Windows::UI::Notifications::ToastNotification*, IInspectable*>
-  ToastActivationHandler;
-typedef ABI::Windows::Foundation::ITypedEventHandler<
-  ABI::Windows::UI::Notifications::ToastNotification*,
-  ABI::Windows::UI::Notifications::ToastDismissedEventArgs*> ToastDismissedHandler;
-typedef ABI::Windows::Foundation::ITypedEventHandler<
-  ABI::Windows::UI::Notifications::ToastNotification*,
-  ABI::Windows::UI::Notifications::ToastFailedEventArgs*> ToastFailedHandler;
-
-using namespace ABI::Windows::Data::Xml::Dom;
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::UI::Notifications;
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-using namespace mozilla;
-
-NS_IMPL_ISUPPORTS(ToastNotificationHandler, nsIAlertNotificationImageListener)
-
-static bool
-SetNodeValueString(const nsString& aString,
-                   IXmlNode* node,
-                   IXmlDocument* xml)
-{
-  ComPtr<IXmlText> inputText;
-  if (NS_WARN_IF(FAILED(xml->CreateTextNode(
-        HStringReference(static_cast<const wchar_t*>(aString.get())).Get(),
-        &inputText)))) {
-    return false;
-  }
-  ComPtr<IXmlNode> inputTextNode;
-  if (NS_WARN_IF(FAILED(inputText.As(&inputTextNode)))) {
-    return false;
-  }
-  ComPtr<IXmlNode> appendedChild;
-  if (NS_WARN_IF(FAILED(node->AppendChild(inputTextNode.Get(),
-                                          &appendedChild)))) {
-    return false;
-  }
-  return true;
-}
-
-static bool
-SetAttribute(IXmlElement* element, const HSTRING name,
-             const nsAString& value)
-{
-  HSTRING valueStr =
-    HStringReference(
-      static_cast<const wchar_t*>(PromiseFlatString(value).get())).Get();
-  if (NS_WARN_IF(FAILED(element->SetAttribute(name, valueStr)))) {
-    return false;
-  }
-  return true;
-}
-
-static bool
-AddActionNode(IXmlDocument* toastXml, IXmlNode* actionsNode,
-              const nsAString& actionTitle, const nsAString& actionArgs)
-{
-  ComPtr<IXmlElement> action;
-  HRESULT hr = toastXml->CreateElement(HStringReference(L"action").Get(),
-                                       &action);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  if (NS_WARN_IF(!SetAttribute(action.Get(), HStringReference(L"content").Get(),
-                               actionTitle))) {
-    return false;
-  }
-
-  if (NS_WARN_IF(!SetAttribute(action.Get(),
-                               HStringReference(L"arguments").Get(),
-                               actionArgs))) {
-    return false;
-  }
-  if (NS_WARN_IF(!SetAttribute(action.Get(),
-                               HStringReference(L"placement").Get(),
-                               NS_LITERAL_STRING("contextmenu")))) {
-    return false;
-  }
-
-  // Add <action> to <actions>
-  ComPtr<IXmlNode> actionNode;
-  hr = action.As(&actionNode);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  ComPtr<IXmlNode> appendedChild;
-  hr = actionsNode->AppendChild(actionNode.Get(), &appendedChild);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  return true;
-}
-
-static ComPtr<IToastNotificationManagerStatics>
-GetToastNotificationManagerStatics()
-{
-  ComPtr<IToastNotificationManagerStatics> toastNotificationManagerStatics;
-  if (NS_WARN_IF(FAILED(GetActivationFactory(
-                          HStringReference(
-                            RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(),
-                          &toastNotificationManagerStatics)))) {
-    return nullptr;
-  }
-
-  return toastNotificationManagerStatics;
-}
-
-ToastNotificationHandler::~ToastNotificationHandler()
-{
-  if (mImageRequest) {
-    mImageRequest->Cancel(NS_BINDING_ABORTED);
-    mImageRequest = nullptr;
-  }
-
-  if (mHasImage) {
-    DebugOnly<nsresult> rv = mImageFile->Remove(false);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot remove temporary image file");
-  }
-
-  if (mNotification && mNotifier) {
-    mNotification->remove_Dismissed(mDismissedToken);
-    mNotification->remove_Activated(mActivatedToken);
-    mNotification->remove_Failed(mFailedToken);
-    mNotifier->Hide(mNotification.Get());
-  }
-}
-
-ComPtr<IXmlDocument>
-ToastNotificationHandler::InitializeXmlForTemplate(
-  ToastTemplateType templateType)
-{
-  ComPtr<IToastNotificationManagerStatics> toastNotificationManagerStatics =
-    GetToastNotificationManagerStatics();
-
-  ComPtr<IXmlDocument> toastXml;
-  toastNotificationManagerStatics->GetTemplateContent(templateType, &toastXml);
-
-  return toastXml;
-}
-
-nsresult
-ToastNotificationHandler::InitAlertAsync(nsIAlertNotification* aAlert)
-{
-  return aAlert->LoadImage(/* aTimeout = */ 0, this, /* aUserData = */ nullptr,
-                           getter_AddRefs(mImageRequest));
-}
-
-bool
-ToastNotificationHandler::ShowAlert()
-{
-  if (!mBackend->IsActiveHandler(mName, this)) {
-    return true;
-  }
-
-  ComPtr<IXmlDocument> toastXml =
-    InitializeXmlForTemplate(
-      !mHasImage ?
-        ToastTemplateType::ToastTemplateType_ToastText03 :
-        ToastTemplateType::ToastTemplateType_ToastImageAndText03);
-
-  if (!toastXml) {
-    return false;
-  }
-
-  HRESULT hr;
-
-  if (mHasImage) {
-    ComPtr<IXmlNodeList> toastImageElements;
-    hr = toastXml->GetElementsByTagName(HStringReference(L"image").Get(),
-                                        &toastImageElements);
-    if (NS_WARN_IF(FAILED(hr))) {
-      return false;
-    }
-    ComPtr<IXmlNode> imageNode;
-    hr = toastImageElements->Item(0, &imageNode);
-    if (NS_WARN_IF(FAILED(hr))) {
-      return false;
-    }
-    ComPtr<IXmlElement> image;
-    hr = imageNode.As(&image);
-    if (NS_WARN_IF(FAILED(hr))) {
-      return false;
-    }
-    if (NS_WARN_IF(!SetAttribute(image.Get(),
-                                 HStringReference(L"src").Get(),
-                                 mImageUri))) {
-      return false;
-    }
-  }
-
-  ComPtr<IXmlNodeList> toastTextElements;
-  hr = toastXml->GetElementsByTagName(HStringReference(L"text").Get(),
-                                      &toastTextElements);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  ComPtr<IXmlNode> titleTextNodeRoot;
-  hr = toastTextElements->Item(0, &titleTextNodeRoot);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-  ComPtr<IXmlNode> msgTextNodeRoot;
-  hr = toastTextElements->Item(1, &msgTextNodeRoot);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  if (NS_WARN_IF(!SetNodeValueString(mTitle, titleTextNodeRoot.Get(),
-                                     toastXml.Get()))) {
-    return false;
-  }
-  if (NS_WARN_IF(!SetNodeValueString(mMsg, msgTextNodeRoot.Get(),
-                                     toastXml.Get()))) {
-    return false;
-  }
-
-  ComPtr<IXmlNodeList> toastElements;
-  hr = toastXml->GetElementsByTagName(HStringReference(L"toast").Get(),
-                                      &toastElements);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  ComPtr<IXmlNode> toastNodeRoot;
-  hr = toastElements->Item(0, &toastNodeRoot);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  ComPtr<IXmlElement> actions;
-  hr = toastXml->CreateElement(HStringReference(L"actions").Get(), &actions);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  ComPtr<IXmlNode> actionsNode;
-  hr = actions.As(&actionsNode);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  nsCOMPtr<nsIStringBundleService> sbs =
-    do_GetService(NS_STRINGBUNDLE_CONTRACTID);
-  if (NS_WARN_IF(!sbs)) {
-    return false;
-  }
-
-  nsCOMPtr<nsIStringBundle> bundle;
-  sbs->CreateBundle("chrome://alerts/locale/alert.properties",
-                    getter_AddRefs(bundle));
-  if (NS_WARN_IF(!bundle)) {
-    return false;
-  }
-
-  if (!mHostPort.IsEmpty()) {
-    nsAutoString disableButtonTitle;
-    const char16_t* formatStrings[] = { mHostPort.get() };
-    bundle->FormatStringFromName("webActions.disableForOrigin.label",
-                                 formatStrings,
-                                 ArrayLength(formatStrings),
-                                 disableButtonTitle);
-
-    AddActionNode(toastXml.Get(), actionsNode.Get(), disableButtonTitle,
-                  NS_LITERAL_STRING("snooze"));
-  }
-
-  nsAutoString settingsButtonTitle;
-  bundle->GetStringFromName("webActions.settings.label", settingsButtonTitle);
-  AddActionNode(toastXml.Get(), actionsNode.Get(), settingsButtonTitle,
-                NS_LITERAL_STRING("settings"));
-
-  ComPtr<IXmlNode> appendedChild;
-  hr = toastNodeRoot->AppendChild(actionsNode.Get(), &appendedChild);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  return CreateWindowsNotificationFromXml(toastXml.Get());
-}
-
-bool
-ToastNotificationHandler::CreateWindowsNotificationFromXml(
-  IXmlDocument *aXml)
-{
-  ComPtr<IToastNotificationFactory> factory;
-  HRESULT hr =
-    GetActivationFactory(
-      HStringReference(
-        RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(),
-      &factory);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  hr = factory->CreateToastNotification(aXml, &mNotification);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  hr = mNotification->add_Activated(
-         Callback<ToastActivationHandler>(
-           this, &ToastNotificationHandler::OnActivate).Get(),
-         &mActivatedToken);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  hr = mNotification->add_Dismissed(
-         Callback<ToastDismissedHandler>(
-           this, &ToastNotificationHandler::OnDismiss).Get(),
-         &mDismissedToken);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  hr = mNotification->add_Failed(
-         Callback<ToastFailedHandler>(
-           this, &ToastNotificationHandler::OnFail).Get(),
-         &mFailedToken);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  ComPtr<IToastNotificationManagerStatics> toastNotificationManagerStatics =
-    GetToastNotificationManagerStatics();
-  if (NS_WARN_IF(!toastNotificationManagerStatics)) {
-    return false;
-  }
-
-  nsAutoString uid;
-  if (NS_WARN_IF(!WinTaskbar::GetAppUserModelID(uid))) {
-    return false;
-  }
-
-  HSTRING uidStr =
-    HStringReference(static_cast<const wchar_t*>(uid.get())).Get();
-  hr = toastNotificationManagerStatics->CreateToastNotifierWithId(uidStr,
-                                                                  &mNotifier);
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  hr = mNotifier->Show(mNotification.Get());
-  if (NS_WARN_IF(FAILED(hr))) {
-    return false;
-  }
-
-  if (mAlertListener) {
-    mAlertListener->Observe(nullptr, "alertshow", mCookie.get());
-  }
-
-  return true;
-}
-
-HRESULT
-ToastNotificationHandler::OnActivate(IToastNotification *notification,
-                                     IInspectable *inspectable)
-{
-  if (mAlertListener) {
-    ComPtr<IToastActivatedEventArgs> eventArgs;
-    HRESULT hr = inspectable->QueryInterface(__uuidof(IToastActivatedEventArgs),
-                                           (void**)&eventArgs);
-    nsAutoString argString;
-    if (SUCCEEDED(hr)) {
-      HSTRING arguments;
-      hr = eventArgs->get_Arguments(&arguments);
-      if (SUCCEEDED(hr)) {
-        uint32_t len = 0;
-        const wchar_t* buffer = WindowsGetStringRawBuffer(arguments, &len);
-        if (buffer) {
-          argString.Assign(buffer, len);
-        }
-      }
-    }
-
-    if (argString.EqualsLiteral("settings")) {
-      mAlertListener->Observe(nullptr, "alertsettingscallback", mCookie.get());
-    } else if (argString.EqualsLiteral("snooze")) {
-      mAlertListener->Observe(nullptr, "alertdisablecallback", mCookie.get());
-    } else if (mClickable) {
-      mAlertListener->Observe(nullptr, "alertclickcallback", mCookie.get());
-    }
-  }
-  mBackend->RemoveHandler(mName, this);
-  return S_OK;
-}
-
-HRESULT
-ToastNotificationHandler::OnDismiss(IToastNotification *notification,
-                                    IToastDismissedEventArgs* aArgs)
-{
-  if (mAlertListener) {
-    mAlertListener->Observe(nullptr, "alertfinished", mCookie.get());
-  }
-  mBackend->RemoveHandler(mName, this);
-  return S_OK;
-}
-
-HRESULT
-ToastNotificationHandler::OnFail(IToastNotification *notification,
-                                 IToastFailedEventArgs* aArgs)
-{
-  if (mAlertListener) {
-    mAlertListener->Observe(nullptr, "alertfinished", mCookie.get());
-  }
-  mBackend->RemoveHandler(mName, this);
-  return S_OK;
-}
-
-nsresult
-ToastNotificationHandler::TryShowAlert()
-{
-  if (NS_WARN_IF(!ShowAlert())) {
-    mBackend->RemoveHandler(mName, this);
-    return NS_ERROR_FAILURE;
-  }
-  return NS_OK;
-}
-NS_IMETHODIMP
-ToastNotificationHandler::OnImageMissing(nsISupports*)
-{
-  return TryShowAlert();
-}
-
-NS_IMETHODIMP
-ToastNotificationHandler::OnImageReady(nsISupports*, imgIRequest* aRequest)
-{
-  nsresult rv = AsyncSaveImage(aRequest);
-  if (NS_FAILED(rv)) {
-    return TryShowAlert();
-  }
-  return rv;
-}
-
-nsresult
-ToastNotificationHandler::AsyncSaveImage(imgIRequest* aRequest)
-{
-  nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR,
-                                       getter_AddRefs(mImageFile));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  rv = mImageFile->Append(NS_LITERAL_STRING("notificationimages"));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  rv = mImageFile->Create(nsIFile::DIRECTORY_TYPE, 0500);
-  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS) {
-    return rv;
-  }
-
-  nsCOMPtr<nsIUUIDGenerator> idGen =
-    do_GetService("@mozilla.org/uuid-generator;1", &rv);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsID uuid;
-  rv = idGen->GenerateUUIDInPlace(&uuid);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  char uuidChars[NSID_LENGTH];
-  uuid.ToProvidedString(uuidChars);
-  // Remove the brackets at the beginning and ending of the generated UUID.
-  nsAutoCString uuidStr(Substring(uuidChars + 1, uuidChars + NSID_LENGTH - 2));
-  uuidStr.AppendLiteral(".bmp");
-  mImageFile->AppendNative(uuidStr);
-
-  nsCOMPtr<imgIContainer> imgContainer;
-  rv = aRequest->GetImage(getter_AddRefs(imgContainer));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsMainThreadPtrHandle<ToastNotificationHandler> self(
-    new nsMainThreadPtrHolder<ToastNotificationHandler>(
-      "ToastNotificationHandler", this));
-
-  nsCOMPtr<nsIFile> imageFile(mImageFile);
-  RefPtr<mozilla::gfx::SourceSurface> surface =
-    imgContainer->GetFrame(imgIContainer::FRAME_FIRST,
-                           imgIContainer::FLAG_SYNC_DECODE);
-  nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
-    "ToastNotificationHandler::AsyncWriteBitmap",
-    [self, imageFile, surface]() -> void {
-
-      nsresult rv;
-      if (!surface) {
-        rv = NS_ERROR_FAILURE;
-      } else {
-        rv = WinUtils::WriteBitmap(imageFile, surface);
-      }
-
-      nsCOMPtr<nsIRunnable> cbRunnable = NS_NewRunnableFunction(
-        "ToastNotificationHandler::AsyncWriteBitmapCb",
-        [self, rv]() -> void {
-          auto handler = const_cast<ToastNotificationHandler*>(self.get());
-          handler->OnWriteBitmapFinished(rv);
-        });
-
-      NS_DispatchToMainThread(cbRunnable);
-    });
-
-  return mBackend->BackgroundDispatch(r);
-}
-
-void
-ToastNotificationHandler::OnWriteBitmapFinished(nsresult rv)
-{
-  if (NS_SUCCEEDED(rv)) {
-    OnWriteBitmapSuccess();
-  }
-  TryShowAlert();
-}
-
-nsresult
-ToastNotificationHandler::OnWriteBitmapSuccess()
-{
-  nsresult rv;
-
-  nsCOMPtr<nsIURI> fileURI;
-  rv = NS_NewFileURI(getter_AddRefs(fileURI), mImageFile);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsAutoCString uriStr;
-  rv = fileURI->GetSpec(uriStr);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  AppendUTF8toUTF16(uriStr, mImageUri);
-
-  mHasImage = true;
-
-  return NS_OK;
-}
-
-} // namespace widget
-} // namespace mozilla
deleted file mode 100644
--- a/widget/windows/ToastNotificationHandler.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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/. */
-
-#ifndef ToastNotificationHandler_h__
-#define ToastNotificationHandler_h__
-
-#include <windows.ui.notifications.h>
-#include <windows.data.xml.dom.h>
-#include <wrl.h>
-#include "imgIContainer.h"
-#include "nsCOMPtr.h"
-#include "nsIAlertsService.h"
-#include "nsICancelable.h"
-#include "nsIFile.h"
-#include "nsString.h"
-
-namespace mozilla {
-namespace widget {
-
-class ToastNotification;
-
-class ToastNotificationHandler final : public nsIAlertNotificationImageListener
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER
-
-  ToastNotificationHandler(ToastNotification* backend, nsIObserver* aAlertListener,
-                           const nsAString& aName, const nsAString& aCookie,
-                           const nsAString& aTitle, const nsAString& aMsg,
-                           const nsAString& aHostPort,
-                           bool aClickable)
-    : mBackend(backend)
-    , mHasImage(false)
-    , mAlertListener(aAlertListener)
-    , mName(aName)
-    , mCookie(aCookie)
-    , mTitle(aTitle)
-    , mMsg(aMsg)
-    , mHostPort(aHostPort)
-    , mClickable(aClickable)
-  {
-  }
-
-  nsresult InitAlertAsync(nsIAlertNotification* aAlert);
-
-  void OnWriteBitmapFinished(nsresult rv);
-
-protected:
-  virtual ~ToastNotificationHandler();
-
-  typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument;
-  typedef ABI::Windows::UI::Notifications::IToastNotifier
-          IToastNotifier;
-  typedef ABI::Windows::UI::Notifications::IToastNotification
-          IToastNotification;
-  typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs
-          IToastDismissedEventArgs;
-  typedef ABI::Windows::UI::Notifications::IToastFailedEventArgs
-          IToastFailedEventArgs;
-  typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType;
-
-  Microsoft::WRL::ComPtr<IToastNotification> mNotification;
-  Microsoft::WRL::ComPtr<IToastNotifier> mNotifier;
-
-  RefPtr<ToastNotification> mBackend;
-
-  nsCOMPtr<nsICancelable> mImageRequest;
-  nsCOMPtr<nsIFile> mImageFile;
-  nsString mImageUri;
-  bool mHasImage;
-
-  EventRegistrationToken mActivatedToken;
-  EventRegistrationToken mDismissedToken;
-  EventRegistrationToken mFailedToken;
-
-  nsCOMPtr<nsIObserver> mAlertListener;
-  nsString mName;
-  nsString mCookie;
-  nsString mTitle;
-  nsString mMsg;
-  nsString mHostPort;
-  bool mClickable;
-
-  nsresult TryShowAlert();
-  bool ShowAlert();
-  nsresult AsyncSaveImage(imgIRequest* aRequest);
-  nsresult OnWriteBitmapSuccess();
-
-  bool CreateWindowsNotificationFromXml(IXmlDocument* aToastXml);
-  Microsoft::WRL::ComPtr<IXmlDocument> InitializeXmlForTemplate(
-                         ToastTemplateType templateType);
-
-  HRESULT OnActivate(IToastNotification *notification,
-                     IInspectable *inspectable);
-  HRESULT OnDismiss(IToastNotification *notification,
-                    IToastDismissedEventArgs* aArgs);
-  HRESULT OnFail(IToastNotification *notification,
-                 IToastFailedEventArgs* aArgs);
-};
-
-} // widget
-} // mozilla
-
-#endif
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -1785,113 +1785,16 @@ WinUtils::SetupKeyModifiersSequence(nsTA
       aArray->AppendElement(
                 KeyPair(VK_CONTROL, VK_LCONTROL, ScanCode::eControlLeft));
       aArray->AppendElement(
                 KeyPair(VK_MENU, VK_RMENU, ScanCode::eAltRight));
     }
   }
 }
 
-/* static */
-nsresult
-WinUtils::WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
-{
-  RefPtr<SourceSurface> surface =
-    aImage->GetFrame(imgIContainer::FRAME_FIRST,
-                     imgIContainer::FLAG_SYNC_DECODE);
-  NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE);
-
-  return WriteBitmap(aFile, surface);
-}
-
-/* static */
-nsresult
-WinUtils::WriteBitmap(nsIFile* aFile, SourceSurface* surface)
-{
-  nsresult rv;
-
-  // For either of the following formats we want to set the biBitCount member
-  // of the BITMAPINFOHEADER struct to 32, below. For that value the bitmap
-  // format defines that the A8/X8 WORDs in the bitmap byte stream be ignored
-  // for the BI_RGB value we use for the biCompression member.
-  MOZ_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8A8 ||
-             surface->GetFormat() == SurfaceFormat::B8G8R8X8);
-
-  RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
-  NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
-
-  int32_t width = dataSurface->GetSize().width;
-  int32_t height = dataSurface->GetSize().height;
-  int32_t bytesPerPixel = 4 * sizeof(uint8_t);
-  uint32_t bytesPerRow = bytesPerPixel * width;
-
-  // initialize these bitmap structs which we will later
-  // serialize directly to the head of the bitmap file
-  BITMAPINFOHEADER bmi;
-  bmi.biSize = sizeof(BITMAPINFOHEADER);
-  bmi.biWidth = width;
-  bmi.biHeight = height;
-  bmi.biPlanes = 1;
-  bmi.biBitCount = (WORD)bytesPerPixel*8;
-  bmi.biCompression = BI_RGB;
-  bmi.biSizeImage = bytesPerRow * height;
-  bmi.biXPelsPerMeter = 0;
-  bmi.biYPelsPerMeter = 0;
-  bmi.biClrUsed = 0;
-  bmi.biClrImportant = 0;
-
-  BITMAPFILEHEADER bf;
-  bf.bfType = 0x4D42; // 'BM'
-  bf.bfReserved1 = 0;
-  bf.bfReserved2 = 0;
-  bf.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
-  bf.bfSize = bf.bfOffBits + bmi.biSizeImage;
-
-  // get a file output stream
-  nsCOMPtr<nsIOutputStream> stream;
-  rv = NS_NewLocalFileOutputStream(getter_AddRefs(stream), aFile);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  DataSourceSurface::MappedSurface map;
-  if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // write the bitmap headers and rgb pixel data to the file
-  rv = NS_ERROR_FAILURE;
-  if (stream) {
-    uint32_t written;
-    stream->Write((const char*)&bf, sizeof(BITMAPFILEHEADER), &written);
-    if (written == sizeof(BITMAPFILEHEADER)) {
-      stream->Write((const char*)&bmi, sizeof(BITMAPINFOHEADER), &written);
-      if (written == sizeof(BITMAPINFOHEADER)) {
-        // write out the image data backwards because the desktop won't
-        // show bitmaps with negative heights for top-to-bottom
-        uint32_t i = map.mStride * height;
-        do {
-          i -= map.mStride;
-          stream->Write(((const char*)map.mData) + i, bytesPerRow, &written);
-          if (written == bytesPerRow) {
-            rv = NS_OK;
-          } else {
-            rv = NS_ERROR_FAILURE;
-            break;
-          }
-        } while (i != 0);
-      }
-    }
-
-    stream->Close();
-  }
-
-  dataSurface->Unmap();
-
-  return rv;
-}
-
 // This is in use here and in dom/events/TouchEvent.cpp
 /* static */
 uint32_t
 WinUtils::IsTouchDeviceSupportPresent()
 {
   int32_t touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
   return (touchCapabilities & NID_READY) &&
          (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH));
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -501,21 +501,16 @@ public:
 
   /**
    * Returns true if executable's path is on a network drive.
    */
   static bool RunningFromANetworkDrive();
 
   static void Initialize();
 
-  static nsresult WriteBitmap(nsIFile* aFile, mozilla::gfx::SourceSurface* surface);
-  // This function is a helper, but it cannot be called from the main thread.
-  // Use the one above!
-  static nsresult WriteBitmap(nsIFile* aFile, imgIContainer* aImage);
-
   /**
    * This function normalizes the input path, converts short filenames to long
    * filenames, and substitutes environment variables for system paths.
    * The resulting output string length is guaranteed to be <= MAX_PATH.
    */
   static bool SanitizePath(const wchar_t* aInputPath, nsAString& aOutput);
 
   /**
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -165,19 +165,13 @@ RESFILE = 'widget.res'
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
 OS_LIBS += [
     'rpcrt4',
 ]
 
 if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
-    SOURCES += [
-        'ToastNotification.cpp',
-        'ToastNotificationHandler.cpp',
-    ]
     # C5038: Suppress initializer list order warnings from wrl.h
-    SOURCES['ToastNotification.cpp'].flags += ['-wd5038']
-    SOURCES['ToastNotificationHandler.cpp'].flags += ['-wd5038']
     SOURCES['WindowsUIUtils.cpp'].flags += ['-wd5038']
 
 if CONFIG['CC_TYPE'] == 'clang-cl':
     AllowCompilerWarnings()  # workaround for bug 1090497
--- a/widget/windows/nsWidgetFactory.cpp
+++ b/widget/windows/nsWidgetFactory.cpp
@@ -37,21 +37,16 @@
 #include "nsDragService.h"
 #include "nsTransferable.h"
 #include "nsHTMLFormatConverter.h"
 
 #include "WinTaskbar.h"
 #include "JumpListBuilder.h"
 #include "JumpListItem.h"
 #include "TaskbarPreview.h"
-// Toast notification support
-#ifndef __MINGW32__
-#include "ToastNotification.h"
-#include "nsToolkitCompsCID.h"
-#endif
 
 #include "WindowsUIUtils.h"
 
 #ifdef NS_PRINTING
 #include "nsDeviceContextSpecWin.h"
 #include "nsPrintDialogWin.h"
 #include "nsPrintSettingsServiceWin.h"
 #include "nsPrintSession.h"
@@ -110,19 +105,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListB
 NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListItem)
 NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListSeparator)
 NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListLink)
 NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListShortcut)
 NS_GENERIC_FACTORY_CONSTRUCTOR(WindowsUIUtils)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
-#ifndef __MINGW32__
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ToastNotification, Init)
-#endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarPreviewCallback)
 #ifdef NS_PRINTING
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceWin, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceWin, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin)
 #endif
@@ -148,19 +140,16 @@ NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERT
 NS_DEFINE_NAMED_CID(NS_WIN_TASKBAR_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTBUILDER_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTITEM_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSEPARATOR_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTLINK_CID);
 NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORTCUT_CID);
 NS_DEFINE_NAMED_CID(NS_WINDOWS_UIUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
-#ifndef __MINGW32__
-NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
-#endif
 NS_DEFINE_NAMED_CID(NS_TASKBARPREVIEWCALLBACK_CID);
 #ifdef NS_PRINTING
 NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
 #endif
@@ -182,19 +171,16 @@ static const mozilla::Module::CIDEntry k
   { &kNS_WIN_TASKBAR_CID, false, nullptr, WinTaskbarConstructor },
   { &kNS_WIN_JUMPLISTBUILDER_CID, false, nullptr, JumpListBuilderConstructor },
   { &kNS_WIN_JUMPLISTITEM_CID, false, nullptr, JumpListItemConstructor },
   { &kNS_WIN_JUMPLISTSEPARATOR_CID, false, nullptr, JumpListSeparatorConstructor },
   { &kNS_WIN_JUMPLISTLINK_CID, false, nullptr, JumpListLinkConstructor },
   { &kNS_WIN_JUMPLISTSHORTCUT_CID, false, nullptr, JumpListShortcutConstructor },
   { &kNS_WINDOWS_UIUTILS_CID, false, nullptr, WindowsUIUtilsConstructor },
   { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY },
-#ifndef __MINGW32__
-  { &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, ToastNotificationConstructor, Module::MAIN_PROCESS_ONLY },
-#endif
   { &kNS_TASKBARPREVIEWCALLBACK_CID, false, nullptr, TaskbarPreviewCallbackConstructor },
 #ifdef NS_PRINTING
   { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceWinConstructor, Module::MAIN_PROCESS_ONLY },
   { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintSettingsServiceWinConstructor },
   { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorWinConstructor },
   { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
   { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecWinConstructor },
 #endif
@@ -216,19 +202,16 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/windows-taskbar;1", &kNS_WIN_TASKBAR_CID },
   { "@mozilla.org/windows-jumplistbuilder;1", &kNS_WIN_JUMPLISTBUILDER_CID },
   { "@mozilla.org/windows-jumplistitem;1", &kNS_WIN_JUMPLISTITEM_CID },
   { "@mozilla.org/windows-jumplistseparator;1", &kNS_WIN_JUMPLISTSEPARATOR_CID },
   { "@mozilla.org/windows-jumplistlink;1", &kNS_WIN_JUMPLISTLINK_CID },
   { "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID },
   { "@mozilla.org/windows-ui-utils;1", &kNS_WINDOWS_UIUTILS_CID },
   { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY },
-#ifndef __MINGW32__
-  { NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID, Module::MAIN_PROCESS_ONLY },
-#endif
   { "@mozilla.org/widget/taskbar-preview-callback;1", &kNS_TASKBARPREVIEWCALLBACK_CID },
 #ifdef NS_PRINTING
   { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
   { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
   { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
   { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
   { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
 #endif