Bug 1482256 - Support switching to browser.xul to browser.xhtml. r=mossop
authorBrendan Dahl <bdahl@mozilla.com>
Thu, 09 Aug 2018 14:16:28 -0700
changeset 486654 6639ad4e8e86ec64e9d97d6512ea77558d1f4510
parent 486653 ebfd031ace655e9001916a4aa0c42dce476cd92d
child 486655 2300b4b766cab3f534187dd12947219d907333f4
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1482256
milestone63.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 1482256 - Support switching to browser.xul to browser.xhtml. r=mossop Adds a new environment variable MOZ_BROWSER_XHTML to change Firefox to load a modified version of browser.xul as browser.xhtml. Adds the xhtml namespace to the script tags to make them work. MozReview-Commit-ID: 2adtOVzXHKd
browser/base/content/browser.xhtml
browser/base/content/browser.xul
browser/base/content/global-scripts.inc
browser/base/content/test/static/browser_all_files_referenced.js
browser/base/jar.mn
browser/base/moz.build
browser/confvars.sh
toolkit/content/editMenuCommands.inc.xul
new file mode 100644
--- /dev/null
+++ b/browser/base/content/browser.xhtml
@@ -0,0 +1,3 @@
+#define BROWSER_XHTML
+#include browser.xul
+#undef BROWSER_XHTML
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -67,17 +67,21 @@
         retargetdocumentfocus="urlbar"
         persist="screenX screenY width height sizemode">
 
 # 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
 # that they can be shared with macWindow.inc.xul.
 #include global-scripts.inc
 
-<script type="application/javascript">
+<script type="application/javascript"
+#ifdef BROWSER_XHTML
+xmlns="http://www.w3.org/1999/xhtml"
+#endif
+>
   Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
   Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser.js", this);
 </script>
 
 # All sets except for popupsets (commands, keys, stringbundles and broadcasters)
 # *must* go into the browser-sets.inc file so that they can be shared with other
 # top level windows in macWindow.inc.xul.
 #include browser-sets.inc
--- a/browser/base/content/global-scripts.inc
+++ b/browser/base/content/global-scripts.inc
@@ -2,17 +2,21 @@
 # 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/.
 
 # If you update this list, you may need to add a mapping within the following
 # file so that ESLint works correctly:
 # tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
 
