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
This commit is contained in:
championshuttler 2019-03-06 10:27:23 +00:00
parent 1bb1750150
commit 10d17e2137
38 changed files with 87 additions and 72 deletions

View file

@ -189,7 +189,6 @@ dom/network/**
dom/payments/** dom/payments/**
dom/performance/** dom/performance/**
dom/permission/** dom/permission/**
dom/plugins/test/mochitest/**
dom/plugins/test/unit/** dom/plugins/test/unit/**
dom/promise/** dom/promise/**
dom/push/** dom/push/**

View file

@ -20,7 +20,6 @@ add_task(async function() {
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
let testTab = gBrowser.selectedTab;
let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html"); let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html");
let homeTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home"); let homeTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");

View file

@ -1,5 +1,7 @@
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/"); 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 * tests for plugin windows and scroll
*/ */
@ -56,7 +58,6 @@ add_task(async function() {
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
let testTab = gBrowser.selectedTab;
let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html"); let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html");
result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { 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"); setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
let testTab = gBrowser.selectedTab;
let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_subframe_test.html"); let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_subframe_test.html");
result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { 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"); setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
let testTab = gBrowser.selectedTab;
let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html"); let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html");
result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { 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"); setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
let testTab = gBrowser.selectedTab;
let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_subframe_test.html"); let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_subframe_test.html");
result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() { result = await ContentTask.spawn(pluginTab.linkedBrowser, null, async function() {

View file

@ -1,3 +1,5 @@
/* eslint-env mozilla/chrome-worker */
const EVENT_OBJECT_SHOW = 0x8002; const EVENT_OBJECT_SHOW = 0x8002;
const EVENT_OBJECT_HIDE = 0x8003; const EVENT_OBJECT_HIDE = 0x8003;
const WINEVENT_OUTOFCONTEXT = 0; const WINEVENT_OUTOFCONTEXT = 0;
@ -7,6 +9,7 @@ const INFINITE = 0xFFFFFFFF;
const WAIT_OBJECT_0 = 0; const WAIT_OBJECT_0 = 0;
const WAIT_TIMEOUT = 258; const WAIT_TIMEOUT = 258;
const PM_NOREMOVE = 0; const PM_NOREMOVE = 0;
var user32;
function DialogWatcher(titleText, onDialogStart, onDialogEnd) { function DialogWatcher(titleText, onDialogStart, onDialogEnd) {
this.titleText = titleText; this.titleText = titleText;
@ -116,6 +119,7 @@ DialogWatcher.prototype.getWindowText = function(hwnd) {
if (this.getWindowTextW(hwnd, buffer, buffer.length)) { if (this.getWindowTextW(hwnd, buffer, buffer.length)) {
return buffer.readString(); return buffer.readString();
} }
return undefined;
}; };
DialogWatcher.prototype.processWindowEvents = function(timeout) { DialogWatcher.prototype.processWindowEvents = function(timeout) {
@ -147,7 +151,7 @@ DialogWatcher.prototype.processWindowEvents = function(timeout) {
0, callback, 0, 0, 0, callback, 0, 0,
WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
if (!hook) { if (!hook) {
return; return null;
} }
// Check if the window is already showing // Check if the window is already showing
var hwnd = this.findWindow(null, this.titleText); var hwnd = this.findWindow(null, this.titleText);

View file

@ -1,3 +1,4 @@
/* eslint-env mozilla/frame-script */
/* Any copyright is dedicated to the Public Domain. /* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */ http://creativecommons.org/publicdomain/zero/1.0/ */
@ -17,5 +18,5 @@ function getTestPlugin(pluginName) {
addMessageListener("check-plugin-unload", function(message) { addMessageListener("check-plugin-unload", function(message) {
var tag = getTestPlugin(); var tag = getTestPlugin();
var results = sendAsyncMessage("check-plugin-unload", tag.loaded); sendAsyncMessage("check-plugin-unload", tag.loaded);
}); });

View file

@ -21,7 +21,6 @@ document.body.appendChild(i);
i.addEventListener("load", function loaded() { i.addEventListener("load", function loaded() {
var id = i.contentDocument; var id = i.contentDocument;
var e = id.createElement("embed"); var e = id.createElement("embed");
var callbackrun = false;
e.width = 200; e.width = 200;
e.height = 200; e.height = 200;
e.type = "application/x-test"; e.type = "application/x-test";
@ -33,7 +32,6 @@ i.addEventListener("load", function loaded() {
ob.removeChild(i); ob.removeChild(i);
id.body.clientTop; id.body.clientTop;
id.body.removeChild(e); id.body.removeChild(e);
callbackrun = true;
}); });
id.body.appendChild(e); id.body.appendChild(e);
e.clientTop; e.clientTop;

View file

@ -1,5 +1,6 @@
const {parseKeyValuePairsFromFile} = ChromeUtils.import("resource://gre/modules/KeyValueParser.jsm"); const {parseKeyValuePairsFromFile} = ChromeUtils.import("resource://gre/modules/KeyValueParser.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var success = false; var success = false;
var observerFired = false; var observerFired = false;
@ -19,9 +20,7 @@ var testObserver = {
isnot(pluginId, "", "got a non-empty plugin crash id"); isnot(pluginId, "", "got a non-empty plugin crash id");
// check plugin dump and extra files // check plugin dump and extra files
let directoryService = let profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
let profD = directoryService.get("ProfD", Ci.nsIFile);
profD.append("minidumps"); profD.append("minidumps");
let pluginDumpFile = profD.clone(); let pluginDumpFile = profD.clone();
pluginDumpFile.append(pluginId + ".dmp"); pluginDumpFile.append(pluginId + ".dmp");
@ -82,9 +81,7 @@ function onPluginCrashed(aEvent) {
ok("submittedCrashReport" in aEvent, "submittedCrashReport is a property of event"); ok("submittedCrashReport" in aEvent, "submittedCrashReport is a property of event");
is(typeof aEvent.submittedCrashReport, "boolean", "submittedCrashReport is correct type"); is(typeof aEvent.submittedCrashReport, "boolean", "submittedCrashReport is correct type");
var os = Cc["@mozilla.org/observer-service;1"]. Services.obs.removeObserver(testObserver, "plugin-crashed");
getService(Ci.nsIObserverService);
os.removeObserver(testObserver, "plugin-crashed");
SimpleTest.finish(); SimpleTest.finish();
} }

View file

@ -1,10 +1,14 @@
/* eslint-env mozilla/chrome-worker */
var user32; var user32;
var sendMessage; var sendMessage;
var getDlgItem; var getDlgItem;
var messageBox; var messageBox;
var watcher; var watcher;
/* import-globals-from hangui_common.js */
importScripts("hangui_common.js"); importScripts("hangui_common.js");
/* import-globals-from dialog_watcher.js */
importScripts("dialog_watcher.js"); importScripts("dialog_watcher.js");
function initCTypes() { function initCTypes() {

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -32,6 +32,7 @@
this.document.mozCancelFullScreen(); this.document.mozCancelFullScreen();
return fullScreenChange; return fullScreenChange;
} }
return Promise.resolve();
}); });
/** /**

View file

@ -40,7 +40,7 @@
ok(true, "Test plugin unloaded in chrome process"); ok(true, "Test plugin unloaded in chrome process");
SimpleTest.finish(); SimpleTest.finish();
} else { } else {
var results = script.sendAsyncMessage("check-plugin-unload"); script.sendAsyncMessage("check-plugin-unload");
} }
} }
testContentUnload(); testContentUnload();

View file

@ -24,9 +24,9 @@
} }
function runTests() { function runTests() {
p = document.getElementById("plugin1"); var p = document.getElementById("plugin1");
ok(p.setColor != undefined, "Static plugin parameter (salign/scale) ordering were correct"); 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"); ok(p2.setColor != undefined, "Dynamic plugin parameter (salign/scale) ordering were correct");
SimpleTest.finish(); SimpleTest.finish();
} }

View file

@ -22,12 +22,13 @@ function runTests() {
waitedForPaint++; waitedForPaint++;
moveBy = -moveBy; moveBy = -moveBy;
$("abs").style.left = ($("abs").offsetLeft + moveBy) + "px"; $("abs").style.left = ($("abs").offsetLeft + moveBy) + "px";
var x = document.documentElement.offsetHeight; document.documentElement.offsetHeight;
var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2; var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2;
if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) { if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) {
setTimeout(func, 0); setTimeout(func, 0);
} else } else {
setTimeout(waitForPaintCountIncrement, 50); setTimeout(waitForPaintCountIncrement, 50);
}
} }
waitForPaintCountIncrement(); waitForPaintCountIncrement();
} }

View file

@ -22,12 +22,13 @@ function runTests() {
waitedForPaint++; waitedForPaint++;
moveBy = -moveBy; moveBy = -moveBy;
$("abs").style.left = ($("abs").offsetLeft + moveBy) + "px"; $("abs").style.left = ($("abs").offsetLeft + moveBy) + "px";
var x = document.documentElement.offsetHeight; document.documentElement.offsetHeight;
var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2; var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2;
if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) { if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) {
setTimeout(func, 0); setTimeout(func, 0);
} else } else {
setTimeout(waitForPaintCountIncrement, 50); setTimeout(waitForPaintCountIncrement, 50);
}
} }
waitForPaintCountIncrement(); waitForPaintCountIncrement();
} }
@ -76,7 +77,7 @@ function runTests() {
var container = $("container"); var container = $("container");
container.style.MozTransformOrigin = "0px 0px"; container.style.MozTransformOrigin = "0px 0px";
container.style.MozTransform = "scale(0.5)"; container.style.MozTransform = "scale(0.5)";
var x = document.documentElement.offsetHeight; document.documentElement.offsetHeight;
click(60, 52, function() { verify("4", 240, 208, test5); }); click(60, 52, function() { verify("4", 240, 208, test5); });
} }
function test5() { // fullZoom=2 + scale(2) function test5() { // fullZoom=2 + scale(2)
@ -84,7 +85,7 @@ function runTests() {
var container = $("container"); var container = $("container");
container.style.MozTransformOrigin = "0px 0px"; container.style.MozTransformOrigin = "0px 0px";
container.style.MozTransform = "scale(2)"; container.style.MozTransform = "scale(2)";
var x = document.documentElement.offsetHeight; document.documentElement.offsetHeight;
click(108, 112, function() { verify("5", 108, 112, endTest); }); click(108, 112, function() { verify("5", 108, 112, endTest); });
} }

View file

@ -47,6 +47,7 @@
// Triggering a paint and waiting for it to be flushed makes sure // Triggering a paint and waiting for it to be flushed makes sure
// that both plugin and platform see the plugin element as visible. // that both plugin and platform see the plugin element as visible.
// See bug 805330 for details. // See bug 805330 for details.
/* global waitForAllPaintsFlushed */
plugin.setColor("FF000088"); plugin.setColor("FF000088");
waitForAllPaintsFlushed(afterPaintsFlushed); waitForAllPaintsFlushed(afterPaintsFlushed);
} }

View file

@ -27,6 +27,7 @@ function go() {
// Force a re-instantiate by re-setting dummy uri, // Force a re-instantiate by re-setting dummy uri,
// making val a wrapper for a dead plugin // making val a wrapper for a dead plugin
// eslint-disable-next-line no-self-assign
plugin.data = plugin.data; plugin.data = plugin.data;
// The correct behavior is an exception, if plugin.checkObjectValue succeeds // The correct behavior is an exception, if plugin.checkObjectValue succeeds

View file

@ -58,10 +58,10 @@
nested_parent.style.display = "inherit"; nested_parent.style.display = "inherit";
// Ensure plugins are spawned // Ensure plugins are spawned
var body_obj = getObjectValue(body_embed); var body_objs = getObjectValue(body_embed);
var nested_obj = getObjectValue(nested_embed); var nested_objs = getObjectValue(nested_embed);
isnot(body_obj, null, "body plugin spawned"); isnot(body_objs, null, "body plugin spawned");
isnot(nested_obj, null, "nested plugin spawned"); isnot(nested_objs, null, "nested plugin spawned");
// Take away frames again, flush layout, restore frames // Take away frames again, flush layout, restore frames
body_embed.style.display = "none"; body_embed.style.display = "none";
@ -75,8 +75,8 @@
// Spin event loop, ensure plugin remains running // Spin event loop, ensure plugin remains running
SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() {
ok(body_embed.checkObjectValue(body_obj), "body plugin still running"); ok(body_embed.checkObjectValue(body_objs), "body plugin still running");
ok(nested_embed.checkObjectValue(nested_obj), "nested plugin still running"); ok(nested_embed.checkObjectValue(nested_objs), "nested plugin still running");
SimpleTest.finish(); SimpleTest.finish();
}); });
}); });

