From 556504ff9305bf48fe001f9aab17407a20f4d4a8 Mon Sep 17 00:00:00 2001
From: Mark Banner
diff --git a/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html b/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html
index 36c8280b684f..b2ed66601545 100644
--- a/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html
+++ b/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html
@@ -71,15 +71,15 @@ add_task(async function() {
},
"SpecialPowers.spawn-subframe": () => {
return SpecialPowers.spawn(frame, [subframeSrc], async src => {
- let frame = this.content.document.createElement("iframe");
- frame.src = src;
- this.content.document.body.appendChild(frame);
+ let subFrame = this.content.document.createElement("iframe");
+ subFrame.src = src;
+ this.content.document.body.appendChild(subFrame);
await new Promise(resolve => {
- frame.addEventListener("load", resolve, { once: true });
+ subFrame.addEventListener("load", resolve, { once: true });
});
- await SpecialPowers.spawn(frame, [], () => {
+ await SpecialPowers.spawn(subFrame, [], () => {
Assert.equal(1, 2, "Thing");
Assert.equal(1, 1, "Hmm");
Assert.ok(true, "Yay.");
diff --git a/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSpawn.html b/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSpawn.html
index b385c01d55b6..851b9195610b 100644
--- a/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSpawn.html
+++ b/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSpawn.html
@@ -30,6 +30,7 @@
is(result, "Hello there.", "Got correct element text from frame");
+ /* eslint-disable no-shadow */
result = await SpecialPowers.spawn(frame, ["#hello"], selector => {
return SpecialPowers.spawn(content.parent, [selector], selector => {
let elem = content.document.querySelector(selector);
@@ -54,7 +55,7 @@
is(result, "Hello there.", "Got correct element text from browsing context");
- let line = 58; // Keep this in sync with the line number where the callback function starts.
+ let line = 59; // Keep this in sync with the line number where the callback function starts.
let callback = () => {
let e = new Error("Hello.");
return { filename: e.fileName, lineNumber: e.lineNumber };
diff --git a/testing/mochitest/tests/Harness_sanity/test_sanityEventUtils.html b/testing/mochitest/tests/Harness_sanity/test_sanityEventUtils.html
index a4894798e27b..f2436ab077b5 100644
--- a/testing/mochitest/tests/Harness_sanity/test_sanityEventUtils.html
+++ b/testing/mochitest/tests/Harness_sanity/test_sanityEventUtils.html
@@ -50,7 +50,7 @@ function starttest() {
$("testMouseEvent").addEventListener("click", doCheck, {once: true});
sendMouseEvent({type:'click'}, "testMouseEvent");
is(check, true, 'sendMouseEvent should dispatch click event');
-
+
check = false;
$("testKeyEvent").addEventListener("keypress", doCheck, {once: true});
$("testKeyEvent").focus();
@@ -58,12 +58,12 @@ function starttest() {
is($("testKeyEvent").value, "x", "sendChar should work");
is(check, true, "sendChar should dispatch keyPress");
$("testKeyEvent").value = "";
-
+
$("testStrEvent").focus();
sendString("string");
is($("testStrEvent").value, "string", "sendString should work");
$("testStrEvent").value = "";
-
+
var keydown = false;
var keypress = false;
$("testKeyEvent").focus();
@@ -76,7 +76,7 @@ function starttest() {
} else {
ok(keypress, "sendKey should dispatch keyPress even for non-printable key");
}
-
+
/* test synthesizeMouse* */
//focus trick enables us to run this in iframes
$("radioTarget1").addEventListener('focus', function (aEvent) {
@@ -97,22 +97,22 @@ function starttest() {
$("textBoxA").addEventListener("click", function() { check = true; });
synthesizeMouseAtCenter($("textBoxA"), {});
is(check, true, 'synthesizeMouse should dispatch mouse event');
-
+
check = false;
synthesizeMouseExpectEvent($("textBoxA"), 1, 1, {}, $("textBoxA"), "click", "synthesizeMouseExpectEvent should fire click event");
is(check, true, 'synthesizeMouse should dispatch mouse event');
}, {once: true});
$("textBoxA").focus();
-
+
/**
- * TODO: testing synthesizeWheel requires a setTimeout
+ * TODO: testing synthesizeWheel requires a setTimeout
* since there is delay between the scroll event and a check, so for now just test
* that we can successfully call it to avoid having setTimeout vary the runtime metric.
* Testing of this method is currently done here:
* toolkit/content/tests/chrome/test_mousescroll.xul
*/
synthesizeWheel($("scrollB"), 5, 5, {'deltaY': 10.0, deltaMode: WheelEvent.DOM_DELTA_LINE});
-
+
/* test synthesizeKey* */
check = false;
$("testKeyEvent").addEventListener("keypress", doCheck, {once:true});
@@ -150,18 +150,18 @@ function starttest() {
{ arg: "~", code: "Backquote", keyCode: KeyboardEvent.DOM_VK_BACK_QUOTE },
{ arg: "<", code: "Comma", keyCode: KeyboardEvent.DOM_VK_COMMA },
{ arg: ".", code: "Period", keyCode: KeyboardEvent.DOM_VK_PERIOD }]) {
- let keydown, keyup;
+ let testKeydown, keyup;
$("testKeyEvent").focus();
- $("testKeyEvent").addEventListener("keydown", (e) => { keydown = e; }, {once: true});
+ $("testKeyEvent").addEventListener("keydown", (e) => { testKeydown = e; }, {once: true});
$("testKeyEvent").addEventListener("keyup", (e) => { keyup = e; }, {once: true});
synthesizeKey(test.arg);
- is(keydown.code, test.code, `Synthesizing "${test.arg}" should set code value of "keydown" to "${test.code}"`);
- is(keydown.keyCode, test.keyCode, `Synthesizing "${test.arg}" should set keyCode value of "keydown" to "${test.keyCode}"`);
+ is(testKeydown.code, test.code, `Synthesizing "${test.arg}" should set code value of "keydown" to "${test.code}"`);
+ is(testKeydown.keyCode, test.keyCode, `Synthesizing "${test.arg}" should set keyCode value of "keydown" to "${test.keyCode}"`);
is(keyup.code, test.code, `Synthesizing "${test.arg}" key should set code value of "keyup" to "${test.code}"`);
is(keyup.keyCode, test.keyCode, `Synthesizing "${test.arg}" key should set keyCode value of "keyup" to "${test.keyCode}"`);
$("testKeyEvent").value = "";
}
-
+
/* test synthesizeComposition */
var description = "";
var keydownEvent = null;
@@ -272,7 +272,7 @@ function starttest() {
is(querySelectedText.text, "",
"query selected text event returns wrong selected text");
$("textBoxB").value = "";
-
+
querySelectedText = synthesizeQuerySelectedText();
ok(querySelectedText, "query selected text event result is null");
ok(querySelectedText.succeeded, "query selected text event failed");
diff --git a/testing/mochitest/tests/Harness_sanity/test_sanityException.html b/testing/mochitest/tests/Harness_sanity/test_sanityException.html
index c0e4368f0a5e..463f51d80eb4 100644
--- a/testing/mochitest/tests/Harness_sanity/test_sanityException.html
+++ b/testing/mochitest/tests/Harness_sanity/test_sanityException.html
@@ -9,6 +9,7 @@