-<script type="application/javascript">
+<script type="text/javascript"
+#ifdef BROWSER_XHTML
+xmlns="http://www.w3.org/1999/xhtml"
+#endif
+>
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 for (let script of [
   "chrome://browser/content/browser.js",
 
   "chrome://browser/content/browser-captivePortal.js",
   "chrome://browser/content/browser-compacttheme.js",
   "chrome://browser/content/browser-contentblocking.js",
--- a/browser/base/content/test/static/browser_all_files_referenced.js
+++ b/browser/base/content/test/static/browser_all_files_referenced.js
@@ -158,16 +158,18 @@ var whitelist = [
   {file: "resource://gre/modules/PerformanceWatcher.jsm"},
   // Bug 1378173 (warning: still used by devtools)
   {file: "resource://gre/modules/Promise.jsm"},
   // Still used by WebIDE, which is going away but not entirely gone.
   {file: "resource://gre/modules/ZipUtils.jsm"},
   // Bug 1463225 (on Mac this is only used by a test)
   {file: "chrome://global/content/bindings/toolbar.xml",
    platforms: ["macosx"]},
+  // Bug 1483277 (temporarily unreferenced)
+  {file: "chrome://browser/content/browser.xhtml"},
 ];
 
 whitelist = new Set(whitelist.filter(item =>
   ("isFromDevTools" in item) == isDevtools &&
   (!item.skipUnofficial || !AppConstants.MOZILLA_OFFICIAL) &&
   (!item.platforms || item.platforms.includes(AppConstants.platform))
 ).map(item => item.file));
 
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -24,16 +24,19 @@ browser.jar:
         content/browser/aboutNetError-new.xhtml        (content/aboutNetError-new.xhtml)
         content/browser/aboutRobots-icon.png          (content/aboutRobots-icon.png)
         content/browser/aboutRobots-widget-left.png   (content/aboutRobots-widget-left.png)
         content/browser/aboutTabCrashed.css           (content/aboutTabCrashed.css)
         content/browser/aboutTabCrashed.js            (content/aboutTabCrashed.js)
         content/browser/aboutTabCrashed.xhtml         (content/aboutTabCrashed.xhtml)
 *       content/browser/browser.css                   (content/browser.css)
         content/browser/browser.js                    (content/browser.js)
+#ifdef MOZ_BROWSER_XHTML
+*       content/browser/browser.xhtml                 (content/browser.xhtml)
+#endif
 *       content/browser/browser.xul                   (content/browser.xul)
         content/browser/browser-addons.js             (content/browser-addons.js)
         content/browser/browser-allTabsMenu.js        (content/browser-allTabsMenu.js)
         content/browser/browser-captivePortal.js      (content/browser-captivePortal.js)
         content/browser/browser-ctrlTab.js            (content/browser-ctrlTab.js)
         content/browser/browser-customization.js      (content/browser-customization.js)
         content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
         content/browser/browser-compacttheme.js       (content/browser-compacttheme.js)
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -57,16 +57,17 @@ BROWSER_CHROME_MANIFESTS += [
     'content/test/trackingUI/browser.ini',
     'content/test/urlbar/browser.ini',
     'content/test/webextensions/browser.ini',
     'content/test/webrtc/browser.ini',
 ]
 
 DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
 DEFINES['MOZ_APP_VERSION_DISPLAY'] = CONFIG['MOZ_APP_VERSION_DISPLAY']
+DEFINES['MOZ_BROWSER_XHTML'] = CONFIG['MOZ_BROWSER_XHTML']
 
 DEFINES['APP_LICENSE_BLOCK'] = '%s/content/overrides/app-license.html' % SRCDIR
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk3', 'cocoa'):
     DEFINES['CONTEXT_COPY_IMAGE_CONTENTS'] = 1
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk3'):
     DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -35,17 +35,21 @@ if test "$OS_ARCH" = "WINNT"; then
 fi
 
 # Enable building ./signmar and running libmar signature tests
 MOZ_ENABLE_SIGNMAR=1
 
 MOZ_APP_VERSION=$FIREFOX_VERSION
 MOZ_APP_VERSION_DISPLAY=$FIREFOX_VERSION_DISPLAY
 
-BROWSER_CHROME_URL=chrome://browser/content/browser.xul
+if [ "${MOZ_BROWSER_XHTML}" = "1" ]; then
+  BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml
+else
+  BROWSER_CHROME_URL=chrome://browser/content/browser.xul
+fi
 
 # MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
 # MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
 # specified. It should never point to the "official" branding directory.
 # For mozilla-beta, mozilla-release, or mozilla-central repositories, use
 # "unofficial" branding.
 # For the mozilla-aurora repository, use "aurora".
 MOZ_BRANDING_DIRECTORY=browser/branding/unofficial
--- a/toolkit/content/editMenuCommands.inc.xul
+++ b/toolkit/content/editMenuCommands.inc.xul
@@ -1,9 +1,13 @@
-<script type="application/javascript" src="chrome://global/content/editMenuOverlay.js"/>
+<script type="application/javascript" src="chrome://global/content/editMenuOverlay.js"
+#ifdef BROWSER_XHTML
+xmlns="http://www.w3.org/1999/xhtml"
+#endif
+/>
 <commandset id="editMenuCommands">
   <commandset id="editMenuCommandSetAll" commandupdater="true" events="focus,select"
               oncommandupdate="goUpdateGlobalEditMenuItems()"/>
   <commandset id="editMenuCommandSetUndo" commandupdater="true" events="undo"
               oncommandupdate="goUpdateUndoEditMenuItems()"/>
   <commandset id="editMenuCommandSetPaste" commandupdater="true" events="clipboard"
               oncommandupdate="goUpdatePasteMenuItems()"/>
   <command id="cmd_undo" oncommand="goDoCommand('cmd_undo')"/>