View file

@ -52,7 +52,7 @@ ok(thrown, "Function call should have thrown");
ok(!spPlugin.hasRunningPlugin, "Plugin should not have spawned"); ok(!spPlugin.hasRunningPlugin, "Plugin should not have spawned");
// Try property access from content // Try property access from content
var hi = plugin._testShouldntExistContent; hi = plugin._testShouldntExistContent;
ok(spPlugin.hasRunningPlugin, "Should've caused plugin to spawn"); ok(spPlugin.hasRunningPlugin, "Should've caused plugin to spawn");
// Property set // Property set

View file

@ -76,28 +76,28 @@
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]), ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]),
"Data stored for sites"); "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() { function test2() {
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]), ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]),
"Data stored for sites"); "Data stored for sites");
// Clear cache data 5 seconds or older. // 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() { function test3() {
ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]), ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]),
"Data stored for sites"); "Data stored for sites");
ok(!stored(["qux.com"]), "Data cleared for qux.com"); ok(!stored(["qux.com"]), "Data cleared for qux.com");
// Clear cache data for foo.com, but leave non-cache data. // 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() { function test4() {
ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]), ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]),
"Data stored for sites"); "Data stored for sites");
// Clear all data 7 seconds or older. // 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() { function test5() {
ok(stored(["bar.com", "baz.com", "quz.com"]), "Data stored for sites"); 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"); ok(!stored(["qux.com"]), "Data cleared for qux.com");
// Clear all cache data. // 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() { function test6() {
ok(stored(["bar.com", "baz.com"]), "Data stored for sites"); ok(stored(["bar.com", "baz.com"]), "Data stored for sites");
ok(!stored(["quz.com"]), "Data cleared for quz.com"); ok(!stored(["quz.com"]), "Data cleared for quz.com");
// Clear all data for bar.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(["baz.com"]), "Data stored for baz.com");
ok(!stored(["bar.com"]), "Data cleared for bar.com"); ok(!stored(["bar.com"]), "Data cleared for bar.com");
// Disable clearing by age. // Disable clearing by age.
p.setSitesWithDataCapabilities(false); 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); is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
test8(rv); test8(rv);
}}); }});
} }
function test8(rv) { function test8() {
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback(rv) { pluginHost.clearSiteData(this.pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback(rv) {
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
test9(rv); test9(rv);
}}); }});
} }
function test9(rv) { function test9() {
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, 20, {callback(rv) { pluginHost.clearSiteData(this.pluginTag, "baz.com", FLAG_CLEAR_ALL, 20, {callback(rv) {
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
test10(rv); test10(rv);
}}); }});
} }
function test10(rv) { function test10() {
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, 20, {callback(rv) { pluginHost.clearSiteData(this.pluginTag, "baz.com", FLAG_CLEAR_CACHE, 20, {callback(rv) {
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED); is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
test11(); test11();
}}); }});
} }
function test11() { function test11() {
// Clear cache for baz.com and globally for all ages. // 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() { 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() { function test13() {
// Check that all of the above were no-ops. // Check that all of the above were no-ops.
ok(stored(["baz.com"]), "Data stored for baz.com"); ok(stored(["baz.com"]), "Data stored for baz.com");
// Clear everything 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() { function test14() {
ok(!stored(["baz.com"]), "Data cleared for baz.com"); ok(!stored(["baz.com"]), "Data cleared for baz.com");
@ -175,7 +175,7 @@
"Data stored for sites"); "Data stored for sites");
// Clear data for "foo.com" and its subdomains. // 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() { function test15() {
ok(stored(["bar.com", "192.168.1.1", "localhost"]), "Data stored for sites"); 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"); ok(!stored(["bar.foo.com"]), "Data cleared for subdomains of foo.com");
// Clear data for "bar.com" using a subdomain. // 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() { function test16() {
ok(!stored(["bar.com"]), "Data cleared for bar.com"); ok(!stored(["bar.com"]), "Data cleared for bar.com");
// Clear data for "192.168.1.1". // 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() { function test17() {
ok(!stored(["192.168.1.1"]), "Data cleared for 192.168.1.1"); ok(!stored(["192.168.1.1"]), "Data cleared for 192.168.1.1");
// Clear data for "localhost". // 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() { function test18() {
ok(!stored(null), "All data cleared"); ok(!stored(null), "All data cleared");
@ -211,14 +211,14 @@
"Data stored for sites"); "Data stored for sites");
// Clear data for the UTF-8 version. // 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() { function test19() {
ok(!stored(["b\u00FCcher.es"]), "Data cleared for UTF-8 representation"); ok(!stored(["b\u00FCcher.es"]), "Data cleared for UTF-8 representation");
ok(!stored(["xn--bcher-kva.es"]), "Data cleared for ACE representation"); ok(!stored(["xn--bcher-kva.es"]), "Data cleared for ACE representation");
// Clear data for the ACE version. // 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() { function test20() {
ok(!stored(["b\u00FCcher.uk"]), "Data cleared for UTF-8 representation"); ok(!stored(["b\u00FCcher.uk"]), "Data cleared for UTF-8 representation");
@ -229,7 +229,7 @@
// strictly required, we test it here. // strictly required, we test it here.
ok(stored(["b\u00FCcher.nz", "xn--bcher-kva.nz"]), ok(stored(["b\u00FCcher.nz", "xn--bcher-kva.nz"]),
"Data stored for sites"); "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() { function test21() {
ok(!stored(["b\u00FCcher.nz"]), "Data cleared for UTF-8 representation"); ok(!stored(["b\u00FCcher.nz"]), "Data cleared for UTF-8 representation");

View file

@ -41,9 +41,9 @@
} }
window.frameLoaded = function reloaded() { window.frameLoaded = function reloaded() {
var p = iframe.contentDocument.getElementById("plugin1"); var p1 = iframe.contentDocument.getElementById("plugin1");
try { try {
p.setColor("FF00FF00"); p1.setColor("FF00FF00");
ok(true, "Reloading worked"); ok(true, "Reloading worked");
} catch (e) { } catch (e) {
ok(false, "Reloading didn't give us a usable plugin"); ok(false, "Reloading didn't give us a usable plugin");

View file

@ -35,9 +35,9 @@
} }
window.frameLoaded = function reloaded() { window.frameLoaded = function reloaded() {
var p = iframe.contentDocument.getElementById("plugin1"); var p1 = iframe.contentDocument.getElementById("plugin1");
try { try {
p.setColor("FF00FF00"); p1.setColor("FF00FF00");
ok(true, "Reloading worked"); ok(true, "Reloading worked");
} catch (e) { } catch (e) {
ok(false, "Reloading didn't give us a usable plugin"); ok(false, "Reloading didn't give us a usable plugin");

View file

@ -26,8 +26,6 @@ SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal",
true]]}); true]]});
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const hangUITimeoutPref = "dom.ipc.plugins.hangUITimeoutSecs"; const hangUITimeoutPref = "dom.ipc.plugins.hangUITimeoutSecs";
const hangUIMinDisplayPref = "dom.ipc.plugins.hangUIMinDisplaySecs"; const hangUIMinDisplayPref = "dom.ipc.plugins.hangUIMinDisplaySecs";
const timeoutPref = "dom.ipc.plugins.timeoutSecs"; const timeoutPref = "dom.ipc.plugins.timeoutSecs";

