Bug 1640676 - Fix parent process and child process message managers following landing of Bug 888600. r=gijs default tip
authorIan Neal <iann_cvs@blueyonder.co.uk>
Mon, 25 May 2020 16:41:12 +0100
changeset 2133 8c47b210d980b0d5ba5fa72279a5e5fcf9277231
parent 2132 c62e8693aebf27919777740c82875a60a5557baa
push id526
push useriann_cvs@blueyonder.co.uk
push dateFri, 29 May 2020 18:58:50 +0000
reviewersgijs
bugs1640676, 888600
Bug 1640676 - Fix parent process and child process message managers following landing of Bug 888600. r=gijs
js/lib/chatzilla-service.js
js/lib/protocol-handlers.jsm
xul/content/static.js
--- a/js/lib/chatzilla-service.js
+++ b/js/lib/chatzilla-service.js
@@ -170,17 +170,26 @@ ProcessHandler.prototype =
     },
 
     /* nsIObserver */
     observe(subject, topic, data)
     {
         if (topic !== "profile-after-change")
             return;
 
-        const ppmm = Cc[PPMM_CONTRACTID].getService(Ci.nsIMessageBroadcaster);
+        var ppmm;
+        // Ci.nsIMessageBroadcaster went in Gecko 61.
+        if (Ci.nsIMessageBroadcaster)
+        {
+            ppmm = Cc[PPMM_CONTRACTID].getService(Ci.nsIMessageBroadcaster);
+        }
+        else
+        {
+            ppmm = Cc[PPMM_CONTRACTID].getService();
+        }
         ppmm.loadProcessScript("chrome://chatzilla/content/lib/js/chatzilla-protocol-script.js", true);
         ppmm.addMessageListener("ChatZilla:SpawnChatZilla", this);
     },
 
     /* nsIMessageListener */
     receiveMessage(msg)
     {
         if (msg.name !== "ChatZilla:SpawnChatZilla")
--- a/js/lib/protocol-handlers.jsm
+++ b/js/lib/protocol-handlers.jsm
@@ -33,18 +33,24 @@ const IRCS_MIMETYPE = "application/x-irc
 //XXXgijs: Because necko is annoying and doesn't expose this error flag, we
 //         define our own constant for it. Throwing something else will show
 //         ugly errors instead of seeminly doing nothing.
 const NS_ERROR_MODULE_NETWORK_BASE = 0x804b0000;
 const NS_ERROR_NO_CONTENT = NS_ERROR_MODULE_NETWORK_BASE + 17;
 
 
 function spawnChatZilla(uri) {
-    const cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
-                  .getService(Ci.nsISyncMessageSender);
+    var cpmm;
+    // Ci.nsISyncMessageSender went in Gecko 61.
+    if (Ci.nsISyncMessageSender) {
+        cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
+                 .getService(Ci.nsISyncMessageSender);
+    } else {
+        cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService();
+    }
     cpmm.sendAsyncMessage("ChatZilla:SpawnChatZilla", { uri });
 }
 
 
 function IRCProtocolHandler(isSecure)
 {
     this.isSecure = isSecure;
 }
--- a/xul/content/static.js
+++ b/xul/content/static.js
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * 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/. */
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
-const __cz_version   = "0.9.95";
+const __cz_version   = "0.9.96";
 const __cz_condition = "green";
 const __cz_suffix    = "";
 const __cz_guid      = "59c81df5-4b7a-477b-912d-4e0fdf64e5f2";
 const __cz_locale    = "0.9.92";
 
 var warn;
 var ASSERT;
 var TEST;