Bug 1315617 - Fix remaining no-unused-vars for local scope in browser/ and enable the rule for all of browser/ r?Mossop draft
authorMark Banner <standard8@mozilla.com>
Thu, 03 Nov 2016 11:56:28 +0000
changeset 434792 1bde8eb36754d2a254d54bb1f1dd1a3ac8946b19
parent 434636 908557c762f798605a2f96e4c943791cbada1b50
child 536117 b033f1313f93e526d937b1d3a2df4bf2a5be196d
push id34826
push userbmo:standard8@mozilla.com
push dateMon, 07 Nov 2016 11:00:22 +0000
reviewersMossop
bugs1315617
milestone52.0a1
Bug 1315617 - Fix remaining no-unused-vars for local scope in browser/ and enable the rule for all of browser/ r?Mossop MozReview-Commit-ID: FO1p5G5K3zg
browser/.eslintrc.js
browser/components/nsBrowserGlue.js
browser/components/places/content/places.js
browser/components/preferences/containers.js
browser/modules/DirectoryLinksProvider.jsm
--- a/browser/.eslintrc.js
+++ b/browser/.eslintrc.js
@@ -1,7 +1,15 @@
 "use strict";
 
 module.exports = {
   "extends": [
     "../toolkit/.eslintrc.js"
   ],
+
+  "rules": {
+    "no-unused-vars": ["error", {
+      "vars": "local",
+      "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
+      "args": "none",
+    }]
+  }
 };
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -643,22 +643,16 @@ BrowserGlue.prototype = {
   },
 
   // runs on startup, before the first command line handler is invoked
   // (i.e. before the first window is opened)
   _finalUIStartup: function BG__finalUIStartup() {
     this._sanitizer.onStartup();
     // check if we're in safe mode
     if (Services.appinfo.inSafeMode) {
-      // See https://bugzilla.mozilla.org/show_bug.cgi?id=1231112#c7 . We need to
-      // register the observer early if we have to migrate tab groups
-      let currentUIVersion = 0;
-      try {
-        currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
-      } catch (ex) {}
       Services.ww.openWindow(null, "chrome://browser/content/safeMode.xul",
                              "_blank", "chrome,centerscreen,modal,resizable=no", null);
     }
 
     // apply distribution customizations
     // prefs are applied in _onAppDefaults()
     this._distributionCustomizer.applyCustomizations();
 
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -638,33 +638,16 @@ var PlacesOrganizer = {
       }
     }
 
     // Clean up the panel before initing it again.
     gEditItemOverlay.uninitPanel(false);
 
     if (selectedNode && !PlacesUtils.nodeIsSeparator(selectedNode)) {
       detailsDeck.selectedIndex = 1;
-      // Using the concrete itemId is arguably wrong.  The bookmarks API
-      // does allow setting properties for folder shortcuts as well, but since
-      // the UI does not distinct between the couple, we better just show
-      // the concrete item properties for shortcuts to root nodes.
-      let concreteId = PlacesUtils.getConcreteItemId(selectedNode);
-      var isRootItem = concreteId != -1 && PlacesUtils.isRootItem(concreteId);
-      var readOnly = isRootItem ||
-                     selectedNode.parent.itemId == PlacesUIUtils.leftPaneFolderId;
-      var useConcreteId = isRootItem ||
-                          PlacesUtils.nodeIsTagQuery(selectedNode);
-      var itemId = -1;
-      if (concreteId != -1 && useConcreteId)
-        itemId = concreteId;
-      else if (selectedNode.itemId != -1)
-        itemId = selectedNode.itemId;
-      else
-        itemId = PlacesUtils._uri(selectedNode.uri);
 
       gEditItemOverlay.initPanel({ node: selectedNode
                                  , hiddenRows: ["folderPicker"] });
 
       this._detectAndSetDetailsPaneMinimalState(selectedNode);
     }
     else if (!selectedNode && aNodeList[0]) {
       if (aNodeList.every(PlacesUtils.nodeIsURI)) {
@@ -1054,19 +1037,16 @@ var ViewMenu = {
    *          localized accesskey.
    *          If propertyPrefix is null, the column label is used as label and
    *          no accesskey is assigned.
    */
   fillWithColumns: function VM_fillWithColumns(event, startID, endID, type, propertyPrefix) {
     var popup = event.target;
     var pivot = this._clean(popup, startID, endID);
 
-    // If no column is "sort-active", the "Unsorted" item needs to be checked,
-    // so track whether or not we find a column that is sort-active.
-    var isSorted = false;
     var content = document.getElementById("placeContent");
     var columns = content.columns;
     for (var i = 0; i < columns.count; ++i) {
       var column = columns.getColumnAt(i).element;
       var menuitem = document.createElement("menuitem");
       menuitem.id = "menucol_" + column.id;
       menuitem.column = column;
       var label = column.getAttribute("label");
@@ -1082,17 +1062,16 @@ var ViewMenu = {
       }
       menuitem.setAttribute("label", label);
       if (type == "radio") {
         menuitem.setAttribute("type", "radio");
         menuitem.setAttribute("name", "columns");
         // This column is the sort key. Its item is checked.
         if (column.getAttribute("sortDirection") != "") {
           menuitem.setAttribute("checked", "true");
-          isSorted = true;
         }
       }
       else if (type == "checkbox") {
         menuitem.setAttribute("type", "checkbox");
         // Cannot uncheck the primary column.
         if (column.getAttribute("primary") == "true")
           menuitem.setAttribute("disabled", "true");
         // Items for visible columns are checked.
--- a/browser/components/preferences/containers.js
+++ b/browser/components/preferences/containers.js
@@ -142,17 +142,16 @@ let gContainersManager = {
     }
     return radiogroup;
   },
 
   onApplyChanges() {
     let icon = document.getElementById("icon").value;
     let color = document.getElementById("color").value;
     let name = document.getElementById("name").value;
-    let userContextId = false;
 
     if (this.icons.indexOf(icon) == -1) {
       throw "Internal error. The icon value doesn't match.";
     }
 
     if (this.colors.indexOf(color) == -1) {
       throw "Internal error. The color value doesn't match.";
     }
--- a/browser/modules/DirectoryLinksProvider.jsm
+++ b/browser/modules/DirectoryLinksProvider.jsm
@@ -521,17 +521,16 @@ var DirectoryLinksProvider = {
   /**
    * Report some action on a newtab page (view, click)
    * @param sites Array of sites shown on newtab page
    * @param action String of the behavior to report
    * @param triggeringSiteIndex optional Int index of the site triggering action
    * @return download promise
    */
   reportSitesAction: function DirectoryLinksProvider_reportSitesAction(sites, action, triggeringSiteIndex) {
-    let pastImpressions;
     // Check if the suggested tile was shown
     if (action == "view") {
       sites.slice(0, triggeringSiteIndex + 1).filter(s => s).forEach(site => {
         let {targetedSite, url} = site.link;
         if (targetedSite) {
           this._addFrequencyCapView(url);
         }
       });
@@ -539,23 +538,16 @@ var DirectoryLinksProvider = {
     // any click action on a suggested tile should stop that tile suggestion
     // click/block - user either removed a tile or went to a landing page
     // pin - tile turned into history tile, should no longer be suggested
     // unpin - the tile was pinned before, should not matter
     else {
       // suggested tile has targetedSite, or frecent_sites if it was pinned
       let {frecent_sites, targetedSite, url} = sites[triggeringSiteIndex].link;
       if (frecent_sites || targetedSite) {
-        // skip past_impressions for "unpin" to avoid chance of tracking
-        if (this._frequencyCaps[url] && action != "unpin") {
-          pastImpressions = {
-            total: this._frequencyCaps[url].totalViews,
-            daily: this._frequencyCaps[url].dailyViews
-          };
-        }
         this._setFrequencyCapClick(url);
       }
     }
 
     let newtabEnhanced = false;
     let pingEndPoint = "";
     try {
       newtabEnhanced = Services.prefs.getBoolPref(PREF_NEWTAB_ENHANCED);