[tbb-commits] [torbutton/master] Bug #10751.1: Load HUDService only if it's not already available.

mikeperry at torproject.org mikeperry at torproject.org
Tue Sep 30 00:23:25 UTC 2014


commit f5095267fcc638bd5ded6f9934e31d98505a6247
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Mon Aug 25 15:50:19 2014 -0700

    Bug #10751.1: Load HUDService only if it's not already available.
    
    Loading by this method breaks the browser console in ESR31.
    Fortunately, ESR31 has a built-in window.HUDService.
---
 src/chrome/content/torbutton.js |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 4cd9c3d..153cc3c 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -6,8 +6,13 @@
 // TODO: Double-check there are no strange exploits to defeat:
 //       http://kb.mozillazine.org/Links_to_local_pages_don%27t_work
 
-XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
-  "resource:///modules/HUDService.jsm");
+// TODO: Remove the following HUDService loading code once TBB-ESR24 has
+// been retired.
+if (!window.hasOwnProperty("HUDService")) {
+  XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
+    "resource:///modules/HUDService.jsm");
+}
+
 XPCOMUtils.defineLazyModuleGetter(this, "ConsoleServiceListener",
   "resource://gre/modules/devtools/WebConsoleUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
@@ -2605,8 +2610,8 @@ var torbutton_console_observer = {
 
   observe: function(subject, topic, data) {
     if (topic === "web-console-created") {
-      var id = subject.QueryInterface(Ci.nsISupportsString).toString();
-      var con = HUDService.getHudReferenceById(subject);
+      var id = subject.QueryInterface(Ci.nsISupportsString).toString(),
+          con = HUDService.getHudReferenceById(id);
       con.ui.reportPageErrorOld = con.ui.reportPageError;
       // Filtering the messages by making them hidden adding the
       // "hidden-message" class. If the message does not need to get filtered





More information about the tbb-commits mailing list