Bug 1425244 - Enable ESLint rule no-redeclare for accessible/tests/mochitest/. r?surkov draft
authorMark Banner <standard8@mozilla.com>
Mon, 11 Dec 2017 15:32:36 +0000
changeset 711971 65205db3a0acb93377221fe2f6e5238572293815
parent 711864 47d20567347125ee4415d6c54acf5f8bb93054d7
child 743930 fafb3000a476318dab5ecab1fc87a942b03ece51
push id93204
push userbmo:standard8@mozilla.com
push dateFri, 15 Dec 2017 02:52:15 +0000
reviewerssurkov
bugs1425244
milestone59.0a1
Bug 1425244 - Enable ESLint rule no-redeclare for accessible/tests/mochitest/. r?surkov MozReview-Commit-ID: CPetBgR8ZAm
accessible/tests/mochitest/.eslintrc.js
accessible/tests/mochitest/aom/test_general.html
accessible/tests/mochitest/attributes.js
accessible/tests/mochitest/common.js
accessible/tests/mochitest/editabletext/editabletext.js
accessible/tests/mochitest/events.js
accessible/tests/mochitest/events/test_attrs.html
accessible/tests/mochitest/events/test_dragndrop.html
accessible/tests/mochitest/events/test_mutation.html
accessible/tests/mochitest/events/test_statechange.html
accessible/tests/mochitest/events/test_text.html
accessible/tests/mochitest/grid.js
accessible/tests/mochitest/hittest/test_zoom_text.html
accessible/tests/mochitest/layout.js
accessible/tests/mochitest/pivot.js
accessible/tests/mochitest/relations.js
accessible/tests/mochitest/scroll/test_zoom.html
accessible/tests/mochitest/selectable.js
accessible/tests/mochitest/selectable/test_select.html
accessible/tests/mochitest/table.js
accessible/tests/mochitest/table/test_indexes_table.html
accessible/tests/mochitest/table/test_mtable.html
accessible/tests/mochitest/table/test_sels_table.html
accessible/tests/mochitest/test_nsIAccessibleImage.html
accessible/tests/mochitest/text.js
accessible/tests/mochitest/text/test_gettext.html
accessible/tests/mochitest/text/test_wordboundary.html
accessible/tests/mochitest/textattrs/test_general.html
accessible/tests/mochitest/textrange/test_selection.html
accessible/tests/mochitest/tree/test_aria_globals.html
accessible/tests/mochitest/tree/test_aria_grid.html
accessible/tests/mochitest/tree/test_list.html
accessible/tests/mochitest/treeupdate/test_ariaowns.html
--- a/accessible/tests/mochitest/.eslintrc.js
+++ b/accessible/tests/mochitest/.eslintrc.js
@@ -7,12 +7,11 @@ module.exports = {
   "rules": {
     "mozilla/no-cpows-in-tests": "error",
     "mozilla/reject-importGlobalProperties": "error",
 
     // XXX These are rules that are enabled in the recommended configuration, but
     // disabled here due to failures when initially implemented. They should be
     // removed (and hence enabled) at some stage.
     "no-nested-ternary": "off",
-    "no-redeclare": "off",
     "no-undef": "off",
   }
 };
