diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index 97b4ed11e83f..a8c47c36d1ae 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -416,15 +416,6 @@ Section "Uninstall" DetailPrint $(STATUS_UNINSTALL_MAIN) SetDetailsPrint none - ; Some system cleanup is most easily handled when XPCOM functionality is - ; available - e.g. removing notifications from Window's Action Center. We - ; handle this in the `uninstall` background task. - ; - ; Return value is saved to an unused variable to prevent the the error flag - ; from being set. - Var /GLOBAL UnusedExecCatchReturn - ExecWait '"$INSTDIR\${FileMainEXE}" --backgroundtask uninstall' $UnusedExecCatchReturn - ; Delete the app exe to prevent launching the app while we are uninstalling. ClearErrors ${DeleteFile} "$INSTDIR\${FileMainEXE}" diff --git a/browser/modules/BackgroundTask_uninstall.jsm b/browser/modules/BackgroundTask_uninstall.jsm deleted file mode 100644 index a81f66f94722..000000000000 --- a/browser/modules/BackgroundTask_uninstall.jsm +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */ - -var { AppConstants } = ChromeUtils.import( - "resource://gre/modules/AppConstants.jsm" -); - -var EXPORTED_SYMBOLS = ["runBackgroundTask"]; -async function runBackgroundTask(commandLine) { - if (AppConstants.platform !== "win") { - console.log("Not a Windows install, skipping `uninstall` background task."); - return; - } - console.log("Running BackgroundTask_uninstall."); - - removeNotifications(); -} - -function removeNotifications() { - console.log("Removing Windows toast notifications."); - - if (!("nsIWindowsAlertsService" in Ci)) { - console.log("nsIWindowsAlertService not present."); - return; - } - - let alertsService; - try { - alertsService = Cc["@mozilla.org/system-alerts-service;1"] - .getService(Ci.nsIAlertsService) - .QueryInterface(Ci.nsIWindowsAlertsService); - } catch (e) { - console.error("Error retrieving nsIWindowsAlertService: " + e.message); - return; - } - - alertsService.removeAllNotificationsForInstall(); - console.log("Finished removing Windows toast notifications."); -} diff --git a/browser/modules/moz.build b/browser/modules/moz.build index 04d8a20e1499..dc73d9fbccdd 100644 --- a/browser/modules/moz.build +++ b/browser/modules/moz.build @@ -154,7 +154,3 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": "WindowsJumpLists.jsm", "WindowsPreviewPerTab.jsm", ] - - EXTRA_JS_MODULES.backgroundtasks += [ - "BackgroundTask_uninstall.jsm", - ] diff --git a/toolkit/components/alerts/nsIAlertsService.idl b/toolkit/components/alerts/nsIAlertsService.idl index 01a86f275343..49678464d316 100644 --- a/toolkit/components/alerts/nsIAlertsService.idl +++ b/toolkit/components/alerts/nsIAlertsService.idl @@ -63,8 +63,8 @@ interface nsIAlertAction : nsISupports * we request Windows to process `action`. At the time of writing, Windows * recognizes the following actions: * - * - `action="dismiss"` dismisses the alert entirely. - * - `action="snooze"` snoozes the alert, generally making it disappear before + * - `action="dismiss"` dismisses the alert entirely; + * - "action="snooze"` snoozes the alert, generally making it disappear before * reappearing a Windows-determined amount of time later. * * On non-Windows, this field is ignored. diff --git a/toolkit/components/alerts/nsIWindowsAlertsService.idl b/toolkit/components/alerts/nsIWindowsAlertsService.idl index dd32da30eb22..75d17114be41 100644 --- a/toolkit/components/alerts/nsIWindowsAlertsService.idl +++ b/toolkit/components/alerts/nsIWindowsAlertsService.idl @@ -50,11 +50,4 @@ interface nsIWindowsAlertsService : nsIAlertsService */ AString getXmlStringForWindowsAlert(in nsIAlertNotification aAlert, [optional] in AString aWindowsTag); - - /** - * Removes all action center and snoozed notifications associated with this - * install. Note that this removes all notifications regardless of which profile - * they originated from. - */ - void removeAllNotificationsForInstall(); }; diff --git a/widget/windows/ToastNotification.cpp b/widget/windows/ToastNotification.cpp index 569892768f04..57a337629fb9 100644 --- a/widget/windows/ToastNotification.cpp +++ b/widget/windows/ToastNotification.cpp @@ -9,10 +9,7 @@ #include #include #include -#include -#include -#include "ErrorList.h" #include "mozilla/BasePrincipal.h" #include "mozilla/Buffer.h" #include "mozilla/DynamicallyLinkedFunctionPtr.h" @@ -37,18 +34,6 @@ namespace mozilla { namespace widget { -using namespace ABI::Windows::Foundation; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -// Needed to disambiguate internal and Windows `ToastNotification` classes. -using namespace ABI::Windows::UI::Notifications; -using WinToastNotification = ABI::Windows::UI::Notifications::ToastNotification; -using IVectorView_ToastNotification = - ABI::Windows::Foundation::Collections::IVectorView; -using IVectorView_ScheduledToastNotification = - ABI::Windows::Foundation::Collections::IVectorView< - ScheduledToastNotification*>; - LazyLogModule sWASLog("WindowsAlertsService"); NS_IMPL_ISUPPORTS(ToastNotification, nsIAlertsService, nsIWindowsAlertsService, @@ -626,65 +611,5 @@ void ToastNotification::RemoveHandler(const nsAString& aAlertName, } } -NS_IMETHODIMP -ToastNotification::RemoveAllNotificationsForInstall() { - HRESULT hr = S_OK; - - ComPtr manager; - hr = GetActivationFactory( - HStringReference( - RuntimeClass_Windows_UI_Notifications_ToastNotificationManager) - .Get(), - &manager); - NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE); - - HString aumid; - MOZ_ASSERT(mAumid.isSome()); - hr = aumid.Set(mAumid.ref().get()); - NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE); - - // Hide toasts in action center. - [&]() { - ComPtr manager2; - hr = manager.As(&manager2); - NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); - - ComPtr history; - hr = manager2->get_History(&history); - NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); - - hr = history->ClearWithId(aumid.Get()); - NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); - }(); - - // Hide scheduled toasts. - [&]() { - ComPtr notifier; - hr = manager->CreateToastNotifierWithId(aumid.Get(), ¬ifier); - NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); - - ComPtr scheduledToasts; - hr = notifier->GetScheduledToastNotifications(&scheduledToasts); - NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); - - unsigned int schedSize; - hr = scheduledToasts->get_Size(&schedSize); - NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); - - for (unsigned int i = 0; i < schedSize; i++) { - ComPtr schedToast; - hr = scheduledToasts->GetAt(i, &schedToast); - if (NS_WARN_IF(FAILED(hr))) { - continue; - } - - hr = notifier->RemoveFromSchedule(schedToast.Get()); - Unused << NS_WARN_IF(FAILED(hr)); - } - }(); - - return NS_OK; -} - } // namespace widget } // namespace mozilla