Bug 1898709 - Use GetMostRecentBrowserWindow() instead of GetMostRecentWindow(u"navigator:browser") to cater for Thunderbird's main window. r=nalexander

Based on https://github.com/Betterbird/thunderbird-patches/blob/main/115/bugs/1863798-toast-notification-foreground-mail-client-m-c.patch

Fixed cases where general code assume main window is Firefox.
GetMostRecentBrowserWindow is getting "navigator:browser" for Firefox, so there is no change in behavior,
but it means more things will work for Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D211520
This commit is contained in:
Magnus Melin 2024-05-24 17:43:52 +00:00
Родитель 53c7b30100
Коммит 67a2c5c9c7
4 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -647,8 +647,7 @@ void ToastNotification::SignalComNotificationHandled(
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
if (winMediator) {
nsCOMPtr<mozIDOMWindowProxy> navWin;
winMediator->GetMostRecentWindow(u"navigator:browser",
getter_AddRefs(navWin));
winMediator->GetMostRecentBrowserWindow(getter_AddRefs(navWin));
if (navWin) {
nsCOMPtr<nsIWidget> widget =
WidgetUtils::DOMWindowToWidget(nsPIDOMWindowOuter::From(navWin));

Просмотреть файл

@ -917,8 +917,7 @@ ToastNotificationHandler::OnActivate(
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
if (winMediator) {
nsCOMPtr<mozIDOMWindowProxy> navWin;
winMediator->GetMostRecentWindow(u"navigator:browser",
getter_AddRefs(navWin));
winMediator->GetMostRecentBrowserWindow(getter_AddRefs(navWin));
if (navWin) {
nsCOMPtr<nsIWidget> widget =
WidgetUtils::DOMWindowToWidget(nsPIDOMWindowOuter::From(navWin));

Просмотреть файл

@ -127,9 +127,9 @@ namespace Foundation {
template <>
struct __declspec(uuid("808aef30-2660-51b0-9c11-f75dd42006b4"))
ITypedEventHandler<ABI::Windows::UI::ViewManagement::UISettings*,
ABI::Windows::UI::ViewManagement::
UISettingsAutoHideScrollBarsChangedEventArgs*>
ITypedEventHandler<ABI::Windows::UI::ViewManagement::UISettings*,
ABI::Windows::UI::ViewManagement::
UISettingsAutoHideScrollBarsChangedEventArgs*>
: ITypedEventHandler_impl<
ABI::Windows::Foundation::Internal::AggregateType<
ABI::Windows::UI::ViewManagement::UISettings*,
@ -555,8 +555,7 @@ void WindowsUIUtils::UpdateInTabletMode() {
nsCOMPtr<nsIWidget> widget;
nsCOMPtr<mozIDOMWindowProxy> navWin;
rv = winMediator->GetMostRecentWindow(u"navigator:browser",
getter_AddRefs(navWin));
rv = winMediator->GetMostRecentBrowserWindow(getter_AddRefs(navWin));
if (NS_FAILED(rv) || !navWin) {
// Fall back to the hidden window
nsCOMPtr<nsIAppShellService> appShell(

Просмотреть файл

@ -108,8 +108,7 @@ static HWND GetMostRecentNavigatorHWND() {
}
nsCOMPtr<mozIDOMWindowProxy> navWin;
rv = winMediator->GetMostRecentWindow(u"navigator:browser",
getter_AddRefs(navWin));
rv = winMediator->GetMostRecentBrowserWindow(getter_AddRefs(navWin));
if (NS_FAILED(rv) || !navWin) {
return nullptr;
}