View file

@ -14,10 +14,9 @@
let ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(SpecialPowers.Ci.nsIPluginHost); let ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(SpecialPowers.Ci.nsIPluginHost);
let plugins = ph.getPluginTags(); let plugins = ph.getPluginTags();
let testPluginName = plugins[0].name; let testPluginName = plugins[0].name;
let oldPrefVal = null;
let prefName = "plugins.navigator.hidden_ctp_plugin"; let prefName = "plugins.navigator.hidden_ctp_plugin";
try { try {
oldPrefVal = SpecialPowers.getCharPref(prefName); SpecialPowers.getCharPref(prefName);
} catch (ex) {} } catch (ex) {}
let promise = SpecialPowers.pushPrefEnv({ set: [[prefName, testPluginName]]}); let promise = SpecialPowers.pushPrefEnv({ set: [[prefName, testPluginName]]});
promise.then(function() { promise.then(function() {

View file

@ -29,6 +29,7 @@
d1.appendChild(p); d1.appendChild(p);
// Forces the plugin to be respawned // Forces the plugin to be respawned
// eslint-disable-next-line no-self-assign
p.src = p.src; p.src = p.src;
destroyed = false; destroyed = false;

View file

@ -39,6 +39,7 @@
["function test() { return 3; } test();", 3], ["function test() { return 3; } test();", 3],
["testMe(3)", 6], ["testMe(3)", 6],
["testMe(new Object(3))", 6], ["testMe(new Object(3))", 6],
// eslint-disable-next-line no-new-object
["new Object(3)", new Object(3)], ["new Object(3)", new Object(3)],
["new Array(1, 2, 3, 4)", [1, 2, 3, 4]], ["new Array(1, 2, 3, 4)", [1, 2, 3, 4]],
["document.getElementById('display')", ["document.getElementById('display')",

View file

@ -26,8 +26,8 @@
function returnArgs() { function returnArgs() {
if (arguments.length == 1) if (arguments.length == 1)
return arguments[0]; return arguments[0];
var arr = new Array(); var arr = [];
for (i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
arr.push(arguments[i]); arr.push(arguments[i]);
} }
return arr; return arr;

View file

@ -48,6 +48,7 @@
["Boolean", true, true], ["Boolean", true, true],
["Boolean", "true", true], ["Boolean", "true", true],
["Boolean", "false", true], ["Boolean", "false", true],
/* eslint-disable no-new-wrappers */
["Boolean", new Boolean(false), true], ["Boolean", new Boolean(false), true],
["Boolean", { "value": false }, true], ["Boolean", { "value": false }, true],
// Function object // Function object
@ -60,6 +61,7 @@
["Object", Boolean(), new Boolean(false)], ["Object", Boolean(), new Boolean(false)],
["Object", "a string", new String("a string")], ["Object", "a string", new String("a string")],
["Object", 3.14, new Number(3.14)], ["Object", 3.14, new Number(3.14)],
/* eslint-enable no-new-wrappers */
["Object", { "key1": "test", "key2": 15 }, { "key1": "test", "key2": 15 }], ["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]], ["Object", [1, 3, 5, 7, 9, 11, 13, 17], [1, 3, 5, 7, 9, 11, 13, 17]],
// RegExp object // RegExp object

View file

@ -244,7 +244,7 @@ function eachList() {
}, },
}; };
// eslint-disable-next-line complexity
function testObject(obj, state) { function testObject(obj, state) {
// If our test combination both sets noChannel but no explicit type // If our test combination both sets noChannel but no explicit type
// it shouldn't load ever. // it shouldn't load ever.
@ -316,7 +316,7 @@ function eachList() {
// should spawn synchronously. // should spawn synchronously.
let scripted = false; let scripted = false;
try { try {
let x = obj.getObjectValue(); obj.getObjectValue();
scripted = true; scripted = true;
} catch (e) {} } catch (e) {}
is(scripted, shouldBeSpawnable, "check plugin scriptability"); is(scripted, shouldBeSpawnable, "check plugin scriptability");

View file

@ -86,6 +86,7 @@ function waitForPaint(func) {
// Ensure the waiter has had a style change, so that this will // Ensure the waiter has had a style change, so that this will
// change its size and cause a paint. // change its size and cause a paint.
paint_waiter.style.backgroundColor = paint_waiter.style.backgroundColor == "blue" ? "yellow" : "blue"; paint_waiter.style.backgroundColor = paint_waiter.style.backgroundColor == "blue" ? "yellow" : "blue";
// eslint-disable-next-line no-unused-vars
var flush = paint_waiter.offsetHeight; var flush = paint_waiter.offsetHeight;
paint_waiter.style.height = "1px"; paint_waiter.style.height = "1px";
waitForPaintHelper(func); waitForPaintHelper(func);

View file

@ -127,7 +127,7 @@ function continueTest() {
var test = tests[Math.floor(index / 2)]; var test = tests[Math.floor(index / 2)];
var p = gTestWindow.document.createElement("p"); 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); gTestWindow.document.getElementById("test").appendChild(p);
if (test.frame) { if (test.frame) {

View file

@ -38,7 +38,7 @@
var startY; var startY;
function doScroll() { function doScroll() {
let [x, y, w, h] = p.getWindowPosition(); let y = p.getWindowPosition()[1];
startY = y; startY = y;
scrollBy(0, kScrollAmount); scrollBy(0, kScrollAmount);
@ -46,7 +46,7 @@
} }
function checkScroll() { 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."); is(y, startY - kScrollAmount, "Window should be informed of its new position.");
SimpleTest.finish(); SimpleTest.finish();

View file

@ -17,7 +17,7 @@
} }
function runTests() { function runTests() {
p = document.getElementById("plugin1"); var p = document.getElementById("plugin1");
p.startWatchingInstanceCount(); p.startWatchingInstanceCount();
p.callOnDestroy(onDestroy); p.callOnDestroy(onDestroy);

View file

@ -20,6 +20,8 @@
var didPaint = function() {}; var didPaint = function() {};
var p = null;
function startTest() { function startTest() {
if (p.getPaintCount() < 1) { if (p.getPaintCount() < 1) {
setTimeout(startTest, 0); setTimeout(startTest, 0);