diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-01 23:45:36 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-02-01 23:45:36 -0500 |
commit | 7d21d02d532fed5613501de63f8b3d50144a751f (patch) | |
tree | 06ae93efe12de8b25d207b13e81d8f6c2c0f2f7d /toolkit/content/globalOverlay.js | |
parent | a18c27ddde9bb269948d5849df4840273237a24b (diff) | |
download | uxp-7d21d02d532fed5613501de63f8b3d50144a751f.tar.gz |
Issue #65 - Remove AppConstants from toolkit/content
Diffstat (limited to 'toolkit/content/globalOverlay.js')
-rw-r--r-- | toolkit/content/globalOverlay.js | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/toolkit/content/globalOverlay.js b/toolkit/content/globalOverlay.js index 1df3d65fc1..d8467f0a12 100644 --- a/toolkit/content/globalOverlay.js +++ b/toolkit/content/globalOverlay.js @@ -4,32 +4,32 @@ function closeWindow(aClose, aPromptFunction) { - let { AppConstants } = Components.utils.import("resource://gre/modules/AppConstants.jsm"); - +#ifdef XP_MACOSX // Closing the last window doesn't quit the application on OS X. - if (AppConstants.platform != "macosx") { - var windowCount = 0; - var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator); - var e = wm.getEnumerator(null); - - while (e.hasMoreElements()) { - var w = e.getNext(); - if (w.closed) { - continue; - } - if (++windowCount == 2) - break; + if (typeof(aPromptFunction) == "function" && !aPromptFunction()) { + return false; + } +#else + var windowCount = 0; + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var e = wm.getEnumerator(null); + + while (e.hasMoreElements()) { + var w = e.getNext(); + if (w.closed) { + continue; } + if (++windowCount == 2) + break; + } - // If we're down to the last window and someone tries to shut down, check to make sure we can! - if (windowCount == 1 && !canQuitApplication("lastwindow")) - return false; - if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction()) - return false; - } else if (typeof(aPromptFunction) == "function" && !aPromptFunction()) { + // If we're down to the last window and someone tries to shut down, check to make sure we can! + if (windowCount == 1 && !canQuitApplication("lastwindow")) return false; - } + if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction()) + return false; +#endif if (aClose) { window.close(); |