Bug 1207491 - Part 13: Remove use of expression closure from browser/components/preferences/. r=Gijs
authorTooru Fujisawa <arai_a@mac.com>
Wed, 23 Sep 2015 18:36:22 +0900
changeset 264350 557d00ab1cf1b36df5be6149531c4d9629035bb0
parent 264349 de798053a05980fe11403ff83dfc66dd3d552a51
child 264351 d30225cc21646c23e51843e57285270e037d8f2e
push id65606
push userarai_a@mac.com
push dateFri, 25 Sep 2015 08:14:49 +0000
treeherdermozilla-inbound@e4f5f909df68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1207491
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207491 - Part 13: Remove use of expression closure from browser/components/preferences/. r=Gijs
browser/components/preferences/aboutPermissions.js
browser/components/preferences/in-content/applications.js
browser/components/preferences/in-content/main.js
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/search.js
browser/components/preferences/translation.js
--- a/browser/components/preferences/aboutPermissions.js
+++ b/browser/components/preferences/aboutPermissions.js
@@ -326,18 +326,22 @@ var PermissionDefaults = {
       return this.DENY;
     }
     return this.UNKNOWN;
   },
   set push(aValue) {
     let value = (aValue != this.DENY);
     Services.prefs.setBoolPref("dom.push.enabled", value);
   },
