Bug 804834 - Part 1: Fix tests depending on E4X for-each in content JS. r=waldo
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 21 Dec 2012 20:47:52 +0900
changeset 125869 b0f89c4fb6dd531f0214ec5f8e11d1dbef268bb1
parent 125868 44b06d49ffc6414b8305c114fb756da222b9efa6
child 125870 ddcfa9f4754582290f0e33ea89573f72abe25a7b
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs804834
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 804834 - Part 1: Fix tests depending on E4X for-each in content JS. r=waldo
browser/base/content/test/feed_discovery.html
content/base/test/file_CrossSiteXHR_inner.html
content/base/test/file_CrossSiteXHR_inner.jar
content/base/test/file_CrossSiteXHR_inner_data.sjs
content/base/test/test_CrossSiteXHR.html
content/base/test/test_CrossSiteXHR_cache.html
content/base/test/test_CrossSiteXHR_origin.html
content/base/test/test_XHRSendData.html
content/base/test/test_bug353334.html
content/base/test/test_bug422537.html
content/base/test/test_bug453736.html
content/canvas/crashtests/421715-1.html
content/events/test/test_bug336682_1.html
content/events/test/test_bug603008.html
content/events/test/test_bug741666.html
content/html/content/reftests/autofocus/autofocus-after-load.html
content/html/content/test/forms/test_form_attribute-1.html
content/html/content/test/forms/test_input_email.html
content/html/content/test/forms/test_input_list_attribute.html
content/html/content/test/forms/test_input_number_value.html
content/html/content/test/forms/test_max_attribute.html
content/html/content/test/forms/test_meter_element.html
content/html/content/test/forms/test_min_attribute.html
content/html/content/test/forms/test_mozistextfield.html
content/html/content/test/forms/test_pattern_attribute.html
content/html/content/test/forms/test_progress_element.html
content/html/content/test/forms/test_required_attribute.html
content/html/content/test/forms/test_step_attribute.html
content/html/content/test/forms/test_stepup_stepdown.html
content/html/content/test/forms/test_valueasnumber_attribute.html
content/html/content/test/reflect.js
content/html/content/test/test_bug274626.html
content/html/content/test/test_bug389797.html
content/html/content/test/test_bug430351.html
content/html/content/test/test_bug523771.html
content/html/content/test/test_bug549475.html
content/html/content/test/test_bug557087-2.html
content/html/content/test/test_bug557087-3.html
content/html/content/test/test_bug557087-4.html
content/html/content/test/test_bug561640.html
content/html/content/test/test_bug573969.html
content/html/content/test/test_bug590353-1.html
content/html/content/test/test_bug590353-2.html
content/html/content/test/test_bug590363.html
content/html/content/test/test_bug595429.html
content/html/content/test/test_bug595449.html
content/html/content/test/test_bug596350.html
content/html/content/test/test_bug598643.html
content/html/content/test/test_bug600155.html
content/html/content/test/test_bug607145.html
content/html/content/test/test_bug618948.html
content/html/content/test/test_bug659596.html
content/html/content/test/test_restore_from_parser_fragment.html
content/svg/content/test/test_SVGxxxList.xhtml
content/svg/content/test/test_isSupported.xhtml
content/xslt/tests/mochitest/test_bug427060.html
content/xslt/tests/mochitest/test_bug440974.html
content/xslt/tests/mochitest/test_exslt_regex.html
dom/plugins/test/mochitest/test_npruntime_npnevaluate.html
dom/plugins/test/mochitest/test_npruntime_npninvoke.html
dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html
dom/tests/mochitest/webapps/test_bug_765063.xul
dom/tests/mochitest/webapps/test_cross_origin.xul
dom/tests/mochitest/webapps/test_install_app.xul
dom/tests/mochitest/webapps/test_launch_paths.xul
js/src/tests/browser.js
js/src/tests/ecma_5/extensions/regress-bug567606.js
js/src/tests/js1_5/Regress/regress-503860.js
js/xpconnect/tests/chrome/test_cows.xul
layout/generic/test/file_bug514732_helper.html
layout/style/test/chrome/hover_helper.html
layout/style/test/test_bug437915.html
layout/style/test/test_bug74880.html
layout/style/test/test_selectors.html
layout/style/test/test_transitions.html
toolkit/components/passwordmgr/test/pwmgr_common.js
toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html
toolkit/components/satchel/test/test_form_autocomplete.html
--- a/browser/base/content/test/feed_discovery.html
+++ b/browser/base/content/test/feed_discovery.html
@@ -83,21 +83,21 @@ https://bugzilla.mozilla.org/show_bug.cg
         var browser = currentWindow.gBrowser.selectedBrowser;
 
         var discovered = browser.feeds;
         tests.push({ check: discovered.length > 0,
                      message: "some feeds should be discovered" });
 
         var feeds = [];
 
