Bug 1608894 - use getMostRecentWindow to find mainwindow, and hook that up for Thunderbird too. r=smaug
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 22 May 2020 19:34:01 +0000
changeset 531728 6ca84f6daedd9a5e4bc3da24d9d3d34ec35e8e66
parent 531727 ccce96f9e591ea3427f5ee9d4d11e6a563541deb
child 531729 3738ba3a4c9a7d50455173a048f1bf44ea7104fb
push id116827
push usermkmelin@iki.fi
push dateFri, 22 May 2020 21:04:40 +0000
treeherderautoland@6ca84f6daedd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1608894
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1608894 - use getMostRecentWindow to find mainwindow, and hook that up for Thunderbird too. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D76019
security/manager/pki/resources/content/pippki.js
xpfe/appshell/nsIWindowMediator.idl
xpfe/appshell/nsWindowMediator.cpp
--- a/security/manager/pki/resources/content/pippki.js
+++ b/security/manager/pki/resources/content/pippki.js
@@ -26,17 +26,17 @@ function setText(id, value) {
 }
 
 async function viewCertHelper(parent, cert, openingOption = "tab") {
   if (!cert) {
     return;
   }
 
   if (Services.prefs.getBoolPref("security.aboutcertificate.enabled")) {
-    let win = Services.wm.getMostRecentWindow("navigator:browser");
+    let win = Services.wm.getMostRecentBrowserWindow();
     let results = await asyncDetermineUsages(cert);
     let chain = getBestChain(results);
     if (!chain) {
       chain = [cert];
     }
     let certs = chain.map(elem =>
       encodeURIComponent(elem.getBase64DERString())
     );
--- a/xpfe/appshell/nsIWindowMediator.idl
+++ b/xpfe/appshell/nsIWindowMediator.idl
@@ -62,17 +62,17 @@ interface nsIWindowMediator: nsISupports
     *                     ("type" is the |windowtype| attribute of
     *                     the XML <window> element.)
     *                     If null, return the topmost window of any type.
     * @return the topmost window
     */
   mozIDOMWindowProxy getMostRecentWindow(in wstring aWindowType);
 
   /** This is a shortcut for getMostRecentWindow('navigator:browser'), but
-    * it also tries 'navigator:geckoview' if that fails.
+    * if that fails it also tries 'navigator:geckoview' and 'mail:3pane'.
     *
     * @return the topmost browser window
     */
   mozIDOMWindowProxy getMostRecentBrowserWindow();
 
   /**
    * Same as getMostRecentWindow, but ignores private browsing
    * windows.
--- a/xpfe/appshell/nsWindowMediator.cpp
+++ b/xpfe/appshell/nsWindowMediator.cpp
@@ -240,16 +240,23 @@ nsWindowMediator::GetMostRecentBrowserWi
 
 #ifdef MOZ_WIDGET_ANDROID
   if (!*outWindow) {
     rv = GetMostRecentWindow(u"navigator:geckoview", outWindow);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 #endif
 
+#ifdef MOZ_THUNDERBIRD
+  if (!*outWindow) {
+    rv = GetMostRecentWindow(u"mail:3pane", outWindow);
+    NS_ENSURE_SUCCESS(rv, rv);
+  }
+#endif
+
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowMediator::GetMostRecentNonPBWindow(const char16_t* aType,
                                            mozIDOMWindowProxy** aWindow) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(aWindow);