Bug 1325464 - Use ES6 method syntax for applications.js. r=mattn draft
authorJared Wein <jwein@mozilla.com>
Thu, 22 Dec 2016 15:54:51 -0500
changeset 454587 e0ae86cc8f6885f544a5a0855c4bdb03e840b2b7
parent 454586 4fd1a0c8244e41cb00622b7f6184599a7682f519
child 454588 0c2feeeec008b36f192edf954eb579b3b14dfcf5
push id39985
push userbmo:jaws@mozilla.com
push dateThu, 29 Dec 2016 19:31:36 +0000
reviewersmattn
bugs1325464
milestone53.0a1
Bug 1325464 - Use ES6 method syntax for applications.js. r=mattn MozReview-Commit-ID: 8sXa5tCp98m
browser/components/preferences/in-content/applications.js
--- a/browser/components/preferences/in-content/applications.js
+++ b/browser/components/preferences/in-content/applications.js
@@ -114,21 +114,21 @@ function getLocalHandlerApp(aFile) {
 function ArrayEnumerator(aItems) {
   this._index = 0;
   this._contents = aItems;
 }
 
 ArrayEnumerator.prototype = {
   _index: 0,
 
-  hasMoreElements: function() {
+  hasMoreElements() {
     return this._index < this._contents.length;
   },
 
-  getNext: function() {
+  getNext() {
     return this._contents[this._index++];
   }
 };
 
 function isFeedType(t) {
   return t == TYPE_MAYBE_FEED || t == TYPE_MAYBE_VIDEO_FEED || t == TYPE_MAYBE_AUDIO_FEED;
 }
 
@@ -167,17 +167,17 @@ HandlerInfoWrapper.prototype = {
                getService(Ci.nsIHandlerService),
 
   _prefSvc: Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefBranch),
 
   _categoryMgr: Cc["@mozilla.org/categorymanager;1"].
                 getService(Ci.nsICategoryManager),
 
-  element: function(aID) {
+  element(aID) {
     return document.getElementById(aID);
   },
 
 
   // nsIHandlerInfo
 
   // The MIME type or protocol scheme.
   _type: null,
@@ -209,26 +209,26 @@ HandlerInfoWrapper.prototype = {
     if (aNewValue)
       this.addPossibleApplicationHandler(aNewValue)
   },
 
   get possibleApplicationHandlers() {
     return this.wrappedHandlerInfo.possibleApplicationHandlers;
   },
 
-  addPossibleApplicationHandler: function(aNewHandler) {
+  addPossibleApplicationHandler(aNewHandler) {
     var possibleApps = this.possibleApplicationHandlers.enumerate();
     while (possibleApps.hasMoreElements()) {
       if (possibleApps.getNext().equals(aNewHandler))
         return;
     }
     this.possibleApplicationHandlers.appendElement(aNewHandler, false);
   },
 
-  removePossibleApplicationHandler: function(aHandler) {
+  removePossibleApplicationHandler(aHandler) {
     var defaultApp = this.preferredApplicationHandler;
     if (defaultApp && aHandler.equals(defaultApp)) {
       // If the app we remove was the default app, we must make sure
       // it won't be used anymore
       this.alwaysAskBeforeHandling = true;
       this.preferredApplicationHandler = null;
     }
 
@@ -357,46 +357,46 @@ HandlerInfoWrapper.prototype = {
   // check for the presence of a user-configured record to determine whether
   // or not this type is only handled by a plugin.  Filed as bug 395142.
   handledOnlyByPlugin: undefined,
 
   get isDisabledPluginType() {
     return this._getDisabledPluginTypes().indexOf(this.type) != -1;
   },
 
-  _getDisabledPluginTypes: function() {
+  _getDisabledPluginTypes() {
     var types = "";
 
     if (this._prefSvc.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES))
       types = this._prefSvc.getCharPref(PREF_DISABLED_PLUGIN_TYPES);
 
     // Only split if the string isn't empty so we don't end up with an array
     // containing a single empty string.
     if (types != "")
       return types.split(",");
 
     return [];
   },
 
-  disablePluginType: function() {
+  disablePluginType() {
     var disabledPluginTypes = this._getDisabledPluginTypes();
 
     if (disabledPluginTypes.indexOf(this.type) == -1)
       disabledPluginTypes.push(this.type);
 
     this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
                               disabledPluginTypes.join(","));
 
     // Update the category manager so existing browser windows update.
     this._categoryMgr.deleteCategoryEntry("Gecko-Content-Viewers",
                                           this.type,
                                           false);
   },
 
-  enablePluginType: function() {
+  enablePluginType() {
     var disabledPluginTypes = this._getDisabledPluginTypes();
 
     var type = this.type;
     disabledPluginTypes = disabledPluginTypes.filter(v => v != type);
 
     this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
                               disabledPluginTypes.join(","));
 
@@ -407,28 +407,28 @@ HandlerInfoWrapper.prototype = {
                        "@mozilla.org/content/plugin/document-loader-factory;1",
                        false,
                        true);
   },
 
 
   // Storage
 
-  store: function() {
+  store() {
     this._handlerSvc.store(this.wrappedHandlerInfo);
   },
 
 
   // Icons
 
   get smallIcon() {
     return this._getIcon(16);
   },
 
-  _getIcon: function(aSize) {
+  _getIcon(aSize) {
     if (this.primaryExtension)
       return "moz-icon://goat." + this.primaryExtension + "?size=" + aSize;
 
     if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo)
       return "moz-icon://goat?size=" + aSize + "&contentType=" + this.type;
 
     // FIXME: consider returning some generic icon when we can't get a URL for
     // one (for example in the case of protocol schemes).  Filed as bug 395141.
@@ -524,43 +524,43 @@ FeedHandlerInfo.prototype = {
       return this._possibleApplicationHandlers;
 
     // A minimal implementation of nsIMutableArray.  It only supports the two
     // methods its callers invoke, namely appendElement and nsIArray::enumerate.
     this._possibleApplicationHandlers = {
       _inner: [],
       _removed: [],
 
-      QueryInterface: function(aIID) {
+      QueryInterface(aIID) {
         if (aIID.equals(Ci.nsIMutableArray) ||
             aIID.equals(Ci.nsIArray) ||
             aIID.equals(Ci.nsISupports))
           return this;
 
         throw Cr.NS_ERROR_NO_INTERFACE;
       },
 
       get length() {
         return this._inner.length;
       },
 
-      enumerate: function() {
+      enumerate() {
         return new ArrayEnumerator(this._inner);
       },
 
-      appendElement: function(aHandlerApp, aWeak) {
+      appendElement(aHandlerApp, aWeak) {
         this._inner.push(aHandlerApp);
       },
 
-      removeElementAt: function(aIndex) {
+      removeElementAt(aIndex) {
         this._removed.push(this._inner[aIndex]);
         this._inner.splice(aIndex, 1);
       },
 
-      queryElementAt: function(aIndex, aInterface) {
+      queryElementAt(aIndex, aInterface) {
         return this._inner[aIndex].QueryInterface(aInterface);
       }
     };
 
     // Add the selected local app if it's different from the OS default handler.
     // Unlike for other types, we can store only one local app at a time for the
     // feed type, since we store it in a preference that historically stores
     // only a single path.  But we display all the local apps the user chooses
@@ -720,17 +720,17 @@ FeedHandlerInfo.prototype = {
 
   // Storage
 
   // Changes to the preferred action and handler take effect immediately
   // (we write them out to the preferences right as they happen),
   // so we when the controller calls store() after modifying the handlers,
   // the only thing we need to store is the removal of possible handlers
   // XXX Should we hold off on making the changes until this method gets called?
-  store: function() {
+  store() {
     for (let app of this._possibleApplicationHandlers._removed) {
       if (app instanceof Ci.nsILocalHandlerApp) {
         let pref = this.element(PREF_FEED_SELECTED_APP);
         var preferredAppFile = pref.value;
         if (preferredAppFile) {
           let preferredApp = getLocalHandlerApp(preferredAppFile);
           if (app.equals(preferredApp))
             pref.reset();
@@ -795,17 +795,17 @@ function InternalHandlerInfoWrapper(aMIM
   HandlerInfoWrapper.call(this, aMIMEType, handlerInfo);
 }
 
 InternalHandlerInfoWrapper.prototype = {
   __proto__: HandlerInfoWrapper.prototype,
 
   // Override store so we so we can notify any code listening for registration
   // or unregistration of this handler.
-  store: function() {
+  store() {
     HandlerInfoWrapper.prototype.store.call(this);
     Services.obs.notifyObservers(null, this._handlerChanged, null);
   },
 
   get enabled() {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
@@ -868,17 +868,17 @@ var gApplicationsPane = {
                   getService(Ci.nsIHandlerService),
 
   _ioSvc        : Cc["@mozilla.org/network/io-service;1"].
                   getService(Ci.nsIIOService),
 
 
   // Initialization & Destruction
 
-  init: function() {
+  init() {
     function setEventListener(aId, aEventType, aCallback)
     {
       document.getElementById(aId)
               .addEventListener(aEventType, aCallback.bind(gApplicationsPane));
     }
 
     // Initialize shortcuts to some commonly accessed elements & values.
     this._brandShortName =
@@ -947,17 +947,17 @@ var gApplicationsPane = {
 
       // Notify observers that the UI is now ready
       Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService).
       notifyObservers(window, "app-handler-pane-loaded", null);
     }
     setTimeout(_delayedPaneLoad, 0, this);
   },
 
-  destroy: function() {
+  destroy() {
     window.removeEventListener("unload", this, false);
     this._prefSvc.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
     this._prefSvc.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
     this._prefSvc.removeObserver(PREF_FEED_SELECTED_APP, this);
     this._prefSvc.removeObserver(PREF_FEED_SELECTED_WEB, this);
     this._prefSvc.removeObserver(PREF_FEED_SELECTED_ACTION, this);
     this._prefSvc.removeObserver(PREF_FEED_SELECTED_READER, this);
 
@@ -970,29 +970,29 @@ var gApplicationsPane = {
     this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
     this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
     this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
   },
 
 
   // nsISupports
 
-  QueryInterface: function(aIID) {
+  QueryInterface(aIID) {
     if (aIID.equals(Ci.nsIObserver) ||
         aIID.equals(Ci.nsIDOMEventListener ||
         aIID.equals(Ci.nsISupports)))
       return this;
 
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
 
 
   // nsIObserver
 
-  observe: function(aSubject, aTopic, aData) {
+  observe(aSubject, aTopic, aData) {
     // Rebuild the list when there are changes to preferences that influence
     // whether or not to show certain entries in the list.
     if (aTopic == "nsPref:changed" && !this._storingAction) {
       // These two prefs alter the list of visible types, so we have to rebuild
       // that list when they change.
       if (aData == PREF_SHOW_PLUGINS_IN_LIST ||
           aData == PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS) {
         this._rebuildVisibleTypes();
@@ -1003,48 +1003,48 @@ var gApplicationsPane = {
       // the view when any of them changes.
       this._rebuildView();
     }
   },
 
 
   // nsIDOMEventListener
 
-  handleEvent: function(aEvent) {
+  handleEvent(aEvent) {
     if (aEvent.type == "unload") {
       this.destroy();
     }
   },
 
 
   // Composed Model Construction
 
-  _loadData: function() {
+  _loadData() {
     this._loadFeedHandler();
     this._loadInternalHandlers();
     this._loadPluginHandlers();
     this._loadApplicationHandlers();
   },
 
-  _loadFeedHandler: function() {
+  _loadFeedHandler() {
     this._handledTypes[TYPE_MAYBE_FEED] = feedHandlerInfo;
     feedHandlerInfo.handledOnlyByPlugin = false;
 
     this._handledTypes[TYPE_MAYBE_VIDEO_FEED] = videoFeedHandlerInfo;
     videoFeedHandlerInfo.handledOnlyByPlugin = false;
 
     this._handledTypes[TYPE_MAYBE_AUDIO_FEED] = audioFeedHandlerInfo;
     audioFeedHandlerInfo.handledOnlyByPlugin = false;
   },
 
   /**
    * Load higher level internal handlers so they can be turned on/off in the
    * applications menu.
    */
-  _loadInternalHandlers: function() {
+  _loadInternalHandlers() {
     var internalHandlers = [pdfHandlerInfo];
     for (let internalHandler of internalHandlers) {
       if (internalHandler.enabled) {
         this._handledTypes[internalHandler.type] = internalHandler;
       }
     }
   },
 
@@ -1061,17 +1061,17 @@ var gApplicationsPane = {
    * to know about it even if it isn't enabled, since we're going to give
    * the user an option to enable it.
    *
    * Also note that enabledPlugin does not get updated when
    * plugin.disable_full_page_plugin_for_types changes, so even if we could use
    * enabledPlugin to get the plugin that would be used, we'd still need to
    * check the pref ourselves to find out if it's enabled.
    */
-  _loadPluginHandlers: function() {
+  _loadPluginHandlers() {
     "use strict";
 
     let mimeTypes = navigator.mimeTypes;
 
     for (let mimeType of mimeTypes) {
       let handlerInfoWrapper;
       if (mimeType.type in this._handledTypes) {
         handlerInfoWrapper = this._handledTypes[mimeType.type];
@@ -1084,17 +1084,17 @@ var gApplicationsPane = {
       }
       handlerInfoWrapper.pluginName = mimeType.enabledPlugin.name;
     }
   },
 
   /**
    * Load the set of handlers defined by the application datastore.
    */
-  _loadApplicationHandlers: function() {
+  _loadApplicationHandlers() {
     var wrappedHandlerInfos = this._handlerSvc.enumerate();
     while (wrappedHandlerInfos.hasMoreElements()) {
       let wrappedHandlerInfo =
         wrappedHandlerInfos.getNext().QueryInterface(Ci.nsIHandlerInfo);
       let type = wrappedHandlerInfo.type;
 
       let handlerInfoWrapper;
       if (type in this._handledTypes)
@@ -1106,17 +1106,17 @@ var gApplicationsPane = {
 
       handlerInfoWrapper.handledOnlyByPlugin = false;
     }
   },
 
 
   // View Construction
 
-  _rebuildVisibleTypes: function() {
+  _rebuildVisibleTypes() {
     // Reset the list of visible types and the visible type description counts.
     this._visibleTypes = [];
     this._visibleTypeDescriptionCount = {};
 
     // Get the preferences that help determine what types to show.
     var showPlugins = this._prefSvc.getBoolPref(PREF_SHOW_PLUGINS_IN_LIST);
     var hidePluginsWithoutExtensions =
       this._prefSvc.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
@@ -1145,17 +1145,17 @@ var gApplicationsPane = {
 
       if (handlerInfo.description in this._visibleTypeDescriptionCount)
         this._visibleTypeDescriptionCount[handlerInfo.description]++;
       else
         this._visibleTypeDescriptionCount[handlerInfo.description] = 1;
     }
   },
 
-  _rebuildView: function() {
+  _rebuildView() {
     // Clear the list of entries.
     while (this._list.childNodes.length > 1)
       this._list.removeChild(this._list.lastChild);
 
     var visibleTypes = this._visibleTypes;
 
     // If the user is filtering the list, then only show matching types.
     if (this._filter.value)
@@ -1176,33 +1176,33 @@ var gApplicationsPane = {
       }
 
       this._list.appendChild(item);
     }
 
     this._selectLastSelectedType();
   },
 
-  _matchesFilter: function(aType) {
+  _matchesFilter(aType) {
     var filterValue = this._filter.value.toLowerCase();
     return this._describeType(aType).toLowerCase().indexOf(filterValue) != -1 ||
            this._describePreferredAction(aType).toLowerCase().indexOf(filterValue) != -1;
   },
 
   /**
    * Describe, in a human-readable fashion, the type represented by the given
    * handler info object.  Normally this is just the description provided by
    * the info object, but if more than one object presents the same description,
    * then we annotate the duplicate descriptions with the type itself to help
    * users distinguish between those types.
    *
    * @param aHandlerInfo {nsIHandlerInfo} the type being described
    * @returns {string} a description of the type
    */
-  _describeType: function(aHandlerInfo) {
+  _describeType(aHandlerInfo) {
     if (this._visibleTypeDescriptionCount[aHandlerInfo.description] > 1)
       return this._prefsBundle.getFormattedString("typeDescriptionWithType",
                                                   [aHandlerInfo.description,
                                                    aHandlerInfo.type]);
 
     return aHandlerInfo.description;
   },
 
@@ -1213,17 +1213,17 @@ var gApplicationsPane = {
    * XXX Should this be part of the HandlerInfoWrapper interface?  It would
    * violate the separation of model and view, but it might make more sense
    * nonetheless (f.e. it would make sortTypes easier).
    *
    * @param aHandlerInfo {nsIHandlerInfo} the type whose preferred action
    *                                      is being described
    * @returns {string} a description of the action
    */
-  _describePreferredAction: function(aHandlerInfo) {
+  _describePreferredAction(aHandlerInfo) {
     // alwaysAskBeforeHandling overrides the preferred action, so if that flag
     // is set, then describe that behavior instead.  For most types, this is
     // the "alwaysAsk" string, but for the feed type we show something special.
     if (aHandlerInfo.alwaysAskBeforeHandling) {
       if (isFeedType(aHandlerInfo.type))
         return this._prefsBundle.getFormattedString("previewInApp",
                                                     [this._brandShortName]);
       return this._prefsBundle.getString("alwaysAsk");
@@ -1275,17 +1275,17 @@ var gApplicationsPane = {
         return this._prefsBundle.getFormattedString("usePluginIn",
                                                     [aHandlerInfo.pluginName,
                                                      this._brandShortName]);
       default:
         throw new Error(`Unexpected preferredAction: ${aHandlerInfo.preferredAction}`);
     }
   },
 
-  _selectLastSelectedType: function() {
+  _selectLastSelectedType() {
     // If the list is disabled by the pref.downloads.disable_button.edit_actions
     // preference being locked, then don't select the type, as that would cause
     // it to appear selected, with a different background and an actions menu
     // that makes it seem like you can choose an action for the type.
     if (this._list.disabled)
       return;
 
     var lastSelectedType = this._list.getAttribute("lastSelectedType");
@@ -1301,33 +1301,33 @@ var gApplicationsPane = {
 
   /**
    * Whether or not the given handler app is valid.
    *
    * @param aHandlerApp {nsIHandlerApp} the handler app in question
    *
    * @returns {boolean} whether or not it's valid
    */
-  isValidHandlerApp: function(aHandlerApp) {
+  isValidHandlerApp(aHandlerApp) {
     if (!aHandlerApp)
       return false;
 
     if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
       return this._isValidHandlerExecutable(aHandlerApp.executable);
 
     if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
       return aHandlerApp.uriTemplate;
 
     if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
       return aHandlerApp.uri;
 
     return false;
   },
 
-  _isValidHandlerExecutable: function(aExecutable) {
+  _isValidHandlerExecutable(aExecutable) {
     let leafName;
     if (AppConstants.platform == "win") {
       leafName = `${AppConstants.MOZ_APP_NAME}.exe`;
     } else if (AppConstants.platform == "macosx") {
       leafName = AppConstants.MOZ_MACBUNDLE_NAME;
     } else {
       leafName = `${AppConstants.MOZ_APP_NAME}-bin`;
     }
@@ -1339,17 +1339,17 @@ var gApplicationsPane = {
 // XXXmano TBD: can probably add this to nsIShellService
            aExecutable.leafName != leafName;
   },
 
   /**
    * Rebuild the actions menu for the selected entry.  Gets called by
    * the richlistitem constructor when an entry in the list gets selected.
    */
-  rebuildActionsMenu: function() {
+  rebuildActionsMenu() {
     var typeItem = this._list.selectedItem;
     var handlerInfo = this._handledTypes[typeItem.type];
     var menu =
       document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
     var menuPopup = menu.menupopup;
 
     // Clear out existing items.
     while (menuPopup.hasChildNodes())
@@ -1534,17 +1534,17 @@ var gApplicationsPane = {
 
   // Sorting & Filtering
 
   _sortColumn: null,
 
   /**
    * Sort the list when the user clicks on a column header.
    */
-  sort: function(event) {
+  sort(event) {
     var column = event.target;
 
     // If the user clicked on a new sort column, remove the direction indicator
     // from the old column.
     if (this._sortColumn && this._sortColumn != column)
       this._sortColumn.removeAttribute("sortDirection");
 
     this._sortColumn = column;
@@ -1557,17 +1557,17 @@ var gApplicationsPane = {
 
     this._sortVisibleTypes();
     this._rebuildView();
   },
 
   /**
    * Sort the list of visible types by the current sort column/direction.
    */
-  _sortVisibleTypes: function() {
+  _sortVisibleTypes() {
     if (!this._sortColumn)
       return;
 
     var t = this;
 
     function sortByType(a, b) {
       return t._describeType(a).toLowerCase().
              localeCompare(t._describeType(b).toLowerCase());
@@ -1589,40 +1589,40 @@ var gApplicationsPane = {
 
     if (this._sortColumn.getAttribute("sortDirection") == "descending")
       this._visibleTypes.reverse();
   },
 
   /**
    * Filter the list when the user enters a filter term into the filter field.
    */
-  filter: function() {
+  filter() {
     this._rebuildView();
   },
 
-  focusFilterBox: function() {
+  focusFilterBox() {
     this._filter.focus();
     this._filter.select();
   },
 
 
   // Changes
 
-  onSelectAction: function(aActionItem) {
+  onSelectAction(aActionItem) {
     this._storingAction = true;
 
     try {
       this._storeAction(aActionItem);
     }
     finally {
       this._storingAction = false;
     }
   },
 
-  _storeAction: function(aActionItem) {
+  _storeAction(aActionItem) {
     var typeItem = this._list.selectedItem;
     var handlerInfo = this._handledTypes[typeItem.type];
 
     let action = parseInt(aActionItem.getAttribute("action"));
 
     // Set the plugin state if we're enabling or disabling a plugin.
     if (action == kActionUsePlugin)
       handlerInfo.enablePluginType();
@@ -1657,17 +1657,17 @@ var gApplicationsPane = {
     typeItem.setAttribute("actionDescription",
                           this._describePreferredAction(handlerInfo));
     if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) {
       typeItem.setAttribute("actionIcon",
                             this._getIconURLForPreferredAction(handlerInfo));
     }
   },
 
-  manageApp: function(aEvent) {
+  manageApp(aEvent) {
     // Don't let the normal "on select action" handler get this event,
     // as we handle it specially ourselves.
     aEvent.stopPropagation();
 
     var typeItem = this._list.selectedItem;
     var handlerInfo = this._handledTypes[typeItem.type];
 
     let onComplete = () => {
@@ -1684,17 +1684,17 @@ var gApplicationsPane = {
       }
     };
 
     gSubDialog.open("chrome://browser/content/preferences/applicationManager.xul",
                     "resizable=no", handlerInfo, onComplete);
 
   },
 
-  chooseApp: function(aEvent) {
+  chooseApp(aEvent) {
     // Don't let the normal "on select action" handler get this event,
     // as we handle it specially ourselves.
     aEvent.stopPropagation();
 
     var handlerApp;
     let chooseAppCallback = function(aHandlerApp) {
       // Rebuild the actions menu whether the user picked an app or canceled.
       // If they picked an app, we want to add the app to the menu and select it.
@@ -1772,23 +1772,23 @@ var gApplicationsPane = {
       fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
       fp.appendFilters(Ci.nsIFilePicker.filterApps);
       fp.open(fpCallback);
     }
   },
 
   // Mark which item in the list was last selected so we can reselect it
   // when we rebuild the list or when the user returns to the prefpane.
-  onSelectionChanged: function() {
+  onSelectionChanged() {
     if (this._list.selectedItem)
       this._list.setAttribute("lastSelectedType",
                               this._list.selectedItem.getAttribute("type"));
   },
 
-  _setIconClassForPreferredAction: function(aHandlerInfo, aElement) {
+  _setIconClassForPreferredAction(aHandlerInfo, aElement) {
     // If this returns true, the attribute that CSS sniffs for was set to something
     // so you shouldn't manually set an icon URI.
     // This removes the existing actionIcon attribute if any, even if returning false.
     aElement.removeAttribute("actionIcon");
 
     if (aHandlerInfo.alwaysAskBeforeHandling) {
       aElement.setAttribute(APP_ICON_ATTR_NAME, "ask");
       return true;
@@ -1812,17 +1812,17 @@ var gApplicationsPane = {
       case kActionUsePlugin:
         aElement.setAttribute(APP_ICON_ATTR_NAME, "plugin");
         return true;
     }
     aElement.removeAttribute(APP_ICON_ATTR_NAME);
     return false;
   },
 
-  _getIconURLForPreferredAction: function(aHandlerInfo) {
+  _getIconURLForPreferredAction(aHandlerInfo) {
     switch (aHandlerInfo.preferredAction) {
       case Ci.nsIHandlerInfo.useSystemDefault:
         return this._getIconURLForSystemDefault(aHandlerInfo);
 
       case Ci.nsIHandlerInfo.useHelperApp:
         let preferredApp = aHandlerInfo.preferredApplicationHandler;
         if (this.isValidHandlerApp(preferredApp))
           return this._getIconURLForHandlerApp(preferredApp);
@@ -1830,55 +1830,55 @@ var gApplicationsPane = {
 
       // This should never happen, but if preferredAction is set to some weird
       // value, then fall back to the generic application icon.
       default:
         return ICON_URL_APP;
     }
   },
 
-  _getIconURLForHandlerApp: function(aHandlerApp) {
+  _getIconURLForHandlerApp(aHandlerApp) {
     if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
       return this._getIconURLForFile(aHandlerApp.executable);
 
     if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
       return this._getIconURLForWebApp(aHandlerApp.uriTemplate);
 
     if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
       return this._getIconURLForWebApp(aHandlerApp.uri)
 
     // We know nothing about other kinds of handler apps.
     return "";
   },
 
-  _getIconURLForFile: function(aFile) {
+  _getIconURLForFile(aFile) {
     var fph = this._ioSvc.getProtocolHandler("file").
               QueryInterface(Ci.nsIFileProtocolHandler);
     var urlSpec = fph.getURLSpecFromFile(aFile);
 
     return "moz-icon://" + urlSpec + "?size=16";
   },
 
-  _getIconURLForWebApp: function(aWebAppURITemplate) {
+  _getIconURLForWebApp(aWebAppURITemplate) {
     var uri = this._ioSvc.newURI(aWebAppURITemplate, null, null);
 
     // Unfortunately we can't use the favicon service to get the favicon,
     // because the service looks in the annotations table for a record with
     // the exact URL we give it, and users won't have such records for URLs
     // they don't visit, and users won't visit the web app's URL template,
     // they'll only visit URLs derived from that template (i.e. with %s
     // in the template replaced by the URL of the content being handled).
 
     if (/^https?$/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
       return uri.prePath + "/favicon.ico";
 
     return "";
   },
 
-  _getIconURLForSystemDefault: function(aHandlerInfo) {
+  _getIconURLForSystemDefault(aHandlerInfo) {
     // Handler info objects for MIME types on some OSes implement a property bag
     // interface from which we can get an icon for the default app, so if we're
     // dealing with a MIME type on one of those OSes, then try to get the icon.
     if ("wrappedHandlerInfo" in aHandlerInfo) {
       let wrappedHandlerInfo = aHandlerInfo.wrappedHandlerInfo;
 
       if (wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
           wrappedHandlerInfo instanceof Ci.nsIPropertyBag) {