-  get camera() this.UNKNOWN,
-  get microphone() this.UNKNOWN
+  get camera() {
+    return this.UNKNOWN;
+  },
+  get microphone() {
+    return this.UNKNOWN;
+  }
 };
 
 /**
  * AboutPermissions manages the about:permissions page.
  */
 var AboutPermissions = {
   /**
    * Number of sites to return from the places database.
--- a/browser/components/preferences/in-content/applications.js
+++ b/browser/components/preferences/in-content/applications.js
@@ -398,17 +398,17 @@ HandlerInfoWrapper.prototype = {
                                           this.type,
                                           false);
   },
 
   enablePluginType: function() {
     var disabledPluginTypes = this._getDisabledPluginTypes();
 
     var type = this.type;
-    disabledPluginTypes = disabledPluginTypes.filter(function(v) v != type);
+    disabledPluginTypes = disabledPluginTypes.filter(v => v != type);
 
     this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
                               disabledPluginTypes.join(","));
 
     // Update the category manager so existing browser windows update.
     this._categoryMgr.
       addCategoryEntry("Gecko-Content-Viewers",
                        this.type,
@@ -1544,17 +1544,17 @@ var gApplicationsPane = {
         menu.selectedItem = internalMenuItem;
         break;
       case Ci.nsIHandlerInfo.useSystemDefault:
         menu.selectedItem = defaultMenuItem;
         break;
       case Ci.nsIHandlerInfo.useHelperApp:
         if (preferredApp)
           menu.selectedItem = 
-            possibleAppMenuItems.filter(function(v) v.handlerApp.equals(preferredApp))[0];
+            possibleAppMenuItems.filter(v => v.handlerApp.equals(preferredApp))[0];
         break;
       case kActionUsePlugin:
         menu.selectedItem = pluginMenuItem;
         break;
       case Ci.nsIHandlerInfo.saveToDisk:
         menu.selectedItem = saveMenuItem;
         break;
     }
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -293,17 +293,19 @@ var gMainPane = {
    * Sets the home page to the current displayed page (or frontmost tab, if the
    * most recent browser window contains multiple tabs), updating preference
    * window UI to reflect this.
    */
   setHomePageToCurrent: function ()
   {
     let homePage = document.getElementById("browser.startup.homepage");
     let tabs = this._getTabsForHomePage();
-    function getTabURI(t) t.linkedBrowser.currentURI.spec;
+    function getTabURI(t) {
+      return t.linkedBrowser.currentURI.spec;
+    }
 
     // FIXME Bug 244192: using dangerous "|" joiner!
     if (tabs.length)
       homePage.value = tabs.map(getTabURI).join("|");
   },
 
   /**
    * Displays a dialog in which the user can select a bookmark to use as home
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -174,18 +174,17 @@ var gPrivacyPane = {
   },
 
   /**
    * Initialize the history mode menulist based on the privacy preferences
    */
   initializeHistoryMode: function PPP_initializeHistoryMode()
   {
     let mode;
-    let getVal = function (aPref)
-      document.getElementById(aPref).value;
+    let getVal = aPref => document.getElementById(aPref).value;
 
     if (this._checkDefaultValues(this.prefsForDefault)) {
       if (getVal("browser.privatebrowsing.autostart"))
         mode = "dontremember";
       else
         mode = "remember";
     }
     else
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -313,17 +313,17 @@ function onDragEngineStart(event) {
 function EngineStore() {
   let pref = document.getElementById("browser.search.hiddenOneOffs").value;
   this.hiddenList = pref ? pref.split(",") : [];
 
   this._engines = Services.search.getVisibleEngines().map(this._cloneEngine, this);
   this._defaultEngines = Services.search.getDefaultEngines().map(this._cloneEngine, this);
 
   // check if we need to disable the restore defaults button
-  var someHidden = this._defaultEngines.some(function (e) e.hidden);
+  var someHidden = this._defaultEngines.some(e => e.hidden);
   gSearchPane.showRestoreDefaults(someHidden);
 }
 EngineStore.prototype = {
   _engines: null,
   _defaultEngines: null,
 
   get engines() {
     return this._engines;
--- a/browser/components/preferences/translation.js
+++ b/browser/components/preferences/translation.js
@@ -20,58 +20,82 @@ const kLanguagesPref = "browser.translat
 function Tree(aId, aData)
 {
   this._data = aData;
   this._tree = document.getElementById(aId);
   this._tree.view = this;
 }
 
 Tree.prototype = {
-  get boxObject() this._tree.treeBoxObject,
-  get isEmpty() !this._data.length,
-  get hasSelection() this.selection.count > 0,
+  get boxObject() {
+    return this._tree.treeBoxObject;
+  },
+  get isEmpty() {
+    return !this._data.length;
+  },
+  get hasSelection() {
+    return this.selection.count > 0;
+  },
   getSelectedItems: function() {
     let result = [];
 
     let rc = this.selection.getRangeCount();
     for (let i = 0; i < rc; ++i) {
       let min = {}, max = {};
       this.selection.getRangeAt(i, min, max);
       for (let j = min.value; j <= max.value; ++j)
         result.push(this._data[j]);
     }
 
     return result;
   },
 
   // nsITreeView implementation
-  get rowCount() this._data.length,
-  getCellText: function (aRow, aColumn) this._data[aRow],
-  isSeparator: function(aIndex) false,
-  isSorted: function() false,
-  isContainer: function(aIndex) false,
+  get rowCount() {
+    return this._data.length;
+  },
+  getCellText: function (aRow, aColumn) {
+    return this._data[aRow];
+  },
+  isSeparator: function(aIndex) {
+    return false;
+  },
+  isSorted: function() {
+    return false;
+  },
+  isContainer: function(aIndex) {
+    return false;
+  },
   setTree: function(aTree) {},
   getImageSrc: function(aRow, aColumn) {},
   getProgressMode: function(aRow, aColumn) {},
   getCellValue: function(aRow, aColumn) {},
   cycleHeader: function(column) {},
-  getRowProperties: function(row) "",
-  getColumnProperties: function(column) "",
-  getCellProperties: function(row, column) "",
+  getRowProperties: function(row) {
+    return "";
+  },
+  getColumnProperties: function(column) {
+    return "";
+  },
+  getCellProperties: function(row, column) {
+    return "";
+  },
   QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView])
 };
 
 function Lang(aCode)
 {
   this.langCode = aCode;
   this._label = gLangBundle.GetStringFromName(aCode);
 }
 
 Lang.prototype = {
-  toString: function() this._label
+  toString: function() {
+    return this._label;
+  }
 }
 
 var gTranslationExceptions = {
   onLoad: function() {
     if (this._siteTree) {
       // Re-using an open dialog, clear the old observers.
       this.uninit();
     }