-        for each (var aFeed in discovered) {
+        for (var aFeed of discovered) {
           feeds[aFeed.href] = true;
         }
 
-        for each (var aLink in document.getElementsByTagName("link")) {
+        for (var aLink of document.getElementsByTagName("link")) {
           // ignore real stylesheets, and anything without an href property
           if (aLink.type != "text/css" && aLink.href) {
             if (/bogus/i.test(aLink.title)) {
               tests.push({ check: !feeds[aLink.href],
                            message: "don't discover " + aLink.href });
             } else {
               tests.push({ check: feeds[aLink.href],
                            message: "should discover " + aLink.href });
--- a/content/base/test/file_CrossSiteXHR_inner.html
+++ b/content/base/test/file_CrossSiteXHR_inner.html
@@ -20,17 +20,17 @@ window.addEventListener("message", funct
     status: 0,
     responseText: "",
     statusText: "",
     responseXML: null,
     sendThrew: false
   };
   
   var xhr = new XMLHttpRequest();
-  for each(type in ["load", "abort", "error", "loadstart", "loadend"]) {
+  for (type of ["load", "abort", "error", "loadstart", "loadend"]) {
     xhr.addEventListener(type, function(e) {
       res.events.push(e.type);
     }, false);
   }
   xhr.addEventListener("readystatechange", function(e) {
     res.events.push("rs" + xhr.readyState);
   }, false);
   xhr.addEventListener("progress", function(e) {
index 9fc85c29c082b1d4c8825c73154fbb1cf91dd7f5..bdb0eb44087ff46452871adf27f9b5b1705f36fa
GIT binary patch
literal 1105
zc$^FHW@Zs#U|`^2SUR)c@lp0M^~uZ(46U3D3^G8`w9K5;c;}-0;^N@UlGF%~p!m$Z
zywoDSjFQ}(sbSIimkmVf&abz4qA3`AO8M0`C6l(cEeE%JV>I!doaraM_zK^)&Fd8Y
zSs$N%M~X{Hzwi9tPd{&@>))&06;ZcyZ_DbZXTRE5RTmZsG1mOqvZsdeG*hB#t7D?W
zx`QGyhi6Ua*z&A2^pmLZ3}*4ZUlj|NT;tCB@cHUpWpSp^Z@rqEj=9wNJTgpgOZ_!l
zZR2gBnQkkz7b#Xw-m)=E>W9>~P46t8#B-flG<kBR$XwC1=yREl(=IOx?+Q<od%NSr
zQ@!NMx}PqbF~zwPWYj*2ZB3KzQQxrc=&1rtA)kloE`k{%Kdreq&N*I5t<1{g+J9MW
ze#Fd#w8g&uoxhHV6q*#)xjDq2`~1CUx^cwjpvOlpUifv@ct`z*-(DwqU%oi)Q2+Gg
zEra0l=t(P<T-b3W-MHD}9k=P0g-@Q(em%4M`lMQ+(@qcdSe%c<n>`WuTD&l)Y6tVB
z-A2oH9e!_`HF?LLYe9}l-$ZY<-9NrG#Zpu&Eq<xdH}<KMy6R-wo0PI{Ot}6-@$1tK
zer{9C(|)^tKcqPMOt|*ytk{5sYu9jhG|k^(^XFT5$&rdREB;nTtHp@={8_lazQ85Q
zs%`qYMVI3z>?^-gY5Qv9%jbdqhuikoRAyX%WTjY>TAHd|A$_FUm1oYz&l|5<bR;MK
zS-K`@2ixJF6MLA>bmoWj`hDIK%B%50)A>=?-R%z=eT<d}o9W3J?T~l5t7ykj-ZFvV
z!jDMN3;yQEg?QDR|FXH~^6YJXoXf9~-?Ua`&O}zNb6)?NSIt{CGq22hr$JY@Z_$GJ
zht5cUP)>QW<@5^GpL5(Mg?oGr$vd_~tNpTN%I%ll2^Jwz3J)e!+TXE1P&wi2+&c?)
zN^{8U$a(#8`K%>38--u1JFH}XBWr%N^^i?2!`&bbu@LvWN-Hn_)cU-4s(jDmw#3sW
zc1JfkIj-%9Ww@-lN7s92b64hB^Fw$2pJefyn)(~e`X7Aymgm&$3qoZc9zqEj9GC7k
z-PUN>*n4wU`NG_Zc}r^^Em|3BxpCv~#QU|LcXo6-=Lc0hHj%QrA!v6g%gO3W){C%i
z!}&?<f1mH4b1wNUr-c^VkB_?#zPXrj=<b8xawclEKdblKZP|AG?8ewHXC+0iZJM;~
z^#9p2mu@e=yT9n2@9q_I{pQA;kT%xM-g@XvQQjTvgZ#qE;(ZgBl-w3A$vn60^4b_t
zo6Rd`?p=2NnS0;4We*vh>L0o$6<YV(-FVIyk}}bv&t-M}u0L!6-i%E447jqh3IhZv
zKxurLn+vLnkwJoCmhyw+Yi^xo4El2)OusnkYw<SfEMtH-D;q=&BSRjLKFbW^0RXqQ
B1>FDu
--- a/content/base/test/file_CrossSiteXHR_inner_data.sjs
+++ b/content/base/test/file_CrossSiteXHR_inner_data.sjs
@@ -9,17 +9,17 @@ window.addEventListener("message", funct
   req = eval(e.data);\n\
   var res = {\n\
     didFail: false,\n\
     events: [],\n\
     progressEvents: 0\n\
   };\n\
   \n\
   var xhr = new XMLHttpRequest();\n\
-  for each(type in ["load", "abort", "error", "loadstart", "loadend"]) {\n\
+  for (type of ["load", "abort", "error", "loadstart", "loadend"]) {\n\
     xhr.addEventListener(type, function(e) {\n\
       res.events.push(e.type);\n\
     }, false);\n\
   }\n\
   xhr.addEventListener("readystatechange", function(e) {\n\
     res.events.push("rs" + xhr.readyState);\n\
   }, false);\n\
   xhr.addEventListener("progress", function(e) {\n\
--- a/content/base/test/test_CrossSiteXHR.html
+++ b/content/base/test/test_CrossSiteXHR.html
@@ -567,17 +567,17 @@ function runTest() {
                  preflightBody: "I'm a preflight response body",
                },
                ];
 
   if (!runPreflightTests) {
     tests = [];
   }
 
-  for each(test in tests) {
+  for (test of tests) {
     var req = {
       url: baseURL + "allowOrigin=" + escape(test.origin || origin),
       method: test.method,
       headers: test.headers,
       uploadProgress: test.uploadProgress,
       body: test.body,
       responseHeaders: test.responseHeaders,
     };
@@ -782,17 +782,17 @@ function runTest() {
              allowCred: 1,
            },
            ];
 
   if (!runCookieTests) {
     tests = [];
   }
 
-  for each(test in tests) {
+  for (test of tests) {
     req = {
       url: baseURL + "allowOrigin=" + escape(test.origin || origin),
       method: test.method,
       headers: test.headers,
       withCred: test.withCred,
     };
 
     if (test.allowCred)
@@ -1107,17 +1107,17 @@ function runTest() {
                     ],
            },
            ];
 
   if (!runRedirectTests) {
     tests = [];
   }
 
-  for each(test in tests) {
+  for (test of tests) {
     req = {
       url: test.hops[0].server + basePath + "hop=1&hops=" +
            escape(test.hops.toSource()),
       method: test.method,
       headers: test.headers,
       body: test.body,
     };
 
--- a/content/base/test/test_CrossSiteXHR_cache.html
+++ b/content/base/test/test_CrossSiteXHR_cache.html
@@ -427,17 +427,17 @@ function runTest() {
                });
   }
 
   baseURL = "http://mochi.test:8888/tests/content/base/test/" +
              "file_CrossSiteXHR_cache_server.sjs?";
   setStateURL = baseURL + "setState=";
 
   var unique = Date.now();
-  for each (test in tests) {
+  for (test of tests) {
     if (test.newTest) {
       unique++;
       continue;
     }
     if (test.pause) {
       setTimeout(function() { gen.next() }, test.pause * 1000);
       yield;
       continue;
--- a/content/base/test/test_CrossSiteXHR_origin.html
+++ b/content/base/test/test_CrossSiteXHR_origin.html
@@ -59,17 +59,17 @@ function runTest() {
   var loader = document.getElementById('loader');
   var loaderWindow = loader.contentWindow;
   loader.onload = function () { gen.next() };
 
   // Test preflight-less requests
   basePath = "/tests/content/base/test/file_CrossSiteXHR_server.sjs?"
   baseURL = "http://mochi.test:8888" + basePath;
 
-  for each(originEntry in origins) {
+  for (originEntry of origins) {
     origin = originEntry.origin || originEntry.server;
 
     loader.src = originEntry.file ||
                  (originEntry.server + "/tests/content/base/test/file_CrossSiteXHR_inner.html");
     yield;
 
     var isNullOrigin = origin == "null";
 
@@ -108,17 +108,17 @@ function runTest() {
       origin.replace(/\/[^.]+\./, "/"),
     ];
 
     if (isNullOrigin) {
       passTests = ["*", "\t \t* \t ", "null"];
       failTests = failTests.filter(function(v) { return v != origin });
     }
     
-    for each(allowOrigin in passTests) {
+    for (allowOrigin of passTests) {
       req = {
         url: baseURL +
              "allowOrigin=" + escape(allowOrigin) +
              "&origin=" + escape(origin),
         method: "GET",
       };
       loaderWindow.postMessage(req.toSource(), isNullOrigin ? "*" : origin);
 
@@ -131,17 +131,17 @@ function runTest() {
          "wrong responseXML in test for " + allowOrigin);
       is(res.responseText, "<res>hello pass</res>\n",
          "wrong responseText in test for " + allowOrigin);
       is(res.events.join(","),
          "opening,rs1,sending,loadstart,rs2,rs3,rs4,load,loadend",
          "wrong responseText in test for " + allowOrigin);
     }
 
-    for each(allowOrigin in failTests) {
+    for (allowOrigin of failTests) {
       req = {
         url: baseURL + "allowOrigin=" + escape(allowOrigin),
         method: "GET",
       };
       loaderWindow.postMessage(req.toSource(), isNullOrigin ? "*" : origin);
 
       res = eval(yield);
       is(res.didFail, true, "should have failed for " + allowOrigin);
--- a/content/base/test/test_XHRSendData.html
+++ b/content/base/test/test_XHRSendData.html
@@ -208,17 +208,17 @@ for (var i = 0; i < testDOMFiles.length;
   tests.push({ body: testDOMFiles[i],
                resBody: testData,
                resContentType: fileTypes[i],
                resContentLength: testData.length,
               });
 }
 
 try {
-  for each(test in tests) {
+  for (test of tests) {
     xhr = new XMLHttpRequest;
     xhr.open("POST", "file_XHRSendData.sjs", !!test.resType);
     if (test.contentType)
       xhr.setRequestHeader("Content-Type", test.contentType);
     if (test.resType) {
       xhr.responseType = test.resType;
       xhr.onloadend = continueTest;
     }
--- a/content/base/test/test_bug353334.html
+++ b/content/base/test/test_bug353334.html
@@ -47,21 +47,21 @@ function checkPrincipal() {
   is(SpecialPowers.getNodePrincipal(document) instanceof SpecialPowers.Ci.nsIPrincipal,
      true,
      "Should be a principal");
 }
 
 addLoadEvent(function() {
   checkPrincipal();
 
-  for each (var i in [ "one", "two", "three", "four" ]) {
+  for (var i of [ "one", "two", "three", "four" ]) {
     doPrincipalTest(i);
   }
 
-  for each (i in [ "five", "six" ]) {
+  for (i of [ "five", "six" ]) {
     doContentTest(i);
   }
 
   SimpleTest.finish();
 });
 </script>
 </pre>
 </body>
--- a/content/base/test/test_bug422537.html
+++ b/content/base/test/test_bug422537.html
@@ -25,17 +25,17 @@ isupports_string.data = "foo";
 
 const url = "http://mochi.test:8888";
 var body = [
   document,
   "foo",
   isupports_string
 ];
 
-for each (var i in body) {
+for (var i of body) {
   var xhr = new XMLHttpRequest();
   xhr.open("POST", url, true);
   if (i == isupports_string)
     SpecialPowers.wrap(xhr).send(i);
   else
     xhr.send(i);
   var chan = SpecialPowers.wrap(xhr).channel;
   if (!SpecialPowers.call_Instanceof(chan, SpecialPowers.Ci.nsIUploadChannel))
--- a/content/base/test/test_bug453736.html
+++ b/content/base/test/test_bug453736.html
@@ -20,17 +20,17 @@ SimpleTest.waitForExplicitFinish();
 addLoadEvent(function() {
   const scriptCreationFuncs = [
     function() { return document.createElement("script"); },
     function() { return document.createElementNS("http://www.w3.org/2000/svg", "script"); }
   ];
 
   const scriptContainers = ["div", "iframe", "noframes", "noembed"];
   for (var i = 0; i < scriptContainers.length; ++i) {
-    for each (var func in scriptCreationFuncs) {
+    for (var func of scriptCreationFuncs) {
       var cont = scriptContainers[i];
       var node = document.createElement(cont);
       document.body.appendChild(node);
       var s = func();
       s.setAttribute("type", "application/javascript");
       s.appendChild(document.createTextNode('window["'+cont+'ScriptRan"] = true'));
 
       window[cont+"ScriptRan"] = false;
--- a/content/canvas/crashtests/421715-1.html
+++ b/content/canvas/crashtests/421715-1.html
@@ -7,17 +7,17 @@
           return a.toSource();
         return ''+a;
       }
       var args = [undefined, null, [], {}, 0, "0"];
       var stringArgs = args.map(stringify);
 
       function test_method(context, method, arity) {
         function testParams(existingParams, depth) {
-          for each (var arg in stringArgs) {
+          for (var arg of stringArgs) {
             var code = "context[method](" + existingParams + arg + ")";
             try {
               eval(code);
             } catch (ex) {
               // Exceptions are expected
             }
 
             if (depth < arity)
--- a/content/events/test/test_bug336682_1.html
+++ b/content/events/test/test_bug336682_1.html
@@ -31,17 +31,17 @@ function makeBodyHandler(eventName) {
     var handler = makeHandler("<body on%1='...'>", eventName, [3,4]);
     handler(aEvent);
   }
 }
 addLoadEvent(function() {
   /** @see test_bug336682.js */
   MAX_STATE = 4;
 
-  for each(var event in ["online", "offline"]) {
+  for (var event of ["online", "offline"]) {
     document.body.addEventListener(
       event,
       makeHandler("document.body.addEventListener('%1', ..., false)",
                   event, [1]),
       false);
 
     document.addEventListener(
       event,
--- a/content/events/test/test_bug603008.html
+++ b/content/events/test/test_bug603008.html
@@ -72,17 +72,17 @@ function checkTouch(aFakeTouch, aTouch) 
   is(aFakeTouch.rotationAngle, aTouch.rotationAngle, "Touch has correct rotationAngle");
   is(aFakeTouch.force, aTouch.force, "Touch has correct force");
 }
 
 function sendTouchEvent(windowUtils, aType, aEvent, aModifiers) {
   var ids = [], xs=[], ys=[], rxs = [], rys = [],
       rotations = [], forces = [];
 
-  for each (var touchType in ["touches", "changedTouches", "targetTouches"]) {
+  for (var touchType of ["touches", "changedTouches", "targetTouches"]) {
     for (var i = 0; i < aEvent[touchType].length; i++) {
       if (ids.indexOf(aEvent[touchType][i].identifier) == -1) {
         ids.push(aEvent[touchType][i].identifier);
         xs.push(aEvent[touchType][i].page.x);
         ys.push(aEvent[touchType][i].page.y);
         rxs.push(aEvent[touchType][i].radius.x);
         rys.push(aEvent[touchType][i].radius.y);
         rotations.push(aEvent[touchType][i].rotationAngle);
--- a/content/events/test/test_bug741666.html
+++ b/content/events/test/test_bug741666.html
@@ -67,17 +67,17 @@ function checkTouch(aFakeTouch, aTouch) 
   is(aFakeTouch.rotationAngle, aTouch.rotationAngle, "Touch has correct rotationAngle");
   is(aFakeTouch.force, aTouch.force, "Touch has correct force");
 }
 
 function sendTouchEvent(windowUtils, aType, aEvent, aModifiers) {
   var ids = [], xs=[], ys=[], rxs = [], rys = [],
       rotations = [], forces = [];
 
-  for each (var touchType in ["touches", "changedTouches", "targetTouches"]) {
+  for (var touchType of ["touches", "changedTouches", "targetTouches"]) {
     for (var i = 0; i < aEvent[touchType].length; i++) {
       if (ids.indexOf(aEvent[touchType][i].identifier) == -1) {
         ids.push(aEvent[touchType][i].identifier);
         xs.push(aEvent[touchType][i].page.x);
         ys.push(aEvent[touchType][i].page.y);
         rxs.push(aEvent[touchType][i].radius.x);
         rys.push(aEvent[touchType][i].radius.y);
         rotations.push(aEvent[touchType][i].rotationAngle);
--- a/content/html/content/reftests/autofocus/autofocus-after-load.html
+++ b/content/html/content/reftests/autofocus/autofocus-after-load.html
@@ -2,17 +2,17 @@
 <html class="reftest-wait">
   <link rel='stylesheet' type='text/css' href='style.css'>
   <script>
     function loadHandler()
     {
       var body = document.body;
 
       var elements = ["input", "textarea", "select", "button"];
-      for each (var e in elements) {
+      for (var e of elements) {
         var el = document.createElement(e);
         el.autofocus = true;
         body.appendChild(el);
       }
 
       setTimeout(document.documentElement.removeAttribute('class'), 0);
     }
   </script>
--- a/content/html/content/test/forms/test_form_attribute-1.html
+++ b/content/html/content/test/forms/test_form_attribute-1.html
@@ -402,40 +402,40 @@ var elementNames = [
   'button', 'fieldset', 'input', 'label', 'object', 'output', 'select',
   'textarea'
 ];
 
 var todoElements = [
   ['keygen', 'Keygen'],
 ];
 
-for each(var e in todoElements) {
+for (var e of todoElements) {
   var node = document.createElement(e[0]);
   var nodeString = HTMLElement.prototype.toString.apply(node);
   nodeString = nodeString.replace(/Element[\] ].*/, "Element");
   todo_is(nodeString, "[object HTML" + e[1] + "Element",
           e[0] + " should not be implemented");
 }
 
-for each(var name in elementNames) {
+for (var name of elementNames) {
   var elements = [
     document.createElement(name),
     document.createElement(name),
   ];
 
-  for each(var func in functions) {
+  for (var func of functions) {
     // Clean-up.
     while (content.firstChild) {
       content.removeChild(content.firstChild);
     }
-    for each(form in forms) {
+    for (form of forms) {
       content.appendChild(form);
       form.removeAttribute('id');
     }
-    for each(e in elements) {
+    for (e of elements) {
       content.appendChild(e);
       e.removeAttribute('form');
       is(e.form, null, "The element should not have a form owner");
     }
 
     // Calling the test.
     var results = func(forms, elements);
 
@@ -454,17 +454,17 @@ for each(var name in elementNames) {
         }
         is(elementsList[j].form, formsList[i],
            "The form owner should be the form associated to the list");
       }
     }
   }
 
   // Cleaning-up.
-  for each(e in elements) {
+  for (e of elements) {
     e.parentNode.removeChild(e);
     e = null;
   }
 }
 
 </script>
 </pre>
 </body>
--- a/content/html/content/test/forms/test_input_email.html
+++ b/content/html/content/test/forms/test_input_email.html
@@ -139,45 +139,45 @@ var multipleValues = [
 /* Additional username checks. */
 
 var legalCharacters = "abcdefghijklmnopqrstuvwxyz";
 legalCharacters += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 legalCharacters += "0123456789";
 legalCharacters += "!#$%&'*+-/=?^_`{|}~.";
 
 // Add all username legal characters individually to the list.
-for each (c in legalCharacters) {
+for (c of legalCharacters) {
   values.push([c + "@bar.com", true]);
 }
 // Add the concatenation of all legal characters too.
 values.push([legalCharacters + "@bar.com", true]);
 
 // Add username illegal characters, the same way.
 var illegalCharacters = "()<>[]:;@\\, \t";
-for each (c in illegalCharacters) {
+for (c of illegalCharacters) {
   values.push([illegalCharacters + "@bar.com", false]);
 }
 
 /* Additional domain checks. */
 
 legalCharacters = "abcdefghijklmnopqrstuvwxyz";
 legalCharacters += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 legalCharacters += "0123456789";
 legalCharacters += "-";
 
 // Add domain legal characters (except '.' because it's special).
-for each (c in legalCharacters) {
+for (c of legalCharacters) {
   values.push(["foo@foo.bar" + c, true]);
 }
 // Add the concatenation of all legal characters too.
 values.push(["foo@bar.com" + legalCharacters, true]);
 
 // Add domain illegal characters.
 illegalCharacters = "()<>[]:;@\\,!#$%&'*+/=?^_`{|}~ \t";
-for each (c in illegalCharacters) {
+for (c of illegalCharacters) {
   values.push(['foo@foo.ba' + c + 'r', false]);
 }
 
 values.forEach(function([value, valid, todo]) {
   if (todo === true) {
     email.value = value;
     todo_is(email.validity.valid, true, "value should be valid");
   } else {
--- a/content/html/content/test/forms/test_input_list_attribute.html
+++ b/content/html/content/test/forms/test_input_list_attribute.html
@@ -230,17 +230,17 @@ function test17(aContent, aInput) {
   return null;
 }
 
 var tests = [ test1, test2, test3, test4, test5, test6, test7, test8, test9,
               test10, test11, test12, test13, test14, test15, test16, test17 ];
 
 test0();
 
-for each (var test in tests) {
+for (var test of tests) {
   var content = document.getElementById('content');
 
   // Clean-up.
   content.textContent = '';
 
   var input = document.createElement("input");
   var res = test(content, input);
 
--- a/content/html/content/test/forms/test_input_number_value.html
+++ b/content/html/content/test/forms/test_input_number_value.html
@@ -102,25 +102,25 @@ function submitNextValue() {
 var valueIndex = 0;
 var submitMethod = submitForm;
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(function () {
   SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
     input.type = "number";
 
-    for each (data in validData) {
+    for (data of validData) {
       input.value = "";
       SpecialPowers.focus(input);
       sendString(data);
       input.blur();
       is(input.value, data, "valid user input should not be sanitized");
     }
 
-    for each (data in invalidData) {
+    for (data of invalidData) {
       input.value = "";
       SpecialPowers.focus(input);
       sendString(data);
       input.blur();
       is(input.value, "", "invalid user input should be sanitized");
     }
 
     testData = validData;
--- a/content/html/content/test/forms/test_max_attribute.html
+++ b/content/html/content/test/forms/test_max_attribute.html
@@ -74,17 +74,17 @@ function checkValidity(aElement, aValidi
        ":in-range matches status should be " + aValidity);
     is(aElement.mozMatchesSelector(":out-of-range"), !aValidity,
        ":out-of-range matches status should be " + !aValidity);
   }
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
-for each (var data in types) {
+for (var data of types) {
   input.type = data[0];
   var apply = data[1];
 
   if (data[2]) {
     todo_is(input.type, data[0], data[0] + " isn't implemented yet");
     continue;
   }
 
--- a/content/html/content/test/forms/test_meter_element.html
+++ b/content/html/content/test/forms/test_meter_element.html
@@ -81,17 +81,17 @@ function checkValueAttribute()
     [  0.5 ],
     [  1.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('meter');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     if (test[2]) {
       element.setAttribute('max', test[2]);
     }
 
     if (test[3]) {
       element.setAttribute('min', test[3]);
     }
 
@@ -113,17 +113,17 @@ function checkMinAttribute()
     [  1.0 ],
     [  2.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('meter');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     checkAttribute(element, 'min', test[0], test[1]);
   }
 }
 
 function checkMaxAttribute()
 {
   var tests = [
     // max default value is 1.0.
@@ -139,17 +139,17 @@ function checkMaxAttribute()
     [  1.0 ],
     [  2.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('meter');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     if (test[2]) {
       element.setAttribute('min', test[2]);
     }
 
     checkAttribute(element, 'max', test[0], test[1]);
 
     element.removeAttribute('min');
   }
@@ -176,17 +176,17 @@ function checkLowAttribute()
     [  0.5 ],
     [  1.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('meter');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     if (test[2]) {
       element.setAttribute('min', test[2]);
     }
     if (test[3]) {
       element.setAttribute('max', test[3]);
     }
 
     checkAttribute(element, 'low', test[0], test[1]);
@@ -217,17 +217,17 @@ function checkHighAttribute()
     [  0.5 ],
     [  1.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('meter');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     if (test[2]) {
       element.setAttribute('min', test[2]);
     }
     if (test[3]) {
       element.setAttribute('max', test[3]);
     }
 
     checkAttribute(element, 'high', test[0], test[1]);
@@ -258,17 +258,17 @@ function checkOptimumAttribute()
     [  0.5 ],
     [  1.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('meter');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     if (test[2]) {
       element.setAttribute('min', test[2]);
     }
     if (test[3]) {
       element.setAttribute('max', test[3]);
     }
 
     checkAttribute(element, 'optimum', test[0], test[1]);
--- a/content/html/content/test/forms/test_min_attribute.html
+++ b/content/html/content/test/forms/test_min_attribute.html
@@ -74,17 +74,17 @@ function checkValidity(aElement, aValidi
        ":in-range matches status should be " + aValidity);
     is(aElement.mozMatchesSelector(":out-of-range"), !aValidity,
        ":out-of-range matches status should be " + !aValidity);
   }
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
-for each (var data in types) {
+for (var data of types) {
   input.type = data[0];
   var apply = data[1];
 
   if (data[2]) {
     todo_is(input.type, data[0], data[0] + " isn't implemented yet");
     continue;
   }
 
--- a/content/html/content/test/forms/test_mozistextfield.html
+++ b/content/html/content/test/forms/test_mozistextfield.html
@@ -100,29 +100,29 @@ function checkMozIsTextFieldValueTodo(aI
           "mozIsTextField(false) should return " + aResult);
   todo_is(aInput.mozIsTextField(true), aResult,
           "mozIsTextField(true) should return " + aResult);
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
 // Check if the method is defined for the correct elements.
-for each (data in gElementTestData) {
+for (data of gElementTestData) {
   checkMozIsTextFieldDefined(data[0], data[1]);
 }
 
 // Check if the method returns the correct value.
 var input = document.createElement('input');
-for each (data in gInputTestData) {
+for (data of gInputTestData) {
   input.type = data[0];
   checkMozIsTextFieldValue(input, data[1]);
 }
 
 // Check for the todo's.
-for each (data in gInputTodoData) {
+for (data of gInputTodoData) {
   input.type = data[0];
   checkMozIsTextFieldValueTodo(input, data[1]);
 }
 
 SimpleTest.finish();
 });
 
 </script>
--- a/content/html/content/test/forms/test_pattern_attribute.html
+++ b/content/html/content/test/forms/test_pattern_attribute.html
@@ -263,28 +263,28 @@ var validTypes = Array('text', 'password
 var barredTypes = Array('hidden', 'reset', 'button', 'submit', 'image');
 var invalidTypes = Array('checkbox', 'radio', 'file', 'number');
 // TODO: 'datetime', 'date', 'month', 'week', 'time', 'datetime-local',
 //       'range', and 'color' do not accept the @pattern too but are not
 //       implemented yet.
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
-for each (type in validTypes) {
+for (type of validTypes) {
   input.type = type;
   completeValidityCheck(input, false);
   checkPatternValidity(input);
 }
 
-for each (type in barredTypes) {
+for (type of barredTypes) {
   input.type = type;
   completeValidityCheck(input, true, true);
 }
 
-for each (type in invalidTypes) {
+for (type of invalidTypes) {
   input.type = type;
   completeValidityCheck(input, true);
 }
 
 SimpleTest.finish();
 });
 
 </script>
--- a/content/html/content/test/forms/test_progress_element.html
+++ b/content/html/content/test/forms/test_progress_element.html
@@ -80,17 +80,17 @@ function checkValueAttribute()
     [  0.5 ],
     [  1.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('progress');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     if (test[2]) {
       element.setAttribute('max', test[2]);
     }
 
     checkAttribute(element, 'value', test[0], test[1]);
 
     element.removeAttribute('max');
   }
@@ -109,17 +109,17 @@ function checkMaxAttribute()
     [  1.0 ],
     [  2.0 ],
     // Check double-precision value.
     [  0.234567898765432 ],
   ];
 
   var element = document.createElement('progress');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     checkAttribute(element, 'max', test[0], test[1]);
   }
 }
 
 function checkPositionAttribute()
 {
   function checkPositionValue(aElement, aValue, aMax, aExpected) {
     if (aValue != null) {
@@ -160,17 +160,17 @@ function checkPositionAttribute()
     [  10,    50,  10/50 ],
     // Values implying .position is a double.
     [ 1.0,   3.0,  1.0/3.0 ],
     [ 0.1,   0.7,  0.1/0.7  ],
   ];
 
   var element = document.createElement('progress');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     checkPositionValue(element, test[0], test[1], test[2], test[3]);
   }
 }
 
 function checkIndeterminatePseudoClass()
 {
   function checkIndeterminate(aElement, aValue, aMax, aIndeterminate) {
     if (aValue != null) {
@@ -201,17 +201,17 @@ function checkIndeterminatePseudoClass()
     [ 1.0,  null, false ],
     [ 1.0, 'foo', false ],
     [ 1.0,  -1.0, false ],
     [ 0.0,   1.0, false ],
   ];
 
   var element = document.createElement('progress');
 
-  for each(var test in tests) {
+  for (var test of tests) {
     checkIndeterminate(element, test[0], test[1], test[2]);
   }
 }
 
 function checkFormListedElement(aElement)
 {
   is(document.forms[0].elements.length, 0, "the form should have no element");
 }
--- a/content/html/content/test/forms/test_required_attribute.html
+++ b/content/html/content/test/forms/test_required_attribute.html
@@ -353,34 +353,34 @@ function checkInputRequiredValidityForFi
 }
 
 checkTextareaRequiredValidity();
 
 // The require attribute behavior depend of the input type.
 // First of all, checks for types that make the element barred from
 // constraint validation.
 var typeBarredFromConstraintValidation = ["hidden", "button", "reset", "submit", "image"];
-for each (type in typeRequireNotApply) {
+for (type of typeBarredFromConstraintValidation) {
   checkInputRequiredNotApply(type, true);
 }
 
 // Then, checks for the types which do not use the required attribute.
 // TODO: check 'color' and 'range' when they will be implemented.
 var typeRequireNotApply = [];
-for each (type in typeRequireNotApply) {
+for (type of typeRequireNotApply) {
   checkInputRequiredNotApply(type, false);
 }
 
 // Now, checking for all types which accept the required attribute.
 // TODO: check 'datetime', 'date', 'month', 'week', 'time' and 'datetime-local'
 //       when they will be implemented.
 var typeRequireApply = ["text", "password", "search", "tel", "email", "url",
                         "number"];
 
-for each (type in typeRequireApply) {
+for (type of typeRequireApply) {
   checkInputRequiredValidity(type);
 }
 
 checkInputRequiredValidityForCheckbox();
 checkInputRequiredValidityForRadio();
 checkInputRequiredValidityForFile();
 
 </script>
--- a/content/html/content/test/forms/test_step_attribute.html
+++ b/content/html/content/test/forms/test_step_attribute.html
@@ -71,17 +71,17 @@ function checkValidity(aElement, aValidi
   is(aElement.mozMatchesSelector(":valid"), aElement.willValidate && aValidity,
      (aElement.willValidate && aValidity) ? ":valid should apply" : "valid shouldn't apply");
   is(aElement.mozMatchesSelector(":invalid"), aElement.willValidate && !aValidity,
      (aElement.wil && aValidity) ? ":invalid shouldn't apply" : "valid should apply");
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
-for each (var data in types) {
+for (var data of types) {
   var input = getFreshElement(data[0]);
   var apply = data[1];
 
   if (data[2]) {
     todo_is(input.type, data[0], data[0] + " isn't implemented yet");
     continue;
   }
 
--- a/content/html/content/test/forms/test_stepup_stepdown.html
+++ b/content/html/content/test/forms/test_stepup_stepdown.html
@@ -61,17 +61,17 @@ function checkAvailability()
     ["time", true],
     ["datetime-local", true],
     ["range", true],
   ];
 
   var element = document.createElement("input");
   element.setAttribute('value', '0');
 
-  for each (data in testData) {
+  for (data of testData) {
     var exceptionCaught = false;
     element.type = data[0];
     try {
       element.stepDown();
     } catch (e) {
       exceptionCaught = true;
     }
     is(exceptionCaught, !data[1], "stepDown() availability is not correct");
@@ -80,17 +80,17 @@ function checkAvailability()
     try {
       element.stepUp();
     } catch (e) {
       exceptionCaught = true;
     }
     is(exceptionCaught, !data[1], "stepUp() availability is not correct");
   }
 
-  for each (data in todoList) {
+  for (data of todoList) {
     var exceptionCaught = false;
     element.type = data[0];
     try {
       element.stepDown();
     } catch (e) {
       exceptionCaught = true;
     }
     todo_is(exceptionCaught, !data[1],
@@ -175,17 +175,17 @@ function checkStepDownForNumber()
     [ '0',  'any',  null,  null,  1,    null,   true ],
     [ '0',  'ANY',  null,  null,  1,    null,   true ],
     [ '0',  'AnY',  null,  null,  1,    null,   true ],
     [ '0',  'aNy',  null,  null,  1,    null,   true ],
     // With @value = step base.
     [ '1',  '2',    null,  null,  null, '-1',   false ],
   ];
 
-  for each (var data in testData) {
+  for (var data of testData) {
     var element = document.createElement("input");
     element.type = 'number';
 
     if (data[0] != null) {
       element.setAttribute('value', data[0]);
     }
 
     if (data[1] != null) {
@@ -285,17 +285,17 @@ function checkStepUpForNumber()
     [ '0',  'any',  null,  null,  1,    null,  true ],
     [ '0',  'ANY',  null,  null,  1,    null,  true ],
     [ '0',  'AnY',  null,  null,  1,    null,  true ],
     [ '0',  'aNy',  null,  null,  1,    null,  true ],
     // With @value = step base.
     [ '1',  '2',    null,  null,  null, '3',   false ],
   ];
 
-  for each (var data in testData) {
+  for (var data of testData) {
     var element = document.createElement("input");
     element.type = 'number';
 
     if (data[0] != null) {
       element.setAttribute('value', data[0]);
     }
 
     if (data[1] != null) {
--- a/content/html/content/test/forms/test_valueasnumber_attribute.html
+++ b/content/html/content/test/forms/test_valueasnumber_attribute.html
@@ -55,17 +55,17 @@ function checkAvailability()
     ["month", true],
     ["week", true],
     ["time", true],
     ["datetime-local", true],
     ["range", true],
   ];
 
 
-  for each (data in testData) {
+  for (data of testData) {
     var exceptionCatched = false;
     element.type = data[0];
     try {
       element.valueAsNumber;
     } catch (e) {
       exceptionCatched = true;
     }
     is(exceptionCatched, false,
@@ -76,17 +76,17 @@ function checkAvailability()
       element.valueAsNumber = 42;
     } catch (e) {
       exceptionCatched = true;
     }
     is(exceptionCatched, !data[1], "valueAsNumber for " + data[0] +
                                    " availability is not correct");
   }
 
-  for each (data in todoList) {
+  for (data of todoList) {
     var exceptionCatched = false;
     element.type = data[0];
     try {
       element.valueAsNumber;
     } catch (e) {
       exceptionCatched = true;
     }
     is(exceptionCatched, false,
@@ -119,17 +119,17 @@ function checkGet()
     ["e2", null],
     ["1e0.1", null],
     ["", null], // the empty string is not a number
     ["foo", null],
     ["42,13", null], // comma can't be used as a decimal separator
   ];
 
   element.type = "number";
-  for each (data in testData) {
+  for (data of testData) {
     element.value = data[0];
     if (data[1] != null) {
       is(element.valueAsNumber, data[1], "valueAsNumber should return the " +
          "floating point representation of the value");
     } else {
       ok(isNaN(element.valueAsNumber), "valueAsNumber should return NaN "  +
          "when the element value is not a number");
     }
@@ -148,17 +148,17 @@ function checkSet()
     [2e1, "20"],
     [1e-1, "0.1"], // value after e can be negative
     [1E2, "100"], // E can be used instead of e
     ["", null], // the empty string is not a number
     ["foo", null],
   ];
 
   element.type = "number";
-  for each (data in testData) {
+  for (data of testData) {
     element.valueAsNumber = data[0];
     if (data[1] != null) {
       is(element.value, data[1],
          "valueAsNumber should be able to set the value");
     } else {
       element.valueAsNumber = testData[0];
       isnot(element.value, data[1],
             "valueAsNumber should not set the value if it's not a number");
--- a/content/html/content/test/reflect.js
+++ b/content/html/content/test/reflect.js
@@ -151,17 +151,17 @@ function reflectUnsignedInt(aParameters)
   is(typeof element[attr], "number", attr + " IDL attribute should be a number");
 
   // Check default value.
   is(element[attr], defaultValue, "default value should be " + defaultValue);
   ok(!element.hasAttribute(attr), attr + " shouldn't be present");
 
   var values = [ 1, 3, 42, 2147483647 ];
 
-  for each (var value in values) {
+  for (var value of values) {
     element[attr] = value;
     is(element[attr], value, "." + attr + " should be equals " + value);
     is(element.getAttribute(attr), value,
        "@" + attr + " should be equals " + value);
 
     element.setAttribute(attr, value);
     is(element[attr], value, "." + attr + " should be equals " + value);
     is(element.getAttribute(attr), value,
@@ -183,25 +183,25 @@ function reflectUnsignedInt(aParameters)
 
   var nonValidValues = [
     /* invalid value, value in the unsigned int range */
     [ -2147483648, 2147483648 ],
     [ -1,          4294967295 ],
     [ 3147483647,  3147483647 ],
   ];
 
-  for each (var values in nonValidValues) {
+  for (var values of nonValidValues) {
     element[attr] = values[0];
     is(element.getAttribute(attr), values[1],
        "@" + attr + " should be equals to " + values[1]);
     is(element[attr], defaultValue,
        "." + attr + " should be equals to " + defaultValue);
   }
 
-  for each (var values in nonValidValues) {
+  for (var values of nonValidValues) {
     element.setAttribute(attr, values[0]);
     is(element.getAttribute(attr), values[0],
        "@" + attr + " should be equals to " + values[0]);
     is(element[attr], defaultValue,
        "." + attr + " should be equals to " + defaultValue);
   }
 
   // Setting to 0 should throw an error if nonZero is true.
--- a/content/html/content/test/test_bug274626.html
+++ b/content/html/content/test/test_bug274626.html
@@ -70,17 +70,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   }
 
   var controls=["textbox_enabled","textbox_disabled",
     "input_button_enabled", "input_button_disabled", "checkbox_enabled", 
     "checkbox_disabled", "button_enabled", "button_disabled",
     "textarea_enabled", "textarea_disabled", "select_enabled", 
     "select_disabled", "fieldset_enabled", "fieldset_disabled"];
 
-  for each(id in controls) {
+  for (id of controls) {
     var ctrl = document.getElementById(id);
     ctrl.addEventListener('mousemove', HandlesMouseMove, false);
     ctrl.handlesMouseMove = false;
     var evt = document.createEvent("MouseEvents");
     evt.initMouseEvent("mousemove", true, true, window,
       0, 0, 0, 0, 0, false, false, false, false, 0, null);
     ctrl.dispatchEvent(evt);
 
--- a/content/html/content/test/test_bug389797.html
+++ b/content/html/content/test/test_bug389797.html
@@ -73,17 +73,17 @@ function HTML_TAG(aTagName, aImplClass) 
 
 const objectIfaces = [
     "imgINotificationObserver", "nsIRequestObserver", "nsIStreamListener",
     "nsIFrameLoaderOwner", "nsIObjectLoadingContent", "nsIInterfaceRequestor",
     "nsIChannelEventSink"
   ];
 
 var objectIfaces2 = [];
-for each (var iface in objectIfaces) {
+for (var iface of objectIfaces) {
   objectIfaces2.push(iface);
 }
 objectIfaces2.push("nsIImageLoadingContent");
 
 /* List copy/pasted from nsHTMLTagList.h, with the second field modified to the
    correct classinfo (instead of the impl class) in the following cases:
 
    applet
@@ -222,17 +222,17 @@ HTML_TAG("ul", "UList");
 HTML_TAG("var", "");
 HTML_TAG("wbr", "");
 HTML_TAG("xmp", "");
 
 function tagName(aTag) {
   return "<" + aTag + ">";
 }
 
-for each (var tag in allTags) {
+for (var tag of allTags) {
   var node = document.createElement(tag);
 
   // Have to use the proto's toString(), since HTMLAnchorElement and company
   // override toString().
   var nodeString = HTMLElement.prototype.toString.apply(node);
 
   // Debug builds have extra info, so chop off after "Element" if it's followed
   // by ' ' or ']'
@@ -244,40 +244,40 @@ for each (var tag in allTags) {
   is(node instanceof window[classInfoString], true,
      tagName(tag) + " not an instance of " + classInfos[tag]);
   is(node instanceof HTMLUnknownElement, false,
      tagName(tag) + " is an instance of HTMLUnknownElement");
   is(node instanceof SpecialPowers.Ci.nsIDOMHTMLUnknownElement, false,
      tagName(tag) + " is an instance of nsIDOMHTMLUnknownElement");
 
   // Check that each node QIs to all the things we expect it to QI to
-  for each (var iface in interfaces[tag].concat(interfacesNonClassinfo[tag])) {
+  for (var iface of interfaces[tag].concat(interfacesNonClassinfo[tag])) {
     is(iface in SpecialPowers.Ci, true,
        iface + " not in Components.interfaces");
     is(node instanceof SpecialPowers.Ci[iface], true,
        tagName(tag) + " does not QI to " + iface);
   }
 
   // Now see what classinfo reports
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var nodeClassInfo = SpecialPowers.wrap(node).QueryInterface(SpecialPowers.Ci.nsIClassInfo);
   var count = {};
   var classInfoInterfaces =
     nodeClassInfo.getInterfaces(count).
     map(function(id) { return SpecialPowers.Components.interfacesByID[id].toString(); });
 
   // Make sure that we know about all the things classinfo claims
-  for each (var classInfoInterface in classInfoInterfaces) {
+  for (var classInfoInterface of classInfoInterfaces) {
     isnot(interfaces[tag].indexOf(classInfoInterface), -1,
           "Should know about " + tagName(tag) + " implementing " +
           classInfoInterface);
   }
 
   // And make sure classinfo claims all the things we know about
-  for each (iface in interfaces[tag]) {
+  for (iface of interfaces[tag]) {
     isnot(classInfoInterfaces.indexOf(iface), -1,
           "Classinfo for " + tagName(tag) + " should claim to implement " +
           iface);
   }
 }
 </script>
 </pre>
 </body>
--- a/content/html/content/test/test_bug430351.html
+++ b/content/html/content/test/test_bug430351.html
@@ -428,17 +428,17 @@ function testElements(parent, tags, shou
     if (parent.ownerDocument.designMode == "on") {
         focusable = focusableInDesignMode;
         errorSuffix = " in a document with designMode=on";
     }
     else if (parent.contentEditable == "true") {
         focusable = focusableInContentEditable;
     }
 
-    for each (var tag in tags) {
+    for (var tag of tags) {
         parent.ownerDocument.body.focus();
 
         if (focusableElementsTODO.indexOf(tag) > -1) {
             todo_is(parent.ownerDocument.activeElement, parent.firstChild,
                     tag + " should be focusable" + errorSuffix);
             continue;
         }
 
--- a/content/html/content/test/test_bug523771.html
+++ b/content/html/content/test/test_bug523771.html
@@ -31,17 +31,17 @@ var input2Files =
 
 SimpleTest.waitForExplicitFinish();
 
 function setFileInputs () {
   f = createFileWithData(input1File.name, input1File.body);
   SpecialPowers.wrap(singleFileInput).mozSetFileNameArray([f.path], 1);
 
   var input2FileNames = [];
-  for each (file in input2Files) {
+  for (file of input2Files) {
     f = createFileWithData(file.name, file.body);
     input2FileNames.push(f.path);
   }
   SpecialPowers.wrap(multiFileInput).mozSetFileNameArray(input2FileNames, input2FileNames.length);
 }
 
 function createFileWithData(fileName, fileData) {
   var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
--- a/content/html/content/test/test_bug549475.html
+++ b/content/html/content/test/test_bug549475.html
@@ -84,17 +84,17 @@ function checkSanitizing(element)
     // For url:
     "\r\n foobar    \n\r",
     // For number:
     "42",
     "13.37",
     "1.234567898765432",
   ];
 
-  for each (value in testData) {
+  for (value of testData) {
     element.setAttribute('value', value);
     is(element.value, sanitizeValue(type, value),
        "The value has not been correctly sanitized for type=" + type);
     is(element.getAttribute('value'), value,
        "The content value should not have been sanitized");
 
     if (type in valueModeValue) {
       element.setAttribute('value', 'tulip');
@@ -128,17 +128,17 @@ function checkSanitizing(element)
     // Cleaning-up.
     element.setAttribute('value', '');
     form.reset();
   }
 }
 
 var pref = SpecialPowers.getBoolPref("dom.experimental_forms");
 SpecialPowers.setBoolPref("dom.experimental_forms", true);
-for each (type in inputTypes) {
+for (type of inputTypes) {
   var form = document.forms[0];
   var element = document.createElement("input");
   element.style.display = "none";
   element.type = type;
   form.appendChild(element);
 
   checkSanitizing(element); // no frame, no editor
 
@@ -150,17 +150,17 @@ for each (type in inputTypes) {
   checkSanitizing(element); // frame, editor
 
   element.style.display = "none";
   checkSanitizing(element); // no frame, editor
 
   form.removeChild(element);
 }
 
-for each (type in todoTypes) {
+for (type of todoTypes) {
   // The only meaning of this is to have a failure when new types are introduced
   // so we will know we have to write the tests here.
   var form = document.forms[0];
   var element = document.createElement("input");
   element.type = type;
   form.appendChild(element);
 
   todo_is(element.type, type, "");
--- a/content/html/content/test/test_bug557087-2.html
+++ b/content/html/content/test/test_bug557087-2.html
@@ -157,118 +157,118 @@ function clean()
   }
 }
 
 function test1()
 {
   gHandled = 0;
 
   // Initialize children without click expected.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldNotHappenHandler, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test2()
 {
   gHandled = 0;
   fieldset1.disabled = false;
   fieldset2.disabled = true;
 
   // Initialize children without click expected.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldNotHappenHandler2, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler2, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test3()
 {
   gHandled = 0;
   fieldset1.disabled = false;
   fieldset2.disabled = false;
 
   // All elements should accept the click.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler3, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler3, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test4()
 {
   gHandled = 0;
   fieldset1.disabled = false;
   fieldset2.disabled = true;
 
   fieldset2.appendChild(legendA);
 
   // All elements should accept the click.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     legendA.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler4, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     legendA.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler4, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test5()
 {
   gHandled = 0;
   fieldset2.insertBefore(legendB, legendA);
 
   // Initialize children without click expected.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     legendA.appendChild(element);
     element.addEventListener("click", clickShouldNotHappenHandler5, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     legendA.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler5, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test6()
@@ -277,25 +277,25 @@ function test6()
   fieldset2.removeChild(legendB);
   fieldset1.disabled = true;
   fieldset2.disabled = false;
 
   fieldset1.appendChild(legendA);
   legendA.appendChild(fieldset2);
 
   // All elements should accept the click.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler6, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     fieldset2.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler6, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test7()
@@ -303,25 +303,25 @@ function test7()
   gHandled = 0;
   fieldset1.disabled = true;
   fieldset2.disabled = false;
 
   fieldset1.appendChild(fieldset2);
   fieldset2.appendChild(legendA);
 
   // All elements should accept the click.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     legendA.appendChild(element);
     element.addEventListener("click", clickShouldNotHappenHandler7, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     legendA.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler7, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 function test8()
@@ -330,25 +330,25 @@ function test8()
   fieldset1.disabled = true;
   fieldset2.disabled = true;
 
   fieldset1.appendChild(legendA);
   legendA.appendChild(fieldset2);
   fieldset2.appendChild(legendB);
 
   // All elements should accept the click.
-  for each(var name in elementsPreventingClick) {
+  for (var name of elementsPreventingClick) {
     var element = document.createElement(name);
     legendB.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler8, false);
     sendMouseEvent({type:'click'}, element);
   }
 
   // Initialize children with click expected.
-  for each(var name in elementsWithClick) {
+  for (var name of elementsWithClick) {
     var element = document.createElement(name);
     legendB.appendChild(element);
     element.addEventListener("click", clickShouldHappenHandler8, false);
     sendMouseEvent({type:'click'}, element);
   }
 }
 
 test1();
--- a/content/html/content/test/test_bug557087-3.html
+++ b/content/html/content/test/test_bug557087-3.html
@@ -33,34 +33,34 @@ function checkCandidateForConstraintVali
   is(aElement.willValidate, aExpected, msg);
 }
 
 function checkDisabledPseudoClass(aElement, aDisabled)
 {
   var disabledElements = document.querySelectorAll(":disabled");
   var found = false;
 
-  for each(var e in disabledElements) {
+  for (var e of disabledElements) {
     if (aElement == e) {
       found = true;
       break;
     }
   }
 
   var msg = aDisabled ? aElement.tagName + " should have :disabled applying"
                       : aElement.tagName + " should not have :disabled applying";
   ok(aDisabled ? found : !found, msg);
 }
 
 function checkEnabledPseudoClass(aElement, aEnabled)
 {
   var enabledElements = document.querySelectorAll(":enabled");
   var found = false;
 
-  for each(var e in enabledElements) {
+  for (var e of enabledElements) {
     if (aElement == e) {
       found = true;
       break;
     }
   }
 
   var msg = aEnabled ? aElement.tagName + " should have :enabled applying"
                      : aElement.tagName + " should not have :enabled applying";
@@ -136,17 +136,17 @@ var fieldset1 = document.createElement("
 var fieldset2 = document.createElement("fieldset");
 var legendA = document.createElement("legend");
 var legendB = document.createElement("legend");
 var content  = document.getElementById('content');
 content.appendChild(fieldset1);
 fieldset1.appendChild(fieldset2);
 fieldset2.disabled = true;
 
-for each(var data in elements) {
+for (var data of elements) {
   var element = document.createElement(data);
 
   if (data[4]) {
     element.required = true;
   }
 
   fieldset1.disabled = false;
   fieldset2.appendChild(element);
--- a/content/html/content/test/test_bug557087-4.html
+++ b/content/html/content/test/test_bug557087-4.html
@@ -50,17 +50,17 @@ form.addEventListener("submit", function
 var inputs = [
   document.getElementById('a'),
   document.getElementById('b'),
   document.getElementById('c'),
 ];
 
 function doSubmit()
 {
-  for each(e in inputs) {
+  for (e of inputs) {
     e.focus();
     synthesizeKey("VK_RETURN", {});
   }
 }
 
 SimpleTest.waitForFocus(function() {
   doSubmit();
 
--- a/content/html/content/test/test_bug561640.html
+++ b/content/html/content/test/test_bug561640.html
@@ -35,17 +35,17 @@ function checkValid(elmt)
 
 function checkInvalid(elmt)
 {
   todo(elmt.validity.tooLong, "element should be too long");
   todo_is(window.getComputedStyle(elmt, null).getPropertyValue('background-color'),
           "rgb(255, 0, 0)", ":invalid pseudo-class should apply");
 }
 
-for each (var elmtName in elements) {
+for (var elmtName of elements) {
   var elmt = document.createElement(elmtName);
   content.appendChild(elmt);
 
   if (elmtName == 'textarea') {
     elmt.textContent = 'foo';
   } else {
     elmt.setAttribute('value', 'foo');
   }
--- a/content/html/content/test/test_bug573969.html
+++ b/content/html/content/test/test_bug573969.html
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 var testData = [
   '<div>foo</div>',
   '&lt;div&gt;&lt;/div&gt;',
 ];
 
 var x = document.getElementById('x');
 
-for each (v in testData) {
+for (v of testData) {
   x.innerHTML = v;
   is(x.innerHTML, v, "innerHTML value should not be escaped");
 }
 
 </script>
 </pre>
 </body>
 </html>
--- a/content/html/content/test/test_bug590353-1.html
+++ b/content/html/content/test/test_bug590353-1.html
@@ -13,17 +13,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <p id="display"></p>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 590353 **/
 
 var testData = ['checkbox', 'radio'];
 
-for each(var data in testData) {
+for (var data of testData) {
   var e = document.createElement('input');
   e.type = data;
   e.checked = true;
   e.value = "foo";
 
   is(e.value, "foo", "foo should be the new " + data + "value");
   is(e.getAttribute('value'), "foo", "foo should be the new " + data +
                                      " value attribute value");
--- a/content/html/content/test/test_bug590353-2.html
+++ b/content/html/content/test/test_bug590353-2.html
@@ -48,17 +48,17 @@ function createFileWithData(fileName, fi
 
   return testFile;
 }
 
 var content = document.getElementById('content');
 var form = document.createElement('form');
 content.appendChild(form);
 
-for each (var data in testData) {
+for (var data of testData) {
   var e = document.createElement('input');
   e.type = data[0];
 
   if (data[0] == 'checkbox' || data[0] == 'radio') {
     e.checked = data[1];
   } else if (data[0] == 'file') {
     // Need privileges to set a filename with .value and create a file.
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
--- a/content/html/content/test/test_bug590363.html
+++ b/content/html/content/test/test_bug590363.html
@@ -59,34 +59,34 @@ for (var i=0; i<length; ++i) {
     e.type = testData[j][0];
     is(e.value, expectedValue, ".value should still return the same value after " +
        "changing type from " + testData[i][0] + " to " + testData[j][0]);
   }
 }
 
 // For type='file' .value doesn't behave the same way.
 // We are just going to check that we do not loose the value.
-for each (var data in testData) {
+for (var data of testData) {
   var e = document.createElement('input');
   e.type = data[0];
   e.value = 'foo';
   e.type = 'file';
   e.type = data[0];
 
   if (data[1]) {
     is(e.value, '', ".value should have been reset to the empty string after " +
        "changing type from " + data[0] + " to 'file' then reverting to " + data[0]);
   } else {
     is(e.value, 'foo', ".value should still return the same value after " +
        "changing type from " + data[0] + " to 'file' then reverting to " + data[0]);
   }
 }
 
 // TODO checks
-for each (var type in todoTypes) {
+for (var type of todoTypes) {
   var e = document.createElement('input');
   e.type = type;
   todo_is(e.type, type, type + " type isn't supported yet");
 }
 
 </script>
 </pre>
 </body>
--- a/content/html/content/test/test_bug595429.html
+++ b/content/html/content/test/test_bug595429.html
@@ -27,17 +27,17 @@ var testData = [
   "foo bar",
 ];
 
 is(fieldset.getAttribute("name"), null,
    "By default, name content attribute should be null");
 is(fieldset.name, "",
    "By default, name IDL attribute should be the empty string");
 
-for each(var data in testData) {
+for (var data of testData) {
   fieldset.setAttribute("name", data);
   is(fieldset.getAttribute("name"), data,
      "name content attribute should be " + data);
   is(fieldset.name, data, "name IDL attribute should be " + data);
 
   fieldset.setAttribute("name", "");
   fieldset.name = data;
   is(fieldset.getAttribute("name"), data,
--- a/content/html/content/test/test_bug595449.html
+++ b/content/html/content/test/test_bug595449.html
@@ -78,17 +78,17 @@ var testData = [
   [ "<legend><input></legend><legend><input></legend>", 2, [ HTMLInputElement, HTMLInputElement ] ],
   [ "<legend><input></legend><input>", 2, [ HTMLInputElement, HTMLInputElement ] ],
   [ "<fieldset></fieldset>", 1, [ HTMLFieldSetElement ] ],
   [ "<fieldset><input></fieldset>", 2, [ HTMLFieldSetElement, HTMLInputElement ] ],
   [ "<fieldset><fieldset><input></fieldset></fieldset>", 3, [ HTMLFieldSetElement, HTMLFieldSetElement, HTMLInputElement ] ],
   [ "<button></button><fieldset></fieldset><input><keygen><object><output></output><select></select><textarea></textarea>", 8, [ HTMLButtonElement, HTMLFieldSetElement, HTMLInputElement, HTMLSelectElement, HTMLObjectElement, HTMLOutputElement, HTMLSelectElement, HTMLTextAreaElement ] ],
 ];
 
-for each(var data in testData) {
+for (var data of testData) {
   fieldset.innerHTML = data[0];
   is(fieldset.elements.length, data[1],
      "fieldset.elements should contain " + data[1] + " elements");
 
   for (var i=0; i<data[1]; ++i) {
     ok(fieldset.elements[i] instanceof data[2][i],
        "fieldset.elements[" + i + "] should be instance of " + data[2][i])
   }
--- a/content/html/content/test/test_bug596350.html
+++ b/content/html/content/test/test_bug596350.html
@@ -39,17 +39,17 @@ var testData = [
   [ 2, "1", "1" ],
   [ 2, "-1", "-1" ],
 ];
 
 var objects = document.getElementsByTagName("object");
 
 function runTests()
 {
-  for each(var data in testData) {
+  for (var data of testData) {
     var obj = objects[data[0]];
 
     if (data[1]) {
       obj.setAttribute("tabindex", data[1]);
     }
 
     is(obj.tabIndex, data[2], "tabIndex value should be " + data[2]);
 
--- a/content/html/content/test/test_bug598643.html
+++ b/content/html/content/test/test_bug598643.html
@@ -55,17 +55,17 @@ var types = [
     "datetime-local" ],
 ];
 
 var input = document.createElement("input");
 input.maxLength = 1;
 input.value = "foo";
 
 // Too long types.
-for each (type in types[0]) {
+for (type of types[0]) {
   input.type = type
   if (type == 'email') {
     input.value = "foo@bar.com";
   } else if (type == 'url') {
     input.value = 'http://foo.org';
   }
 
   todo(!input.validity.valid, "the element should be invalid [type=" + type + "]");
@@ -73,25 +73,25 @@ for each (type in types[0]) {
        "the element should suffer from being too long [type=" + type + "]");
 
   if (type == 'email' || type == 'url') {
     input.value = 'foo';
   }
 }
 
 // Not too long types.
-for each (type in types[1]) {
+for (type of types[1]) {
   input.type = type
   ok(input.validity.valid, "the element should be valid [type=" + type + "]");
   ok(!input.validity.tooLong,
      "the element shouldn't suffer from being too long [type=" + type + "]");
 }
 
 // Not too long types but TODO.
-for each (type in types[2]) {
+for (type of types[2]) {
   input.type = type
   ok(input.validity.valid, "the element should be valid [type=" + type + "]");
   ok(!input.validity.tooLong,
      "the element shouldn't suffer from being too long [type=" + type + "]");
 }
 
 testFileControl(input);
 
--- a/content/html/content/test/test_bug600155.html
+++ b/content/html/content/test/test_bug600155.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 600155 **/
 
 var subjectForConstraintValidation = [ "input", "select", "textarea" ];
 var content = document.getElementById('content');
 
-for each (var eName in subjectForConstraintValidation) {
+for (var eName of subjectForConstraintValidation) {
   var e = document.createElement(eName);
   content.appendChild(e);
   e.setAttribute("x-moz-errormessage", "foo");
   if ("required" in e) {
     e.required = true;
   } else {
     e.setCustomValidity("bar");
   }
--- a/content/html/content/test/test_bug607145.html
+++ b/content/html/content/test/test_bug607145.html
@@ -47,24 +47,24 @@ function reflectURL(aElement, aAttr)
     [ "", "" ], // TODO: doesn't follow the specs, should be location.href.
     [ " ", location.href ],
     [ "../", previousDir ],
     [ "...", dir + "..." ],
     // invalid URL
     [ "http://a b/", "http://a b/" ], // TODO: doesn't follow the specs, should be "".
   ];
 
-  for each (var value in values) {
+  for (var value of values) {
     aElement[idl] = value[0];
     is(aElement[idl], value[1], "." + idl + " value should be " + value[1]);
     is(aElement.getAttribute(attr), value[0],
        "@" + attr + " value should be " + value[0]);
   }
 
-  for each (var value in values) {
+  for (var value of values) {
     aElement.setAttribute(attr, value[0]);
     is(aElement[idl], value[1], "." + idl + " value should be " + value[1]);
     is(aElement.getAttribute(attr), value[0],
        "@" + attr + " value should be " + value[0]);
   }
 }
 
 reflectURL(document.createElement("form"), "action");
--- a/content/html/content/test/test_bug618948.html
+++ b/content/html/content/test/test_bug618948.html
@@ -30,26 +30,26 @@ var handled = ({});
 function eventHandler(event)
 {
  dump("\n" + event.type + "\n");
   handled[event.type] = true;
 }
 
 function beginTest()
 {
-  for each (var e in events) {
+  for (var e of events) {
     handled[e] = false;
   }
 
   i.focus();
 }
 
 function endTest()
 {
-  for each (var e in events) {
+  for (var e of events) {
     ok(handled[e], "on" + e + " should have been called");
   }
 
   SimpleTest.finish();
 }
 
 var i = document.getElementsByTagName('input')[0];
 var b = document.getElementsByTagName('button')[0];
--- a/content/html/content/test/test_bug659596.html
+++ b/content/html/content/test/test_bug659596.html
@@ -18,49 +18,49 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 function checkReflection(option, attribute) {
   /**
    * Getting.
    */
 
   // When attribute isn't present.
   var tests = [ "", "foo" ];
-  for each (var test in tests) {
+  for (var test of tests) {
     option.removeAttribute(attribute);
     option.textContent = test;
     is(option.getAttribute(attribute), null,
        "option " + attribute + "'s value should be null");
     is(option[attribute], option.textContent,
        "option." + attribute + " should reflect the text content when the attribute isn't set");
   }
 
   // When attribute is present.
   tests = [
     [ "", "" ],
     [ "", "foo" ],
     [ "foo", "bar" ],
     [ "foo", "" ],
   ];
-  for each (var test in tests) {
+  for (var test of tests) {
     option.setAttribute(attribute, test[0]);
     option.textContent = test[1];
     is(option[attribute], option.getAttribute(attribute),
        "option." + attribute + " should reflect the content attribute when it is set");
   }
 
   /**
    * Setting.
    */
 
   // When attribute isn't present.
   tests = [
     [ "", "new" ],
     [ "foo", "new" ],
   ];
-  for each (var test in tests) {
+  for (var test of tests) {
     option.removeAttribute(attribute);
     option.textContent = test[0];
     option[attribute] = test[1]
 
     is(option.getAttribute(attribute), test[1],
        "when setting, the content attribute should change");
     is(option.textContent, test[0],
        "when setting, the text content should not change");
@@ -68,17 +68,17 @@ function checkReflection(option, attribu
 
   // When attribute is present.
   tests = [
     [ "", "", "new" ],
     [ "", "foo", "new" ],
     [ "foo", "bar", "new" ],
     [ "foo", "", "new" ],
   ];
-  for each (var test in tests) {
+  for (var test of tests) {
     option.setAttribute(attribute, test[0]);
     option.textContent = test[1];
     option[attribute] = test[2];
 
     is(option.getAttribute(attribute), test[2],
        "when setting, the content attribute should change");
     is(option.textContent, test[1],
        "when setting, the text content should not change");
--- a/content/html/content/test/test_restore_from_parser_fragment.html
+++ b/content/html/content/test/test_restore_from_parser_fragment.html
@@ -34,17 +34,17 @@ var tests = [
   [  "button", "<button></button>" ],
   [  "input", "<input>" ],
   [  "textarea", "<textarea></textarea>" ],
   [  "select", "<select></select>" ],
 ];
 
 var element = null;
 
-for each (var test in tests) {
+for (var test of tests) {
   appendHTML(content, test[1]);
   element = content.getElementsByTagName(test[0])[0];
   is(element.disabled, false, "element shouldn't be disabled");
   element.disabled = true;
   is(element.disabled, true, "element should be disabled");
 
   clearHTML(content);
 
--- a/content/svg/content/test/test_SVGxxxList.xhtml
+++ b/content/svg/content/test/test_SVGxxxList.xhtml
@@ -450,17 +450,17 @@ function get_array_of_list_items(list)
  *
  * @param t A test from the 'tests' array.
  */
 function run_baseVal_API_tests()
 {
   var res, threw, items;
   var eventChecker = new MutationEventChecker;
 
-  for each (var t in tests) {
+  for (var t of tests) {
 
     // Test .clear():
 
     t.element.setAttribute(t.attr_name, t.attr_val_4);
 
     is(t.baseVal.numberOfItems, 4,
        'The '+t.list_type+' object should contain four list items.');
 
@@ -845,17 +845,17 @@ function run_baseVal_API_tests()
 /**
  * This function tests the SVGXxxList API for the anim val list (see also the
  * comment for test_baseVal_API).
  */
 function run_animVal_API_tests()
 {
   var threw, item;
 
-  for each (var t in tests) {
+  for (var t of tests) {
     if (!t.animVal)
       continue; // SVGStringList isn't animatable
 
     item = t.item_constructor();
 
     t.element.setAttribute(t.attr_name, t.attr_val_4);
 
     is(t.animVal.numberOfItems, 4,
@@ -944,17 +944,17 @@ function run_animVal_API_tests()
 
 
 /**
  * This function runs some basic tests to check the effect of setAttribute()
  * calls on object identity, without taking SMIL animation into consideration.
  */
 function run_basic_setAttribute_tests()
 {
-  for each (var t in tests) {
+  for (var t of tests) {
 
     // Since the t.prop, t.baseVal and t.animVal objects should never ever
     // change, we leave testing of them to our caller so that it can check
     // them after all the other mutations such as SMIL changes.
 
     t.element.setAttribute(t.attr_name, t.attr_val_4);
 
     ok(t.baseVal.numberOfItems == 4 && t.baseVal.getItem(3) != null,
@@ -1041,17 +1041,17 @@ function run_basic_setAttribute_tests()
 }
 
 /**
  * This function verifies that a list's animVal is kept in sync with its
  * baseVal, when we add & remove items from the baseVal.
  */
 function run_list_mutation_tests()
 {
-  for each (var t in tests) {
+  for (var t of tests) {
     if (t.animVal) {
       // Test removeItem()
       // =================
       // Save second item in baseVal list; then make it the first item, and
       // check that animVal is updated accordingly.
       t.element.setAttribute(t.attr_name, t.attr_val_4);
 
       var secondVal = t.baseVal.getItem(1);
@@ -1137,17 +1137,17 @@ function run_list_mutation_tests()
  *
  * See the comment for create_animate_elements() for details of the animations
  * and their timings.
  */
 function run_animation_timeline_tests()
 {
   var svg = document.getElementById('svg');
 
-  for each (var t in tests) {
+  for (var t of tests) {
     // Skip if there is no animVal for this test or if it is a transform list
     // since these are handled specially
     if (!t.animVal || is_transform_attr(t.attr_name))
       continue;
 
     svg.setCurrentTime(0); // reset timeline
 
     // Reset attributes before moving along the timeline and triggering SMIL:
@@ -1363,17 +1363,17 @@ function run_animation_timeline_tests()
    }
 }
 
 
 function run_tests()
 {
   // Initialize each test object with some useful properties, and create their
   // 'animate' elements. Note that 'prop' and 'animVal' may be null.
-  for each (var t in tests) {
+  for (var t of tests) {
     t.element = document.getElementById(t.target_element_id);
     t.prop = t.prop_name ? t.element[t.prop_name] : null;
     t.baseVal = ( t.prop || t.element )[t.bv_name];
     t.animVal = t.av_name ? ( t.prop || t.element )[t.av_name] : null;
     t.bv_path = t.el_type + '.' +
                 (t.prop ? t.prop_name + '.' : '') +
                 t.bv_name;  // e.g. 'SVGTextElement.x.baseVal'
     if (t.animVal) {
@@ -1404,17 +1404,17 @@ function run_tests()
   run_animVal_API_tests();
   run_basic_setAttribute_tests();
   run_list_mutation_tests();
   run_animation_timeline_tests();
 
   // After all the other test manipulations, we check that the following
   // objects have still not changed, since they never should:
 
-  for each (var t in tests) {
+  for (var t of tests) {
     if (t.prop) {
       ok(t.prop === t.element[t.prop_name],
          'The same '+t.prop_type+' object should ALWAYS be returned for '+
          t.el_type+'.'+t.prop_name+' each time it is accessed.');
     }
 
     ok(t.baseVal === ( t.prop || t.element )[t.bv_name],
        'The same '+t.list_type+' object should ALWAYS be returned for '+
--- a/content/svg/content/test/test_isSupported.xhtml
+++ b/content/svg/content/test/test_isSupported.xhtml
@@ -131,17 +131,17 @@ var features = [
   ["org.w3c.dom.svg", "1.0", false],
   ["org.w3c.dom.svg.all", "1.0", false],
   ["org.w3c.dom.svg.static", "1.0", false],
   ["org.w3c.dom.svg.animation", "1.0", true],
   ["org.w3c.dom.svg.dynamic", "1.0", false]
 ];
 
 function testIsSupported(elem) {
-  for each (var [feature, version, accepted_result] in features) {
+  for (var [feature, version, accepted_result] of features) {
     if (accepted_result) {
       ok(elem.isSupported(feature, version), "isSupported(" + feature + ", " + version + ") returned wrong value, Was it changed to unsupported feature?");
     } else {
       todo(elem.isSupported(feature, version), "isSupported(" + feature + ", " + version + ") is unsupported feature string");
     }
   }
 }
 
--- a/content/xslt/tests/mochitest/test_bug427060.html
+++ b/content/xslt/tests/mochitest/test_bug427060.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 427060 **/
 
 var xmldoc, xsltdoc;
-[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(xml, "text/xml") for each (xml in [ 
+[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(xml, "text/xml") for (xml of [ 
 
     '<opml version="1.0"><body></body></opml>' ,
 
     '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
     	<xsl:template match="/opml">\n\
     		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n\
     			<head>\n\
     				<base target="_blank"></base>\n\
--- a/content/xslt/tests/mochitest/test_bug440974.html
+++ b/content/xslt/tests/mochitest/test_bug440974.html
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 function isTxResult(node)
 {
   return node.namespaceURI == "http://www.mozilla.org/TransforMiix" &&
          node.localName == "result";
 }
 
 var xmldoc, xsltdoc;
-[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(xml, "text/xml") for each (xml in [ 
+[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(xml, "text/xml") for (xml of [ 
 
     '<items><item><id>1</id></item><item><id>2</id></item><item><id>3</id></item></items>' ,
 
     '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
         <xsl:output method="xml" />\n\
         <xsl:template match="item"><foo id="{id}"/></xsl:template>\n\
     </xsl:stylesheet>'
 
--- a/content/xslt/tests/mochitest/test_exslt_regex.html
+++ b/content/xslt/tests/mochitest/test_exslt_regex.html
@@ -23,17 +23,17 @@ http://www.exslt.org/regexp/index.html
       expr: "regexp:match('XSLT is great', 'XSL.', '')[1]",
       expResult: "XSLT" },
 
     { descr: "Testing regexp:replace",
       expr: "regexp:replace('Food is great', 'Fo.d', '', 'XSLT')",
       expResult: "XSLT is great" }
   ];
 
-  for each(test in tests) {
+  for (test of tests) {
     var style =
       '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
                       'xmlns:regexp="http://exslt.org/regular-expressions" '+
                       'version="1.0">' +
         '<xsl:output method="html"/>' +
         '<xsl:template match="/">' +
           '<xsl:value-of select="'+test.expr+'" /> ' +
         '</xsl:template>' +
--- a/dom/plugins/test/mochitest/test_npruntime_npnevaluate.html
+++ b/dom/plugins/test/mochitest/test_npruntime_npnevaluate.html
@@ -50,17 +50,17 @@
     ["function test2() { var x = {a: '1', b: '2'}; return x; } test2();", 
         {a: '1', b: '2'}],
   ];
  
   function runTests() {
     var plugin = document.getElementById("plugin1");
 
     // Test calling NPN_Evaluate from within plugin code.
-    for each (var test in tests) {
+    for (var test of tests) {
       var expected = test[1];
       var result = plugin.npnEvaluateTest(test[0]);
       // serialize the two values for easy comparison
       var json_expected = JSON.stringify(expected);
       var json_result = JSON.stringify(result);
       if (typeof(result) == "function")
           json_result = result.toString();
       if (typeof(expected) == "function")
--- a/dom/plugins/test/mochitest/test_npruntime_npninvoke.html
+++ b/dom/plugins/test/mochitest/test_npruntime_npninvoke.html
@@ -110,17 +110,17 @@
     [["returnTwoArgs", ["a", undefined], "a"], true],
     [["returnTwoArgs", [undefined, undefined]], true],
   ];
  
   function runTests() {
     var plugin = document.getElementById("plugin1");
     
     var result;
-    for each (var test in tests) {
+    for (var test of tests) {
       switch (test[0].length) {
         case 2:
           result = plugin.npnInvokeTest(test[0][0], test[0][1]);
           break;
         case 3:
           result = plugin.npnInvokeTest(test[0][0], test[0][1], test[0][2]);
           break;
         case 4:
--- a/dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html
+++ b/dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html
@@ -86,17 +86,17 @@
     ["parseInt", "156", 156],
     ["encodeURI", "a = b", "a%20=%20b"],
   ];
  
   function runTests() {
     var plugin = document.getElementById("plugin1");
 
     // Test calling NPN_InvokeDefault from within plugin code.
-    for each (var test in tests) {
+    for (var test of tests) {
       var result;
       var expected = test[test.length - 1];
       switch (test.length) {
         case 2:
           result = plugin.npnInvokeDefaultTest(test[0]);
           break;
         case 3:
           result = plugin.npnInvokeDefaultTest(test[0], test[1]);
--- a/dom/tests/mochitest/webapps/test_bug_765063.xul
+++ b/dom/tests/mochitest/webapps/test_bug_765063.xul
@@ -27,17 +27,17 @@ var url = "http://test/chrome/dom/tests/
 // Observe app installation and confirm that the install origin didn't change.
 var observer = {
   observe: function observe(subject, topic, data) {
     Services.obs.removeObserver(observer, "webapps-sync-install");
     is(JSON.parse(data).installOrigin, "http://test",
        "the install origin didn't change");
 
     navigator.mozApps.mgmt.getAll().onsuccess = function onGetAll() {
-      var app = [a for each (a in this.result) if (a.manifestURL == url)][0];
+      var app = [a for (a of this.result) if (a.manifestURL == url)][0];
       app.uninstall().onsuccess = function onUninstall() {
         SimpleTest.finish();
       }
     }
   }
 };
 
 Components.utils.import("resource://gre/modules/Services.jsm");
--- a/dom/tests/mochitest/webapps/test_cross_origin.xul
+++ b/dom/tests/mochitest/webapps/test_cross_origin.xul
@@ -65,32 +65,32 @@ function installAppFromOtherOrigin(next)
       window.removeEventListener("message", onMessage, false);
       next();
     }
   }, false);
 }
 
 function getInstalled(next) {
   navigator.mozApps.getInstalled().onsuccess = function onGetInstalled() {
-    var app1 = [a for each (a in this.result) if (a.manifestURL == url1)][0];
+    var app1 = [a for (a of this.result) if (a.manifestURL == url1)][0];
     ok(app1, "getInstalled() includes app installed from own origin");
 
-    var app2 = [a for each (a in this.result) if (a.manifestURL == url2)][0];
+    var app2 = [a for (a of this.result) if (a.manifestURL == url2)][0];
     ok(!app2, "getInstalled() excludes app installed from other origin");
 
     next();
   };
 }
 
 function getAll(next) {
   navigator.mozApps.mgmt.getAll().onsuccess = function onMgmtGetAll() {
-    var app1 = [a for each (a in this.result) if (a.manifestURL == url1)][0];
+    var app1 = [a for (a of this.result) if (a.manifestURL == url1)][0];
     ok(app1, "mgmt.getAll() includes app installed from own origin");
 
-    var app2 = [a for each (a in this.result) if (a.manifestURL == url2)][0];
+    var app2 = [a for (a of this.result) if (a.manifestURL == url2)][0];
     ok(app2, "mgmt.getAll() includes app installed from other origin");
 
     next();
   };
 }
 
 function uninstall(next) {
   app1.uninstall().onsuccess = function onUninstallApp1() {
--- a/dom/tests/mochitest/webapps/test_install_app.xul
+++ b/dom/tests/mochitest/webapps/test_install_app.xul
@@ -59,17 +59,17 @@ function install(next) {
 
     next();
   }
 }
 
 function getInstalledReturnsApp(next) {
   navigator.mozApps.getInstalled().onsuccess = function onGetInstalled() {
     // Retrieve the app we just installed from the list of installed apps.
-    var a = [a for each (a in this.result) if (a.manifestURL == url)][0];
+    var a = [a for (a of this.result) if (a.manifestURL == url)][0];
 
     // Compare the values of the two app objects to make sure install()
     // and getInstalled() return identical objects.
     isDeeply(a, app, "getInstalled() returns app identical to install()");
 
     next();
   };
 }
@@ -82,17 +82,17 @@ function getSelf(next) {
   };
 }
 
 function uninstall(next) {
   app.uninstall().onsuccess = function onUninstall() {
     // Try to retrieve the app we just uninstalled, to make sure it no longer
     // exists in the registry.
     navigator.mozApps.getInstalled().onsuccess = function onGetInstalled() {
-      var a = [a for each (a in this.result) if (a.manifestURL == url)][0];
+      var a = [a for (a of this.result) if (a.manifestURL == url)][0];
       is(a, undefined, "getInstalled() returns nothing again after uninstall");
 
       next();
     };
   };
 }
 
 ]]>
--- a/dom/tests/mochitest/webapps/test_launch_paths.xul
+++ b/dom/tests/mochitest/webapps/test_launch_paths.xul
@@ -59,17 +59,17 @@ function install(next) {
 
     next();
   }
 }
 
 function getInstalledReturnsApp(next) {
   navigator.mozApps.getInstalled().onsuccess = function onGetInstalled() {
     // Retrieve the app we just installed from the list of installed apps.
-    var a = [a for each (a in this.result) if (a.manifestURL == url)][0];
+    var a = [a for (a of this.result) if (a.manifestURL == url)][0];
 
     // Compare the values of the two app objects to make sure install()
     // and getInstalled() return identical objects.
     isDeeply(a, app, "getInstalled() returns app identical to install()");
 
     next();
   };
 }
@@ -82,17 +82,17 @@ function getSelf(next) {
   };
 }
 
 function uninstall(next) {
   app.uninstall().onsuccess = function onUninstall() {
     // Try to retrieve the app we just uninstalled, to make sure it no longer
     // exists in the registry.
     navigator.mozApps.getInstalled().onsuccess = function onGetInstalled() {
-      var a = [a for each (a in this.result) if (a.manifestURL == url)][0];
+      var a = [a for (a of this.result) if (a.manifestURL == url)][0];
       is(a, undefined, "getInstalled() returns nothing again after uninstall");
 
       next();
     };
   };
 }
 
 ]]>
--- a/js/src/tests/browser.js
+++ b/js/src/tests/browser.js
@@ -289,22 +289,26 @@ function jsTestDriverBrowserInit()
     }
   }
 
   if (!properties.version && navigator.userAgent.indexOf('Gecko/') != -1)
   {
     // If the version is not specified, and the browser is Gecko,
     // use the default version corresponding to the shell's version(0).
     // See https://bugzilla.mozilla.org/show_bug.cgi?id=522760#c11
-    // Otherwise adjust the version to match the suite version for 1.7,
-    // and later due to the use of let, yield, etc.
+    // Otherwise adjust the version to match the suite version for 1.6,
+    // and later due to the use of for-each, let, yield, etc.
     //
     // Note that js1_8, js1_8_1, and js1_8_5 are treated identically in
     // the browser.
-    if (properties.test.match(/^js1_7/))
+    if (properties.test.match(/^js1_6/))
+    {
+      properties.version = '1.6';
+    }
+    else if (properties.test.match(/^js1_7/))
     {
       properties.version = '1.7';
     }
     else if (properties.test.match(/^js1_8/))
     {
       properties.version = '1.8';
     }
   }
--- a/js/src/tests/ecma_5/extensions/regress-bug567606.js
+++ b/js/src/tests/ecma_5/extensions/regress-bug567606.js
@@ -5,15 +5,15 @@ var global = this;
 
 (function() {
     function f() {
         this.b = function() {};
         Object.defineProperty(this, "b", ({
             configurable: global.__defineSetter__("", function() {})
         }));
     }
-    for each(y in [0]) {
+    for (y of [0]) {
         _ = new f();
     }
 })();
 uneval(this);
 
 reportCompare(true, true);
--- a/js/src/tests/js1_5/Regress/regress-503860.js
+++ b/js/src/tests/js1_5/Regress/regress-503860.js
@@ -13,12 +13,12 @@ var actual = "FAIL";
 var a = {y: 1};
 
 function B(){}
 B.prototype.__defineSetter__('x', function setx(val) { actual = expect; });
 var b = new B;
 b.y = 1;
 
 var arr = [a, b];       // same shape prior to bug 497789 fix
-for each (var obj in arr)
+for (var obj of arr)
     obj.x = 2;          // should call b's setter but doesn't
 
 reportCompare(expect, actual, summary);
--- a/js/xpconnect/tests/chrome/test_cows.xul
+++ b/js/xpconnect/tests/chrome/test_cows.xul
@@ -230,18 +230,16 @@ function COWTests() {
         ok(/Permission denied/.test(e),
            "deleting a read-only exposed prop should throw error");
     }
 
     try {
         var props = [name for (name in getCOW(readable))];
         is(props.length, 1, "COW w/ one exposed prop should enumerate once");
         is(props[0], 'foo', "COW w/ one exposed prop should enumerate it");
-        props = [value for each (value in getCOW(readable))];
-        is(props[0], 5, "for-each over COWs works");
     } catch (e) {
         ok(false, "COW w/ a readable prop should not raise exc " +
                   "on enumeration: " + e);
     }
 
     // Test read/write property
     var readwrite = getCOW({ __exposedProps__: {foo: 'rw'}});
     try {
--- a/layout/generic/test/file_bug514732_helper.html
+++ b/layout/generic/test/file_bug514732_helper.html
@@ -81,17 +81,17 @@ function waitInterrupt(result, gen) {
   setTimeout(function() { if (!result.success) gen.next(); }, 3500);
 }
 
 function testPhoom(isCapturing, x, y, expectEvent) {
 
   var eventGen = (function() {
     var innerdoc = document.getElementById('testframe').contentDocument;
 
-    for each (var doc in [document, innerdoc]) {
+    for (var doc of [document, innerdoc]) {
       var inner = (doc == innerdoc);
       var w, h, result, listener;
 
       /* --- EXPANSION --- */
 
       result = makeResult();
       listener = makeListener(result, eventGen);
 
--- a/layout/style/test/chrome/hover_helper.html
+++ b/layout/style/test/chrome/hover_helper.html
@@ -31,17 +31,17 @@
     <div style="width: 5000px; height: 10px;"></div>
   </div>
 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 var imports = [ "SimpleTest", "is", "isnot", "ok" ];
-for each (var name in imports) {
+for (var name of imports) {
     window[name] = window.opener.wrappedJSObject[name];
 }
 
 var div = document.getElementById("display");
 var divtwo = document.getElementById("two");
 var iframe = document.getElementById("twoi");
 var divtwoparent = document.getElementById("twoparent");
 
--- a/layout/style/test/test_bug437915.html
+++ b/layout/style/test/test_bug437915.html
@@ -48,17 +48,17 @@ var wsmap = {
   true: { str: "", "text-decoration": "underline", "visibility": "hidden" }
 };
 
 for (var char in chars) {
   var is_whitespace = chars[char];
   var mapent = wsmap[is_whitespace];
   div.setAttribute("class", "classvalue" + String.fromCharCode(char) + "b")
   div.setAttribute("title", "a" + String.fromCharCode(char) + "titlevalue")
-  for each (var prop in ["text-decoration", "visibility"]) {
+  for (var prop of ["text-decoration", "visibility"]) {
     is(cs.getPropertyValue(prop), mapent[prop],
        "Character " + char + " should" + mapent.str +
        " be treated as whitespace ("
        + prop + " should be " + mapent[prop] + ")");
   }
 }
 
 
--- a/layout/style/test/test_bug74880.html
+++ b/layout/style/test/test_bug74880.html
@@ -49,19 +49,19 @@ function values_for(set) {
     values = gLengthValues;
   return values;
 }
 
 var e = document.getElementById("display");
 var s = e.style;
 var c = window.getComputedStyle(e, "");
 
-for each (var set in gProps) {
+for (var set of gProps) {
   var values = values_for(set);
-  for each (var val in values) {
+  for (var val of values) {
     function check(dir, plogical, pvisual) {
       var v0 = c.getPropertyValue(pvisual);
       s.setProperty("direction", dir, "");
       s.setProperty(pvisual, val, "");
       var v1 = c.getPropertyValue(pvisual);
       if (val != "initial" && val != "currentColor")
         isnot(v1, v0, "setProperty set the property " + pvisual + ": " + val);
       s.removeProperty(pvisual);
--- a/layout/style/test/test_selectors.html
+++ b/layout/style/test/test_selectors.html
@@ -531,17 +531,17 @@ function run() {
     test_selector_in_html(":nth-last-of-type(6)", seven_ps,
                           pset([2]), pset([1, 3, 4, 5, 6, 7]));
 
     // Test [first|last|only]-[child|node|of-type]
     var interesting_doc = "<!----> <div id='p1'> <!---->x<p id='s1'></p> <!----><p id='s2'></p> <!----></div> <!----><p id='p2'> <!----><span id='s3'></span> <!----><span id='s4'></span> <!---->x</p> <!----><div id='p3'> <!----><p id='s5'></p> <!----></div> <!---->";
     function idset(ids) { // takes an array of ids
         return function idset_filter(doc) {
             var result = [];
-            for each (var id in ids)
+            for (var id of ids)
                 result.push(doc.getElementById(id));
             return result;
         }
     }
     function classset(classes) { // takes an array of classes
         return function classset_filter(doc) {
             var i, j, els;
             var result = [];
--- a/layout/style/test/test_transitions.html
+++ b/layout/style/test/test_transitions.html
@@ -146,17 +146,17 @@ for (var tf in timingFunctions) {
     is(getComputedStyle(p, "").textIndent, "0px",
        "should be zero before changing value");
     tftests.push([ p, tf ]);
 }
 
 // Check that the timing function continues even when we restyle in the
 // middle.
 var interrupt_tests = [];
-for each (var restyleParent in [true, false]) {
+for (var restyleParent of [true, false]) {
     for (var itime = 2; itime < 8; itime += 2) {
         var p = document.createElement("p");
         var t = document.createTextNode("interrupt on " +
                                         (restyleParent ? "parent" : "node itself") +
                                         " at " + itime + "s");
         p.appendChild(t);
         p.style.textIndent = "0px";
         p.style.transition = "8s text-indent cubic-bezier(0, 1, 1, 0)";
--- a/toolkit/components/passwordmgr/test/pwmgr_common.js
+++ b/toolkit/components/passwordmgr/test/pwmgr_common.js
@@ -141,17 +141,17 @@ function commonInit() {
     var logins = pwmgr.getAllLogins();
     if (logins.length) {
         //todo(false, "Warning: wasn't expecting logins to be present.");
         pwmgr.removeAllLogins();
     }
     var disabledHosts = pwmgr.getAllDisabledHosts();
     if (disabledHosts.length) {
         //todo(false, "Warning: wasn't expecting disabled hosts to be present.");
-        for each (var host in disabledHosts)
+        for (var host of disabledHosts)
             pwmgr.setLoginSavingEnabled(host, true);
     }
 
     // Add a login that's used in multiple tests
     var login = Components.classes["@mozilla.org/login-manager/loginInfo;1"].
                 createInstance(Components.interfaces.nsILoginInfo);
     login.init("http://mochi.test:8888", "http://mochi.test:8888", null,
                "testuser", "testpass", "uname", "pword");
--- a/toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html
+++ b/toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html
@@ -98,17 +98,17 @@ var TestObserver = {
       var id = formInfo.get("passwordField").form.id;
       this.results[id].receivedNotification = true;
       this.results[id].data = formInfo;
     }
   }
 };
 
 // Initialize the object that stores the results of notifications.
-for each (var formID in ["form1", "form2", "form3", "form4", "form5"])
+for (var formID of ["form1", "form2", "form3", "form4", "form5"])
   TestObserver.results[formID] = { receivedNotification: false, data: null };
 
 // Add the observer
 var os = Cc["@mozilla.org/observer-service;1"].
          getService(Ci.nsIObserverService);
 os.addObserver(TestObserver, "passwordmgr-found-logins", false);
 
 function startTest(){
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -135,17 +135,17 @@ fh.addEntry("field8", "value");
 fh.addEntry("field9", "value");
 fh.addEntry("field10", "42");
 fh.addEntry("searchbar-history", "blacklist test");
 
 // All these non-implemeted types might need autocomplete tests in the future.
 var todoTypes = [ "datetime", "date", "month", "week", "time", "datetime-local",
                   "range", "color" ];
 var todoInput = document.createElement("input");
-for each (var type in todoTypes) {
+for (var type of todoTypes) {
   todoInput.type = type;
   todo_is(todoInput.type, type, type + " type shouldn't be implemented");
 }
 
 
 function setForm(value) {
   input.value = value;
   input.focus();