Bug 1508987 - Enable ESLint for dom/svg/ (Manual Changes). r=jwatt
authorchampionshuttler <shivams2799@gmail.com>
Mon, 25 Mar 2019 19:22:27 +0000
changeset 466516 772847bbb31406441f209732aa8b77a4b6b48ed9
parent 466515 69b00bf72f9e848f4da07120f391c5cf147ea5a5
child 466517 062344ad3eea0d383fc7e938577a8b0831c5a935
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1508987
milestone68.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 1508987 - Enable ESLint for dom/svg/ (Manual Changes). r=jwatt Differential Revision: https://phabricator.services.mozilla.com/D22294
.eslintignore
dom/svg/test/MutationEventChecker.js
dom/svg/test/pointer-events.js
dom/svg/test/test_SVGLengthList.xhtml
dom/svg/test/test_SVGMatrix.xhtml
dom/svg/test/test_SVGNumberList.xhtml
dom/svg/test/test_SVGPointList.xhtml
dom/svg/test/test_SVGTransformList.xhtml
dom/svg/test/test_SVGTransformListAddition.xhtml
dom/svg/test/test_SVGxxxList.xhtml
dom/svg/test/test_SVGxxxListIndexing.xhtml
dom/svg/test/test_animLengthUnits.xhtml
dom/svg/test/test_bounds.html
dom/svg/test/test_fragments.html
dom/svg/test/test_getCTM.html
dom/svg/test/test_markerOrient.xhtml
dom/svg/test/test_non-scaling-stroke.html
dom/svg/test/test_pathAnimInterpolation.xhtml
dom/svg/test/test_pointAtLength.xhtml
dom/svg/test/test_pointer-events-2.xhtml
dom/svg/test/test_pointer-events-3.xhtml
dom/svg/test/test_pointer-events-4.xhtml
dom/svg/test/test_pointer-events-5.xhtml
dom/svg/test/test_pointer-events-7.xhtml
dom/svg/test/test_scientific.html
dom/svg/test/test_stroke-linecap-hit-testing.xhtml
dom/svg/test/test_text_lengthAdjust.html
dom/svg/test/test_text_scaled.html
dom/svg/test/test_text_selection.html
dom/svg/test/test_transform.xhtml
--- a/.eslintignore
+++ b/.eslintignore
@@ -186,17 +186,16 @@ dom/push/**
 dom/quota/**
 dom/security/test/cors/**
 dom/security/test/csp/**
 dom/security/test/general/**
 dom/security/test/mixedcontentblocker/**
 dom/security/test/sri/**
 dom/serviceworkers/**
 dom/smil/**
-dom/svg/**
 
 dom/tests/html/**
 dom/tests/mochitest/**
 dom/u2f/**
 dom/vr/**
 dom/webauthn/**
 dom/webgpu/**
 dom/websocket/**
@@ -208,16 +207,18 @@ dom/xml/**
 dom/xslt/**
 dom/xul/**
 
 # Third-party
 dom/canvas/test/webgl-conf/**
 dom/imptests/**
 dom/media/webaudio/test/blink/**
 dom/media/webvtt/**
+dom/svg/test/test_nonAnimStrings.xhtml
+dom/svg/test/test_SVG_namespace_ids.html
 
 # Third-party
 editor/libeditor/tests/browserscope/**
 
 # Third-party
 gfx/ots/**
 gfx/skia/**
 gfx/wr/**
--- a/dom/svg/test/MutationEventChecker.js
+++ b/dom/svg/test/MutationEventChecker.js
@@ -196,16 +196,17 @@ function MutationEventChecker() {
     switch (evtId) {
     case MutationEvent.MODIFICATION:
       return "modification";
     case MutationEvent.ADDITION:
       return "addition";
     case MutationEvent.REMOVAL:
       return "removal";
     }
+    return "Unknown MutationEvent Type";
   };
 
   this._argToEventId = function(arg) {
     if (typeof arg === "number")
       return arg;
 
     if (typeof arg !== "string") {
       ok(false, "Unexpected event type: " + arg);
--- a/dom/svg/test/pointer-events.js
+++ b/dom/svg/test/pointer-events.js
@@ -220,17 +220,17 @@ function make_log_msg(over, tag, attribu
   var target;
   if (over == (POINT_OVER_FILL | POINT_OVER_STROKE)) {
     target = "fill and stroke";
   } else if (over == POINT_OVER_FILL) {
     target = "fill";
   } else if (over == POINT_OVER_STROKE) {
     target = "stroke";
   } else {
-    throw "unexpected bit combination in 'over'";
+    throw new Error("unexpected bit combination in 'over'");
   }
   var msg = "Check if events are intercepted at a point over the " + target + " on <" + tag + "> for";
   for (var attr in attributes) {
     msg += " " + attr + "=" + attributes[attr];
   }
   return msg;
 }
 
@@ -253,17 +253,17 @@ function test_element(id, x, y, over /* 
   var inputs;
   if (over == (POINT_OVER_FILL | POINT_OVER_STROKE)) {
     inputs = hit_test_inputs.both;
   } else if (over == POINT_OVER_FILL) {
     inputs = hit_test_inputs.fill;
   } else if (over == POINT_OVER_STROKE) {
     inputs = hit_test_inputs.stroke;
   } else {
-    throw "unexpected bit combination in 'over'";
+    throw new Error("unexpected bit combination in 'over'");
   }
 
   for_all_permutations(inputs, test_permutation);
 
   // To reduce the chance of bogus results in subsequent tests:
   element.setAttribute("fill", "none");
   element.setAttribute("stroke", "none");
 }
@@ -281,17 +281,17 @@ function run_tests(subtest) {
   switch (subtest) {
     case 0:
       pointer_events_values.splice(partition);
       break;
     case 1:
       pointer_events_values.splice(0, partition);
       break;
     case 2:
-      throw "unexpected subtest number";
+      throw new Error("unexpected subtest number");
   }
 
   test_element("rect", 30, 30, POINT_OVER_FILL);
   test_element("rect", 5, 5, POINT_OVER_STROKE);
 
   // The SVG 1.1 spec essentially says that, for text, hit testing is done
   // against the character cells of the text, and not the fill and stroke as
   // you might expect for a normal graphics element like <path>. See the
--- a/dom/svg/test/test_SVGLengthList.xhtml
+++ b/dom/svg/test/test_SVGLengthList.xhtml
@@ -35,17 +35,17 @@ function run_tests() {
 
   var text = document.getElementById("text");
   var lengths = text.x.baseVal;
 
   is(lengths.numberOfItems, 0, "Checking numberOfItems");
 
   // Test mutation events
   // --- Initialization
-  eventChecker = new MutationEventChecker;
+  var eventChecker = new MutationEventChecker;
   eventChecker.watchAttr(text, "x");
   eventChecker.expect("modify");
   text.textContent = "abc";
   text.setAttribute("x", "10 20 30");
   is(lengths.numberOfItems, 3, "Checking numberOfItems");
   // -- Actual changes
   eventChecker.expect("modify modify modify modify modify");
   lengths[0].value = 8;
--- a/dom/svg/test/test_SVGMatrix.xhtml
+++ b/dom/svg/test/test_SVGMatrix.xhtml
@@ -35,17 +35,17 @@ function main() {
     ];
   for (var i = 0; i < tests.length; i++) {
     tests[i]();
   }
   SimpleTest.finish();
 }
 
 function testCreateMatrix() {
-  svg = $("svg");
+  var svg = $("svg");
   var m = svg.createSVGMatrix();
 
   // Should be initialised to identity
   cmpMatrix(m, [1, 0, 0, 1, 0, 0],
             "createMatrix should produce identity matrix");
 
   // Should return a new object each time;
   ok(m != svg.createSVGMatrix(),
--- a/dom/svg/test/test_SVGNumberList.xhtml
+++ b/dom/svg/test/test_SVGNumberList.xhtml
@@ -33,17 +33,17 @@ function run_tests() {
 
   var text = document.getElementById("text");
   var numbers = text.rotate.baseVal;
 
   is(numbers.numberOfItems, 3, "Checking numberOfItems");
 
   // Test mutation events
   // --- Initialization
-  eventChecker = new MutationEventChecker;
+  var eventChecker = new MutationEventChecker;
   eventChecker.watchAttr(text, "rotate");
   // -- Actual changes
   eventChecker.expect("modify modify");
   numbers[0].value = 15;
   text.setAttribute("rotate", "17 20 30");
   // -- Redundant changes
   eventChecker.expect("");
   numbers[0].value = 17;
--- a/dom/svg/test/test_SVGPointList.xhtml
+++ b/dom/svg/test/test_SVGPointList.xhtml
@@ -34,17 +34,17 @@ function run_tests() {
 
   var polyline = document.getElementById("polyline");
   var points = polyline.points;
 
   is(points.numberOfItems, 2, "Checking numberOfItems");
 
   // Test mutation events
   // --- Initialization
-  eventChecker = new MutationEventChecker;
+  var eventChecker = new MutationEventChecker;
   eventChecker.watchAttr(polyline, "points");
   // -- Actual changes
   eventChecker.expect("modify modify");
   points[0].x = 40;
   polyline.setAttribute("points", "30,375 150,380");
   // -- Redundant changes
   eventChecker.expect("");
   points[0].x = 30;
--- a/dom/svg/test/test_SVGTransformList.xhtml
+++ b/dom/svg/test/test_SVGTransformList.xhtml
@@ -323,17 +323,16 @@ function testOrphan(g) {
   var exception = null;
   try {
     roTransform.setTranslate(5, 3);
   } catch (e) {
     exception = e;
   }
   ok(exception === null,
      "Unexpected exception " + exception + " modifying orphaned transform");
-  uexception = null;
 
   // So should matrix
   exception = null;
   try {
     roMatrix.a = 1;
   } catch (e) {
     exception = e;
   }
@@ -359,17 +358,17 @@ function testFailedSet(g) {
 
 function testMutationEvents(g) {
   // Check mutation events
 
   // Set initial value
   g.setAttribute("transform", "translate(50 90)");
   var list = g.transform.baseVal;
   is(list.numberOfItems, 1, "Unexpected initial length of list");
-  eventChecker = new MutationEventChecker;
+  var eventChecker = new MutationEventChecker;
   eventChecker.watchAttr(g, "transform");
 
   // consolidate
   //
   // Consolidate happens to generate two modification events in our
   // implementation--it's not ideal but it's better than none
   eventChecker.expect("modify modify modify");
   g.setAttribute("transform", "translate(10 10) translate(10 10)");
--- a/dom/svg/test/test_SVGTransformListAddition.xhtml
+++ b/dom/svg/test/test_SVGTransformListAddition.xhtml
@@ -165,17 +165,17 @@ function createAnims(specs) {
 }
 
 function createAnim(attrs) {
   var SVG_NS = "http://www.w3.org/2000/svg";
   var anim = document.createElementNS(SVG_NS, "animateTransform");
   anim.setAttribute("attributeName", "transform");
   anim.setAttribute("dur", "1s");
   anim.setAttribute("fill", "freeze");
-  for (attr in attrs) {
+  for (let attr in attrs) {
     anim.setAttribute(attr, attrs[attr]);
   }
   return anim;
 }
 
 window.addEventListener("load", main);
 
 ]]>
--- a/dom/svg/test/test_SVGxxxList.xhtml
+++ b/dom/svg/test/test_SVGxxxList.xhtml
@@ -365,17 +365,17 @@ function create_animate_elements(test) {
 
 function is_transform_attr(attr_name) {
   return attr_name == "transform" ||
          attr_name == "gradientTransform" ||
          attr_name == "patternTransform";
 }
 
 function get_array_of_list_items(list) {
-  array = [];
+  let array = [];
   for (var i = 0; i < list.numberOfItems; ++i) {
     array.push(list.getItem(i));
   }
   return array;
 }
 
 
 /**
@@ -389,17 +389,17 @@ function get_array_of_list_items(list) {
  *   SVGLength insertItemBefore(in SVGLength newItem, in unsigned long index)
  *   SVGLength replaceItem(in SVGLength newItem, in unsigned long index)
  *   SVGLength removeItem(in unsigned long index)
  *   SVGLength appendItem(in SVGLength newItem)
  *
  * @param t A test from the 'tests' array.
  */
 function run_baseVal_API_tests() {
-  var res, threw, items;
+  var res, threw;
   var eventChecker = new MutationEventChecker;
 
   for (var t of tests) {
     // Test .clear():
 
     t.element.setAttribute(t.attr_name, t.attr_val_4);
 
     is(t.baseVal.numberOfItems, 4,
@@ -448,17 +448,17 @@ function run_baseVal_API_tests() {
     var item = t.item_constructor();
     // Our current implementation of 'initialize' for most list types performs
     // a 'clear' followed by an 'insertItemBefore'. This results in two
     // modification events being dispatched. SVGStringList however avoids the
     // additional clear.
     var expectedModEvents =
       t.item_type == "DOMString" ? "modify" : "modify modify";
     eventChecker.expect(expectedModEvents);
-    var res = t.baseVal.initialize(item);
+    res = t.baseVal.initialize(item);
     eventChecker.ignoreEvents();
 
 
     is(t.baseVal.numberOfItems, 1,
        "The " + t.list_type + " object should contain one list item.");
     ok(res === item,
        "The list item returned by " + t.list_type + ".initialize() should be the " +
        "exact same object as the item that was passed to that method, since " +
@@ -810,17 +810,17 @@ function run_animVal_API_tests() {
       threw = true;
     }
     ok(threw,
        "The method " + t.list_type + ".clear() should throw when called on an " +
        "anim val list, since anim val lists should be readonly.");
 
     // Test .getItem():
 
-    var item = t.animVal.getItem(2);
+    item = t.animVal.getItem(2);
     ok(item != null && item === t.animVal.getItem(2),
        "The method " + t.list_type + ".getItem() should work when called on an " +
        "anim val list, and always return the exact same object.");
 
     // .initialize()
 
     threw = false;
     try {
@@ -908,23 +908,25 @@ function run_basic_setAttribute_tests() 
          "The " + t.list_type + " objects for " + t.bv_path + " and " + t.av_path +
          " should be different objects.");
 
       ok(t.baseVal.getItem(0) !== t.animVal.getItem(0),
          "The " + t.item_type + " list items in the " + t.list_type + " objects for " +
          t.bv_path + " and " + t.av_path + " should be different objects.");
     }
 
+    // eslint-disable-next-line no-self-compare
     ok(t.baseVal.getItem(0) === t.baseVal.getItem(0),
        "The exact same " + t.item_type + " DOM object should be returned each " +
        "time the item at a given index in the " + t.list_type + " for " +
        t.bv_path + " is accessed, given that the index was not made invalid " +
        "by a change in list length between the successive accesses.");
 
     if (t.animVal) {
+      // eslint-disable-next-line no-self-compare
       ok(t.animVal.getItem(0) === t.animVal.getItem(0),
          "The exact same " + t.item_type + " DOM object should be returned each " +
          "time the item at a given index in the " + t.list_type + " for " +
          t.av_path + " is accessed, given that the index was not made invalid " +
          "by a change in list length between the successive accesses.");
     }
 
     // Test the effect of setting the attribute to new values:
@@ -1294,17 +1296,17 @@ function run_animation_timeline_tests() 
        "end and unfreezing of the animation occurred.");
    }
 }
 
 
 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 (var t of tests) {
+  for (let 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) {
@@ -1335,17 +1337,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 (var t of tests) {
+  for (let 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/dom/svg/test/test_SVGxxxListIndexing.xhtml
+++ b/dom/svg/test/test_SVGxxxListIndexing.xhtml
@@ -12,19 +12,20 @@ https://bugzilla.mozilla.org/show_bug.cg
 <svg xmlns="http://www.w3.org/2000/svg" id="svg">
   <text id="text" x="10 20 30" rotate="40 50 60">abcde</text>
   <path id="path" d="M0,0 L100,100"/>
   <polygon id="poly" points="50,50 70,70 90,50"/>
   <g id="g" transform="translate(20 30) rotate(50 60 70) scale(2)"
      requiredFeatures="foo bar baz"/>
 </svg>
 <script type="text/javascript"><![CDATA[
+
 var text = document.getElementById("text"),
     path = document.getElementById("path"),
-    poly = document.getElementById("poly");
+    poly = document.getElementById("poly"),
     g    = document.getElementById("g");
 
 function CheckList(aListObject, aExpectedListLength, aListDescription) {
   is(aListObject.numberOfItems, aExpectedListLength, aListDescription + ".numberOfItems");
   is(aListObject.length, aExpectedListLength, aListDescription + ".length");
   for (let i = 0; i < aListObject.length; i++) {
     let item = aListObject.getItem(i);
     ok(aListObject[i] === item, aListDescription + "[" + i + "]");
--- a/dom/svg/test/test_animLengthUnits.xhtml
+++ b/dom/svg/test/test_animLengthUnits.xhtml
@@ -107,17 +107,16 @@ function checkWhilstFrozen() {
     "frozen");
   is(circle.cx.animVal.value, 70,
     "(3) Unexpected value for animVal after changing font-size whilst " +
     "frozen");
 
   SimpleTest.finish();
 }
 
-var animate = document.getElementById("animate");
 if (animate && animate.targetElement) {
   window.addEventListener("load", main);
 } else {
   ok(true); // Skip tests but don't report 'todo' either
   SimpleTest.finish();
 }
 ]]>
 </script>
--- a/dom/svg/test/test_bounds.html
+++ b/dom/svg/test/test_bounds.html
@@ -111,17 +111,17 @@ function runTest() {
   var rect3Bounds = doc.getElementById("rect3").getBoundingClientRect();
   var rect4Bounds = doc.getElementById("rect4").getBoundingClientRect();
 
   is(rect1Bounds.left, 50, "rect1.getBoundingClientRect().left");
   is(rect1Bounds.top, 50, "rect1.getBoundingClientRect().top");
   is(rect1Bounds.width, 50, "rect1.getBoundingClientRect().width");
   is(rect1Bounds.height, 50, "rect1.getBoundingClientRect().height");
 
-  rect = new Rect(175 - 50 * sin45, 75 - 50 * sin45, 50 * sin45 * 2, 50 * sin45 * 2);
+  var rect = new Rect(175 - 50 * sin45, 75 - 50 * sin45, 50 * sin45 * 2, 50 * sin45 * 2);
   isWithAbsTolerance(rect2Bounds.left, rect.left, 0.1, "rect2.getBoundingClientRect().left");
   isWithAbsTolerance(rect2Bounds.top, rect.top, 0.1, "rect2.getBoundingClientRect().top");
   isWithAbsTolerance(rect2Bounds.width, rect.width, 0.1, "rect2.getBoundingClientRect().width");
   isWithAbsTolerance(rect2Bounds.height, rect.height, 0.1, "rect2.getBoundingClientRect().height");
 
   is(rect3Bounds.left, 50, "rect3.getBoundingClientRect().left");
   is(rect3Bounds.top, 160, "rect3.getBoundingClientRect().top");
   is(rect3Bounds.width, 100, "rect3.getBoundingClientRect().width");
@@ -240,17 +240,17 @@ function runTest() {
                     "nonScalingStrokedLine2.getBoundingClientRect().top");
   isWithAbsTolerance(nonScalingStrokedLine2Bounds.width, rect.width, 0.15,
                      "nonScalingStrokedLine2.getBoundingClientRect().width");
   isWithAbsTolerance(nonScalingStrokedLine2Bounds.height, rect.height, 0.15,
                      "nonScalingStrokedLine2.getBoundingClientRect().height");
 
   var nonScalingStrokedLine3Bounds =
     doc.getElementById("nonScalingStrokedLine3").getBoundingClientRect();
-  var capDelta = 5 / Math.SQRT2;
+  capDelta = 5 / Math.SQRT2;
   rect = new Rect(280 - capDelta, 15 - capDelta, 20 / Math.SQRT2 + 2 * capDelta,
                   20 / Math.SQRT2 + 2 * capDelta);
   isWithAbsTolerance(nonScalingStrokedLine3Bounds.left, rect.left, 0.1,
                      "nonScalingStrokedLine3.getBoundingClientRect().left");
   isWithAbsTolerance(nonScalingStrokedLine3Bounds.top, rect.top, 0.1,
                     "nonScalingStrokedLine3.getBoundingClientRect().top");
   isWithAbsTolerance(nonScalingStrokedLine3Bounds.width, rect.width, 0.1,
                      "nonScalingStrokedLine3.getBoundingClientRect().width");
--- a/dom/svg/test/test_fragments.html
+++ b/dom/svg/test/test_fragments.html
@@ -12,26 +12,27 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=759124">Mozilla Bug 759124</a>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 
 <iframe id="svg"></iframe>
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
+var svg = $("svg");
+
 SimpleTest.waitForExplicitFinish();
 
 function Test(svgFragmentIdentifier, valid, viewBoxString,
               preserveAspectRatioString, zoomAndPanString) {
     this.svgFragmentIdentifier = svgFragmentIdentifier;
     this.valid = valid;
 }
 
 function runTests() {
-  var svg = $("svg");
   var doc = svg.contentWindow.document;
   var rootElement = doc.documentElement;
 
   var tests = [
       new Test("unknown", false),
       new Test("svgView(viewBox(0,0,200,200))", true),
       new Test("svgView(preserveAspectRatio(xMaxYMin slice))", true),
       new Test("svgView(viewBox(1,2,3,4);preserveAspectRatio(xMinYMax))", true),
@@ -102,14 +103,14 @@ function runTests() {
     rootElement.setAttribute("preserveAspectRatio", "none");
     rootElement.setAttribute("zoomAndPan", "disable");
     rootElement.setAttribute("transform", "translate(10,10)");
   }
 
   SimpleTest.finish();
 }
 
-$(svg).addEventListener("load", runTests);
-$(svg).setAttribute("src", "fragments-helper.svg");
+svg.addEventListener("load", runTests);
+svg.setAttribute("src", "fragments-helper.svg");
 </script>
 </pre>
 </body>
 </html>
--- a/dom/svg/test/test_getCTM.html
+++ b/dom/svg/test/test_getCTM.html
@@ -31,17 +31,16 @@ function runTest() {
   var inner = doc.getElementById("inner");
   var g1 = doc.getElementById("g1");
   var outer = doc.getElementById("outer");
   var outer2 = doc.getElementById("outer2");
   var g2 = doc.getElementById("g2");
   var g3 = doc.getElementById("g3");
   var g4 = doc.getElementById("g4");
   var g5 = doc.getElementById("g5");
-  var sym = doc.getElementById("sym");
   var symbolRect = doc.getElementById("symbolRect");
   var fO = doc.getElementById("fO");
   /* Tests the consistency with nearestViewportElement
      (code is from test_viewport.html) */
   // root.nearestViewportElement == null
   is((function() { try { return root.getCTM(); } catch (e) { return e; } })(), null, "root.getCTM()");
   // inner.nearestViewportElement == root
   is((function() { try { return inner.getCTM().e; } catch (e) { return e; } })(), 1, "inner.getCTM().e");
--- a/dom/svg/test/test_markerOrient.xhtml
+++ b/dom/svg/test/test_markerOrient.xhtml
@@ -32,19 +32,19 @@ https://bugzilla.mozilla.org/show_bug.cg
        "orientAngle animVal for auto-start-reverse");
   }
 
   function testAngleIsSet(marker, angleVal) {
     is(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE,
        "orientType baseVal after numeric angle is set");
     is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE,
        "orientType animVal after numeric angle is set");
-    is(m.orientAngle.baseVal.value, angleVal,
+    is(marker.orientAngle.baseVal.value, angleVal,
        "orientAngle baseVal after numeric angle is set");
-    is(m.orientAngle.animVal.value, angleVal,
+    is(marker.orientAngle.animVal.value, angleVal,
        "orientAngle animVal after numeric angle is set");
   }
 
   function run() {
     var m = $("m");
 
     // Testing two conditions:
     // 1) If orient is set to a numeric angle and then set to auto or
--- a/dom/svg/test/test_non-scaling-stroke.html
+++ b/dom/svg/test/test_non-scaling-stroke.html
@@ -29,17 +29,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
   function startTest() {
     SimpleTest.waitForFocus(function() {
         disableNonTestMouseEvents(true);
-        var line = document.getElementById("line");
         // Send a click
         synthesizeMouseExpectEvent($("svg"), 170, 100, { },
                                    $("line"), "click",
                                    "Testing mouse event on non-scaling-stroke");
         disableNonTestMouseEvents(false);
         SimpleTest.finish();
     });
   }
--- a/dom/svg/test/test_pathAnimInterpolation.xhtml
+++ b/dom/svg/test/test_pathAnimInterpolation.xhtml
@@ -218,19 +218,19 @@ function addTest(aPrefixLength, aPrefix,
                  aAdditive) {
   var fromPath = aPrefix + aFromType + aFromArguments,
       toPath = aPrefix + aToType + aToArguments;
 
   var path = newSVGElement("path", { d: fromPath });
   var animate =
     newSVGElement("animate", { attributeName: "d",
                                from: fromPath,
-			       to: toPath,
-			       dur: "8s",
-			       additive: aAdditive ? "sum" : "replace" });
+                               to: toPath,
+                               dur: "8s",
+                               additive: aAdditive ? "sum" : "replace" });
   path.appendChild(animate);
   gSVG.appendChild(path);
 
   gTests.push({ element: path,
                 prefixLength: aPrefixLength,
                 from: fromPath,
                 to: toPath,
                 toType: aToType,
@@ -270,54 +270,54 @@ function run() {
           toType = typePair[1],
           fromArguments = suffixEntry[0],
           toArguments = suffixEntry[1],
           expectedArguments = suffixEntry[indexOfExpectedArguments];
 
       for (let prefixEntry of gPrefixes) {
         let [prefixLength, prefix] = prefixEntry;
         addTest(prefixLength, prefix, fromType, fromArguments,
-	        toType, toArguments, toType, expectedArguments, additive);
+                toType, toArguments, toType, expectedArguments, additive);
       }
     }
 
     // Test that differences in arc flag parameters cause the
     // interpolation/addition not to occur.
     addTest(1, "M100,100",
             "A", [10, 20, 30, 0, 0, 40, 50],
             "a", [60, 70, 80, 0, 1, 90, 100],
-	    "a", [60, 70, 80, 0, 1, 90, 100], additive);
+            "a", [60, 70, 80, 0, 1, 90, 100], additive);
     addTest(1, "M100,100",
             "A", [10, 20, 30, 0, 0, 40, 50],
             "a", [60, 70, 80, 1, 0, 90, 100],
-	    "a", [60, 70, 80, 1, 0, 90, 100], additive);
+            "a", [60, 70, 80, 1, 0, 90, 100], additive);
 
     // Test all pairs of segment types that cannot be interpolated between.
     for (let fromType of gTypes) {
       let fromArguments = generatePathSegmentArguments(fromType, 0);
       for (let toType of gTypes) {
         if (!isValidInterpolation(fromType, toType)) {
           let toArguments = generatePathSegmentArguments(toType, 1000);
           addTest(1, "M100,100", fromType, fromArguments,
-	          toType, toArguments, toType, toArguments, additive);
+          toType, toArguments, toType, toArguments, additive);
         }
       }
     }
   }
 
   // Move the document time to half way through the animations.
   gSVG.setCurrentTime(4);
 
   // Inspect the results of each subtest.
   for (let test of gTests) {
     let list = test.element.animatedPathSegList;
     is(list.numberOfItems, test.prefixLength + 1,
        "Length of animatedPathSegList for interpolation " +
          (test.usesAddition ? "with addition " : "") +
-	 " from " + test.from + " to " + test.to);
+         " from " + test.from + " to " + test.to);
 
     let seg = list.getItem(list.numberOfItems - 1);
     let propertyNames = argumentNames(test.expectedType);
 
     let actual = [];
     for (let i = 0; i < test.expected.length; i++) {
       actual.push(+seg[propertyNames[i]]);
     }
--- a/dom/svg/test/test_pointAtLength.xhtml
+++ b/dom/svg/test/test_pointAtLength.xhtml
@@ -17,17 +17,17 @@ function run() {
   var p1 = document.getElementById("p1");
   var point = p1.getPointAtLength(200);
   is(point.x, 200);
   is(point.y, 50);
 
   // set the pathLength to twice its actual length
   // and check that makes no difference
   p1.setAttribute("pathLength", "800");
-  var point = p1.getPointAtLength(200);
+  point = p1.getPointAtLength(200);
   is(point.x, 200);
   is(point.y, 50);
 
   SimpleTest.finish();
 }
 
 window.addEventListener("load", run);
 ]]>
--- a/dom/svg/test/test_pointer-events-2.xhtml
+++ b/dom/svg/test/test_pointer-events-2.xhtml
@@ -9,23 +9,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="run()">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function run() {
-  var svgDoc = document.getElementById("svg");
   var div = document.getElementById("div");
   // Get the coords of the origin of the SVG canvas:
   var originX = div.offsetLeft;
   var originY = div.offsetTop;
   var circle = document.getElementById("circle");
-  var path = document.getElementById("path");
 
   var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55);
   is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"');
 
   elementFromPoint = document.elementFromPoint(originX + 205, originY + 55);
   is(elementFromPoint, circle, "Over foreignObject, outside clip path");
 
   elementFromPoint = document.elementFromPoint(originX + 225, originY + 75);
--- a/dom/svg/test/test_pointer-events-3.xhtml
+++ b/dom/svg/test/test_pointer-events-3.xhtml
@@ -9,33 +9,32 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="run()">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function run() {
-  var svgDoc = document.getElementById("svg");
   var div = document.getElementById("div");
   // Get the coords of the origin of the SVG canvas:
   var originX = div.offsetLeft;
   var originY = div.offsetTop;
   var circle = document.getElementById("circle");
 
   var elementFromPoint = document.elementFromPoint(originX + 150, originY + 52);
   is(elementFromPoint, circle, "Top of circle should hit");
 
-  var elementFromPoint = document.elementFromPoint(originX + 249, originY + 150);
+  elementFromPoint = document.elementFromPoint(originX + 249, originY + 150);
   is(elementFromPoint, circle, "Right of circle should hit");
 
-  var elementFromPoint = document.elementFromPoint(originX + 150, originY + 249);
+  elementFromPoint = document.elementFromPoint(originX + 150, originY + 249);
   is(elementFromPoint, circle, "Bottom of circle should hit");
 
-  var elementFromPoint = document.elementFromPoint(originX + 51, originY + 150);
+  elementFromPoint = document.elementFromPoint(originX + 51, originY + 150);
   is(elementFromPoint, circle, "Left of circle should hit");
 
   SimpleTest.finish();
 }
 
 ]]>
 </script>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=762679">Mozilla Bug 762679</a>
--- a/dom/svg/test/test_pointer-events-4.xhtml
+++ b/dom/svg/test/test_pointer-events-4.xhtml
@@ -9,24 +9,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="run()">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function run() {
-  var svgDoc = document.getElementById("svg");
   var div = document.getElementById("div");
   // Get the coords of the origin of the SVG canvas:
   var originX = div.offsetLeft;
   var originY = div.offsetTop;
   var r1 = document.getElementById("r1");
   var r2 = document.getElementById("r2");
   var element;
+  var background = document.getElementById("background");
 
   // Test r1 just outsite the clip area:
 
   element = document.elementFromPoint(originX + 19, originY + 19);
   is(element, background, "Should not hit top-left of r1");
 
   element = document.elementFromPoint(originX + 101, originY + 19);
   is(element, background, "Should not hit top-right of r1");
--- a/dom/svg/test/test_pointer-events-5.xhtml
+++ b/dom/svg/test/test_pointer-events-5.xhtml
@@ -9,23 +9,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="run()">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function run() {
-  var svgDoc = document.getElementById("svg");
   var div = document.getElementById("div");
   // Get the coords of the origin of the SVG canvas:
   var originX = div.offsetLeft;
   var originY = div.offsetTop;
   var circle = document.getElementById("circle");
-  var path = document.getElementById("path");
 
   var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55);
   is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"');
 
   elementFromPoint = document.elementFromPoint(originX + 205, originY + 55);
   is(elementFromPoint, circle, "Over foreignObject, outside clip path");
 
   elementFromPoint = document.elementFromPoint(originX + 225, originY + 75);
--- a/dom/svg/test/test_pointer-events-7.xhtml
+++ b/dom/svg/test/test_pointer-events-7.xhtml
@@ -9,24 +9,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="run()">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function run() {
-  var svgDoc = document.getElementById("svg");
   var div = document.getElementById("div");
   // Get the coords of the origin of the SVG canvas:
   var originX = div.offsetLeft;
   var originY = div.offsetTop;
   var image4 = document.getElementById("image4");
   var image5 = document.getElementById("image5");
   var element;
+  var background = document.getElementById("background");
 
   element = document.elementFromPoint(originX + 20, originY + 20);
   is(element, background, "Should not hit visibility:hidden image by default");
 
   element = document.elementFromPoint(originX + 120, originY + 20);
   is(element, background, "Should not hit pointer-events:none image");
 
   element = document.elementFromPoint(originX + 220, originY + 20);
--- a/dom/svg/test/test_scientific.html
+++ b/dom/svg/test/test_scientific.html
@@ -14,70 +14,69 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none"></div>
 
 <iframe id="svg" src="scientific-helper.svg"></iframe>
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
 	SimpleTest.waitForExplicitFinish();
 
-	function runTests() 	{
-	var doc = $("svg").contentWindow.document;
-	var rect = doc.getElementById("rect");
-	var text = doc.getElementById("text");
+	function runTests() {
+	  var doc = $("svg").contentWindow.document;
+	  var rect = doc.getElementById("rect");
 
-	// ordinary
+	  // ordinary
 
-	rect.setAttribute("stroke-width", "5");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Ordinary");
+	  rect.setAttribute("stroke-width", "5");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Ordinary");
 
-	// valid exponential notation
+	  // valid exponential notation
 
-	rect.setAttribute("stroke-width", "4E1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Exponent");
+	  rect.setAttribute("stroke-width", "4E1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Exponent");
 
-	rect.setAttribute("stroke-width", "6e1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "60px", "Lower-case Exponent");
+	  rect.setAttribute("stroke-width", "6e1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "60px", "Lower-case Exponent");
 
-	rect.setAttribute("stroke-width", "2E+1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "20px", "Positive Exponent");
+	  rect.setAttribute("stroke-width", "2E+1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "20px", "Positive Exponent");
 
-	rect.setAttribute("stroke-width", "100E-1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "10px", "Negative Exponent");
+	  rect.setAttribute("stroke-width", "100E-1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "10px", "Negative Exponent");
 
-	rect.setAttribute("stroke-width", "0.7E1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "7px", "Floating Point with Exponent");
+	  rect.setAttribute("stroke-width", "0.7E1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "7px", "Floating Point with Exponent");
 
-	rect.setAttribute("stroke-width", "50.0E-1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Floating Point with Negative Exponent");
+	  rect.setAttribute("stroke-width", "50.0E-1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Floating Point with Negative Exponent");
 
-	rect.setAttribute("stroke-width", "0.8E+1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "8px", "Floating Point with Positive Exponent");
+	  rect.setAttribute("stroke-width", "0.8E+1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "8px", "Floating Point with Positive Exponent");
 
-	rect.setAttribute("stroke-width", "4E1px");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Units");
+	  rect.setAttribute("stroke-width", "4E1px");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Units");
 
-	// check units that begin with the letter e
+	  // check units that begin with the letter e
 
-	var font_size = doc.defaultView.getComputedStyle(rect).getPropertyValue("font-size");
+	  var font_size = doc.defaultView.getComputedStyle(rect).getPropertyValue("font-size");
 
-	rect.setAttribute("stroke-width", "1em");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), font_size, "em Units");
+	  rect.setAttribute("stroke-width", "1em");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), font_size, "em Units");
 
-	// invalid exponential notation
+	  // invalid exponential notation
 
-	rect.setAttribute("stroke-width", "1E1.1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Floating Point Exponent");
+	  rect.setAttribute("stroke-width", "1E1.1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Floating Point Exponent");
 
-	rect.setAttribute("stroke-width", "E1");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "No Mantissa");
+	  rect.setAttribute("stroke-width", "E1");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "No Mantissa");
 
-	rect.setAttribute("stroke-width", "1 e");
-	is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Spaces");
+	  rect.setAttribute("stroke-width", "1 e");
+	  is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Spaces");
 
-	SimpleTest.finish();
+	  SimpleTest.finish();
 	}
 
 	window.addEventListener("load", runTests);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/svg/test/test_stroke-linecap-hit-testing.xhtml
+++ b/dom/svg/test/test_stroke-linecap-hit-testing.xhtml
@@ -9,17 +9,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="run()">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function run() {
-  var svg = document.getElementById("svg");
   var div = document.getElementById("div");
   var x = div.offsetLeft;
   var y = div.offsetTop;
   var got, expected;
 
   got = document.elementFromPoint(5 + x, 5 + y);
   expected = document.getElementById("zero-length-square-caps");
   is(got, expected, "Check hit on zero length subpath's square caps");
--- a/dom/svg/test/test_text_lengthAdjust.html
+++ b/dom/svg/test/test_text_lengthAdjust.html
@@ -31,17 +31,17 @@ function runTest() {
 
   // get the original length
   var length = text.getComputedTextLength();
 
   // get the original glyph positions
   var startPositions = [],
       endPositions = [],
       extents = [];
-  for (var i = 0; i < 3; i++) {
+  for (let i = 0; i < 3; i++) {
     startPositions.push(text.getStartPositionOfChar(i));
     endPositions.push(text.getEndPositionOfChar(i));
     extents.push(text.getExtentOfChar(i));
   }
 
   // widths should all be the same
   is(extents[0].width, extents[1].width);
   is(extents[0].width, extents[2].width);
@@ -49,17 +49,17 @@ function runTest() {
   var checkCharNumAtPosition = function(x, y, i) {
     var p = document.querySelector("svg").createSVGPoint();
     p.x = x;
     p.y = y;
     is(text.getCharNumAtPosition(p), i, "getCharNumAtPosition(" + i + ")");
   };
 
   var checkPositions = function(start, end, width) {
-    for (var i = 0; i < 3; i++) {
+    for (let i = 0; i < 3; i++) {
       // check their positions
       close(text.getStartPositionOfChar(i).x, start[i], "start position of glyph " + i);
       close(text.getEndPositionOfChar(i).x, end[i], "end position of glyph " + i);
       close(text.getExtentOfChar(i).x, start[i], "left edge of extent of glyph " + i);
       close(text.getExtentOfChar(i).width, width, "width of glyph " + i);
       checkCharNumAtPosition((start[i] + end[i]) / 2, 100, i);
     }
   };
--- a/dom/svg/test/test_text_scaled.html
+++ b/dom/svg/test/test_text_scaled.html
@@ -35,34 +35,25 @@ function runTest() {
   }
 
   var epsilon = 0.001;
 
   function isClose(a, b, str) {
     ok(Math.abs(a - b) < epsilon, str + " - " + b + " should be close to " + a);
   }
 
-  function isPoint(pt1, x, y, str) {
-    is(pt1.x, x, str + " x");
-    is(pt1.y, y, str + " y");
-  }
-
   function isPointCloseX(pt1, x, y, str) {
     isClose(pt1.x, x, str + " x");
     is(pt1.y, y, str + " y");
   }
 
   function ymost(r) {
     return r.y + r.height;
   }
 
-  function xmost(r) {
-    return r.x + r.width;
-  }
-
   var p = text1.getStartPositionOfChar(0);
 
   // Simple horizontal string
 
   is(text1.getNumberOfChars(), 3, "text1 length");
   ok(text1.getComputedTextLength() > 0, "text1 measured length");
   is(text1.getComputedTextLength(), text1.getSubStringLength(0, 3), "text1 substring length");
   isPointCloseX(text1.getStartPositionOfChar(0), 10, 400, "text1 char 0 start offset");
--- a/dom/svg/test/test_text_selection.html
+++ b/dom/svg/test/test_text_selection.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none"></div>
 
 <iframe src="text-helper-selection.svg" width="400" height="300"></iframe>
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
 SimpleTest.waitForExplicitFinish();
 
-var svg, doc, win, text, dragstart, dragend;
+var svg, doc, win, dragstart, dragend;
 
 function drag(fromX, fromY, toX, toY, show) {
   synthesizeMouse(doc.documentElement, fromX, fromY, { type: "mousemove" }, win);
   synthesizeMouse(doc.documentElement, fromX, fromY, { type: "mousedown" }, win);
   synthesizeMouse(doc.documentElement, toX, toY, { type: "mousemove" }, win);
   synthesizeMouse(doc.documentElement, toX, toY, { type: "mouseup" }, win);
 
   if (show) {
--- a/dom/svg/test/test_transform.xhtml
+++ b/dom/svg/test/test_transform.xhtml
@@ -140,17 +140,17 @@ function run() {
      "Got different matrix objects after manipulation");
 
   testCreateTransform();
 
   SimpleTest.finish();
 }
 
 function testCreateTransform() {
-  svg = $("svg");
+  var svg = $("svg");
   var t = svg.createSVGTransform();
   ok(t != svg.createSVGTransform(),
      "Got identical objects when creating new transform");
   checkTransform(t, SVGTransform.SVG_TRANSFORM_MATRIX,
                  1, 0, 0, 1, 0, 0, 0, "createSVGTransform");
 
   var m = svg.createSVGMatrix();
   m.a = 1;