Fix bug 1243550 - Bring Browser Console to Thunderbird. r=mkmelin
authorPhilipp Kewisch <mozilla@kewis.ch>
Fri, 10 Jun 2016 01:02:24 +0200
changeset 25237 4da79677dea30cb34da13a10214965d72f8e48e0
parent 25236 7533feed2f235cdcde7f5adc7e729ad25d50cfce
child 25238 4f9fcae55b38ab19cfbad2853cb22a896f8b2876
push id1725
push userclokep@gmail.com
push dateMon, 19 Sep 2016 17:35:08 +0000
treeherdercomm-beta@6ead1abf3817 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1243550
Fix bug 1243550 - Bring Browser Console to Thunderbird. r=mkmelin
mail/app/profile/all-thunderbird.js
mail/base/content/mailCore.js
mail/components/devtools/content/webconsole-overlay.xul
mail/components/devtools/jar.mn
mail/confvars.sh
mail/installer/package-manifest.in
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -809,18 +809,20 @@ pref("browser.search.order.US.2", "data:
 pref("browser.search.order.US.3", "data:text/plain,browser.search.defaultenginename.US=");
 
 // XXX Don't update yet, until we've verified how that affects us.
 pref("browser.search.update", false);
 
 // Check whether we need to perform engine updates every 6 hours
 pref("browser.search.update.interval", 21600);
 
-// Disable remote debugging protocol logging
+// Developer Tools related preferences
 pref("devtools.debugger.log", false);
+pref("devtools.chrome.enabled", true);
+pref("devtools.selfxss.count", 5);
 
 pref("mail.chat.enabled", true);
 // Whether to show chat notifications or not.
 pref("mail.chat.show_desktop_notifications", true);
 // Decide how much information is to be shown in the notification.
 // 0 == Show all info (sender, chat message message preview),
 // 1 == Show sender's info only (not message preview),
 // 2 == No info (fill dummy values).
--- a/mail/base/content/mailCore.js
+++ b/mail/base/content/mailCore.js
@@ -319,17 +319,19 @@ function onViewToolbarsPopupShowing(aEve
         menuItem.addEventListener("command", onMenuItemCommand, false);
       }
     }
   }
 }
 
 function toJavaScriptConsole()
 {
-  toOpenWindowByType("global:console", "chrome://global/content/console.xul");
+  let { require } = Components.utils.import("resource://devtools/shared/Loader.jsm", {})
+  let HUDService = require("devtools/client/webconsole/hudservice");
+  HUDService.openBrowserConsoleOrFocus();
 }
 
 function toOpenWindowByType(inType, uri)
 {
   var topWindow = Services.wm.getMostRecentWindow(inType);
   if (topWindow)
     topWindow.focus();
   else
new file mode 100644
--- /dev/null
+++ b/mail/components/devtools/content/webconsole-overlay.xul
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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/. -->
+
+<!DOCTYPE overlay SYSTEM "chrome://messenger/locale/messenger.dtd">
+
+<overlay id="tb-webconsole-overlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <window id="devtools-webconsole" browserConsoleTitle="&errorConsoleCmd.label;">
+    <!--  Workaround since devtools hardcodes navigator:browser, which makes
+          browserWindow null, which means it falls back to using the
+          webconsole.xul window to look for gViewSourceUtils. -->
+    <script type="application/javascript" src="chrome://global/content/viewSourceUtils.js"/>
+    <script type="application/javascript"><![CDATA[
+        function openUILinkIn(url) {
+            var mailWindow = Services.wm.getMostRecentWindow("mail:3pane");
+            return mailWindow.openLinkExternally(url);
+        }
+    ]]></script>
+  </window>
+</overlay>
--- a/mail/components/devtools/jar.mn
+++ b/mail/components/devtools/jar.mn
@@ -1,8 +1,10 @@
 # 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/.
 
 messenger.jar:
 % overlay chrome://messenger/content/messenger.xul chrome://messenger/content/devtools/dbg-messenger-overlay.xul
+% overlay chrome://devtools/content/webconsole/webconsole.xul chrome://messenger/content/devtools/webconsole-overlay.xul
   content/messenger/devtools/dbg-messenger-overlay.xul     (content/dbg-messenger-overlay.xul)
   content/messenger/devtools/dbg-messenger-overlay.js      (content/dbg-messenger-overlay.js)
+  content/messenger/devtools/webconsole-overlay.xul        (content/webconsole-overlay.xul)
--- a/mail/confvars.sh
+++ b/mail/confvars.sh
@@ -42,8 +42,10 @@ MAR_CHANNEL_ID=thunderbird-comm-central
 JSGC_GENERATIONAL=1
 MOZ_PROFILE_MIGRATOR=1
 MOZ_JSDOWNLOADS=1
 MOZ_BINARY_EXTENSIONS=1
 MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES=1
 
 # Enable building ./signmar and running libmar signature tests
 MOZ_ENABLE_SIGNMAR=1
+
+MOZ_DEVTOOLS=all
--- a/mail/installer/package-manifest.in
+++ b/mail/installer/package-manifest.in
@@ -297,16 +297,19 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 @RESPATH@/chrome/classic@JAREXT@
 @RESPATH@/chrome/classic.manifest
 
 ; DevTools
 @RESPATH@/chrome/devtools@JAREXT@
 @RESPATH@/chrome/devtools.manifest
+@RESPATH@/@PREF_DIR@/devtools.js
+@RESPATH@/components/devtools-startup.manifest
+@RESPATH@/components/devtools-startup.js
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Default Profile Settings
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ; default pref files
 @RESPATH@/defaults/pref/all-thunderbird.js
 @RESPATH@/defaults/pref/channel-prefs.js