Bug 1560550 - Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Tue, 25 Jun 2019 23:37:27 +0200
changeset 35948 708b5e8fcaa6367e896f98abaaf783cb24c063e5
parent 35947 259114255352b7456cf207d3586afdd69533d869
child 35949 d04da3816b8e83bb9816322b5eb980e671ca704f
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersfrg
bugs1560550, 1339461
Bug 1560550 - Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM. r=frg
suite/base/content/utilityOverlay.js
suite/browser/navigator.js
suite/browser/tabbrowser.xml
suite/components/bindings/notification.xml
suite/components/console/content/consoleBindings.xml
suite/components/dataman/content/dataman.js
suite/components/feeds/WebContentConverter.js
suite/components/helpviewer/content/help.js
suite/components/nsSuiteGlue.js
suite/components/permissions/content/cookieViewer.js
suite/components/pref/content/pref-languages-add.js
suite/components/sessionstore/nsSessionStore.js
suite/components/sidebar/content/sidebarOverlay.js
suite/components/sync/content/syncSetup.js
suite/mailnews/components/compose/content/MsgComposeCommands.js
suite/mailnews/content/mailWidgets.xml
suite/mailnews/content/mailWindowOverlay.js
suite/mailnews/content/msgHdrViewOverlay.js
suite/mailnews/content/msgMail3PaneWindow.js
suite/mailnews/content/tabmail.xml
suite/modules/WindowsJumpLists.jsm
--- a/suite/base/content/utilityOverlay.js
+++ b/suite/base/content/utilityOverlay.js
@@ -917,17 +917,17 @@ addEventListener("load", utilityOnLoad, 
  *
  * @return suggested filename as a string.
  */
 function suggestUniqueFileName(aBaseName, aExtension, aExistingNames)
 {
   var suffix = 1;
   aBaseName = validateFileName(aBaseName);
   var suggestion = aBaseName + aExtension;
-  while (aExistingNames.indexOf(suggestion) != -1)
+  while (aExistingNames.includes(suggestion))
   {
     suffix++;
     suggestion = aBaseName + "(" + suffix + ")" + aExtension;
   }
   return suggestion;
 }
 
 function focusElement(aElement)
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -884,17 +884,17 @@ function Startup()
       defaultWidth /= 2;
 
     // Tweak sizes to be sure we don't grow outside the screen
     defaultWidth = defaultWidth - 20;
     defaultHeight = defaultHeight - 10;
 
     // On X, we're not currently able to account for the size of the window
     // border.  Use 28px as a guess (titlebar + bottom window border)
-    if (navigator.appVersion.indexOf("X11") != -1)
+    if (navigator.appVersion.includes("X11"))
       defaultHeight -= 28;
 
     // On small screens, default to maximized state
     if (defaultHeight <= 600)
       document.documentElement.setAttribute("sizemode", "maximized");
 
     document.documentElement.setAttribute("width", defaultWidth);
     document.documentElement.setAttribute("height", defaultHeight);
@@ -1212,17 +1212,17 @@ function Shutdown()
 
 function Translate()
 {
   var service = GetLocalizedStringPref("browser.translation.service");
   var serviceDomain = GetLocalizedStringPref("browser.translation.serviceDomain");
   var targetURI = getWebNavigation().currentURI.spec;
 
   // if we're already viewing a translated page, then just reload
-  if (targetURI.indexOf(serviceDomain) >= 0)
+  if (targetURI.includes(serviceDomain))
     BrowserReload();
   else {
     loadURI(encodeURI(service) + encodeURIComponent(targetURI));
   }
 }
 
 function GetTypePermFromId(aId)
 {
@@ -1701,17 +1701,17 @@ var BrowserSearch = {
 
         if (content instanceof Ci.nsIRDFLiteral) {
           // the search panel entry exists, now check if it is excluded
           // for navigator
           var excludeProp = RDF.GetResource("http://home.netscape.com/NC-rdf#exclude");
           var exclude = datasource.GetTarget(aboutValue, excludeProp, true);
 
           if (exclude instanceof Ci.nsIRDFLiteral) {
-            searchPanelExists = (exclude.Value.indexOf("navigator:browser") < 0);
+            searchPanelExists = !exclude.Value.includes("navigator:browser");
           } else {
             // panel exists and no exclude set
             searchPanelExists = true;
           }
         }
       } catch (e) {
         searchPanelExists = false;
       }
@@ -3320,17 +3320,17 @@ function AddKeywordForSearchField() {
       }
     }
   }
 
   if (form.method == "post" &&
       form.enctype == "application/x-www-form-urlencoded") {
     postData = formData.join("&");
   } else { // get
-    spec += spec.indexOf("?") != -1 ? "&" : "?";
+    spec += spec.includes("?") ? "&" : "?";
     spec += formData.join("&");
   }
 
   PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(spec), title, description, null,
                                          null, null, "", postData, charset);
 }
 
 function getCert()
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -1032,17 +1032,17 @@
             }
             newTitle += modifier;
 
             // If location bar is hidden and the URL type supports a host,
             // add the scheme and host to the title to prevent spoofing.
             // XXX https://bugzilla.mozilla.org/show_bug.cgi?id=22183#c239
             // (only for schemes that support a host)
             try {
-              if (docElement.getAttribute("chromehidden").indexOf("location") != -1) {
+              if (docElement.getAttribute("chromehidden").includes("location")) {
                 var uri = this.mURIFixup.createExposableURI(aBrowser.currentURI);
                 if (uri.schemeIs("about"))
                   newTitle = uri.spec + sep + newTitle;
                 else if (uri.host)
                   newTitle = uri.prePath + sep + newTitle;
               }
             } catch (e) {
             }
@@ -2070,30 +2070,30 @@
 
       <method name="addProgressListener">
         <parameter name="aListener"/>
         <body>
           <![CDATA[
             if (!aListener)
               throw Cr.NS_ERROR_INVALID_ARG;
 
-            if (this.mProgressListeners.indexOf(aListener) != -1)
+            if (this.mProgressListeners.includes(aListener))
               throw Cr.NS_ERROR_FAILURE;
 
             // push() does not disturb possibly ongoing iterations.
             this.mProgressListeners.push(aListener);
           ]]>
         </body>
       </method>
 
       <method name="removeProgressListener">
         <parameter name="aListener"/>
         <body>
           <![CDATA[
-            if (this.mProgressListeners.indexOf(aListener) == -1)
+            if (!this.mProgressListeners.includes(aListener))
               throw Cr.NS_ERROR_FAILURE;
 
             // Create a new array, not to disturb possibly ongoing iterations.
             this.mProgressListeners =
               this.mProgressListeners.filter(
                 function removeListener(element) {
                   return element != aListener;
                 }
@@ -2104,30 +2104,30 @@
 
       <method name="addTabsProgressListener">
         <parameter name="aListener"/>
         <body>
           <![CDATA[
             if (!aListener)
               throw Cr.NS_ERROR_INVALID_ARG;
 
-            if (this.mTabsProgressListeners.indexOf(aListener) != -1)
+            if (this.mTabsProgressListeners.includes(aListener))
               throw Cr.NS_ERROR_FAILURE;
 
             // push() does not disturb possibly ongoing iterations.
             this.mTabsProgressListeners.push(aListener);
           ]]>
         </body>
       </method>
 
       <method name="removeTabsProgressListener">
         <parameter name="aListener"/>
         <body>
           <![CDATA[
-            if (this.mTabsProgressListeners.indexOf(aListener) == -1)
+            if (!this.mTabsProgressListeners.includes(aListener))
               throw Cr.NS_ERROR_FAILURE;
 
             // Create a new array, not to disturb possibly ongoing iterations.
             this.mTabsProgressListeners =
               this.mTabsProgressListeners.filter(
                 function removeListener(element) {
                   return element != aListener;
                 }
@@ -2380,17 +2380,17 @@
                                 .getService(Ci.nsIDroppedLinkHandler);
             try {
               // Pass true to disallow dropping javascript: or data: urls.
               url = linkHandler.dropLink(aEvent, {}, true);
             } catch (ex) {}
 
             // Valid urls don't contain spaces ' '; if we have a space
             // it isn't a valid url.
-            if (!url || url.indexOf(" ") != -1)
+            if (!url || url.includes(" "))
               return;
 
             getShortcutOrURIAndPostData(url).then(data => {
               var bgLoad = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
               if (aEvent.shiftKey)
                 bgLoad = !bgLoad;
 
               let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal(aEvent);
--- a/suite/components/bindings/notification.xml
+++ b/suite/components/bindings/notification.xml
@@ -1422,17 +1422,17 @@
       </method>
 
       <method name="pluginNeedsActivationExceptThese">
         <parameter name="aExceptThese"/>
         <body>
           <![CDATA[
             var pluginNeedsActivation = this.contentWindowUtils
                                             .plugins.some(function(aPlugin) {
-              return aExceptThese.indexOf(aPlugin) < 0 &&
+              return !aExceptThese.includes(aPlugin) &&
                      this.canActivatePlugin(aPlugin);
             }, this);
 
             return pluginNeedsActivation;
           ]]>
         </body>
       </method>
 
--- a/suite/components/console/content/consoleBindings.xml
+++ b/suite/components/console/content/consoleBindings.xml
@@ -377,17 +377,17 @@
         <body><![CDATA[
           if (!aString || !aFilter) {
             return true;
           }
 
           let searchStr = aString.toLowerCase();
           let filterStrings = aFilter.split(/\s+/);
           return !filterStrings.some(function (f) {
-            return searchStr.indexOf(f) == -1;
+            return !searchStr.includes(f);
           });
         ]]></body>
       </method>
 
       <constructor>this.init();</constructor>
       <destructor>this.destroy();</destructor>
 
       <!-- Command controller for the copy command -->
--- a/suite/components/dataman/content/dataman.js
+++ b/suite/components/dataman/content/dataman.js
@@ -206,17 +206,17 @@ var gDataman = {
   restoreSelectionFromIDs: function dataman_restoreSelectionFromIDs(aTree, aIDFunction, aCachedIDs) {
     // Restore selection from cached IDs (as possible).
     if (!aCachedIDs.length)
       return;
 
     aTree.view.selection.clearSelection();
     // Find out which current rows match a cached selection and add them to the selection.
     for (let row = 0; row < aTree.view.rowCount; row++)
-      if (aCachedIDs.indexOf(aIDFunction(row)) != -1)
+      if (aCachedIDs.includes(aIDFunction(row)))
         aTree.view.selection.toggleSelect(row);
   },
 }
 
 // :::::::::::::::::::: base object to use as a prototype for all others ::::::::::::::::::::
 var gBaseTreeView = {
   setTree: function(aTree) {},
   getImageSrc: function(aRow, aColumn) {},
@@ -771,17 +771,17 @@ var gDomains = {
     this.tree.treeBoxObject.beginUpdateBatch();
     var selectionCache = gDataman.getSelectedIDs(this.tree, this._getObjID);
     this.tree.view.selection.clearSelection();
     this.displayedDomains = [];
     var lcSearch = aSearchString.toLocaleLowerCase();
     var sType = aType || this.selectfield.value;
     for (let domain in this.domainObjects) {
       if (this.domainObjects[domain].displayTitle
-              .toLocaleLowerCase().indexOf(lcSearch) != -1 &&
+              .toLocaleLowerCase().includes(lcSearch) &&
           (sType == "all" || this.domainObjects[domain]["has" + sType]))
         this.displayedDomains.push(this.domainObjects[domain]);
     }
     this.sort();
     gDataman.restoreSelectionFromIDs(this.tree, this._getObjID, selectionCache);
     this.tree.treeBoxObject.endUpdateBatch();
     this.ignoreSelect = false;
     // Make sure we clear the data pane when selection has been removed.
@@ -1157,17 +1157,17 @@ var gCookies = {
       if (this.displayedCookies.length) {
         selectionCache = gDataman.getSelectedIDs(this.tree, this._getObjID);
         this.displayedCookies = [];
       }
       this.loadList();
       var domainList = [];
       for (let cookie of this.cookies) {
         let domain = gDomains.getDomainFromHost(cookie.rawHost);
-        if (domainList.indexOf(domain) == -1)
+        if (!domainList.includes(domain))
           domainList.push(domain);
       }
       gDomains.resetFlagToDomains("hasCookies", domainList);
       // Restore the local panel display if needed.
       if (gTabs.activePanel == "cookiesPanel" &&
           gDomains.selectedDomain.hasCookies) {
         this.tree.treeBoxObject.beginUpdateBatch();
         this.displayedCookies = this.cookies.filter(
@@ -2281,17 +2281,17 @@ var gPasswords = {
         this.tree.view.selection.clearSelection();
         this.displayedSignons = [];
         this.tree.treeBoxObject.endUpdateBatch();
       }
       this.loadList();
       let domainList = [];
       for (let lSignon of this.allSignons) {
         let domain = gDomains.getDomainFromHost(lSignon.hostname);
-        if (domainList.indexOf(domain) == -1)
+        if (!domainList.includes(domain))
           domainList.push(domain);
       }
       gDomains.resetFlagToDomains("hasPasswords", domainList);
       return;
     }
 
     // Usual notifications for addLogin, modifyLogin, removeLogin - do "surgical" updates.
     let curLogin = null, oldLogin = null;
@@ -2717,17 +2717,17 @@ var gStorage = {
     if (this.displayedStorages.length) {
       selectionCache = gDataman.getSelectedIDs(this.tree, this._getObjID);
       this.displayedStorages = [];
     }
     this.loadList();
     var domainList = [];
     for (let lStorage of this.storages) {
       let domain = gDomains.getDomainFromHost(lStorage.rawHost);
-      if (domainList.indexOf(domain) == -1)
+      if (!domainList.includes(domain))
         domainList.push(domain);
     }
     gDomains.resetFlagToDomains("hasStorage", domainList);
     // Restore the local panel display if needed.
     if (gTabs.activePanel == "storagePanel" &&
         gDomains.selectedDomain.hasStorage) {
       this.tree.treeBoxObject.beginUpdateBatch();
       this.displayedStorages = this.storages.filter(
@@ -2995,18 +2995,18 @@ var gFormdata = {
 
   search: function formdata_search(aSearchString) {
     let selectionCache = gDataman.getSelectedIDs(this.tree, this._getObjID);
     this.tree.treeBoxObject.beginUpdateBatch();
     this.tree.view.selection.clearSelection();
     var lcSearch = aSearchString.toLocaleLowerCase();
     this.displayedFormdata = this.formdata.filter(
       function(aFd) {
-        return aFd.fieldname.toLocaleLowerCase().indexOf(lcSearch) != -1 ||
-               aFd.value.toLocaleLowerCase().indexOf(lcSearch) != -1;
+        return aFd.fieldname.toLocaleLowerCase().includes(lcSearch) ||
+               aFd.value.toLocaleLowerCase().includes(lcSearch);
       });
     this.sort(null, false, false);
     gDataman.restoreSelectionFromIDs(this.tree, this._getObjID, selectionCache);
     this.tree.treeBoxObject.endUpdateBatch();
   },
 
   focusSearch: function formdata_focusSearch() {
     this.searchfield.focus();
--- a/suite/components/feeds/WebContentConverter.js
+++ b/suite/components/feeds/WebContentConverter.js
@@ -319,17 +319,17 @@ WebContentConverterRegistrar.prototype =
     // We also reject handlers registered from a different host (see bug 402287)
     // The pref allows us to test the feature
     if ((!Services.prefs.prefHasUserValue(PREF_ALLOW_DIFFERENT_HOST) ||
          !Services.prefs.getBoolPref(PREF_ALLOW_DIFFERENT_HOST)) &&
         aContentWindow.location.hostname != uri.host)
       throw("Permission denied to add " + uri.spec + " as a content or protocol handler");
 
     // If the uri doesn't contain '%s', it won't be a good handler
-    if (uri.spec.indexOf("%s") < 0)
+    if (!uri.spec.includes("%s"))
       throw NS_ERROR_DOM_SYNTAX_ERR;
 
     return uri;
   },
 
   /**
    * Determines if a web handler is already registered.
    *
--- a/suite/components/helpviewer/content/help.js
+++ b/suite/components/helpviewer/content/help.js
@@ -257,17 +257,17 @@ function loadHelpRDF() {
       var iterator = RDFContainer.GetElements();
       while (iterator.hasMoreElements()) {
         var panelDef = iterator.getNext();
 
         var panelID        = getAttribute(helpFileDS, panelDef, NC_PANELID, null);
         var datasources    = getAttribute(helpFileDS, panelDef, NC_DATASOURCES, "");
         var panelPlatforms = getAttribute(helpFileDS, panelDef, NC_PLATFORM, null);
 
-        if (panelPlatforms && panelPlatforms.split(/\s+/).indexOf(platform) == -1)
+        if (panelPlatforms && !panelPlatforms.split(/\s+/).includes(platform))
           continue; // ignore datasources for other platforms
 
         // empty datasources are valid on search panel definitions
         // convert them to "rdf:null" which can be filtered and ignored
         if (!datasources)
           datasources = "rdf:null";
 
         datasources = normalizeLinks(helpBaseURI, datasources);
@@ -348,17 +348,17 @@ function filterSeqByPlatform(aDatasource
     var currentTarget = targets.getNext();
 
     // find out on which platforms this node is meaningful
     var nodePlatforms = getAttribute(aDatasource,
                                      currentTarget.QueryInterface(Ci.nsIRDFResource),
                                      NC_PLATFORM,
                                      platform);
 
-    if (nodePlatforms.split(/\s+/).indexOf(platform) == -1) { // node is for another platform
+    if (!nodePlatforms.split(/\s+/).includes(platform)) { // node is for another platform
       var currentNode = currentTarget.QueryInterface(Ci.nsIRDFNode);
       // "false" because we don't want to renumber elements in the container
       RDFC.RemoveElement(currentNode, false);
 
       // move to next node - ignore the children, because 1) they might be
       // needed elsewhere and 2) nodes not connected to RDF_ROOT are ignored
       continue;
     }
--- a/suite/components/nsSuiteGlue.js
+++ b/suite/components/nsSuiteGlue.js
@@ -1160,17 +1160,17 @@ SuiteGlue.prototype = {
       Services.prefs.setCharPref(prefName, prefValue);
     }
 
     var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
                          .getService(Ci.mozISpellCheckingEngine);
     var dictList = spellChecker.getDictionaryList();
     // If the preference contains an invalid dictionary, set it to a valid
     // dictionary, any dictionary will do.
-    if (dictList.length && dictList.indexOf(prefValue) < 0)
+    if (dictList.length && !dictList.includes(prefValue))
       Services.prefs.setCharPref(prefName, dictList[0]);
   },
 
   _migrateDownloadPrefs: function()
   {
     // Migration of download-manager preferences
     if (Services.prefs.getPrefType("browser.download.dir") == Services.prefs.PREF_INVALID ||
         Services.prefs.getPrefType("browser.download.lastDir") != Services.prefs.PREF_INVALID)
--- a/suite/components/permissions/content/cookieViewer.js
+++ b/suite/components/permissions/content/cookieViewer.js
@@ -598,19 +598,19 @@ function doHelpButton()
 }
 
 /*** =================== FILTER CODE =================== ***/
 
 function filterCookies(aFilterValue)
 {
   var filterSet = [];
   for (let cookie of allCookies) {
-    if (cookie.rawHost.indexOf(aFilterValue) != -1 ||
-        cookie.name.indexOf(aFilterValue) != -1 ||
-        cookie.value.indexOf(aFilterValue) != -1)
+    if (cookie.rawHost.includes(aFilterValue) ||
+        cookie.name.includes(aFilterValue) ||
+        cookie.value.includes(aFilterValue))
       filterSet.push(cookie);
   }
   return filterSet;
 }
 
 function filter(filter)
 {
   // clear the display
--- a/suite/components/pref/content/pref-languages-add.js
+++ b/suite/components/pref/content/pref-languages-add.js
@@ -16,17 +16,17 @@ function OnLoadAddLanguages()
   gSelectedLanguages = document.getElementById("intl.accept_languages").value
                                .toLowerCase().split(/\s*,\s*/);
   gOtherLanguages = document.getElementById("otherLanguages");
 
   if (gLanguageNames)
   {
     for (var i = 0; i < gLanguageNames.length; i++)
     {
-      if (gSelectedLanguages.indexOf(gLanguageNames[i][1]) == -1)
+      if (!gSelectedLanguages.includes(gLanguageNames[i][1]))
         gAvailableLanguages.appendItem(gLanguageNames[i][0],
                                        gLanguageNames[i][1]);
     }
   }
 }
 
 function IsRFC1766LangTag(aCandidate)
 {
@@ -96,18 +96,18 @@ function WriteAddedLanguages(aListbox)
   if (languages)
   {
     let languageIds = languages.replace(/\s+/g, "").toLowerCase().split(",");
     for (var i = 0; i < languageIds.length; i++)
     {
       let languageId = languageIds[i];
       if (IsRFC1766LangTag(languageId))
       {
-        if (addedLang.indexOf(languageId) == -1 &&
-            gSelectedLanguages.indexOf(languageId) == -1)
+        if (!addedLang.includes(languageId) &&
+            !gSelectedLanguages.includes(languageId))
           addedLang.push(languageId);
       }
       else
       {
         invalidLangs.push(languageId);
       }
     }
   }
--- a/suite/components/sessionstore/nsSessionStore.js
+++ b/suite/components/sessionstore/nsSessionStore.js
@@ -1372,17 +1372,17 @@ SessionStoreService.prototype = {
     // up overwriting all of them. Otherwise we'll just close the tabs that
     // match home pages.
     let homePages = aWindow.getHomePage();
     let removableTabs = [];
     let tabbrowser = aWindow.getBrowser();
     let normalTabsLen = tabbrowser.tabs.length - tabbrowser._numPinnedTabs;
     for (let i = 0; i < tabbrowser.tabs.length; i++) {
       let tab = tabbrowser.tabs[i];
-      if (homePages.indexOf(tab.linkedBrowser.currentURI.spec) != -1) {
+      if (homePages.includes(tab.linkedBrowser.currentURI.spec)) {
         removableTabs.push(tab);
       }
     }
 
     if (tabbrowser.tabs.length == removableTabs.length) {
       canOverwriteTabs = true;
     }
     else {
@@ -2654,17 +2654,17 @@ SessionStoreService.prototype = {
           Cu.reportError(ex);
         }
       }
     }
 
     // make sure to reset the capabilities and attributes, in case this tab gets reused
     var disallow = (tabData.disallow)?tabData.disallow.split(","):[];
     CAPABILITIES.forEach(function(aCapability) {
-      browser.docShell["allow" + aCapability] = disallow.indexOf(aCapability) == -1;
+      browser.docShell["allow" + aCapability] = !disallow.includes(aCapability);
     });
     for (let name in this.xulAttributes)
       tab.removeAttribute(name);
     for (let name in tabData.attributes)
       tab.setAttribute(name, tabData.attributes[name]);
 
     if (tabData.storage && browser.docShell instanceof Ci.nsIDocShell)
       this._deserializeSessionStorage(tabData.storage, browser.docShell);
@@ -3123,17 +3123,17 @@ SessionStoreService.prototype = {
           } catch (ex) { /* throws for invalid indices */ }
         }
         else if (value && value.fileList && value.type == "file" && node.type == "file") {
           node.mozSetFileNameArray(value.fileList, value.fileList.length);
           eventType = "input";
         }
         else if (value && typeof value.indexOf == "function" && node.options) {
           Array.from(node.options).forEach(function(aOpt, aIx) {
-            aOpt.selected = value.indexOf(aIx) > -1;
+            aOpt.selected = value.includes(aIx);
 
             // Only fire the event here if this wasn't selected by default
             if (!aOpt.defaultSelected)
               eventType = "change";
           });
         }
 
         // Fire events for this node if applicable
@@ -3193,17 +3193,17 @@ SessionStoreService.prototype = {
    * @param aWindow
    *        Window reference
    * @param aWinData
    *        Object containing session data for the window
    */
   restoreWindowFeatures: function sss_restoreWindowFeatures(aWindow, aWinData) {
     var hidden = (aWinData.hidden)?aWinData.hidden.split(","):[];
     WINDOW_HIDEABLE_FEATURES.forEach(function(aItem) {
-      aWindow[aItem].visible = hidden.indexOf(aItem) == -1;
+      aWindow[aItem].visible = !hidden.includes(aItem);
     });
 
     if (aWinData.isPopup)
       this._windows[aWindow.__SSi].isPopup = true;
     else
       delete this._windows[aWindow.__SSi].isPopup;
 
     Services.tm.mainThread.dispatch(this.restoreDimensions.bind(this, aWindow,
--- a/suite/components/sidebar/content/sidebarOverlay.js
+++ b/suite/components/sidebar/content/sidebarOverlay.js
@@ -526,17 +526,17 @@ function ()
 
 // This exclude function is used on panels and on the panel picker menu.
 // That is why it is hanging out in the global name space instead of
 // minding its own business in the class.
 function sb_panel_is_excluded(node)
 {
   var exclude = node.getAttribute('exclude');
   return ( exclude && exclude != '' &&
-           exclude.indexOf(sidebarObj.component) != -1 );
+           exclude.includes(sidebarObj.component));
 }
 sbPanel.prototype.is_excluded =
 function ()
 {
   return sb_panel_is_excluded(this.get_header());
 }
 
 sbPanel.prototype.is_in_view =
--- a/suite/components/sync/content/syncSetup.js
+++ b/suite/components/sync/content/syncSetup.js
@@ -125,19 +125,19 @@ var gSyncSetup = {
 
     // Generate a new passphrase so that Weave.Service.login() will
     // actually do something.
     let passphrase = Weave.Utils.generatePassphrase();
     Weave.Service.identity.syncKey = passphrase;
 
     // Only open the dialog if username + password are actually correct.
     Weave.Service.login();
-    if ([Weave.LOGIN_FAILED_INVALID_PASSPHRASE,
+    if (![Weave.LOGIN_FAILED_INVALID_PASSPHRASE,
          Weave.LOGIN_FAILED_NO_PASSPHRASE,
-         Weave.LOGIN_SUCCEEDED].indexOf(Weave.Status.login) == -1)
+         Weave.LOGIN_SUCCEEDED].includes(Weave.Status.login))
       return;
 
     // Hide any errors about the passphrase, we know it's not right.
     let feedback = document.getElementById("existingPassphraseFeedbackRow");
     feedback.hidden = true;
     let el = document.getElementById("existingPassphrase");
     el.value = Weave.Utils.hyphenatePassphrase(passphrase);
 
--- a/suite/mailnews/components/compose/content/MsgComposeCommands.js
+++ b/suite/mailnews/components/compose/content/MsgComposeCommands.js
@@ -3296,17 +3296,17 @@ function AutoSave()
  *
  * @param aURL    the URL from which to remove the query part
  * @param aQuery  the query part to remove
  * @return        the URL with the query part removed
  */
 function removeQueryPart(aURL, aQuery)
 {
   // Quick pre-check.
-  if (aURL.indexOf(aQuery) < 0)
+  if (!aURL.includes(aQuery))
     return aURL;
 
   let indexQM = aURL.indexOf("?");
   if (indexQM < 0)
     return aURL;
 
   let queryParts = aURL.substr(indexQM + 1).split("&");
   let indexPart = queryParts.indexOf(aQuery);
--- a/suite/mailnews/content/mailWidgets.xml
+++ b/suite/mailnews/content/mailWidgets.xml
@@ -874,17 +874,17 @@
               return null;
 
             let menulist = document.getAnonymousNodes(this)[0];
             let isCustom = isNaN(this.value);
             let typedValue = isCustom ? this.value : parseInt(this.value);
 
             // custom attribute to style the unavailable menulist item
             menulist.setAttribute("unavailable",
-              this.valueIds.indexOf(typedValue) < 0);
+              !this.valueIds.includes(typedValue));
 
             // add a hidden menulist item if value is missing
             let menuitem = menulist.getElementsByAttribute("value", this.value).item(0);
             if (!menuitem)
             { // need to add a hidden menuitem
               menuitem = menulist.appendItem(this.valueLabel, this.value);
               menuitem.hidden = true;
             }
--- a/suite/mailnews/content/mailWindowOverlay.js
+++ b/suite/mailnews/content/mailWindowOverlay.js
@@ -606,17 +606,17 @@ function ToggleMessageTagKey(index)
   {
     var key = tagArray[i].key;
     if (!--index)
     {
       // found the key, now toggle its state
       var curKeys = msgHdr.getStringProperty("keywords");
       if (msgHdr.label)
         curKeys += " $label" + msgHdr.label;
-      var addKey  = (" " + curKeys + " ").indexOf(" " + key + " ") < 0;
+      var addKey  = !(" " + curKeys + " ").includes(" " + key + " ");
       ToggleMessageTag(key, addKey);
       return;
     }
   }
 }
 
 function ToggleMessageTagMenu(target)
 {
@@ -701,17 +701,17 @@ function InitMessageTags(menuPopup)
   // now rebuild the list
   var msgHdr = gFolderDisplay.selectedMessage;
   var curKeys = msgHdr.getStringProperty("keywords");
   if (msgHdr.label)
     curKeys += " $label" + msgHdr.label;
   for (var i = 0; i < tagCount; ++i)
   {
     var taginfo = tagArray[i];
-    var removeKey = (" " + curKeys + " ").indexOf(" " + taginfo.key + " ") > -1;
+    var removeKey = (" " + curKeys + " ").includes(" " + taginfo.key + " ");
     if (taginfo.ordinal.includes("~AUTOTAG") && !removeKey)
       continue;
 
     // TODO we want to either remove or "check" the tags that already exist
     var newMenuItem = document.createElement("menuitem");
     SetMessageTagLabel(newMenuItem, i + 1, taginfo.tag);
     newMenuItem.setAttribute("value", taginfo.key);
     newMenuItem.setAttribute("type", "checkbox");
--- a/suite/mailnews/content/msgHdrViewOverlay.js
+++ b/suite/mailnews/content/msgHdrViewOverlay.js
@@ -490,17 +490,17 @@ var messageHeaderSink = {
       if (("from" in currentHeaderData) && ("sender" in currentHeaderData) && msgHeaderParser)
       {
         var senderMailbox = kMailboxSeparator +
           msgHeaderParser.extractHeaderAddressMailboxes(
             currentHeaderData.sender.headerValue) + kMailboxSeparator;
         var fromMailboxes = kMailboxSeparator +
           msgHeaderParser.extractHeaderAddressMailboxes(
             currentHeaderData.from.headerValue) + kMailboxSeparator;
-        if (fromMailboxes.indexOf(senderMailbox) >= 0)
+        if (fromMailboxes.includes(senderMailbox))
           delete currentHeaderData.sender;
       }
 
       this.onEndHeaders();
     },
 
     handleAttachment: function(contentType, url, displayName, uri, isExternalAttachment)
     {
@@ -701,17 +701,17 @@ function SetTagHeader()
   // extract the tag keys from the msgHdr
   var msgKeyArray = msgHdr.getStringProperty("keywords").split(" ");
 
   // attach legacy label to the front if not already there
   var label = msgHdr.label;
   if (label)
   {
     var labelKey = "$label" + label;
-    if (msgKeyArray.indexOf(labelKey) < 0)
+    if (!msgKeyArray.includes(labelKey))
       msgKeyArray.unshift(labelKey);
   }
 
   // Rebuild the keywords string with just the keys that are actual tags or
   // legacy labels and not other keywords like Junk and NonJunk.
   // Retain their order, though, with the label as oldest element.
   for (let i = msgKeyArray.length - 1; i >= 0; --i)
     if (!(msgKeyArray[i] in tagKeys))
--- a/suite/mailnews/content/msgMail3PaneWindow.js
+++ b/suite/mailnews/content/msgMail3PaneWindow.js
@@ -267,21 +267,21 @@ var folderListener =
           var imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
           if (imapFolder) {
             var hdrParser = imapFolder.hdrParser;
             if (hdrParser) {
               var msgHdr = hdrParser.GetNewMsgHdr();
               if (msgHdr)
               {
                 var hdrs = hdrParser.headers;
-                if (hdrs && hdrs.indexOf("X-attachment-size:") > 0) {
+                if (hdrs && hdrs.includes("X-attachment-size:")) {
                   msgHdr.OrFlags(Ci.nsMsgMessageFlags
                                    .Attachment);
                 }
-                if (hdrs && hdrs.indexOf("X-image-size:") > 0) {
+                if (hdrs && hdrs.includes("X-image-size:")) {
                   msgHdr.setStringProperty("imageSize", "1");
                 }
               }
             }
           }
         }
       }
       else if (event == "DeleteOrMoveMsgCompleted") {
@@ -553,17 +553,17 @@ function IsCurrentLoadedFolder(aFolder)
   let currentLoadedFolder = GetThreadPaneFolder();
 
   // If the currently loaded folder is virtual,
   // check if aFolder is one of its searched folders.
   if (currentLoadedFolder.flags & Ci.nsMsgFolderFlags.Virtual)
   {
     return currentLoadedFolder.msgDatabase.dBFolderInfo
                               .getCharProperty("searchFolderUri").split("|")
-                              .indexOf(msgFolderUri) != -1;
+                              .includes(msgFolderUri);
   }
 
   // Is aFolder the currently loaded folder?
   return currentLoadedFolder.URI == msgFolderUri;
 }
 
 function ServerContainsFolder(server, folder)
 {
--- a/suite/mailnews/content/tabmail.xml
+++ b/suite/mailnews/content/tabmail.xml
@@ -311,28 +311,29 @@
       <field name="tabMonitors" readonly="true">
         new Array()
       </field>
 
       <method name="registerTabMonitor">
         <parameter name="aTabMonitor"/>
         <body>
           <![CDATA[
-            if (this.tabMonitors.indexOf(aTabMonitor) == -1)
+            if (!this.tabMonitors.includes(aTabMonitor))
               this.tabMonitors.push(aTabMonitor);
           ]]>
         </body>
       </method>
 
       <method name="unregisterTabMonitor">
         <parameter name="aTabMonitor"/>
         <body>
           <![CDATA[
-            if (this.tabMonitors.indexOf(aTabMonitor) >= 0)
-              this.tabMonitors.splice(this.tabMonitors.indexOf(aTabMonitor), 1);
+            let index = this.tabMonitors.indexOf(aTabMonitor);
+            if (index >= 0)
+              this.tabMonitors.splice(index, 1);
           ]]>
         </body>
       </method>
 
       <method name="openFirstTab">
         <body>
           <![CDATA[
             // From the moment of creation, our XBL binding already has a
--- a/suite/modules/WindowsJumpLists.jsm
+++ b/suite/modules/WindowsJumpLists.jsm
@@ -379,17 +379,17 @@ var WinTaskbarJumpList =
         }
 
         if (count >= this._maxItemCount) {
           return;
         }
 
         // Do not add items to recent that have already been added to frequent.
         if (this._frequentHashList &&
-            this._frequentHashList.indexOf(aResult.uri) != -1) {
+            this._frequentHashList.includes(aResult.uri)) {
           return;
         }
 
         let title = aResult.title || aResult.uri;
         let faviconPageUri = Services.io.newURI(aResult.uri);
         let shortcut = this._getHandlerAppItem(title, title, aResult.uri, 2,
                                                faviconPageUri);
         items.appendElement(shortcut);