Bug 1614195 - Fix applicationManager in helper applications pref pane. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sat, 15 Feb 2020 15:06:01 +0100
changeset 37479 efe3807a3a7cfcd737c44d6c529758fb3bebdfb8
parent 37478 fc4e611490916c260705dce78e94678e7a610662
child 37480 0d93f5cf6d4956ef6e65ff0aa1ca9db5a7bf685b
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg
bugs1614195
Bug 1614195 - Fix applicationManager in helper applications pref pane. r=frg
suite/components/pref/content/pref-applicationManager.js
suite/components/pref/content/pref-applications.js
--- a/suite/components/pref/content/pref-applicationManager.js
+++ b/suite/components/pref/content/pref-applicationManager.js
@@ -1,42 +1,46 @@
 /* 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/. */
 
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 var gAppManagerDialog = {
   _removed: [],
 
   init: function appManager_init() {
     this.handlerInfo = window.arguments[0];
 
     var bundle = document.getElementById("appManagerBundle");
     var contentText;
     if (this.handlerInfo.type == TYPE_MAYBE_FEED)
       contentText = bundle.getString("descriptionHandleWebFeeds");
     else {
       var description = gApplicationsPane._describeType(this.handlerInfo);
-      var key = (this.handlerInfo.wrappedHandlerInfo instanceof nsIMIMEInfo) ?
-                "descriptionHandleFile" :
-                "descriptionHandleProtocol";
+      var key =
+        (this.handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) ?
+          "descriptionHandleFile" :
+          "descriptionHandleProtocol";
       contentText = bundle.getFormattedString(key, [description]);
     }
     document.getElementById("appDescription").textContent = contentText;
 
     var list = document.getElementById("appList");
     var apps = this.handlerInfo.possibleApplicationHandlers.enumerate();
     while (apps.hasMoreElements()) {
       let app = apps.getNext();
       if (!gApplicationsPane.isValidHandlerApp(app))
         continue;
 
       app.QueryInterface(Ci.nsIHandlerApp);
       var item = list.appendItem(app.name);
       item.className = "listitem-iconic";
-      item.setAttribute("image", gApplicationsPane._getIconURLForHandlerApp(app));
+      item.setAttribute("image",
+                        gApplicationsPane._getIconURLForHandlerApp(app));
       item.app = app;
     }
 
     list.selectedIndex = 0;
   },
 
   onOK: function appManager_onOK() {
     if (!this._removed.length) {
--- a/suite/components/pref/content/pref-applications.js
+++ b/suite/components/pref/content/pref-applications.js
@@ -1,16 +1,19 @@
 /* -*- Mode: Java; tab-width: 2; c-basic-offset: 2; -*-
  *
  * 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/. */
 
 const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 const {ShellService} = ChromeUtils.import("resource:///modules/ShellService.jsm");
+// Needed as this script is also loaded by pref-applicationManager.xul.
+const {XPCOMUtils} =
+  ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function Startup()
 {
   gApplicationsPane.init();
 }
 
 XPCOMUtils.defineLazyServiceGetters(this, {
   gCategoryManager: ["@mozilla.org/categorymanager;1", "nsICategoryManager"],