Bug 955489 - Add a way to pref off JS prpls, r=clokep.
authorFlorian Quèze <florian@instantbird.org>
Mon, 15 Jul 2013 22:27:16 +0200
changeset 19073 94d4c97336abb10f3a5c7b3ee835cd6519e32a23
parent 19072 f5e9d2047b821009ab153c1357d0cb4f3da6e1d0
child 19074 e6af13a818170e53a1107567c9198df00378a87d
push id1103
push usermbanner@mozilla.com
push dateTue, 18 Mar 2014 07:44:06 +0000
treeherdercomm-beta@50c6279a0af0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep
bugs955489
Bug 955489 - Add a way to pref off JS prpls, r=clokep.
im/app/profile/all-instantbird.js
im/modules/ibCore.jsm
--- a/im/app/profile/all-instantbird.js
+++ b/im/app/profile/all-instantbird.js
@@ -301,8 +301,12 @@ pref("browser.tabs.tabClipWidth", 140);
 // 2  no close buttons at all
 // 3  at the end of the tabstrip
 pref("browser.tabs.closeButtons", 1);
 
 #expand pref("chat.irc.defaultQuitMessage", "Instantbird __APP_VERSION__ -- http://www.instantbird.com");
 
 pref("chat.twitter.consumerKey", "TSuyS1ieRAkB3qWv8yyEw");
 pref("chat.twitter.consumerSecret", "DKtKaSf5a7pBNhdBsSZHTnI5Y03hRlPFYWmb4xXBlkU");
+
+// Comma separated list of prpl ids that should use libpurple even if there is
+// a JS implementation. This is used to land JS-prpls pref'ed off in nightlies.
+pref("chat.prpls.forcePurple", "");
--- a/im/modules/ibCore.jsm
+++ b/im/modules/ibCore.jsm
@@ -15,16 +15,33 @@ var Core = {
   _events: [
     "account-disconnected",
     "browser-request",
     "quit-application-requested"
   ],
 
   get bundle() l10nHelper("chrome://instantbird/locale/core.properties"),
 
+  initLibpurpleOverrides: function() {
+    let forcePurple = Services.prefs.getCharPref("chat.prpls.forcePurple")
+                              .split(",")
+                              .map(String.trim)
+                              .filter(function(aPrplId) !!aPrplId);
+    if (!forcePurple.length)
+      return;
+
+    let catMan =
+      Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
+    for (let prplId of forcePurple) {
+      catMan.addCategoryEntry("im-protocol-plugin", prplId,
+                              "@instantbird.org/purple/protocol;1",
+                              false, true);
+    }
+  },
+
   init: function() {
     try {
       // Set the Vendor for breakpad only
       if ("nsICrashReporter" in Ci) {
         Components.classes["@mozilla.org/xre/app-info;1"]
                   .getService(Ci.nsICrashReporter)
                   .annotateCrashReport("Vendor", "Instantbird");
       }
@@ -38,16 +55,18 @@ var Core = {
       return false;
     }
 
     if (!Components.classes["@mozilla.org/chat/core-service;1"]) {
       this._promptError("startupFailure.xpcomRegistrationError");
       return false;
     }
 
+    this.initLibpurpleOverrides();
+
     try {
       Services.core.init();
     }
     catch (e) {
       this._promptError("startupFailure.purplexpcomInitError", e);
       return false;
     }