Bug 1556080 - Add gViewSourceUtils object to Error Console window. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 04 Jun 2019 14:15:46 +1200
changeset 35758 cd98a2947dd26a15d8b8ad3f7134fd343fc3b201
parent 35757 d2a2d9de473d7f9dc377906bc3e75be14bd15246
child 35759 100447ecdcb26ecb78822c5938ef801542059d55
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersjorgk
bugs1556080
Bug 1556080 - Add gViewSourceUtils object to Error Console window. r=jorgk
mail/base/content/mailCore.js
--- a/mail/base/content/mailCore.js
+++ b/mail/base/content/mailCore.js
@@ -39,34 +39,36 @@ XPCOMUtils.defineLazyGetter(this, "gView
     window.openDialog("chrome://messenger/content/viewSource.xul", "_blank", "all,dialog=no", aArgs);
   };
   return scope.gViewSourceUtils;
 });
 
 Services.obs.addObserver({
   observe(win) {
     win.addEventListener("load", function() {
-      if (this.location.href != "chrome://devtools/content/webconsole/browserconsole.xul") {
+      if (this.location.href != "chrome://devtools/content/webconsole/index.html") {
         return;
       }
 
       this.setTimeout(() => {
-        this.gViewSourceUtils.viewSource = async function(aArgs) {
-          // Check if external view source is enabled. If so, try it. If it fails,
-          // fallback to internal view source.
-          if (Services.prefs.getBoolPref("view_source.editor.external")) {
-            try {
-              await this.openInExternalEditor(aArgs);
-              return;
-            } catch (ex) {}
-          }
+        this.gViewSourceUtils = {
+          async viewSource(aArgs) {
+            // Check if external view source is enabled. If so, try it. If it fails,
+            // fallback to internal view source.
+            if (Services.prefs.getBoolPref("view_source.editor.external")) {
+              try {
+                await this.openInExternalEditor(aArgs);
+                return;
+              } catch (ex) {}
+            }
 
-          window.openDialog("chrome://messenger/content/viewSource.xul", "_blank", "all,dialog=no", aArgs);
+            window.openDialog("chrome://messenger/content/viewSource.xul", "_blank", "all,dialog=no", aArgs);
+          },
         };
-      }, 0);
+      });
     }, { capture: false, once: true });
   },
 }, "chrome-document-global-created");
 
 var gCustomizeSheet = false;
 
 function overlayRestoreDefaultSet() {
   let toolbox = null;