Bug 1472751 - Remove MAC_NON_BROWSER_WINDOW preprocessor directive;r=Gijs draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 02 Jul 2018 14:25:35 -0700
changeset 813290 4628aa160fefcb5eacad0e6b174be7216071bda1
parent 813062 9c02d2ecf22050bfee5d70c04a359d8aaff6eb91
push id114846
push userbgrinstead@mozilla.com
push dateMon, 02 Jul 2018 21:25:53 +0000
reviewersGijs
bugs1472751
milestone63.0a1
Bug 1472751 - Remove MAC_NON_BROWSER_WINDOW preprocessor directive;r=Gijs The menuitem used to be only included in the markup for the non-browser window case. This changes it to include it as a hidden <menuitem> for the browser window case, and then unhide it for the non-browser window case. MozReview-Commit-ID: 8tY3GiTFmqe
browser/base/content/browser-menubar.inc
browser/base/content/browser.js
browser/base/content/macWindow.inc.xul
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -28,22 +28,21 @@
                           accesskey="&newNavigatorCmd.accesskey;"
                           key="key_newNavigator"
                           command="cmd_newNavigator"/>
                 <menuitem id="menu_newPrivateWindow"
                           label="&newPrivateWindow.label;"
                           accesskey="&newPrivateWindow.accesskey;"
                           command="Tools:PrivateBrowsing"
                           key="key_privatebrowsing"/>
-#ifdef MAC_NON_BROWSER_WINDOW
                 <menuitem id="menu_openLocation"
+                          hidden="true"
                           label="&openLocationCmd.label;"
                           command="Browser:OpenLocation"
                           key="focusURLBar"/>
-#endif
                 <menuitem id="menu_openFile"
                           label="&openFileCmd.label;"
                           command="Browser:OpenFile"
                           key="openFileKb"
                           accesskey="&openFileCmd.accesskey;"/>
                 <menuitem id="menu_close"
                           class="show-only-for-keyboard"
                           label="&closeCmd.label;"
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1960,16 +1960,24 @@ if (AppConstants.platform == "macosx") {
     var element;
 
     for (let disabledItem of disabledItems) {
       element = document.getElementById(disabledItem);
       if (element)
         element.setAttribute("disabled", "true");
     }
 
+    // Show menus that are only visible in non-browser windows
+    let shownItems = ["menu_openLocation"];
+    for (let shownItem of shownItems) {
+      element = document.getElementById(shownItem);
+      if (element)
+        element.removeAttribute("hidden");
+    }
+
     // If no windows are active (i.e. we're the hidden window), disable the close, minimize
     // and zoom menu commands as well
     if (window.location.href == "chrome://browser/content/hiddenWindow.xul") {
       var hiddenWindowDisabledItems = ["cmd_close", "minimizeWindow", "zoomWindow"];
       for (let hiddenWindowDisabledItem of hiddenWindowDisabledItems) {
         element = document.getElementById(hiddenWindowDisabledItem);
         if (element)
           element.setAttribute("disabled", "true");
--- a/browser/base/content/macWindow.inc.xul
+++ b/browser/base/content/macWindow.inc.xul
@@ -1,16 +1,14 @@
 # -*- Mode: HTML -*-
 #
 # 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/.
 
-#define MAC_NON_BROWSER_WINDOW
-
 # This include file should only contain things that are needed to support MacOS
 # specific features that are needed for all top level windows. If the feature is
 # also needed in browser.xul, it should go in one of the various include files
 # below that are shared with browser.xul. When including this file,
 # browser-doctype.inc must also be included.
 
 # All JS files which are needed by browser.xul and other top level windows to
 # support MacOS specific features *must* go into the global-scripts.inc file so