Bug 1187110 part 2: Use "let" instead of "var" in test_extra_inherit_initial.html, to make scoping more explicit. r=heycam
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 04 Aug 2015 14:05:22 -0700
changeset 287873 5189e3db2bc23d8c44ac94e652219c7a7234d4eb
parent 287872 de6004c72675c91db8b1000befd2863af201cebf
child 287874 c4e7b4e83365ba58b6d6753aad25bed557ba9e5a
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1187110
milestone42.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 1187110 part 2: Use "let" instead of "var" in test_extra_inherit_initial.html, to make scoping more explicit. r=heycam
layout/style/test/test_extra_inherit_initial.html
--- a/layout/style/test/test_extra_inherit_initial.html
+++ b/layout/style/test/test_extra_inherit_initial.html
@@ -19,33 +19,33 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.7">
 
 /*
  * Inspired by mistake in quotes noticed while reviewing bug 189519.
  */
 
-var gPropsNeedComma = {
+let gPropsNeedComma = {
   "font": true,
   "font-family": true,
   "voice-family": true,
 };
 
-var gElement = document.getElementById("testnode");
-var gDeclaration = gElement.style;
+let gElement = document.getElementById("testnode");
+let gDeclaration = gElement.style;
 
 function test_property(property)
 {
-  var info = gCSSProperties[property];
+  let info = gCSSProperties[property];
 
-  var delim = (property in gPropsNeedComma) ? ", " : " ";
+  let delim = (property in gPropsNeedComma) ? ", " : " ";
 
   function test_value_pair(relation, val1, val2, extraval) {
-    var decl = property + ": " + val1 + delim + val2;
+    let decl = property + ": " + val1 + delim + val2;
     gElement.setAttribute("style", decl);
     if ("subproperties" in info) {
       // Shorthand property; inspect each subproperty value.
       for (let subprop of info.subproperties) {
         is(gDeclaration.getPropertyValue(subprop), "",
            ["expected", extraval, "ignored", relation, "value in",
             "'" + decl + "'", "when looking at subproperty",
             "'" + subprop + "'"].join(" "));
@@ -62,28 +62,29 @@ function test_property(property)
     test_value_pair("after", value, "inherit", "inherit");
     test_value_pair("after", value, "initial", "initial");
     test_value_pair("after", value, "unset", "unset");
     test_value_pair("before", "inherit", value, "inherit");
     test_value_pair("before", "initial", value, "initial");
     test_value_pair("before", "unset", value, "unset");
   }
 
-  var idx;
-  for (idx in info.initial_values)
+  for (let idx in info.initial_values) {
     test_value(info.initial_values[idx]);
-  for (idx in info.other_values)
-    test_value(info.other_values[idx]);
+  }
+  for (let idx in info.other_values) {
+    test_value(info.initial_values[idx]);
+  }
 }
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestLongerTimeout(4);
 
 function start_test() {
-  for (var prop in gCSSProperties) {
+  for (let prop in gCSSProperties) {
     test_property(prop);
   }
   SimpleTest.finish();
 }
 
 // Turn off CSS error reporting for this test, since it's a bit expensive,
 // and we're expecting to generate tons and tons of parse errors here.
 SpecialPowers.pushPrefEnv({ "set": [["layout.css.report_errors", false]] },