--- a/accessible/tests/mochitest/aom/test_general.html
+++ b/accessible/tests/mochitest/aom/test_general.html
@@ -67,17 +67,17 @@
         states = [
           "readonly", "busy", "focusable", "opaque", "stale", "enabled", "sensitive"
         ];
         break;
       default:
         ok(false, "Unexpected amount of states");
     }
     if (states) {
-      for (var i = 0; i < states.length; i++) {
+      for (let i = 0; i < states.length; i++) {
         is(anode.states[i], states[i], `${states[i]} state is expected at ${i}th index`);
       }
     }
 
     ok(anode.is("document", "focusable"),
        "correct role and state on an accessible node");
 
     is(anode.get("explicit-name"), "true",
@@ -91,17 +91,17 @@
       attrs = [
         "margin-left", "text-align", "text-indent", "margin-right",
         "tag", "margin-top", "margin-bottom", "display",
         "explicit-name"
       ];
     }
 
     is(anode.attributes.length, attrs.length, "correct number of attributes");
-    for (var i = 0; i < attrs.length; i++) {
+    for (let i = 0; i < attrs.length; i++) {
       ok(attrs.indexOf(anode.attributes[i]) >= 0,
          `${anode.attributes[i]} attribute is expected and found`);
     }
 
     finish();
   }
   </script>
 </head>
--- a/accessible/tests/mochitest/attributes.js
+++ b/accessible/tests/mochitest/attributes.js
@@ -75,28 +75,28 @@ function testGroupAttrs(aAccOrElmOrID, a
   acc.groupPosition(levelObj, setSizeObj, posInSetObj);
 
   if (aPosInSet && aSetSize) {
     is(posInSetObj.value, aPosInSet,
        "Wrong group position (posinset) for " + prettyName(aAccOrElmOrID));
     is(setSizeObj.value, aSetSize,
        "Wrong size of the group (setsize) for " + prettyName(aAccOrElmOrID));
 
-    var attrs = {
+    let attrs = {
       "posinset": String(aPosInSet),
       "setsize": String(aSetSize)
     };
     testAttrs(aAccOrElmOrID, attrs, true);
   }
 
   if (aLevel) {
     is(levelObj.value, aLevel,
        "Wrong group level for " + prettyName(aAccOrElmOrID));
 
-    var attrs = { "level": String(aLevel) };
+    let attrs = { "level": String(aLevel) };
     testAttrs(aAccOrElmOrID, attrs, true);
   }
 }
 
 // //////////////////////////////////////////////////////////////////////////////
 // Text attributes.
 
 /**
@@ -138,20 +138,20 @@ function testTextAttrs(aID, aOffset, aAt
 
   is(startOffset.value, aStartOffset, "Wrong start offset" + errorMsg);
   is(endOffset.value, aEndOffset, "Wrong end offset" + errorMsg);
 
   compareAttrs(errorMsg, attrs, aAttrs, aSkipUnexpectedAttrs);
 
   // include attributes exposed on hyper text accessible
   var expectedAttrs = {};
-  for (var name in aAttrs)
+  for (let name in aAttrs)
     expectedAttrs[name] = aAttrs[name];
 
-  for (var name in aDefAttrs) {
+  for (let name in aDefAttrs) {
     if (!(name in expectedAttrs))
       expectedAttrs[name] = aDefAttrs[name];
   }
 
   attrs = getTextAttributes(aID, accessible, true, aOffset,
                             startOffset, endOffset);
 
   if (!attrs)
@@ -316,17 +316,17 @@ function testAttrsInternal(aAccOrElmOrID
   compareAttrs(errorMsg, attrs, aAttrs, aSkipUnexpectedAttrs, aAbsentAttrs);
 }
 
 function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
                       aAbsentAttrs) {
   // Check if all obtained attributes are expected and have expected value.
   var enumerate = aAttrs.enumerate();
   while (enumerate.hasMoreElements()) {
-    var prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
+    let prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
 
     if (!(prop.key in aExpectedAttrs)) {
       if (!aSkipUnexpectedAttrs)
         ok(false, "Unexpected attribute '" + prop.key + "' having '" +
            prop.value + "'" + aErrorMsg);
     } else {
       var msg = "Attribute '" + prop.key + "' has wrong value" + aErrorMsg;
       var expectedValue = aExpectedAttrs[prop.key];
@@ -334,35 +334,35 @@ function compareAttrs(aErrorMsg, aAttrs,
       if (typeof expectedValue == "function")
         ok(expectedValue(prop.value), msg);
       else
         is(prop.value, expectedValue, msg);
     }
   }
 
   // Check if all expected attributes are presented.
-  for (var name in aExpectedAttrs) {
+  for (let name in aExpectedAttrs) {
     var value = "";
     try {
       value = aAttrs.getStringProperty(name);
     } catch (e) { }
 
     if (!value)
       ok(false,
          "There is no expected attribute '" + name + "' " + aErrorMsg);
   }
 
   // Check if all unexpected attributes are absent.
   if (aAbsentAttrs) {
     for (var name in aAbsentAttrs) {
       var wasFound = false;
 
-      var enumerate = aAttrs.enumerate();
+      enumerate = aAttrs.enumerate();
       while (enumerate.hasMoreElements()) {
-        var prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
+        let prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
         if (prop.key == name)
           wasFound = true;
       }
     }
 
     ok(!wasFound,
        "There is an unexpected attribute '" + name + "' " + aErrorMsg);
   }
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -419,17 +419,17 @@ function testAccessibleTree(aAccOrElmOrI
 
     case "absentAttributes":
       testAbsentAttrs(acc, accTree[prop]);
       break;
 
     case "interfaces": {
       var ifaces = (accTree[prop] instanceof Array) ?
         accTree[prop] : [ accTree[prop] ];
-      for (var i = 0; i < ifaces.length; i++) {
+      for (let i = 0; i < ifaces.length; i++) {
         ok((acc instanceof ifaces[i]),
            "No " + ifaces[i] + " interface on " + prettyName(acc));
       }
       break;
     }
 
     case "relations": {
       for (var rel in accTree[prop])
@@ -453,25 +453,25 @@ function testAccessibleTree(aAccOrElmOrI
     case "tagName":
       is(accTree[prop], acc.DOMNode.tagName, msg);
       break;
 
     case "textAttrs": {
       var prevOffset = -1;
       for (var offset in accTree[prop]) {
         if (prevOffset != -1) {
-          var attrs = accTree[prop][prevOffset];
+          let attrs = accTree[prop][prevOffset];
           testTextAttrs(acc, prevOffset, attrs, { }, prevOffset, +offset, true);
         }
         prevOffset = +offset;
       }
 
       if (prevOffset != -1) {
         var charCount = getAccessible(acc, [nsIAccessibleText]).characterCount;
-        var attrs = accTree[prop][prevOffset];
+        let attrs = accTree[prop][prevOffset];
         testTextAttrs(acc, prevOffset, attrs, { }, prevOffset, charCount, true);
       }
 
       break;
     }
 
     default:
       if (prop.indexOf("todo_") == 0)
@@ -482,17 +482,17 @@ function testAccessibleTree(aAccOrElmOrI
   }
 
   // Test children.
   if ("children" in accTree && accTree.children instanceof Array) {
     var children = acc.children;
     var childCount = children.length;
 
     if (accTree.children.length != childCount) {
-      for (var i = 0; i < Math.max(accTree.children.length, childCount); i++) {
+      for (let i = 0; i < Math.max(accTree.children.length, childCount); i++) {
         var accChild = null, testChild = null;
         try {
           testChild = accTree.children[i];
           accChild = children.queryElementAt(i, nsIAccessible);
 
           if (!testChild) {
             ok(false, prettyName(acc) + " has an extra child at index " + i +
               " : " + prettyName(accChild));
@@ -511,18 +511,18 @@ function testAccessibleTree(aAccOrElmOrI
         } catch (e) {
           ok(false, prettyName(accTree) + " is expected to have a child at index " + i +
              " : " + prettyName(testChild) + ", original tested: " +
              prettyName(aAccOrElmOrID) + ", " + e);
         }
       }
     } else {
       if (aFlags & kSkipTreeFullCheck) {
-        for (var i = 0; i < childCount; i++) {
-          var child = children.queryElementAt(i, nsIAccessible);
+        for (let i = 0; i < childCount; i++) {
+          let child = children.queryElementAt(i, nsIAccessible);
           testAccessibleTree(child, accTree.children[i], aFlags);
         }
         return;
       }
 
       // nsIAccessible::firstChild
       var expectedFirstChild = childCount > 0 ?
         children.queryElementAt(0, nsIAccessible) : null;
@@ -535,17 +535,17 @@ function testAccessibleTree(aAccOrElmOrI
       var expectedLastChild = childCount > 0 ?
         children.queryElementAt(childCount - 1, nsIAccessible) : null;
       var lastChild = null;
       try { lastChild = acc.lastChild; } catch (e) {}
       is(lastChild, expectedLastChild,
          "Wrong last child of " + prettyName(acc));
 
       for (var i = 0; i < childCount; i++) {
-        var child = children.queryElementAt(i, nsIAccessible);
+        let child = children.queryElementAt(i, nsIAccessible);
 
         // nsIAccessible::parent
         var parent = null;
         try { parent = child.parent; } catch (e) {}
         is(parent, acc, "Wrong parent of " + prettyName(child));
 
         // nsIAccessible::indexInParent
         var indexInParent = -1;
@@ -761,30 +761,30 @@ function getAccessibleDOMNodeID(accessib
   } catch (e) { /* This will fail if accessible is not a proxy. */ }
 }
 
 /**
  * Return pretty name for identifier, it may be ID, DOM node or accessible.
  */
 function prettyName(aIdentifier) {
   if (aIdentifier instanceof Array) {
-    var msg = "";
+    let msg = "";
     for (var idx = 0; idx < aIdentifier.length; idx++) {
       if (msg != "")
         msg += ", ";
 
       msg += prettyName(aIdentifier[idx]);
     }
     return msg;
   }
 
   if (aIdentifier instanceof nsIAccessible) {
     var acc = getAccessible(aIdentifier);
     var domID = getAccessibleDOMNodeID(acc);
-    var msg = "[";
+    let msg = "[";
     try {
       if (Services.appinfo.browserTabsRemoteAutostart) {
         if (domID) {
           msg += `DOM node id: ${domID}, `;
         }
       } else {
         msg += `${getNodePrettyName(acc.DOMNode)}, `;
       }
--- a/accessible/tests/mochitest/editabletext/editabletext.js
+++ b/accessible/tests/mochitest/editabletext/editabletext.js
@@ -254,24 +254,24 @@ function editableTextTest(aID) {
 
         aChecker.check();
         et.unwrapNextTest(); // replace dummy invoker on real invoker object.
       },
       getID: function getID() { return aInvokerID; }
     };
 
     if (aRemoveTriple) {
-      var checker = new textChangeChecker(aID, aRemoveTriple[0],
+      let checker = new textChangeChecker(aID, aRemoveTriple[0],
                                           aRemoveTriple[1], aRemoveTriple[2],
                                           false);
       invoker.eventSeq.push(checker);
     }
 
     if (aInsertTriple) {
-      var checker = new textChangeChecker(aID, aInsertTriple[0],
+      let checker = new textChangeChecker(aID, aInsertTriple[0],
                                           aInsertTriple[1], aInsertTriple[2],
                                           true);
       invoker.eventSeq.push(checker);
     }
 
     // Claim that we don't want to fail when no events are expected.
     if (!aRemoveTriple && !aInsertTriple)
       invoker.noEventsOnAction = true;
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -1,8 +1,11 @@
+// XXX Bug 1425371 - enable no-redeclare and fix the issues with the tests.
+/* eslint-disable no-redeclare */
+
 // //////////////////////////////////////////////////////////////////////////////
 // Constants
 
 const EVENT_ALERT = nsIAccessibleEvent.EVENT_ALERT;
 const EVENT_DESCRIPTION_CHANGE = nsIAccessibleEvent.EVENT_DESCRIPTION_CHANGE;
 const EVENT_DOCUMENT_LOAD_COMPLETE = nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE;
 const EVENT_DOCUMENT_RELOAD = nsIAccessibleEvent.EVENT_DOCUMENT_RELOAD;
 const EVENT_DOCUMENT_LOAD_STOPPED = nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_STOPPED;
--- a/accessible/tests/mochitest/events/test_attrs.html
+++ b/accessible/tests/mochitest/events/test_attrs.html
@@ -44,22 +44,22 @@
 
     // gA11yEventDumpID = "eventdump"; // debug stuff
     // gA11yEventDumpToConsole = true; // debug stuff
 
     function doTests() {
       gQueue = new eventQueue();
 
       var id = "textbox", noTargetId = "textarea";
-      var checker =
+      let checker =
         new eventFromInputChecker(EVENT_FOCUS, id, "false", noTargetId);
       gQueue.push(new synthFocus(id, checker));
 
       if (!MAC) { // Mac failure is bug 541093
-        var checker =
+        checker =
           new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "true", noTargetId);
         gQueue.push(new synthHomeKey(id, checker));
       }
 
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
--- a/accessible/tests/mochitest/events/test_dragndrop.html
+++ b/accessible/tests/mochitest/events/test_dragndrop.html
@@ -61,23 +61,23 @@
         return prettyName(aNodeOrID) + " aria-dropeffect changed";
       };
     }
 
     function doTests() {
       // Test aria attribute mutation events
       gQueue = new eventQueue(nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED);
 
-      var id = "grabbable";
+      let id = "grabbable";
       gQueue.push(new changeGrabbed(id, "true"));
       gQueue.push(new changeGrabbed(id, "false"));
       todo(false, "uncomment this test when 472142 is fixed.");
       // gQueue.push(new changeGrabbed(id, "undefined"));
 
-      var id = "dropregion";
+      id = "dropregion";
       gQueue.push(new changeDropeffect(id, "copy"));
       gQueue.push(new changeDropeffect(id, "execute"));
 
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTests);
--- a/accessible/tests/mochitest/events/test_mutation.html
+++ b/accessible/tests/mochitest/events/test_mutation.html
@@ -66,17 +66,17 @@
        * Replace the default target currently registered for a given event type
        * with the nodes in the targets array.
        */
       this.setTargets = function mutateA11yTree_setTargets(aEventType, aTargets) {
         var targetIdx = this.setTarget(aEventType, aTargets[0]);
 
         var type = this.getA11yEventType(aEventType);
         for (var i = 1; i < aTargets.length; i++) {
-          var checker = new invokerChecker(type, aTargets[i]);
+          let checker = new invokerChecker(type, aTargets[i]);
           this.getEventSeq().splice(++targetIdx, 0, checker);
         }
       };
 
       // Implementation
       this.getA11yEventType = function mutateA11yTree_getA11yEventType(aEventType) {
         if (aEventType == kReorderEvent)
           return nsIAccessibleEvent.EVENT_REORDER;
@@ -88,29 +88,29 @@
           return nsIAccessibleEvent.EVENT_SHOW;
       };
 
       this.getEventSeq = function mutateA11yTree_getEventSeq() {
         return this.doNotExpectEvents ? this.unexpectedEventSeq : this.eventSeq;
       };
 
       if (aEventTypes & kHideEvent) {
-        var checker = new invokerChecker(this.getA11yEventType(kHideEvent),
+        let checker = new invokerChecker(this.getA11yEventType(kHideEvent),
                                          this.DOMNode);
         this.getEventSeq().push(checker);
       }
 
       if (aEventTypes & kShowEvent) {
-        var checker = new invokerChecker(this.getA11yEventType(kShowEvent),
+        let checker = new invokerChecker(this.getA11yEventType(kShowEvent),
                                          this.DOMNode);
         this.getEventSeq().push(checker);
       }
 
       if (aEventTypes & kReorderEvent) {
-        var checker = new invokerChecker(this.getA11yEventType(kReorderEvent),
+        let checker = new invokerChecker(this.getA11yEventType(kReorderEvent),
                                          this.DOMNode.parentNode);
         this.getEventSeq().push(checker);
       }
     }
 
     /**
      * Change CSS style for the given node.
      */
@@ -427,61 +427,61 @@
      */
     var gQueue = null;
 
     function doTests() {
       gQueue = new eventQueue();
 
       // Show/hide events by changing of display style of accessible DOM node
       // from 'inline' to 'none', 'none' to 'inline'.
-      var id = "link1";
+      let id = "link1";
       getAccessible(id); // ensure accessible is created
       gQueue.push(new changeStyle(id, "display", "none", kHideEvents));
       gQueue.push(new changeStyle(id, "display", "inline", kShowEvents));
 
       // Show/hide events by changing of visibility style of accessible DOM node
       // from 'visible' to 'hidden', 'hidden' to 'visible'.
-      var id = "link2";
+      id = "link2";
       getAccessible(id);
       gQueue.push(new changeStyle(id, "visibility", "hidden", kHideEvents));
       gQueue.push(new changeStyle(id, "visibility", "visible", kShowEvents));
 
       // Show/hide events by changing of display style of accessible DOM node
       // from 'inline' to 'block', 'block' to 'inline'.
-      var id = "link3";
+      id = "link3";
       getAccessible(id); // ensure accessible is created
       gQueue.push(new changeStyle(id, "display", "block", kHideAndShowEvents));
       gQueue.push(new changeStyle(id, "display", "inline", kHideAndShowEvents));
 
       // Show/hide events by changing of visibility style of accessible DOM node
       // from 'collapse' to 'visible', 'visible' to 'collapse'.
-      var id = "link4";
+      id = "link4";
       gQueue.push(new changeStyle(id, "visibility", "visible", kShowEvents));
       gQueue.push(new changeStyle(id, "visibility", "collapse", kHideEvents));
 
       // Show/hide events by adding new accessible DOM node and removing old one.
-      var id = "link5";
+      id = "link5";
       gQueue.push(new cloneAndAppendToDOM(id));
       gQueue.push(new removeFromDOM(id));
 
       // No show/hide events by adding new not accessible DOM node and removing
       // old one, no reorder event for their parent.
-      var id = "child1";
+      id = "child1";
       gQueue.push(new cloneAndAppendToDOM(id, kNoEvents));
       gQueue.push(new removeFromDOM(id, kNoEvents));
 
       // Show/hide events by adding new accessible DOM node and removing
       // old one, there is reorder event for their parent.
-      var id = "child2";
+      id = "child2";
       gQueue.push(new cloneAndAppendToDOM(id));
       gQueue.push(new removeFromDOM(id));
 
       // Show/hide events by adding new DOM node containing accessible DOM and
       // removing old one, there is reorder event for their parent.
-      var id = "child3";
+      id = "child3";
       gQueue.push(new cloneAndAppendToDOM(id, kShowEvents, getFirstChild,
                                           getParent));
 
       // Hide event for accessible child of unaccessible removed DOM node and
       // reorder event for its parent.
       gQueue.push(new removeFromDOM(id, kHideEvents,
                                     getNEnsureFirstChild, getParent));
 
--- a/accessible/tests/mochitest/events/test_statechange.html
+++ b/accessible/tests/mochitest/events/test_statechange.html
@@ -29,19 +29,19 @@
         // Note: this should fire an EVENT_STATE_CHANGE
         this.DOMNode.designMode = "on";
       };
 
       this.check = function editabledoc_check(aEvent) {
 
         testStates(aDocNode, 0, EXT_STATE_EDITABLE);
 
-        var event = null;
+        let event = null;
         try {
-          var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
+          event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
         } catch (e) {
           ok(false, "State change event was expected");
         }
 
         if (!event) { return; }
 
         ok(event.isExtraState, "Extra state change was expected");
         is(event.state, EXT_STATE_EDITABLE, "Wrong state of statechange event");
--- a/accessible/tests/mochitest/events/test_text.html
+++ b/accessible/tests/mochitest/events/test_text.html
@@ -59,35 +59,35 @@
      * Insert inaccessible child node containing accessibles.
      */
     function insertChildSpan(aID, aInsertAllTogether) {
       this.__proto__ = new textInsertInvoker(aID, 0, 5, "33322");
 
       this.invoke = function insertChildSpan_invoke() {
         // <span><span>333</span><span>22</span></span>
         if (aInsertAllTogether) {
-          var topSpan = document.createElement("span");
-          var fSpan = document.createElement("span");
+          let topSpan = document.createElement("span");
+          let fSpan = document.createElement("span");
           fSpan.textContent = "333";
           topSpan.appendChild(fSpan);
-          var sSpan = document.createElement("span");
+          let sSpan = document.createElement("span");
           sSpan.textContent = "22";
           topSpan.appendChild(sSpan);
 
           this.DOMNode.insertBefore(topSpan, this.DOMNode.childNodes[0]);
 
         } else {
-          var topSpan = document.createElement("span");
+          let topSpan = document.createElement("span");
           this.DOMNode.insertBefore(topSpan, this.DOMNode.childNodes[0]);
 
-          var fSpan = document.createElement("span");
+          let fSpan = document.createElement("span");
           fSpan.textContent = "333";
           topSpan.appendChild(fSpan);
 
-          var sSpan = document.createElement("span");
+          let sSpan = document.createElement("span");
           sSpan.textContent = "22";
           topSpan.appendChild(sSpan);
         }
       };
 
       this.getID = function insertChildSpan_getID() {
        return "Insert inaccessible span containing accessibles" +
           prettyName(aID);
--- a/accessible/tests/mochitest/grid.js
+++ b/accessible/tests/mochitest/grid.js
@@ -66,59 +66,60 @@ function grid(aTableIdentifier) {
   };
 
   this.handleKeyEvent = function handleKeyEvent(aEvent) {
     if (aEvent.target.localName != "td")
       return;
 
     var cell = aEvent.target;
     switch (aEvent.keyCode) {
-      case nsIDOMKeyEvent.DOM_VK_UP:
-        var colsCount = this.getColsCount();
-        var idx = this.getIndexByCell(cell);
+      case nsIDOMKeyEvent.DOM_VK_UP: {
+        let colsCount = this.getColsCount();
+        let idx = this.getIndexByCell(cell);
         var upidx = idx - colsCount;
         if (upidx >= 0) {
           cell.removeAttribute("tabindex");
           var upcell = this.getCellAtIndex(upidx);
           upcell.setAttribute("tabindex", "0");
           upcell.focus();
         }
         break;
-
-      case nsIDOMKeyEvent.DOM_VK_DOWN:
-        var colsCount = this.getColsCount();
-        var idx = this.getIndexByCell(cell);
+      }
+      case nsIDOMKeyEvent.DOM_VK_DOWN: {
+        let colsCount = this.getColsCount();
+        let idx = this.getIndexByCell(cell);
         var downidx = idx + colsCount;
         if (downidx <= this.getMaxIndex()) {
           cell.removeAttribute("tabindex");
           var downcell = this.getCellAtIndex(downidx);
           downcell.setAttribute("tabindex", "0");
           downcell.focus();
         }
         break;
-
-      case nsIDOMKeyEvent.DOM_VK_LEFT:
-        var idx = this.getIndexByCell(cell);
+      }
+      case nsIDOMKeyEvent.DOM_VK_LEFT: {
+        let idx = this.getIndexByCell(cell);
         if (idx > 0) {
           cell.removeAttribute("tabindex");
           var prevcell = this.getCellAtIndex(idx - 1);
           prevcell.setAttribute("tabindex", "0");
           prevcell.focus();
         }
         break;
-
-      case nsIDOMKeyEvent.DOM_VK_RIGHT:
-        var idx = this.getIndexByCell(cell);
+      }
+      case nsIDOMKeyEvent.DOM_VK_RIGHT: {
+        let idx = this.getIndexByCell(cell);
         if (idx < this.getMaxIndex()) {
           cell.removeAttribute("tabindex");
           var nextcell = this.getCellAtIndex(idx + 1);
           nextcell.setAttribute("tabindex", "0");
           nextcell.focus();
         }
         break;
+      }
     }
   };
 
   this.handleClickEvent = function handleClickEvent(aEvent) {
     if (aEvent.target.localName != "td")
       return;
 
     var curCell = this.getCurrentCell();
--- a/accessible/tests/mochitest/hittest/test_zoom_text.html
+++ b/accessible/tests/mochitest/hittest/test_zoom_text.html
@@ -14,24 +14,24 @@
           src="../role.js"></script>
   <script type="application/javascript"
           src="../layout.js"></script>
 
   <script type="application/javascript">
     function doTest() {
       var hyperText = getNode("paragraph");
       var textNode = hyperText.firstChild;
-      var [x, y, width, height] = getBounds(textNode);
+      let [x, y, width, height] = getBounds(textNode);
       testOffsetAtPoint(hyperText, x + width / 2, y + height / 2,
                         COORDTYPE_SCREEN_RELATIVE,
                         hyperText.textContent.length / 2);
 
       zoomDocument(document, 2.0);
 
-      var [x, y, width, height] = getBounds(textNode);
+      [x, y, width, height] = getBounds(textNode);
       testOffsetAtPoint(hyperText, x + width / 2, y + height / 2,
                         COORDTYPE_SCREEN_RELATIVE,
                         hyperText.textContent.length / 2);
 
       zoomDocument(document, 1.0);
 
       SimpleTest.finish();
     }
--- a/accessible/tests/mochitest/layout.js
+++ b/accessible/tests/mochitest/layout.js
@@ -210,23 +210,23 @@ function getBoundsForDOMElm(aID) {
     var img = elm.ownerDocument.querySelector(selector);
 
     var areaCoords = elm.coords.split(",");
     var areaX = parseInt(areaCoords[0]);
     var areaY = parseInt(areaCoords[1]);
     var areaWidth = parseInt(areaCoords[2]) - areaX;
     var areaHeight = parseInt(areaCoords[3]) - areaY;
 
-    var rect = img.getBoundingClientRect();
+    let rect = img.getBoundingClientRect();
     x = rect.left + areaX;
     y = rect.top + areaY;
     width = areaWidth;
     height = areaHeight;
   } else {
-    var rect = elm.getBoundingClientRect();
+    let rect = elm.getBoundingClientRect();
     x = rect.left;
     y = rect.top;
     width = rect.width;
     height = rect.height;
   }
 
   var elmWindow = elm.ownerGlobal;
   return CSSToDevicePixels(elmWindow,
--- a/accessible/tests/mochitest/pivot.js
+++ b/accessible/tests/mochitest/pivot.js
@@ -379,27 +379,27 @@ function setModalRootInvoker(aDocAcc, aM
 function queueTraversalSequence(aQueue, aDocAcc, aRule, aModalRoot, aSequence) {
   aDocAcc.virtualCursor.position = null;
 
   // Add modal root (if any)
   aQueue.push(new setModalRootInvoker(aDocAcc, aModalRoot, 0));
 
   aQueue.push(new setVCPosInvoker(aDocAcc, "moveFirst", aRule, aSequence[0]));
 
-  for (var i = 1; i < aSequence.length; i++) {
-    var invoker =
+  for (let i = 1; i < aSequence.length; i++) {
+    let invoker =
       new setVCPosInvoker(aDocAcc, "moveNext", aRule, aSequence[i]);
     aQueue.push(invoker);
   }
 
   // No further more matches for given rule, expect no virtual cursor changes.
   aQueue.push(new setVCPosInvoker(aDocAcc, "moveNext", aRule, false));
 
-  for (var i = aSequence.length - 2; i >= 0; i--) {
-    var invoker =
+  for (let i = aSequence.length - 2; i >= 0; i--) {
+    let invoker =
       new setVCPosInvoker(aDocAcc, "movePrevious", aRule, aSequence[i]);
     aQueue.push(invoker);
   }
 
   // No previous more matches for given rule, expect no virtual cursor changes.
   aQueue.push(new setVCPosInvoker(aDocAcc, "movePrevious", aRule, false));
 
   aQueue.push(new setVCPosInvoker(aDocAcc, "moveLast", aRule,
--- a/accessible/tests/mochitest/relations.js
+++ b/accessible/tests/mochitest/relations.js
@@ -60,44 +60,45 @@ function testRelation(aIdentifier, aRelT
     ok(false, "There are unexpected targets of " + relDescr);
     return;
   }
 
   var relatedIds = (aRelatedIdentifiers instanceof Array) ?
   aRelatedIdentifiers : [aRelatedIdentifiers];
 
   var targets = [];
-   for (var idx = 0; idx < relatedIds.length; idx++)
+   for (let idx = 0; idx < relatedIds.length; idx++)
      targets.push(getAccessible(relatedIds[idx]));
 
   if (targets.length != relatedIds.length)
     return;
 
   var actualTargets = relation.getTargets();
 
   // Check if all given related accessibles are targets of obtained relation.
-  for (var idx = 0; idx < targets.length; idx++) {
+  for (let idx = 0; idx < targets.length; idx++) {
     var isFound = false;
-    var enumerate = actualTargets.enumerate();
+    let enumerate = actualTargets.enumerate();
     while (enumerate.hasMoreElements()) {
-      var relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
+      let relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
       if (targets[idx] == relatedAcc) {
         isFound = true;
         break;
       }
     }
 
     ok(isFound, prettyName(relatedIds[idx]) + " is not a target of" + relDescr);
   }
 
   // Check if all obtained targets are given related accessibles.
-  var enumerate = actualTargets.enumerate();
+  let enumerate = actualTargets.enumerate();
   while (enumerate.hasMoreElements()) {
-    var relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
-    for (var idx = 0; idx < targets.length && relatedAcc != targets[idx]; idx++);
+    let relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
+    let idx;
+    for (idx = 0; idx < targets.length && relatedAcc != targets[idx]; idx++);
 
     if (idx == targets.length)
       ok(false, "There is unexpected target" + prettyName(relatedAcc) + "of" + relDescr);
   }
 }
 
 /**
  * Test that the given accessible relations don't exist.
@@ -123,26 +124,26 @@ function testAbsentRelation(aIdentifier,
     ok(true, "No relations exist.");
     return;
   }
 
   var relatedIds = (aUnrelatedIdentifiers instanceof Array) ?
     aUnrelatedIdentifiers : [aUnrelatedIdentifiers];
 
   var targets = [];
-  for (var idx = 0; idx < relatedIds.length; idx++)
+  for (let idx = 0; idx < relatedIds.length; idx++)
     targets.push(getAccessible(relatedIds[idx]));
 
   if (targets.length != relatedIds.length)
     return;
 
   var actualTargets = relation.getTargets();
 
   // Any found targets that match given accessibles should be called out.
-  for (var idx = 0; idx < targets.length; idx++) {
+  for (let idx = 0; idx < targets.length; idx++) {
     var notFound = true;
     var enumerate = actualTargets.enumerate();
     while (enumerate.hasMoreElements()) {
       var relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
       if (targets[idx] == relatedAcc) {
         notFound = false;
         break;
       }
--- a/accessible/tests/mochitest/scroll/test_zoom.html
+++ b/accessible/tests/mochitest/scroll/test_zoom.html
@@ -16,37 +16,37 @@
           src="../role.js"></script>
   <script type="application/javascript"
           src="../layout.js"></script>
 
   <script type="application/javascript">
     function testScrollToPoint() {
       // scrollToPoint relative screen
       var anchor = getAccessible("bottom1");
-      var [x, /* y */] = getPos(anchor);
+      let [x, /* y */] = getPos(anchor);
       var [docX, docY] = getPos(document);
 
       anchor.scrollToPoint(COORDTYPE_SCREEN_RELATIVE, docX, docY);
       testPos(anchor, [x, docY]);
 
       // scrollToPoint relative window
       anchor = getAccessible("bottom2");
-      var [x, /* y */] = getPos(anchor);
+      [x, /* y */] = getPos(anchor);
       var wnd = getRootAccessible().DOMDocument.defaultView;
       var [screenX, screenY] = CSSToDevicePixels(wnd, wnd.screenX, wnd.screenY);
-      var scrollToX = docX - screenX, scrollToY = docY - screenY;
+      let scrollToX = docX - screenX, scrollToY = docY - screenY;
 
       anchor.scrollToPoint(COORDTYPE_WINDOW_RELATIVE, scrollToX, scrollToY);
       testPos(anchor, [x, docY]);
 
       // scrollToPoint relative parent
       anchor = getAccessible("bottom3");
-      var [x, /* y */] = getPos(anchor);
+      [x, /* y */] = getPos(anchor);
       var [parentX, parentY] = getPos(anchor.parent);
-      var scrollToX = parentX - docX, scrollToY = parentY - docY;
+      scrollToX = parentX - docX, scrollToY = parentY - docY;
 
       anchor.scrollToPoint(COORDTYPE_PARENT_RELATIVE, scrollToX, scrollToY);
       testPos(anchor, [x, docY]);
     }
 
     function doTest() {
       testScrollToPoint();
       zoomDocument(document, 2.0);
--- a/accessible/tests/mochitest/selectable.js
+++ b/accessible/tests/mochitest/selectable.js
@@ -13,32 +13,32 @@ function testSelectableSelection(aIdenti
   var len = aSelectedChildren.length;
 
   // getSelectedChildren
   var selectedChildren = acc.selectedItems;
   is(selectedChildren ? selectedChildren.length : 0, len,
      msg + "getSelectedChildren: wrong selected children count for " +
      prettyName(aIdentifier));
 
-  for (var idx = 0; idx < len; idx++) {
-    var expectedAcc = getAccessible(aSelectedChildren[idx]);
+  for (let idx = 0; idx < len; idx++) {
+    let expectedAcc = getAccessible(aSelectedChildren[idx]);
     var actualAcc = selectedChildren.queryElementAt(idx, nsIAccessible);
     is(actualAcc, expectedAcc,
        msg + "getSelectedChildren: wrong selected child at index " + idx +
        " for " + prettyName(aIdentifier) + " { actual : " +
        prettyName(actualAcc) + ", expected: " + prettyName(expectedAcc) + "}");
   }
 
   // selectedItemCount
   is(acc.selectedItemCount, aSelectedChildren.length,
      "selectedItemCount: wrong selected children count for " + prettyName(aIdentifier));
 
   // getSelectedItemAt
-  for (var idx = 0; idx < len; idx++) {
-    var expectedAcc = getAccessible(aSelectedChildren[idx]);
+  for (let idx = 0; idx < len; idx++) {
+    let expectedAcc = getAccessible(aSelectedChildren[idx]);
     is(acc.getSelectedItemAt(idx), expectedAcc,
        msg + "getSelectedItemAt: wrong selected child at index " + idx + " for " +
        prettyName(aIdentifier));
   }
 
   // isItemSelected
   testIsItemSelected(acc, acc, { value: 0 }, aSelectedChildren, msg);
 }
--- a/accessible/tests/mochitest/selectable/test_select.html
+++ b/accessible/tests/mochitest/selectable/test_select.html
@@ -76,17 +76,17 @@
       testSelectableSelection(select, [ "cb2_item1" ]);
 
       select.unselectAll();
       testSelectableSelection(select, [ "cb2_item1" ]);
 
       // ////////////////////////////////////////////////////////////////////////
       // select@size="4" aka single selectable listbox
 
-      var id = "listbox";
+      id = "listbox";
       ok(isAccessible(id, [nsIAccessibleSelectable]),
          "No selectable accessible for " + id);
 
       select = getAccessible(id, [nsIAccessibleSelectable]);
       testSelectableSelection(select, [ ]);
 
       // select 2nd item
       select.addItemToSelection(1);
@@ -151,17 +151,17 @@
                               "selectAll: ");
 
       select.unselectAll();
       testSelectableSelection(select, [ ], "unselectAll: ");
 
       // ////////////////////////////////////////////////////////////////////////
       // select@size="4" multiselect with optgroups
 
-      var id = "listbox4";
+      id = "listbox4";
       ok(isAccessible(id, [nsIAccessibleSelectable]),
          "No selectable accessible for " + id);
 
       select = getAccessible(id, [nsIAccessibleSelectable]);
       testSelectableSelection(select, [ ]);
 
       select.addItemToSelection(0);
       testSelectableSelection(select, [ "lb4_item1" ]);
--- a/accessible/tests/mochitest/table.js
+++ b/accessible/tests/mochitest/table.js
@@ -90,17 +90,17 @@ function testTableStruct(aIdentifier, aC
 
   // special types of column headers handling
   if (aColHeaderType) {
     var headersObj = {
       role: ROLE_LIST,
       children: []
     };
 
-    for (var idx = 0; idx < colsCount; idx++) {
+    for (let idx = 0; idx < colsCount; idx++) {
       var headerCellObj = {
         role: ROLE_COLUMNHEADER
       };
       headersObj.children.push(headerCellObj);
     }
 
     if (aColHeaderType == kTreeColumnHeader) {
       var columnPickerObj = {
@@ -109,24 +109,24 @@ function testTableStruct(aIdentifier, aC
 
       headersObj.children.push(columnPickerObj);
     }
 
     tableObj.children.push(headersObj);
   }
 
   // rows and cells accessibles
-  for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
-    var rowObj = {
+  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+    let rowObj = {
       role: aRowRoles ? aRowRoles[rowIdx] : ROLE_ROW,
       children: []
     };
 
-    for (var colIdx = 0; colIdx < colsCount; colIdx++) {
-      var celltype = aCellsArray[rowIdx][colIdx];
+    for (let colIdx = 0; colIdx < colsCount; colIdx++) {
+      let celltype = aCellsArray[rowIdx][colIdx];
 
       var role = ROLE_NOTHING;
       switch (celltype) {
         case kDataCell:
           role = (aTableType == kMathTable ? ROLE_MATHML_CELL :
                   (isGrid ? ROLE_GRID_CELL : ROLE_CELL));
           break;
         case kRowHeaderCell:
@@ -158,35 +158,36 @@ function testTableStruct(aIdentifier, aC
 
   // rowCount and columnCount
   is(table.rowCount, rowCount,
      "Wrong rows count of " + prettyName(aIdentifier));
   is(table.columnCount, colsCount,
      "Wrong columns count of " + prettyName(aIdentifier));
 
   // rows and columns extents
-  for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
-    for (var colIdx = 0; colIdx < colsCount; colIdx++) {
-      var celltype = aCellsArray[rowIdx][colIdx];
+  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+    for (let colIdx = 0; colIdx < colsCount; colIdx++) {
+      let celltype = aCellsArray[rowIdx][colIdx];
       if (celltype & kOrigin) {
 
         // table getRowExtentAt
         var rowExtent = table.getRowExtentAt(rowIdx, colIdx);
-        for (var idx = rowIdx + 1;
+        let idx;
+        for (idx = rowIdx + 1;
              idx < rowCount && (aCellsArray[idx][colIdx] & kRowSpanned);
              idx++);
 
         var expectedRowExtent = idx - rowIdx;
         is(rowExtent, expectedRowExtent,
            "getRowExtentAt: Wrong number of spanned rows at (" + rowIdx + ", " +
            colIdx + ") for " + prettyName(aIdentifier));
 
         // table getColumnExtentAt
         var colExtent = table.getColumnExtentAt(rowIdx, colIdx);
-        for (var idx = colIdx + 1;
+        for (idx = colIdx + 1;
              idx < colsCount && (aCellsArray[rowIdx][idx] & kColSpanned);
              idx++);
 
         var expectedColExtent = idx - colIdx;
         is(colExtent, expectedColExtent,
            "getColumnExtentAt: Wrong number of spanned columns at (" + rowIdx +
            ", " + colIdx + ") for " + prettyName(aIdentifier));
 
@@ -367,19 +368,19 @@ function testTableSelection(aIdentifier,
 
   var rowCount = aCellsArray.length;
   var colsCount = aCellsArray[0].length;
 
   // Columns selection tests.
   var selCols = [];
 
   // isColumnSelected test
-  for (var colIdx = 0; colIdx < colsCount; colIdx++) {
+  for (let colIdx = 0; colIdx < colsCount; colIdx++) {
     var isColSelected = true;
-    for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+    for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
       if (aCellsArray[rowIdx][colIdx] == false ||
           aCellsArray[rowIdx][colIdx] == undefined) {
         isColSelected = false;
         break;
       }
     }
 
     is(acc.isColumnSelected(colIdx), isColSelected,
@@ -398,28 +399,28 @@ function testTableSelection(aIdentifier,
   var actualSelColsCountObj = { value: null };
   var actualSelCols = acc.getSelectedColumnIndices(actualSelColsCountObj);
 
   var actualSelColsCount = actualSelColsCountObj.value;
   is(actualSelColsCount, selCols.length,
       msg + "Wrong count of selected columns for " + prettyName(aIdentifier) +
       "from getSelectedColumns.");
 
-  for (var i = 0; i < actualSelColsCount; i++) {
+  for (let i = 0; i < actualSelColsCount; i++) {
     is(actualSelCols[i], selCols[i],
         msg + "Column at index " + selCols[i] + " should be selected.");
   }
 
   // Rows selection tests.
   var selRows = [];
 
   // isRowSelected test
-  for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
     var isRowSelected = true;
-    for (var colIdx = 0; colIdx < colsCount; colIdx++) {
+    for (let colIdx = 0; colIdx < colsCount; colIdx++) {
       if (aCellsArray[rowIdx][colIdx] == false ||
           aCellsArray[rowIdx][colIdx] == undefined) {
         isRowSelected = false;
         break;
       }
     }
 
     is(acc.isRowSelected(rowIdx), isRowSelected,
@@ -438,27 +439,27 @@ function testTableSelection(aIdentifier,
   var actualSelrowCountObj = { value: null };
   var actualSelRows = acc.getSelectedRowIndices(actualSelrowCountObj);
 
   var actualSelrowCount = actualSelrowCountObj.value;
   is(actualSelrowCount, selRows.length,
       msg + "Wrong count of selected rows for " + prettyName(aIdentifier) +
       "from getSelectedRows.");
 
-  for (var i = 0; i < actualSelrowCount; i++) {
+  for (let i = 0; i < actualSelrowCount; i++) {
     is(actualSelRows[i], selRows[i],
         msg + "Row at index " + selRows[i] + " should be selected.");
   }
 
   // Cells selection tests.
   var selCells = [];
 
   // isCellSelected test
-  for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
-    for (var colIdx = 0; colIdx < colsCount; colIdx++) {
+  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+    for (let colIdx = 0; colIdx < colsCount; colIdx++) {
       if (aCellsArray[rowIdx][colIdx] & kSpanned)
         continue;
 
       var isSelected = aCellsArray[rowIdx][colIdx] == true;
       is(acc.isCellSelected(rowIdx, colIdx), isSelected,
          msg + "Wrong selection state of cell at " + rowIdx + " row and " +
          colIdx + " column for " + prettyName(aIdentifier));
 
@@ -475,43 +476,43 @@ function testTableSelection(aIdentifier,
   var actualSelCellsCountObj = { value: null };
   var actualSelCells = acc.getSelectedCellIndices(actualSelCellsCountObj);
 
   var actualSelCellsCount = actualSelCellsCountObj.value;
   is(actualSelCellsCount, selCells.length,
      msg + "Wrong count of selected cells for " + prettyName(aIdentifier) +
      "from getSelectedCells.");
 
-  for (var i = 0; i < actualSelCellsCount; i++) {
+  for (let i = 0; i < actualSelCellsCount; i++) {
     is(actualSelCells[i], selCells[i],
        msg + "getSelectedCellIndices: Cell at index " + selCells[i] +
        " should be selected.");
   }
 
   // selectedCells and isSelected tests
   var actualSelCellsArray = acc.selectedCells;
-  for (var i = 0; i < actualSelCellsCount; i++) {
+  for (let i = 0; i < actualSelCellsCount; i++) {
     var actualSelCellAccessible =
       actualSelCellsArray.queryElementAt(i, nsIAccessibleTableCell);
 
-    var colIdx = acc.getColumnIndexAt(selCells[i]);
-    var rowIdx = acc.getRowIndexAt(selCells[i]);
+    let colIdx = acc.getColumnIndexAt(selCells[i]);
+    let rowIdx = acc.getRowIndexAt(selCells[i]);
     var expectedSelCellAccessible = acc.getCellAt(rowIdx, colIdx);
 
     ok(actualSelCellAccessible, expectedSelCellAccessible,
        msg + "getSelectedCells: Cell at index " + selCells[i] +
        " should be selected.");
 
     ok(actualSelCellAccessible.isSelected(),
        "isSelected: Cell at index " + selCells[i] + " should be selected.");
   }
 
   // selected states tests
-  for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
-    for (var colIdx = 0; colIdx < colsCount; colIdx++) {
+  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+    for (let colIdx = 0; colIdx < colsCount; colIdx++) {
       if (aCellsArray[rowIdx][colIdx] & kSpanned)
         continue;
 
       var cell = acc.getCellAt(rowIdx, colIdx);
       var isSel = aCellsArray[rowIdx][colIdx];
       if (isSel == undefined)
         testStates(cell, 0, 0, STATE_SELECTABLE | STATE_SELECTED);
       else if (isSel == true)
@@ -693,17 +694,17 @@ function testHeaderCells(aHeaderInfoMap)
     var actualRowHeaderCells = dataCell.rowHeaderCells;
     var actualRowHeaderCellsCount = actualRowHeaderCells.length;
 
     is(actualRowHeaderCellsCount, rowHeaderCellsCount,
        "Wrong number of row header cells for the cell " +
        prettyName(dataCellIdentifier));
 
     if (actualRowHeaderCellsCount == rowHeaderCellsCount) {
-      for (var idx = 0; idx < rowHeaderCellsCount; idx++) {
+      for (let idx = 0; idx < rowHeaderCellsCount; idx++) {
         var rowHeaderCell = getAccessible(rowHeaderCells[idx]);
         var actualRowHeaderCell =
           actualRowHeaderCells.queryElementAt(idx, nsIAccessible);
         isObject(actualRowHeaderCell, rowHeaderCell,
                  "Wrong row header cell at index " + idx + " for the cell " +
                  dataCellIdentifier);
       }
     }
@@ -714,17 +715,17 @@ function testHeaderCells(aHeaderInfoMap)
     var actualColHeaderCells = dataCell.columnHeaderCells;
     var actualColHeaderCellsCount = actualColHeaderCells.length;
 
     is(actualColHeaderCellsCount, colHeaderCellsCount,
        "Wrong number of column header cells for the cell " +
        prettyName(dataCellIdentifier));
 
     if (actualColHeaderCellsCount == colHeaderCellsCount) {
-      for (var idx = 0; idx < colHeaderCellsCount; idx++) {
+      for (let idx = 0; idx < colHeaderCellsCount; idx++) {
         var colHeaderCell = getAccessible(colHeaderCells[idx]);
         var actualColHeaderCell =
           actualColHeaderCells.queryElementAt(idx, nsIAccessible);
         isObject(actualColHeaderCell, colHeaderCell,
                  "Wrong column header cell at index " + idx + " for the cell " +
                  dataCellIdentifier);
       }
     }
@@ -738,27 +739,27 @@ function testHeaderCells(aHeaderInfoMap)
  * Return row and column of orig cell for the given spanned cell.
  */
 function getOrigRowAndColumn(aCellsArray, aRowIdx, aColIdx) {
   var cellState = aCellsArray[aRowIdx][aColIdx];
 
   var origRowIdx = aRowIdx, origColIdx = aColIdx;
   if (cellState & kRowSpanned) {
     for (var prevRowIdx = aRowIdx - 1; prevRowIdx >= 0; prevRowIdx--) {
-      var prevCellState = aCellsArray[prevRowIdx][aColIdx];
+      let prevCellState = aCellsArray[prevRowIdx][aColIdx];
       if (!(prevCellState & kRowSpanned)) {
         origRowIdx = prevRowIdx;
         break;
       }
     }
   }
 
   if (cellState & kColSpanned) {
     for (var prevColIdx = aColIdx - 1; prevColIdx >= 0; prevColIdx--) {
-      var prevCellState = aCellsArray[aRowIdx][prevColIdx];
+      let prevCellState = aCellsArray[aRowIdx][prevColIdx];
       if (!(prevCellState & kColSpanned)) {
         origColIdx = prevColIdx;
         break;
       }
     }
   }
 
   return [origRowIdx, origColIdx];
--- a/accessible/tests/mochitest/table/test_indexes_table.html
+++ b/accessible/tests/mochitest/table/test_indexes_table.html
@@ -37,17 +37,17 @@ https://bugzilla.mozilla.org/show_bug.cg
         [6, 7, 7],
         [6, 8, 9]
       ];
 
       testTableIndexes("tableborder", idxes);
 
       // ////////////////////////////////////////////////////////////////////////
       // table
-      var idxes = [
+      idxes = [
         [ 0,  1,  2,  2,  3,  4,  5,  6],
         [ 7,  8,  9, 10, 11, 12, 13,  6],
         [14, 15, 15, 16, 17, 18, 19,  6],
         [20, 15, 15, 21, 22, 18, 23,  6]
       ];
 
       testTableIndexes("table2", idxes);
 
--- a/accessible/tests/mochitest/table/test_mtable.html
+++ b/accessible/tests/mochitest/table/test_mtable.html
@@ -49,19 +49,19 @@
         ROLE_MATHML_TABLE_ROW
       ];
       testTableStruct("complex", cellsArray, kNoColumnHeader,
                       "", "", kMathTable, rowsArray);
 
       // 'Simple' table with mlabeledtr
       // At the moment we do not implement mlabeledtr but just hide the label
       // with display: none. Thus we just test the role for now. See bug 689641.
-      var idxes = [[0]];
+      idxes = [[0]];
       testTableIndexes("simple_label", idxes);
-      var cellsArray = [[kDataCell]];
+      cellsArray = [[kDataCell]];
       rowsArray = [ROLE_MATHML_LABELED_ROW];
       testTableStruct("simple_label", cellsArray, kNoColumnHeader,
                       "", "", kMathTable, rowsArray);
 
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
--- a/accessible/tests/mochitest/table/test_sels_table.html
+++ b/accessible/tests/mochitest/table/test_sels_table.html
@@ -30,29 +30,29 @@
         [false, false,       false,       false,       false, false,       false, kRowSpanned],
         [false, false,       kColSpanned, false,       false, false,       false, kRowSpanned],
         [false, kRowSpanned, kSpanned,    false,       false, kRowSpanned, false, kRowSpanned]
       ];
 
       testTableSelection("table", cellsArray);
 
       var rowCount = 4;
-      for (var rowIdx = 0; rowIdx < rowCount; rowIdx++)
+      for (let rowIdx = 0; rowIdx < rowCount; rowIdx++)
         testSelectTableRow("table", rowIdx, cellsArray);
 
-      for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+      for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
         testSelectTableRow("table", rowIdx, cellsArray);
         testUnselectTableRow("table", rowIdx, cellsArray);
       }
 
       var columsCount = 8;
-      for (var colIdx = 0; colIdx < columsCount; colIdx++)
+      for (let colIdx = 0; colIdx < columsCount; colIdx++)
         testSelectTableColumn("table", colIdx, cellsArray);
 
-      for (var colIdx = 0; colIdx < columsCount; colIdx++) {
+      for (let colIdx = 0; colIdx < columsCount; colIdx++) {
         testSelectTableColumn("table", colIdx, cellsArray);
         testUnselectTableColumn("table", colIdx, cellsArray);
       }
 
       var accTable = getAccessible("table", [nsIAccessibleTable]);
       ok(!accTable.isProbablyForLayout(), "table is not for layout");
 
       // ////////////////////////////////////////////////////////////////////////
--- a/accessible/tests/mochitest/test_nsIAccessibleImage.html
+++ b/accessible/tests/mochitest/test_nsIAccessibleImage.html
@@ -110,17 +110,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       testThis("nonLinkedImage", "moz.png", 89, 38);
 
       // Test linked image
       var actionNamesArray = ["jump"];
       testThis("linkedImage", "moz.png", 89, 38, 1,
                actionNamesArray);
 
       // Image with long desc
-      var actionNamesArray = ["showlongdesc"];
+      actionNamesArray = ["showlongdesc"];
       testThis("longdesc", "moz.png", 89, 38, 1,
                actionNamesArray);
 
       // Image with invalid url in long desc
       testThis("invalidLongdesc", "moz.png", 89, 38, 0);
 
       // Image with click and long desc
       actionNamesArray = null;
--- a/accessible/tests/mochitest/text.js
+++ b/accessible/tests/mochitest/text.js
@@ -477,40 +477,40 @@ function testTextRange(aRange, aRangeDes
 }
 
 // //////////////////////////////////////////////////////////////////////////////
 // Private
 
 function testTextSuperHelper(aFuncName, aArgs) {
   // List of tests.
   if (aArgs[2] instanceof Array) {
-    var ids = (aArgs[0] instanceof Array) ? aArgs[0] : [ aArgs[0] ];
-    var boundaryType = aArgs[1];
-    var list = aArgs[2];
-    for (var i = 0; i < list.length; i++) {
-      var offset1 = list[i][0], offset2 = list[i][1];
-      var text = list[i][2], startOffset = list[i][3], endOffset = list[i][4];
-      var failureList = list[i][5];
-      for (var offset = offset1; offset <= offset2; offset++) {
-        for (var idIdx = 0; idIdx < ids.length; idIdx++) {
-          var id = ids[idIdx];
+    let ids = (aArgs[0] instanceof Array) ? aArgs[0] : [ aArgs[0] ];
+    let boundaryType = aArgs[1];
+    let list = aArgs[2];
+    for (let i = 0; i < list.length; i++) {
+      let offset1 = list[i][0], offset2 = list[i][1];
+      let text = list[i][2], startOffset = list[i][3], endOffset = list[i][4];
+      let failureList = list[i][5];
+      for (let offset = offset1; offset <= offset2; offset++) {
+        for (let idIdx = 0; idIdx < ids.length; idIdx++) {
+          let id = ids[idIdx];
 
-          var flagOk1 = kOk, flagOk2 = kOk, flagOk3 = kOk;
+          let flagOk1 = kOk, flagOk2 = kOk, flagOk3 = kOk;
           if (failureList) {
-            for (var fIdx = 0; fIdx < failureList.length; fIdx++) {
+            for (let fIdx = 0; fIdx < failureList.length; fIdx++) {
               if (offset == failureList[fIdx][0] && id == failureList[fIdx][1]) {
                 flagOk1 = failureList[fIdx][2];
                 flagOk2 = failureList[fIdx][3];
                 flagOk3 = failureList[fIdx][4];
                 break;
               }
             }
           }
 
-          var acc = getAccessible(id, nsIAccessibleText);
+          let acc = getAccessible(id, nsIAccessibleText);
           testTextHelper(id, offset, boundaryType,
                          text, startOffset, endOffset,
                          flagOk1, flagOk2, flagOk3,
                          acc[aFuncName], aFuncName + " ");
         }
       }
     }
     return;
@@ -518,35 +518,35 @@ function testTextSuperHelper(aFuncName, 
 
   // Test at single offset. List of IDs.
   var offset = aArgs[0];
   var boundaryType = aArgs[1];
   var text = aArgs[2];
   var startOffset = aArgs[3];
   var endOffset = aArgs[4];
   if (aArgs[5] instanceof Array) {
-    var ids = aArgs[5];
-    for (var i = 0; i < ids.length; i++) {
-      var acc = getAccessible(ids[i], nsIAccessibleText);
+    let ids = aArgs[5];
+    for (let i = 0; i < ids.length; i++) {
+      let acc = getAccessible(ids[i], nsIAccessibleText);
       testTextHelper(ids[i], offset, boundaryType,
                      text, startOffset, endOffset,
                      kOk, kOk, kOk,
                      acc[aFuncName], aFuncName + " ");
     }
 
     return;
   }
 
   // Each ID is tested separately.
-  for (var i = 5; i < aArgs.length; i = i + 4) {
-    var ID = aArgs[i];
-    var acc = getAccessible(ID, nsIAccessibleText);
-    var toDoFlag1 = aArgs[i + 1];
-    var toDoFlag2 = aArgs[i + 2];
-    var toDoFlag3 = aArgs[i + 3];
+  for (let i = 5; i < aArgs.length; i = i + 4) {
+    let ID = aArgs[i];
+    let acc = getAccessible(ID, nsIAccessibleText);
+    let toDoFlag1 = aArgs[i + 1];
+    let toDoFlag2 = aArgs[i + 2];
+    let toDoFlag3 = aArgs[i + 3];
 
     testTextHelper(ID, offset, boundaryType,
                    text, startOffset, endOffset,
                    toDoFlag1, toDoFlag2, toDoFlag3,
                    acc[aFuncName], aFuncName + " ");
   }
 }
 
--- a/accessible/tests/mochitest/text/test_gettext.html
+++ b/accessible/tests/mochitest/text/test_gettext.html
@@ -52,17 +52,17 @@
       //
       // __o__n__e__w__o__r__d__\n
       //  0  1  2  3  4  5  6  7
       // __\n
       //  8
       // __t__w__o__ __w__o__r__d__s__\n
       //  9 10 11 12 13 14 15 16 17 18
 
-      var IDs = ["d3", "dbr3", "e3", "ebr3", "t3"];
+      IDs = ["d3", "dbr3", "e3", "ebr3", "t3"];
 
       testCharacterCount(IDs, 19);
 
       testText(IDs, 0, 19, "oneword\n\ntwo words\n");
       testText(IDs, 0, -1, "oneword\n\ntwo words\n");
 
       SimpleTest.finish();
     }
--- a/accessible/tests/mochitest/text/test_wordboundary.html
+++ b/accessible/tests/mochitest/text/test_wordboundary.html
@@ -31,17 +31,17 @@
       testTextAfterOffset(ids, BOUNDARY_WORD_START,
                           [ [ 0, 5, "", 5, 5 ] ]);
       testTextAfterOffset(ids, BOUNDARY_WORD_END,
                           [ [ 0, 5, "", 5, 5 ] ]);
 
       // "hello "
       // __h__e__l__l__o__ __
       //  0  1  2  3  4  5  6
-      var ids = [ "i2", "d2", "e2", "t2" ];
+      ids = [ "i2", "d2", "e2", "t2" ];
       testTextBeforeOffset(ids, BOUNDARY_WORD_START,
                            [ [ 0, 6, "", 0, 0 ] ]);
       testTextBeforeOffset(ids, BOUNDARY_WORD_END,
                            [ [ 0, 5, "", 0, 0 ],
                              [ 6, 6, "hello", 0, 5 ]
                            ]);
 
       testTextAtOffset(ids, BOUNDARY_WORD_START,
--- a/accessible/tests/mochitest/textattrs/test_general.html
+++ b/accessible/tests/mochitest/textattrs/test_general.html
@@ -532,32 +532,32 @@
       testTextAttrs(ID, 39, attrs, defAttrs, 39, 44);
 
       // ////////////////////////////////////////////////////////////////////////
       // area18, "auto-generation text" tests
       ID = "area18";
       defAttrs = buildDefaultTextAttrs(ID, "12pt");
       testDefaultTextAttrs(ID, defAttrs);
 
-      var attrs = {
+      attrs = {
         "auto-generated": "true"
       };
       testTextAttrs(ID, 0, attrs, defAttrs, 0, 3);
       testTextAttrs(ID, 3, { }, defAttrs, 3, 7);
       testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);
 
        // ////////////////////////////////////////////////////////////////////////
       // area19, "HTML5 mark tag" test
       // text enclosed in mark tag will have a different background color
       ID = "area19";
       defAttrs = buildDefaultTextAttrs(ID, "12pt");
 
       attrs = {};
       testTextAttrs(ID, 0, attrs, defAttrs, 0, 10);
-    
+
       tempElem = getNode(ID).firstChild.nextSibling;
       gComputedStyle = document.defaultView.getComputedStyle(tempElem);
       attrs = { "background-color": gComputedStyle.backgroundColor };
       testTextAttrs(ID, 11, attrs, defAttrs, 10, 17);
 
       attrs = {};
       testTextAttrs(ID, 18, attrs, defAttrs, 17, 28);
 
@@ -639,19 +639,19 @@
   </p>
   <!-- Green!*!RedNormal-->
   <p id="area5">
     <span style="color: green">Green</span>
     <img src="../moz.png" alt="image"/>
     <span style="color: red">Red</span>Normal
   </p>
   <p id="area6">
-    This <sup>sentence</sup> has the word 
-    <span style="vertical-align:super;">sentence</span> in 
-    <sub>superscript</sub> and 
+    This <sup>sentence</sup> has the word
+    <span style="vertical-align:super;">sentence</span> in
+    <sub>superscript</sub> and
     <span style="vertical-align:sub;">subscript</span> and
     <span style="vertical-align:20%;">superscript 20%</span> and
     <span style="vertical-align:-20%;">subscript 20%</span> and
     <span style="vertical-align:20px;">superscript 20px</span> and
     <span style="vertical-align:-20px;">subscript 20px</span>
   </p>
 
   <p lang="en" id="area7">
--- a/accessible/tests/mochitest/textrange/test_selection.html
+++ b/accessible/tests/mochitest/textrange/test_selection.html
@@ -31,69 +31,69 @@
 
       testTextRange(a11yrange, "selection range #1", document, 3, document, 4);
 
       ok(a11yrange.crop(getAccessible(a)), "Range failed to crop #1.");
       testTextRange(a11yrange, "cropped range #1", a, 0, a, 5);
 
       // the range is contained by the accessible
       range.selectNode(a);
-      var a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
-      var a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
+      a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
+      a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #2", p, 5, p, 6);
 
       ok(a11yrange.crop(getAccessible(p)), "Range failed to crop #2.");
       testTextRange(a11yrange, "cropped range #2", p, 5, p, 6);
 
       // the range starts before the accessible and ends inside it
       range.setStart(p, 0);
       range.setEndAfter(a.firstChild, 4);
-      var a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
-      var a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
+      a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
+      a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #3", p, 0, a, 4);
 
       ok(a11yrange.crop(getAccessible(a)), "Range failed to crop #3.");
       testTextRange(a11yrange, "cropped range #3", a, 0, a, 4);
 
       // the range starts inside the accessible and ends after it
       range.setStart(a.firstChild, 1);
       range.setEndAfter(p);
-      var a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
-      var a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
+      a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
+      a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #4", a, 1, document, 4);
 
       ok(a11yrange.crop(getAccessible(a)), "Range failed to crop #4.");
       testTextRange(a11yrange, "cropped range #4", a, 1, a, 5);
 
       // the range ends before the accessible
       range.setStart(p.firstChild, 0);
       range.setEnd(p.firstChild, 4);
-      var a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
-      var a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
+      a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
+      a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #5", p, 0, p, 4);
       ok(!a11yrange.crop(getAccessible(a)), "Crop #5 succeeded while it shouldn't");
 
       // the range starts after the accessible
       range.setStart(p.lastChild, 0);
       range.setEnd(p.lastChild, 4);
-      var a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
-      var a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
+      a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
+      a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #6", p, 6, p, 10);
 
       ok(!a11yrange.crop(getAccessible(a)), "Crop #6 succeeded while it shouldn't");
 
       // crop a range by a table
       range.selectNode(getNode("c2"));
-      var a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
-      var a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
+      a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
+      a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #7", document, 4, document, 5);
 
       ok(a11yrange.crop(getAccessible("table")), "Range failed to crop #7.");
       testTextRange(a11yrange, "cropped range #7", "c2", 5, "c2", 6);
 
       SimpleTest.finish();
     }
--- a/accessible/tests/mochitest/tree/test_aria_globals.html
+++ b/accessible/tests/mochitest/tree/test_aria_globals.html
@@ -34,29 +34,29 @@
         "relevant"
       ];
 
       // Elements having ARIA global state or properties or referred by another
       // element must be accessible.
       ok(isAccessible("pawn"),
          "Must be accessible because referred by another element.");
 
-      for (var idx = 0; idx < globalIds.length; idx++) {
+      for (let idx = 0; idx < globalIds.length; idx++) {
         ok(isAccessible(globalIds[idx]),
            "Must be accessible becuase of aria-" + globalIds[idx] +
            " presence");
       }
 
       // Unfocusable elements, having ARIA global state or property with a valid
       // IDREF value, and an inherited presentation role. A generic accessible
       // is created (to prevent table cells text jamming).
       ok(!isAccessible("td_nothing", nsIAccessibleTableCell),
          "inherited presentation role takes a place");
 
-      for (var idx = 0; idx < globalIds.length; idx++) {
+      for (let idx = 0; idx < globalIds.length; idx++) {
         ok(isAccessible("td_" + globalIds[idx]),
            "Inherited presentation role must be ignored becuase of " +
            "aria-" + globalIds[idx] + " presence");
       }
 
       SimpleTest.finish();
     }
 
--- a/accessible/tests/mochitest/tree/test_aria_grid.html
+++ b/accessible/tests/mochitest/tree/test_aria_grid.html
@@ -168,17 +168,17 @@
         ]
       };
 
       testAccessibleTree("crazy_grid4", accTree);
 
       // ////////////////////////////////////////////////////////////////////////
       // grids that could contain whitespace accessibles but shouldn't.
 
-      var accTree =
+      accTree =
         { TREE_TABLE: [
           { ROW: [
             { GRID_CELL: [
               { TEXT_LEAF: [ ] }
             ] },
             { GRID_CELL: [
               { TEXT_LEAF: [ ] }
             ] },
--- a/accessible/tests/mochitest/tree/test_list.html
+++ b/accessible/tests/mochitest/tree/test_list.html
@@ -117,29 +117,29 @@
               ] }
             ] }
           ] }
         ] };
 
       testAccessibleTree("list6", tree);
 
       // li having no display:list-item style
-      var tree =
+      tree =
         { LIST: [ // ul
           { LISTITEM: [ // li
             { TEXT_LEAF: [] },
           ] },
           { TEXT_LEAF: [] },
           { LISTITEM: [ // li
             { TEXT_LEAF: [] }
           ] }
         ] };
       testAccessibleTree("list7", tree);
 
-      var tree =
+      tree =
         { LIST: [ // ul
           { LISTITEM: [ // li
             { TEXT_LEAF: [] },
           ] },
           { LISTITEM: [ // li
             { TEXT_LEAF: [] }
           ] }
         ] };
--- a/accessible/tests/mochitest/treeupdate/test_ariaowns.html
+++ b/accessible/tests/mochitest/treeupdate/test_ariaowns.html
@@ -401,21 +401,21 @@
 
       this.getID = function showHiddenElement_getID() {
         return "Show hidden ARIA owns referred element";
       };
     }
 
     function rearrangeARIAOwns(aContainer, aAttr, aIdList, aRoleList) {
       this.eventSeq = [];
-      for (var id of aIdList) {
+      for (let id of aIdList) {
         this.eventSeq.push(new invokerChecker(EVENT_HIDE, getNode(id)));
       }
 
-      for (var id of aIdList) {
+      for (let id of aIdList) {
         this.eventSeq.push(new invokerChecker(EVENT_SHOW, getNode(id)));
       }
       this.eventSeq.push(new invokerChecker(EVENT_REORDER, getNode(aContainer)));
 
       this.invoke = function rearrangeARIAOwns_invoke() {
         getNode(aContainer).setAttribute("aria-owns", aAttr);
       };