From 10d17e21376062de459ad43b777e22de996e1d77 Mon Sep 17 00:00:00 2001 From: championshuttler Date: Wed, 6 Mar 2019 10:27:23 +0000 Subject: [PATCH] Bug 1508992 - Enable ESLint for dom/plugins/test/mochitest (Manual changes). r=Standard8,qdot Differential Revision: https://phabricator.services.mozilla.com/D20094 --HG-- extra : moz-landing-system : lando --- .eslintignore | 1 - .../test/mochitest/browser_bug1196539.js | 1 - .../test/mochitest/browser_pluginscroll.js | 6 +-- dom/plugins/test/mochitest/dialog_watcher.js | 6 ++- dom/plugins/test/mochitest/file_bug1245545.js | 3 +- .../test/mochitest/file_bug863792.html | 2 - dom/plugins/test/mochitest/hang_test.js | 9 ++-- dom/plugins/test/mochitest/hangui_iface.js | 4 ++ .../test/mochitest/test_bug1028200-1.html | 1 + .../test/mochitest/test_bug1028200-2.html | 1 + .../test/mochitest/test_bug1028200-3.html | 1 + .../test/mochitest/test_bug1028200-4.html | 1 + .../test/mochitest/test_bug1028200-5.html | 1 + .../test/mochitest/test_bug1028200-6.html | 1 + .../test/mochitest/test_bug1028200-7.html | 1 + .../test/mochitest/test_bug1245545.html | 2 +- .../test/mochitest/test_bug1307694.html | 4 +- .../test/mochitest/test_bug539565-1.html | 5 +- .../test/mochitest/test_bug539565-2.html | 9 ++-- .../test/mochitest/test_bug751809.html | 1 + .../test/mochitest/test_bug777098.html | 1 + .../test/mochitest/test_bug784131.html | 12 ++--- .../test/mochitest/test_bug967694.html | 2 +- .../test/mochitest/test_clear_site_data.html | 48 +++++++++---------- dom/plugins/test/mochitest/test_crashing.html | 4 +- dom/plugins/test/mochitest/test_hanging.html | 4 +- dom/plugins/test/mochitest/test_hangui.xul | 2 - .../test/mochitest/test_hidden_plugin.html | 3 +- .../mochitest/test_instance_re-parent.html | 1 + .../mochitest/test_npruntime_npnevaluate.html | 1 + .../mochitest/test_npruntime_npninvoke.html | 4 +- .../test_npruntime_npninvokedefault.html | 2 + dom/plugins/test/mochitest/test_object.html | 4 +- dom/plugins/test/mochitest/test_painting.html | 1 + .../test/mochitest/test_pluginstream_err.html | 2 +- .../test/mochitest/test_positioning.html | 4 +- .../test/mochitest/test_src_url_change.html | 2 +- .../test/mochitest/test_visibility.html | 2 + 38 files changed, 87 insertions(+), 72 deletions(-) diff --git a/.eslintignore b/.eslintignore index 949b5e77c18a..49121341f82e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -189,7 +189,6 @@ dom/network/** dom/payments/** dom/performance/** dom/permission/** -dom/plugins/test/mochitest/** dom/plugins/test/unit/** dom/promise/** dom/push/** diff --git a/dom/plugins/test/mochitest/browser_bug1196539.js b/dom/plugins/test/mochitest/browser_bug1196539.js index 092eec55514f..88c5b8605382 100644 --- a/dom/plugins/test/mochitest/browser_bug1196539.js +++ b/dom/plugins/test/mochitest/browser_bug1196539.js @@ -20,7 +20,6 @@ add_task(async function() { setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); - let testTab = gBrowser.selectedTab; let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html"); let homeTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home"); diff --git a/dom/plugins/test/mochitest/browser_pluginscroll.js b/dom/plugins/test/mochitest/browser_pluginscroll.js index 9ecc6c9c226a..63f0371b50e8 100644 --- a/dom/plugins/test/mochitest/browser_pluginscroll.js +++ b/dom/plugins/test/mochitest/browser_pluginscroll.js @@ -1,5 +1,7 @@ var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/"); +const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm"); + /** * tests for plugin windows and scroll */ @@ -56,7 +58,6 @@ add_task(async function() { setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); - let testTab = gBrowser.selectedTab; let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html"); result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { @@ -121,7 +122,6 @@ add_task(async function() { setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); - let testTab = gBrowser.selectedTab; let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_subframe_test.html"); result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { @@ -183,7 +183,6 @@ add_task(async function() { setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); - let testTab = gBrowser.selectedTab; let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html"); result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { @@ -248,7 +247,6 @@ add_task(async function() { setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); - let testTab = gBrowser.selectedTab; let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_subframe_test.html"); result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { diff --git a/dom/plugins/test/mochitest/dialog_watcher.js b/dom/plugins/test/mochitest/dialog_watcher.js index 44f9fb0a2f9f..7280ba5b96b0 100644 --- a/dom/plugins/test/mochitest/dialog_watcher.js +++ b/dom/plugins/test/mochitest/dialog_watcher.js @@ -1,3 +1,5 @@ +/* eslint-env mozilla/chrome-worker */ + const EVENT_OBJECT_SHOW = 0x8002; const EVENT_OBJECT_HIDE = 0x8003; const WINEVENT_OUTOFCONTEXT = 0; @@ -7,6 +9,7 @@ const INFINITE = 0xFFFFFFFF; const WAIT_OBJECT_0 = 0; const WAIT_TIMEOUT = 258; const PM_NOREMOVE = 0; +var user32; function DialogWatcher(titleText, onDialogStart, onDialogEnd) { this.titleText = titleText; @@ -116,6 +119,7 @@ DialogWatcher.prototype.getWindowText = function(hwnd) { if (this.getWindowTextW(hwnd, buffer, buffer.length)) { return buffer.readString(); } + return undefined; }; DialogWatcher.prototype.processWindowEvents = function(timeout) { @@ -147,7 +151,7 @@ DialogWatcher.prototype.processWindowEvents = function(timeout) { 0, callback, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); if (!hook) { - return; + return null; } // Check if the window is already showing var hwnd = this.findWindow(null, this.titleText); diff --git a/dom/plugins/test/mochitest/file_bug1245545.js b/dom/plugins/test/mochitest/file_bug1245545.js index c4816e14e427..89218feda6dd 100644 --- a/dom/plugins/test/mochitest/file_bug1245545.js +++ b/dom/plugins/test/mochitest/file_bug1245545.js @@ -1,3 +1,4 @@ +/* eslint-env mozilla/frame-script */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ @@ -17,5 +18,5 @@ function getTestPlugin(pluginName) { addMessageListener("check-plugin-unload", function(message) { var tag = getTestPlugin(); - var results = sendAsyncMessage("check-plugin-unload", tag.loaded); + sendAsyncMessage("check-plugin-unload", tag.loaded); }); diff --git a/dom/plugins/test/mochitest/file_bug863792.html b/dom/plugins/test/mochitest/file_bug863792.html index b5692497d3b2..4a6889a563ab 100644 --- a/dom/plugins/test/mochitest/file_bug863792.html +++ b/dom/plugins/test/mochitest/file_bug863792.html @@ -21,7 +21,6 @@ document.body.appendChild(i); i.addEventListener("load", function loaded() { var id = i.contentDocument; var e = id.createElement("embed"); - var callbackrun = false; e.width = 200; e.height = 200; e.type = "application/x-test"; @@ -33,7 +32,6 @@ i.addEventListener("load", function loaded() { ob.removeChild(i); id.body.clientTop; id.body.removeChild(e); - callbackrun = true; }); id.body.appendChild(e); e.clientTop; diff --git a/dom/plugins/test/mochitest/hang_test.js b/dom/plugins/test/mochitest/hang_test.js index 57d22d9de6a6..03b7b8b439dd 100644 --- a/dom/plugins/test/mochitest/hang_test.js +++ b/dom/plugins/test/mochitest/hang_test.js @@ -1,5 +1,6 @@ const {parseKeyValuePairsFromFile} = ChromeUtils.import("resource://gre/modules/KeyValueParser.jsm"); +var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var success = false; var observerFired = false; @@ -19,9 +20,7 @@ var testObserver = { isnot(pluginId, "", "got a non-empty plugin crash id"); // check plugin dump and extra files - let directoryService = - Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); - let profD = directoryService.get("ProfD", Ci.nsIFile); + let profD = Services.dirsvc.get("ProfD", Ci.nsIFile); profD.append("minidumps"); let pluginDumpFile = profD.clone(); pluginDumpFile.append(pluginId + ".dmp"); @@ -82,9 +81,7 @@ function onPluginCrashed(aEvent) { ok("submittedCrashReport" in aEvent, "submittedCrashReport is a property of event"); is(typeof aEvent.submittedCrashReport, "boolean", "submittedCrashReport is correct type"); - var os = Cc["@mozilla.org/observer-service;1"]. - getService(Ci.nsIObserverService); - os.removeObserver(testObserver, "plugin-crashed"); + Services.obs.removeObserver(testObserver, "plugin-crashed"); SimpleTest.finish(); } diff --git a/dom/plugins/test/mochitest/hangui_iface.js b/dom/plugins/test/mochitest/hangui_iface.js index 6eac8cc9229a..4e1455aaa954 100644 --- a/dom/plugins/test/mochitest/hangui_iface.js +++ b/dom/plugins/test/mochitest/hangui_iface.js @@ -1,10 +1,14 @@ +/* eslint-env mozilla/chrome-worker */ + var user32; var sendMessage; var getDlgItem; var messageBox; var watcher; +/* import-globals-from hangui_common.js */ importScripts("hangui_common.js"); +/* import-globals-from dialog_watcher.js */ importScripts("dialog_watcher.js"); function initCTypes() { diff --git a/dom/plugins/test/mochitest/test_bug1028200-1.html b/dom/plugins/test/mochitest/test_bug1028200-1.html index 94906fcba154..a1f0b72aa2f3 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-1.html +++ b/dom/plugins/test/mochitest/test_bug1028200-1.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1028200-2.html b/dom/plugins/test/mochitest/test_bug1028200-2.html index c041fad38b6b..4b60ffbf7be2 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-2.html +++ b/dom/plugins/test/mochitest/test_bug1028200-2.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1028200-3.html b/dom/plugins/test/mochitest/test_bug1028200-3.html index 2e227fa070c1..8b8368c3f040 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-3.html +++ b/dom/plugins/test/mochitest/test_bug1028200-3.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1028200-4.html b/dom/plugins/test/mochitest/test_bug1028200-4.html index 6d8a0b0828b5..818c09d71987 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-4.html +++ b/dom/plugins/test/mochitest/test_bug1028200-4.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1028200-5.html b/dom/plugins/test/mochitest/test_bug1028200-5.html index b414e4fdd631..a70f25240ecc 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-5.html +++ b/dom/plugins/test/mochitest/test_bug1028200-5.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1028200-6.html b/dom/plugins/test/mochitest/test_bug1028200-6.html index 025ee030f462..c0d1f92d988e 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-6.html +++ b/dom/plugins/test/mochitest/test_bug1028200-6.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1028200-7.html b/dom/plugins/test/mochitest/test_bug1028200-7.html index 650ee978a156..46b6a1345007 100644 --- a/dom/plugins/test/mochitest/test_bug1028200-7.html +++ b/dom/plugins/test/mochitest/test_bug1028200-7.html @@ -32,6 +32,7 @@ this.document.mozCancelFullScreen(); return fullScreenChange; } + return Promise.resolve(); }); /** diff --git a/dom/plugins/test/mochitest/test_bug1245545.html b/dom/plugins/test/mochitest/test_bug1245545.html index aaecd7935f15..f3248746f1ed 100644 --- a/dom/plugins/test/mochitest/test_bug1245545.html +++ b/dom/plugins/test/mochitest/test_bug1245545.html @@ -40,7 +40,7 @@ ok(true, "Test plugin unloaded in chrome process"); SimpleTest.finish(); } else { - var results = script.sendAsyncMessage("check-plugin-unload"); + script.sendAsyncMessage("check-plugin-unload"); } } testContentUnload(); diff --git a/dom/plugins/test/mochitest/test_bug1307694.html b/dom/plugins/test/mochitest/test_bug1307694.html index e0d33edf67fa..45745b609469 100644 --- a/dom/plugins/test/mochitest/test_bug1307694.html +++ b/dom/plugins/test/mochitest/test_bug1307694.html @@ -24,9 +24,9 @@ } function runTests() { - p = document.getElementById("plugin1"); + var p = document.getElementById("plugin1"); ok(p.setColor != undefined, "Static plugin parameter (salign/scale) ordering were correct"); - p2 = document.getElementById("plugin2"); + var p2 = document.getElementById("plugin2"); ok(p2.setColor != undefined, "Dynamic plugin parameter (salign/scale) ordering were correct"); SimpleTest.finish(); } diff --git a/dom/plugins/test/mochitest/test_bug539565-1.html b/dom/plugins/test/mochitest/test_bug539565-1.html index 0052f7060bc4..93b61ed15f98 100644 --- a/dom/plugins/test/mochitest/test_bug539565-1.html +++ b/dom/plugins/test/mochitest/test_bug539565-1.html @@ -22,12 +22,13 @@ function runTests() { waitedForPaint++; moveBy = -moveBy; $("abs").style.left = ($("abs").offsetLeft + moveBy) + "px"; - var x = document.documentElement.offsetHeight; + document.documentElement.offsetHeight; var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2; if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) { setTimeout(func, 0); - } else + } else { setTimeout(waitForPaintCountIncrement, 50); + } } waitForPaintCountIncrement(); } diff --git a/dom/plugins/test/mochitest/test_bug539565-2.html b/dom/plugins/test/mochitest/test_bug539565-2.html index 59d3269b40e9..e99e65b9b5d6 100644 --- a/dom/plugins/test/mochitest/test_bug539565-2.html +++ b/dom/plugins/test/mochitest/test_bug539565-2.html @@ -22,12 +22,13 @@ function runTests() { waitedForPaint++; moveBy = -moveBy; $("abs").style.left = ($("abs").offsetLeft + moveBy) + "px"; - var x = document.documentElement.offsetHeight; + document.documentElement.offsetHeight; var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2; if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) { setTimeout(func, 0); - } else + } else { setTimeout(waitForPaintCountIncrement, 50); + } } waitForPaintCountIncrement(); } @@ -76,7 +77,7 @@ function runTests() { var container = $("container"); container.style.MozTransformOrigin = "0px 0px"; container.style.MozTransform = "scale(0.5)"; - var x = document.documentElement.offsetHeight; + document.documentElement.offsetHeight; click(60, 52, function() { verify("4", 240, 208, test5); }); } function test5() { // fullZoom=2 + scale(2) @@ -84,7 +85,7 @@ function runTests() { var container = $("container"); container.style.MozTransformOrigin = "0px 0px"; container.style.MozTransform = "scale(2)"; - var x = document.documentElement.offsetHeight; + document.documentElement.offsetHeight; click(108, 112, function() { verify("5", 108, 112, endTest); }); } diff --git a/dom/plugins/test/mochitest/test_bug751809.html b/dom/plugins/test/mochitest/test_bug751809.html index 7c04cfff4bf5..5703e481a8ed 100644 --- a/dom/plugins/test/mochitest/test_bug751809.html +++ b/dom/plugins/test/mochitest/test_bug751809.html @@ -47,6 +47,7 @@ // Triggering a paint and waiting for it to be flushed makes sure // that both plugin and platform see the plugin element as visible. // See bug 805330 for details. + /* global waitForAllPaintsFlushed */ plugin.setColor("FF000088"); waitForAllPaintsFlushed(afterPaintsFlushed); } diff --git a/dom/plugins/test/mochitest/test_bug777098.html b/dom/plugins/test/mochitest/test_bug777098.html index 3863a13e6c03..c2c78bcb50a5 100644 --- a/dom/plugins/test/mochitest/test_bug777098.html +++ b/dom/plugins/test/mochitest/test_bug777098.html @@ -27,6 +27,7 @@ function go() { // Force a re-instantiate by re-setting dummy uri, // making val a wrapper for a dead plugin + // eslint-disable-next-line no-self-assign plugin.data = plugin.data; // The correct behavior is an exception, if plugin.checkObjectValue succeeds diff --git a/dom/plugins/test/mochitest/test_bug784131.html b/dom/plugins/test/mochitest/test_bug784131.html index ff2dd19c17d9..c919d29d344b 100644 --- a/dom/plugins/test/mochitest/test_bug784131.html +++ b/dom/plugins/test/mochitest/test_bug784131.html @@ -58,10 +58,10 @@ nested_parent.style.display = "inherit"; // Ensure plugins are spawned - var body_obj = getObjectValue(body_embed); - var nested_obj = getObjectValue(nested_embed); - isnot(body_obj, null, "body plugin spawned"); - isnot(nested_obj, null, "nested plugin spawned"); + var body_objs = getObjectValue(body_embed); + var nested_objs = getObjectValue(nested_embed); + isnot(body_objs, null, "body plugin spawned"); + isnot(nested_objs, null, "nested plugin spawned"); // Take away frames again, flush layout, restore frames body_embed.style.display = "none"; @@ -75,8 +75,8 @@ // Spin event loop, ensure plugin remains running SimpleTest.executeSoon(function() { - ok(body_embed.checkObjectValue(body_obj), "body plugin still running"); - ok(nested_embed.checkObjectValue(nested_obj), "nested plugin still running"); + ok(body_embed.checkObjectValue(body_objs), "body plugin still running"); + ok(nested_embed.checkObjectValue(nested_objs), "nested plugin still running"); SimpleTest.finish(); }); }); diff --git a/dom/plugins/test/mochitest/test_bug967694.html b/dom/plugins/test/mochitest/test_bug967694.html index 8a7602134dfb..f4000d3e66f9 100644 --- a/dom/plugins/test/mochitest/test_bug967694.html +++ b/dom/plugins/test/mochitest/test_bug967694.html @@ -52,7 +52,7 @@ ok(thrown, "Function call should have thrown"); ok(!spPlugin.hasRunningPlugin, "Plugin should not have spawned"); // Try property access from content -var hi = plugin._testShouldntExistContent; +hi = plugin._testShouldntExistContent; ok(spPlugin.hasRunningPlugin, "Should've caused plugin to spawn"); // Property set diff --git a/dom/plugins/test/mochitest/test_clear_site_data.html b/dom/plugins/test/mochitest/test_clear_site_data.html index 4c9065654441..a2e438a2db1b 100644 --- a/dom/plugins/test/mochitest/test_clear_site_data.html +++ b/dom/plugins/test/mochitest/test_clear_site_data.html @@ -76,28 +76,28 @@ ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]), "Data stored for sites"); - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 4, {callback() { test2(); }}); + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_CACHE, 4, {callback() { test2(); }}); } function test2() { ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]), "Data stored for sites"); // Clear cache data 5 seconds or older. - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 5, {callback() { test3(); }}); + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_CACHE, 5, {callback() { test3(); }}); } function test3() { ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]), "Data stored for sites"); ok(!stored(["qux.com"]), "Data cleared for qux.com"); // Clear cache data for foo.com, but leave non-cache data. - pluginHost.clearSiteData(pluginTag, "foo.com", FLAG_CLEAR_CACHE, 20, {callback() { test4(); }}); + pluginHost.clearSiteData(this.pluginTag, "foo.com", FLAG_CLEAR_CACHE, 20, {callback() { test4(); }}); } function test4() { ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]), "Data stored for sites"); // Clear all data 7 seconds or older. - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 7, {callback() { test5(); }}); + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_ALL, 7, {callback() { test5(); }}); } function test5() { ok(stored(["bar.com", "baz.com", "quz.com"]), "Data stored for sites"); @@ -105,58 +105,58 @@ ok(!stored(["qux.com"]), "Data cleared for qux.com"); // Clear all cache data. - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback() { test6(); }}); + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback() { test6(); }}); } function test6() { ok(stored(["bar.com", "baz.com"]), "Data stored for sites"); ok(!stored(["quz.com"]), "Data cleared for quz.com"); // Clear all data for bar.com. - pluginHost.clearSiteData(pluginTag, "bar.com", FLAG_CLEAR_ALL, 20, {callback(rv) { test7(rv); }}); + pluginHost.clearSiteData(this.pluginTag, "bar.com", FLAG_CLEAR_ALL, 20, {callback(rv) { test7(rv); }}); } - function test7(rv) { + function test7() { ok(stored(["baz.com"]), "Data stored for baz.com"); ok(!stored(["bar.com"]), "Data cleared for bar.com"); // Disable clearing by age. p.setSitesWithDataCapabilities(false); - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 20, {callback(rv) { + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_ALL, 20, {callback(rv) { is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); test8(rv); }}); } - function test8(rv) { - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback(rv) { + function test8() { + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback(rv) { is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); test9(rv); }}); } - function test9(rv) { - pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, 20, {callback(rv) { + function test9() { + pluginHost.clearSiteData(this.pluginTag, "baz.com", FLAG_CLEAR_ALL, 20, {callback(rv) { is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); test10(rv); }}); } - function test10(rv) { - pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, 20, {callback(rv) { + function test10() { + pluginHost.clearSiteData(this.pluginTag, "baz.com", FLAG_CLEAR_CACHE, 20, {callback(rv) { is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); test11(); }}); } function test11() { // Clear cache for baz.com and globally for all ages. - pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, -1, {callback(rv) { test12(); }}); + pluginHost.clearSiteData(this.pluginTag, "baz.com", FLAG_CLEAR_CACHE, -1, {callback(rv) { test12(); }}); } function test12() { - pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, -1, {callback(rv) { test13(); }}); + pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_CACHE, -1, {callback(rv) { test13(); }}); } function test13() { // Check that all of the above were no-ops. ok(stored(["baz.com"]), "Data stored for baz.com"); // Clear everything for baz.com. - pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test14(); }}); + pluginHost.clearSiteData(this.pluginTag, "baz.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test14(); }}); } function test14() { ok(!stored(["baz.com"]), "Data cleared for baz.com"); @@ -175,7 +175,7 @@ "Data stored for sites"); // Clear data for "foo.com" and its subdomains. - pluginHost.clearSiteData(pluginTag, "foo.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test15(); }}); + pluginHost.clearSiteData(this.pluginTag, "foo.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test15(); }}); } function test15() { ok(stored(["bar.com", "192.168.1.1", "localhost"]), "Data stored for sites"); @@ -183,19 +183,19 @@ ok(!stored(["bar.foo.com"]), "Data cleared for subdomains of foo.com"); // Clear data for "bar.com" using a subdomain. - pluginHost.clearSiteData(pluginTag, "foo.bar.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test16(); }}); + pluginHost.clearSiteData(this.pluginTag, "foo.bar.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test16(); }}); } function test16() { ok(!stored(["bar.com"]), "Data cleared for bar.com"); // Clear data for "192.168.1.1". - pluginHost.clearSiteData(pluginTag, "192.168.1.1", FLAG_CLEAR_ALL, -1, {callback(rv) { test17(); }}); + pluginHost.clearSiteData(this.pluginTag, "192.168.1.1", FLAG_CLEAR_ALL, -1, {callback(rv) { test17(); }}); } function test17() { ok(!stored(["192.168.1.1"]), "Data cleared for 192.168.1.1"); // Clear data for "localhost". - pluginHost.clearSiteData(pluginTag, "localhost", FLAG_CLEAR_ALL, -1, {callback(rv) { test18(); }}); + pluginHost.clearSiteData(this.pluginTag, "localhost", FLAG_CLEAR_ALL, -1, {callback(rv) { test18(); }}); } function test18() { ok(!stored(null), "All data cleared"); @@ -211,14 +211,14 @@ "Data stored for sites"); // Clear data for the UTF-8 version. - pluginHost.clearSiteData(pluginTag, "b\u00FCcher.es", FLAG_CLEAR_ALL, -1, {callback(rv) { test19(); }}); + pluginHost.clearSiteData(this.pluginTag, "b\u00FCcher.es", FLAG_CLEAR_ALL, -1, {callback(rv) { test19(); }}); } function test19() { ok(!stored(["b\u00FCcher.es"]), "Data cleared for UTF-8 representation"); ok(!stored(["xn--bcher-kva.es"]), "Data cleared for ACE representation"); // Clear data for the ACE version. - pluginHost.clearSiteData(pluginTag, "xn--bcher-kva.uk", FLAG_CLEAR_ALL, -1, {callback(rv) { test20(); }}); + pluginHost.clearSiteData(this.pluginTag, "xn--bcher-kva.uk", FLAG_CLEAR_ALL, -1, {callback(rv) { test20(); }}); } function test20() { ok(!stored(["b\u00FCcher.uk"]), "Data cleared for UTF-8 representation"); @@ -229,7 +229,7 @@ // strictly required, we test it here. ok(stored(["b\u00FCcher.nz", "xn--bcher-kva.nz"]), "Data stored for sites"); - pluginHost.clearSiteData(pluginTag, "b\u00FCcher.nz", FLAG_CLEAR_ALL, -1, {callback(rv) { test21(); }}); + pluginHost.clearSiteData(this.pluginTag, "b\u00FCcher.nz", FLAG_CLEAR_ALL, -1, {callback(rv) { test21(); }}); } function test21() { ok(!stored(["b\u00FCcher.nz"]), "Data cleared for UTF-8 representation"); diff --git a/dom/plugins/test/mochitest/test_crashing.html b/dom/plugins/test/mochitest/test_crashing.html index 3270b4ad9562..ccf13a228748 100644 --- a/dom/plugins/test/mochitest/test_crashing.html +++ b/dom/plugins/test/mochitest/test_crashing.html @@ -41,9 +41,9 @@ } window.frameLoaded = function reloaded() { - var p = iframe.contentDocument.getElementById("plugin1"); + var p1 = iframe.contentDocument.getElementById("plugin1"); try { - p.setColor("FF00FF00"); + p1.setColor("FF00FF00"); ok(true, "Reloading worked"); } catch (e) { ok(false, "Reloading didn't give us a usable plugin"); diff --git a/dom/plugins/test/mochitest/test_hanging.html b/dom/plugins/test/mochitest/test_hanging.html index 49cf66e4997c..b4188b2ad35b 100644 --- a/dom/plugins/test/mochitest/test_hanging.html +++ b/dom/plugins/test/mochitest/test_hanging.html @@ -35,9 +35,9 @@ } window.frameLoaded = function reloaded() { - var p = iframe.contentDocument.getElementById("plugin1"); + var p1 = iframe.contentDocument.getElementById("plugin1"); try { - p.setColor("FF00FF00"); + p1.setColor("FF00FF00"); ok(true, "Reloading worked"); } catch (e) { ok(false, "Reloading didn't give us a usable plugin"); diff --git a/dom/plugins/test/mochitest/test_hangui.xul b/dom/plugins/test/mochitest/test_hangui.xul index fc9de4e7bff8..9ad3fcc00297 100644 --- a/dom/plugins/test/mochitest/test_hangui.xul +++ b/dom/plugins/test/mochitest/test_hangui.xul @@ -26,8 +26,6 @@ SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal", true]]}); setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); -const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); - const hangUITimeoutPref = "dom.ipc.plugins.hangUITimeoutSecs"; const hangUIMinDisplayPref = "dom.ipc.plugins.hangUIMinDisplaySecs"; const timeoutPref = "dom.ipc.plugins.timeoutSecs"; diff --git a/dom/plugins/test/mochitest/test_hidden_plugin.html b/dom/plugins/test/mochitest/test_hidden_plugin.html index 1445fa98f328..1106b8e07c9c 100644 --- a/dom/plugins/test/mochitest/test_hidden_plugin.html +++ b/dom/plugins/test/mochitest/test_hidden_plugin.html @@ -14,10 +14,9 @@ let ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(SpecialPowers.Ci.nsIPluginHost); let plugins = ph.getPluginTags(); let testPluginName = plugins[0].name; - let oldPrefVal = null; let prefName = "plugins.navigator.hidden_ctp_plugin"; try { - oldPrefVal = SpecialPowers.getCharPref(prefName); + SpecialPowers.getCharPref(prefName); } catch (ex) {} let promise = SpecialPowers.pushPrefEnv({ set: [[prefName, testPluginName]]}); promise.then(function() { diff --git a/dom/plugins/test/mochitest/test_instance_re-parent.html b/dom/plugins/test/mochitest/test_instance_re-parent.html index 9314d2d71146..3cf68b94593b 100644 --- a/dom/plugins/test/mochitest/test_instance_re-parent.html +++ b/dom/plugins/test/mochitest/test_instance_re-parent.html @@ -29,6 +29,7 @@ d1.appendChild(p); // Forces the plugin to be respawned + // eslint-disable-next-line no-self-assign p.src = p.src; destroyed = false; diff --git a/dom/plugins/test/mochitest/test_npruntime_npnevaluate.html b/dom/plugins/test/mochitest/test_npruntime_npnevaluate.html index 2b587a2f314e..e55a04b83b80 100644 --- a/dom/plugins/test/mochitest/test_npruntime_npnevaluate.html +++ b/dom/plugins/test/mochitest/test_npruntime_npnevaluate.html @@ -39,6 +39,7 @@ ["function test() { return 3; } test();", 3], ["testMe(3)", 6], ["testMe(new Object(3))", 6], + // eslint-disable-next-line no-new-object ["new Object(3)", new Object(3)], ["new Array(1, 2, 3, 4)", [1, 2, 3, 4]], ["document.getElementById('display')", diff --git a/dom/plugins/test/mochitest/test_npruntime_npninvoke.html b/dom/plugins/test/mochitest/test_npruntime_npninvoke.html index 53e6473de2e8..72b6c47f489d 100644 --- a/dom/plugins/test/mochitest/test_npruntime_npninvoke.html +++ b/dom/plugins/test/mochitest/test_npruntime_npninvoke.html @@ -26,8 +26,8 @@ function returnArgs() { if (arguments.length == 1) return arguments[0]; - var arr = new Array(); - for (i = 0; i < arguments.length; i++) { + var arr = []; + for (var i = 0; i < arguments.length; i++) { arr.push(arguments[i]); } return arr; diff --git a/dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html b/dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html index 5d91dfd24095..c8b7bf7fe740 100644 --- a/dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html +++ b/dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html @@ -48,6 +48,7 @@ ["Boolean", true, true], ["Boolean", "true", true], ["Boolean", "false", true], + /* eslint-disable no-new-wrappers */ ["Boolean", new Boolean(false), true], ["Boolean", { "value": false }, true], // Function object @@ -60,6 +61,7 @@ ["Object", Boolean(), new Boolean(false)], ["Object", "a string", new String("a string")], ["Object", 3.14, new Number(3.14)], + /* eslint-enable no-new-wrappers */ ["Object", { "key1": "test", "key2": 15 }, { "key1": "test", "key2": 15 }], ["Object", [1, 3, 5, 7, 9, 11, 13, 17], [1, 3, 5, 7, 9, 11, 13, 17]], // RegExp object diff --git a/dom/plugins/test/mochitest/test_object.html b/dom/plugins/test/mochitest/test_object.html index 4759334b62ad..5ea868ac4969 100644 --- a/dom/plugins/test/mochitest/test_object.html +++ b/dom/plugins/test/mochitest/test_object.html @@ -244,7 +244,7 @@ function eachList() { }, }; - + // eslint-disable-next-line complexity function testObject(obj, state) { // If our test combination both sets noChannel but no explicit type // it shouldn't load ever. @@ -316,7 +316,7 @@ function eachList() { // should spawn synchronously. let scripted = false; try { - let x = obj.getObjectValue(); + obj.getObjectValue(); scripted = true; } catch (e) {} is(scripted, shouldBeSpawnable, "check plugin scriptability"); diff --git a/dom/plugins/test/mochitest/test_painting.html b/dom/plugins/test/mochitest/test_painting.html index ff84e7f66624..003e1b148146 100644 --- a/dom/plugins/test/mochitest/test_painting.html +++ b/dom/plugins/test/mochitest/test_painting.html @@ -86,6 +86,7 @@ function waitForPaint(func) { // Ensure the waiter has had a style change, so that this will // change its size and cause a paint. paint_waiter.style.backgroundColor = paint_waiter.style.backgroundColor == "blue" ? "yellow" : "blue"; + // eslint-disable-next-line no-unused-vars var flush = paint_waiter.offsetHeight; paint_waiter.style.height = "1px"; waitForPaintHelper(func); diff --git a/dom/plugins/test/mochitest/test_pluginstream_err.html b/dom/plugins/test/mochitest/test_pluginstream_err.html index 90c26ff82135..54a164d9c3b6 100644 --- a/dom/plugins/test/mochitest/test_pluginstream_err.html +++ b/dom/plugins/test/mochitest/test_pluginstream_err.html @@ -127,7 +127,7 @@ function continueTest() { var test = tests[Math.floor(index / 2)]; var p = gTestWindow.document.createElement("p"); - p.innerHTML = "Plugin Stream Test " + index; + p.textContent = "Plugin Stream Test " + Number(index); gTestWindow.document.getElementById("test").appendChild(p); if (test.frame) { diff --git a/dom/plugins/test/mochitest/test_positioning.html b/dom/plugins/test/mochitest/test_positioning.html index c0ef0991d01c..e59ce8098981 100644 --- a/dom/plugins/test/mochitest/test_positioning.html +++ b/dom/plugins/test/mochitest/test_positioning.html @@ -38,7 +38,7 @@ var startY; function doScroll() { - let [x, y, w, h] = p.getWindowPosition(); + let y = p.getWindowPosition()[1]; startY = y; scrollBy(0, kScrollAmount); @@ -46,7 +46,7 @@ } function checkScroll() { - let [x, y, w, h] = p.getWindowPosition(); + let y = p.getWindowPosition()[1]; is(y, startY - kScrollAmount, "Window should be informed of its new position."); SimpleTest.finish(); diff --git a/dom/plugins/test/mochitest/test_src_url_change.html b/dom/plugins/test/mochitest/test_src_url_change.html index af62ea89b99a..7ba6f7954b8f 100644 --- a/dom/plugins/test/mochitest/test_src_url_change.html +++ b/dom/plugins/test/mochitest/test_src_url_change.html @@ -17,7 +17,7 @@ } function runTests() { - p = document.getElementById("plugin1"); + var p = document.getElementById("plugin1"); p.startWatchingInstanceCount(); p.callOnDestroy(onDestroy); diff --git a/dom/plugins/test/mochitest/test_visibility.html b/dom/plugins/test/mochitest/test_visibility.html index 22159938213f..ff92c0a2c3e7 100644 --- a/dom/plugins/test/mochitest/test_visibility.html +++ b/dom/plugins/test/mochitest/test_visibility.html @@ -20,6 +20,8 @@ var didPaint = function() {}; + var p = null; + function startTest() { if (p.getPaintCount() < 1) { setTimeout(startTest, 0);