diff --git a/.eslintignore b/.eslintignore index 8936c9986b7c..aaeca66ac124 100644 --- a/.eslintignore +++ b/.eslintignore @@ -191,7 +191,6 @@ dom/security/test/mixedcontentblocker/** dom/security/test/sri/** dom/serviceworkers/** dom/smil/** -dom/svg/** dom/tests/html/** dom/tests/mochitest/** @@ -213,6 +212,8 @@ 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/** diff --git a/dom/svg/test/MutationEventChecker.js b/dom/svg/test/MutationEventChecker.js index 5b80b8951292..4e6f5c0b2ebe 100644 --- a/dom/svg/test/MutationEventChecker.js +++ b/dom/svg/test/MutationEventChecker.js @@ -201,6 +201,7 @@ function MutationEventChecker() { case MutationEvent.REMOVAL: return "removal"; } + return "Unknown MutationEvent Type"; }; this._argToEventId = function(arg) { diff --git a/dom/svg/test/pointer-events.js b/dom/svg/test/pointer-events.js index d62a5728c2af..37e728ad0845 100644 --- a/dom/svg/test/pointer-events.js +++ b/dom/svg/test/pointer-events.js @@ -225,7 +225,7 @@ function make_log_msg(over, tag, attributes) { } 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) { @@ -258,7 +258,7 @@ function test_element(id, x, y, over /* bit flags indicating which area(s) of th } 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); @@ -286,7 +286,7 @@ function run_tests(subtest) { 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); diff --git a/dom/svg/test/test_SVGLengthList.xhtml b/dom/svg/test/test_SVGLengthList.xhtml index 0efd8119c061..f9e74da60c2b 100644 --- a/dom/svg/test/test_SVGLengthList.xhtml +++ b/dom/svg/test/test_SVGLengthList.xhtml @@ -40,7 +40,7 @@ function run_tests() { // Test mutation events // --- Initialization - eventChecker = new MutationEventChecker; + var eventChecker = new MutationEventChecker; eventChecker.watchAttr(text, "x"); eventChecker.expect("modify"); text.textContent = "abc"; diff --git a/dom/svg/test/test_SVGMatrix.xhtml b/dom/svg/test/test_SVGMatrix.xhtml index 74c7a11b5100..898780a2d472 100644 --- a/dom/svg/test/test_SVGMatrix.xhtml +++ b/dom/svg/test/test_SVGMatrix.xhtml @@ -40,7 +40,7 @@ function main() { } function testCreateMatrix() { - svg = $("svg"); + var svg = $("svg"); var m = svg.createSVGMatrix(); // Should be initialised to identity diff --git a/dom/svg/test/test_SVGNumberList.xhtml b/dom/svg/test/test_SVGNumberList.xhtml index 4dcf6720ac7b..4f61c79d4b8b 100644 --- a/dom/svg/test/test_SVGNumberList.xhtml +++ b/dom/svg/test/test_SVGNumberList.xhtml @@ -38,7 +38,7 @@ function run_tests() { // Test mutation events // --- Initialization - eventChecker = new MutationEventChecker; + var eventChecker = new MutationEventChecker; eventChecker.watchAttr(text, "rotate"); // -- Actual changes eventChecker.expect("modify modify"); diff --git a/dom/svg/test/test_SVGPointList.xhtml b/dom/svg/test/test_SVGPointList.xhtml index 042e2a6059d6..1cd0ca3cab25 100644 --- a/dom/svg/test/test_SVGPointList.xhtml +++ b/dom/svg/test/test_SVGPointList.xhtml @@ -39,7 +39,7 @@ function run_tests() { // Test mutation events // --- Initialization - eventChecker = new MutationEventChecker; + var eventChecker = new MutationEventChecker; eventChecker.watchAttr(polyline, "points"); // -- Actual changes eventChecker.expect("modify modify"); diff --git a/dom/svg/test/test_SVGTransformList.xhtml b/dom/svg/test/test_SVGTransformList.xhtml index cb401815095f..69ddbb4ab332 100644 --- a/dom/svg/test/test_SVGTransformList.xhtml +++ b/dom/svg/test/test_SVGTransformList.xhtml @@ -328,7 +328,6 @@ function testOrphan(g) { } ok(exception === null, "Unexpected exception " + exception + " modifying orphaned transform"); - uexception = null; // So should matrix exception = null; @@ -364,7 +363,7 @@ function testMutationEvents(g) { 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 diff --git a/dom/svg/test/test_SVGTransformListAddition.xhtml b/dom/svg/test/test_SVGTransformListAddition.xhtml index a54f7f703da0..e879268daf03 100644 --- a/dom/svg/test/test_SVGTransformListAddition.xhtml +++ b/dom/svg/test/test_SVGTransformListAddition.xhtml @@ -170,7 +170,7 @@ function createAnim(attrs) { 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; diff --git a/dom/svg/test/test_SVGxxxList.xhtml b/dom/svg/test/test_SVGxxxList.xhtml index 8145da5f114c..dda3ad1adbfb 100644 --- a/dom/svg/test/test_SVGxxxList.xhtml +++ b/dom/svg/test/test_SVGxxxList.xhtml @@ -370,7 +370,7 @@ function is_transform_attr(attr_name) { } function get_array_of_list_items(list) { - array = []; + let array = []; for (var i = 0; i < list.numberOfItems; ++i) { array.push(list.getItem(i)); } @@ -394,7 +394,7 @@ 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 res, threw; var eventChecker = new MutationEventChecker; for (var t of tests) { @@ -453,7 +453,7 @@ function run_baseVal_API_tests() { 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(); @@ -815,7 +815,7 @@ function run_animVal_API_tests() { // 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."); @@ -913,6 +913,7 @@ function run_basic_setAttribute_tests() { 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 " + @@ -920,6 +921,7 @@ function run_basic_setAttribute_tests() { "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 " + @@ -1299,7 +1301,7 @@ 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 (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]; @@ -1340,7 +1342,7 @@ function run_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 " + diff --git a/dom/svg/test/test_SVGxxxListIndexing.xhtml b/dom/svg/test/test_SVGxxxListIndexing.xhtml index 7dfd071f0f47..7d9e17d0df84 100644 --- a/dom/svg/test/test_SVGxxxListIndexing.xhtml +++ b/dom/svg/test/test_SVGxxxListIndexing.xhtml @@ -17,9 +17,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=631437 requiredFeatures="foo bar baz"/> diff --git a/dom/svg/test/test_getCTM.html b/dom/svg/test/test_getCTM.html index 88f044dc6b7f..0b2460a4e399 100644 --- a/dom/svg/test/test_getCTM.html +++ b/dom/svg/test/test_getCTM.html @@ -36,7 +36,6 @@ function runTest() { 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 diff --git a/dom/svg/test/test_markerOrient.xhtml b/dom/svg/test/test_markerOrient.xhtml index 71bca92885d1..92710960d802 100644 --- a/dom/svg/test/test_markerOrient.xhtml +++ b/dom/svg/test/test_markerOrient.xhtml @@ -37,9 +37,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=892372 "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"); } diff --git a/dom/svg/test/test_non-scaling-stroke.html b/dom/svg/test/test_non-scaling-stroke.html index 0abd8e660175..6639a148e7b1 100644 --- a/dom/svg/test/test_non-scaling-stroke.html +++ b/dom/svg/test/test_non-scaling-stroke.html @@ -34,7 +34,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=829085 function startTest() { SimpleTest.waitForFocus(function() { disableNonTestMouseEvents(true); - var line = document.getElementById("line"); // Send a click synthesizeMouseExpectEvent($("svg"), 170, 100, { }, $("line"), "click", diff --git a/dom/svg/test/test_pathAnimInterpolation.xhtml b/dom/svg/test/test_pathAnimInterpolation.xhtml index 6fd153446368..b6d6210ed696 100644 --- a/dom/svg/test/test_pathAnimInterpolation.xhtml +++ b/dom/svg/test/test_pathAnimInterpolation.xhtml @@ -223,9 +223,9 @@ function addTest(aPrefixLength, aPrefix, aFromType, aFromArguments, 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); @@ -275,7 +275,7 @@ function run() { for (let prefixEntry of gPrefixes) { let [prefixLength, prefix] = prefixEntry; addTest(prefixLength, prefix, fromType, fromArguments, - toType, toArguments, toType, expectedArguments, additive); + toType, toArguments, toType, expectedArguments, additive); } } @@ -284,11 +284,11 @@ function run() { 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) { @@ -297,7 +297,7 @@ function run() { 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); } } } @@ -312,7 +312,7 @@ function run() { 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); diff --git a/dom/svg/test/test_pointAtLength.xhtml b/dom/svg/test/test_pointAtLength.xhtml index dad3c235a087..adb0d343f1a1 100644 --- a/dom/svg/test/test_pointAtLength.xhtml +++ b/dom/svg/test/test_pointAtLength.xhtml @@ -22,7 +22,7 @@ function run() { // 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); diff --git a/dom/svg/test/test_pointer-events-2.xhtml b/dom/svg/test/test_pointer-events-2.xhtml index 0c638c78bc7a..bcfcaf5d0669 100644 --- a/dom/svg/test/test_pointer-events-2.xhtml +++ b/dom/svg/test/test_pointer-events-2.xhtml @@ -14,13 +14,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174 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"'); diff --git a/dom/svg/test/test_pointer-events-3.xhtml b/dom/svg/test/test_pointer-events-3.xhtml index 716c94c0ac48..5bf9b625506b 100644 --- a/dom/svg/test/test_pointer-events-3.xhtml +++ b/dom/svg/test/test_pointer-events-3.xhtml @@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=762679 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; @@ -24,13 +23,13 @@ function run() { 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(); diff --git a/dom/svg/test/test_pointer-events-4.xhtml b/dom/svg/test/test_pointer-events-4.xhtml index 171c0496593d..3207d2a11a8f 100644 --- a/dom/svg/test/test_pointer-events-4.xhtml +++ b/dom/svg/test/test_pointer-events-4.xhtml @@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=820506 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; @@ -22,6 +21,7 @@ function run() { var r1 = document.getElementById("r1"); var r2 = document.getElementById("r2"); var element; + var background = document.getElementById("background"); // Test r1 just outsite the clip area: diff --git a/dom/svg/test/test_pointer-events-5.xhtml b/dom/svg/test/test_pointer-events-5.xhtml index 0c638c78bc7a..bcfcaf5d0669 100644 --- a/dom/svg/test/test_pointer-events-5.xhtml +++ b/dom/svg/test/test_pointer-events-5.xhtml @@ -14,13 +14,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174 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"'); diff --git a/dom/svg/test/test_pointer-events-7.xhtml b/dom/svg/test/test_pointer-events-7.xhtml index bfeb9c4af4f9..b41ca668c58c 100644 --- a/dom/svg/test/test_pointer-events-7.xhtml +++ b/dom/svg/test/test_pointer-events-7.xhtml @@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1119698 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; @@ -22,6 +21,7 @@ function run() { 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"); diff --git a/dom/svg/test/test_scientific.html b/dom/svg/test/test_scientific.html index 187878cc0a42..c73f2c8ac88c 100644 --- a/dom/svg/test/test_scientific.html +++ b/dom/svg/test/test_scientific.html @@ -19,61 +19,60 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=302971