--- a/browser/base/content/test/plugins/browser.ini
+++ b/browser/base/content/test/plugins/browser.ini
@@ -60,36 +60,32 @@ skip-if = !crashreporter
tags = blocklist
[browser_CTP_drag_drop.js]
tags = blocklist
[browser_CTP_favorfallback.js]
[browser_CTP_hide_overlay.js]
tags = blocklist
[browser_CTP_iframe.js]
tags = blocklist
-[browser_CTP_multi_allow.js]
-tags = blocklist
[browser_CTP_nonplugins.js]
tags = blocklist
[browser_CTP_notificationBar.js]
tags = blocklist
[browser_CTP_outsideScrollArea.js]
tags = blocklist
[browser_CTP_remove_navigate.js]
tags = blocklist
[browser_CTP_resize.js]
tags = blocklist
[browser_CTP_shouldShowOverlay.js]
[browser_CTP_zoom.js]
tags = blocklist
[browser_blocking.js]
tags = blocklist
[browser_iterate_hidden_plugins.js]
-[browser_plugins_added_dynamically.js]
-tags = blocklist
[browser_pluginnotification.js]
tags = blocklist
[browser_plugin_reloading.js]
tags = blocklist
[browser_blocklist_content.js]
skip-if = !e10s
tags = blocklist
[browser_enable_DRM_prompt.js]
--- a/browser/base/content/test/plugins/browser_CTP_context_menu.js
+++ b/browser/base/content/test/plugins/browser_CTP_context_menu.js
@@ -56,14 +56,14 @@ add_task(async function() {
ok(actMenuItem, "Should have a context menu entry for activating the plugin");
// Activate the plugin via the context menu
EventUtils.synthesizeMouseAtCenter(actMenuItem, {});
await promiseForCondition(() => !PopupNotifications.panel.dismissed && PopupNotifications.panel.firstChild);
// Activate the plugin
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
// check plugin state
pluginInfo = await promiseForPluginInfo("test", gBrowser.selectedBrowser);
ok(pluginInfo.activated, "plugin should not be activated");
});
--- a/browser/base/content/test/plugins/browser_CTP_crashreporting.js
+++ b/browser/base/content/test/plugins/browser_CTP_crashreporting.js
@@ -70,17 +70,17 @@ add_task(async function() {
await promiseUpdatePluginBindings(browser);
let pluginInfo = await promiseForPluginInfo("test", browser);
ok(!pluginInfo.activated, "Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
let notification = PopupNotifications.getNotification("click-to-play-plugins", browser);
await promiseForNotificationShown(notification, browser);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
// Prepare a crash report topic observer that only returns when
// the crash report has been successfully sent.
let crashReportChecker = (subject, data) => {
return (data == "success");
};
let crashReportPromise = TestUtils.topicObserved("crash-report-status",
crashReportChecker);
--- a/browser/base/content/test/plugins/browser_CTP_drag_drop.js
+++ b/browser/base/content/test/plugins/browser_CTP_drag_drop.js
@@ -84,13 +84,13 @@ add_task(async function() {
});
let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser).dismissed && gNewWindow.PopupNotifications.panel.firstChild;
await promiseForCondition(condition);
});
add_task(async function() {
// Click the activate button on doorhanger to make sure it works
- gNewWindow.PopupNotifications.panel.firstChild._primaryButton.click();
+ gNewWindow.PopupNotifications.panel.firstChild.button.click();
let pluginInfo = await promiseForPluginInfo("test", gNewWindow.gBrowser.selectedBrowser);
ok(pluginInfo.activated, "plugin should be activated");
});
deleted file mode 100644
--- a/browser/base/content/test/plugins/browser_CTP_multi_allow.js
+++ /dev/null
@@ -1,99 +0,0 @@
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-
-add_task(async function() {
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
- Services.prefs.clearUserPref("plugins.click_to_play");
- Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
- gBrowser.removeCurrentTab();
- window.focus();
- });
-});
-
-add_task(async function() {
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
- gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
-
- await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_two_types.html");
-
- // Work around for delayed PluginBindingAttached
- await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-
- // Test that the click-to-play doorhanger for multiple plugins shows the correct
- // state when re-opening without reloads or navigation.
-
- let pluginInfo = await promiseForPluginInfo("test", gBrowser.selectedBrowser);
- ok(!pluginInfo.activated, "plugin should be activated");
-
- let notification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
- ok(notification, "Test 1a, Should have a click-to-play notification");
-
- await promiseForNotificationShown(notification);
-
- is(notification.options.pluginData.size, 2,
- "Test 1a, Should have two types of plugin in the notification");
-
- // Work around for delayed PluginBindingAttached
- await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-
- is(PopupNotifications.panel.firstChild.childNodes.length, 2, "have child nodes");
-
- let pluginItem = null;
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- is(item.value, "block", "Test 1a, all plugins should start out blocked");
- if (item.action.pluginName == "Test") {
- pluginItem = item;
- }
- }
-
- // Choose "Allow now" for the test plugin
- pluginItem.value = "allownow";
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- pluginInfo = await promiseForPluginInfo("test", gBrowser.selectedBrowser);
- ok(pluginInfo.activated, "plugin should be activated");
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
- ok(notification, "Test 1b, Should have a click-to-play notification");
-
- await promiseForNotificationShown(notification);
-
- pluginItem = null;
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- if (item.action.pluginName == "Test") {
- is(item.value, "allownow", "Test 1b, Test plugin should now be set to 'Allow now'");
- } else {
- is(item.value, "block", "Test 1b, Second Test plugin should still be blocked");
- pluginItem = item;
- }
- }
-
- // Choose "Allow and remember" for the Second Test plugin
- pluginItem.value = "allowalways";
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- pluginInfo = await promiseForPluginInfo("secondtestA", gBrowser.selectedBrowser);
- ok(pluginInfo.activated, "plugin should be activated");
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
- ok(notification, "Test 1c, Should have a click-to-play notification");
-
- await promiseForNotificationShown(notification);
-
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- if (item.action.pluginName == "Test") {
- is(item.value, "allownow", "Test 1c, Test plugin should be set to 'Allow now'");
- } else {
- is(item.value, "allowalways", "Test 1c, Second Test plugin should be set to 'Allow always'");
- }
- }
-});
--- a/browser/base/content/test/plugins/browser_CTP_notificationBar.js
+++ b/browser/base/content/test/plugins/browser_CTP_notificationBar.js
@@ -77,17 +77,17 @@ add_task(async function() {
let pluginInfo = await promiseForPluginInfo("test");
ok(!pluginInfo.activated, "Test 1a, plugin should not be activated");
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(!(overlay && overlay.classList.contains("visible")),
+ Assert.ok(!overlay || !overlay.classList.contains("visible"),
"Test 3b, overlay should be hidden.");
});
});
add_task(async function() {
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_positioned.html");
// Work around for delayed PluginBindingAttached
@@ -104,17 +104,17 @@ add_task(async function() {
Assert.equal(plugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
"Test 4b, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
});
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(!(overlay && overlay.classList.contains("visible")),
+ Assert.ok(!overlay || !overlay.classList.contains("visible"),
"Test 4b, overlay should be hidden.");
});
});
// Test that the notification bar is getting dismissed when directly activating plugins
// via the doorhanger.
add_task(async function() {
@@ -137,16 +137,16 @@ add_task(async function() {
await promisePopupNotification("click-to-play-plugins");
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(notification, "Test 6, Should have a click-to-play notification");
// simulate "always allow"
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
let notificationBox = gBrowser.getNotificationBox(gTestBrowser);
await promiseForCondition(() => notificationBox.getNotificationWithValue("plugin-hidden") === null);
let pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 7, plugin should be activated");
});
--- a/browser/base/content/test/plugins/browser_CTP_outsideScrollArea.js
+++ b/browser/base/content/test/plugins/browser_CTP_outsideScrollArea.js
@@ -52,18 +52,19 @@ add_task(async function() {
await promiseUpdatePluginBindings(gTestBrowser);
await promisePopupNotification("click-to-play-plugins");
await ContentTask.spawn(gTestBrowser, {}, async function() {
let plugin = content.document.getElementById("test");
let doc = content.document;
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(overlay && overlay.classList.contains("visible"),
- "Test 2, overlay should be visible.");
+ Assert.ok(overlay && overlay.classList.contains("visible") &&
+ !overlay.classList.contains("minimal"),
+ "Test 2, overlay should be visible.");
});
});
add_task(async function() {
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_outsideScrollArea.html");
await ContentTask.spawn(gTestBrowser, {}, async function() {
let doc = content.document;
@@ -81,18 +82,19 @@ add_task(async function() {
await promiseUpdatePluginBindings(gTestBrowser);
await promisePopupNotification("click-to-play-plugins");
await ContentTask.spawn(gTestBrowser, null, async function() {
let plugin = content.document.getElementById("test");
let doc = content.document;
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(overlay && overlay.classList.contains("visible"),
- "Test 3, overlay should be visible.");
+ Assert.ok(overlay && overlay.classList.contains("visible") &&
+ !overlay.classList.contains("minimal"),
+ "Test 3, overlay should be visible.");
});
});
add_task(async function() {
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_outsideScrollArea.html");
await ContentTask.spawn(gTestBrowser, {}, async function() {
let doc = content.document;
@@ -109,12 +111,12 @@ add_task(async function() {
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(gTestBrowser);
await promisePopupNotification("click-to-play-plugins");
await ContentTask.spawn(gTestBrowser, null, async function() {
let plugin = content.document.getElementById("test");
let doc = content.document;
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(!(overlay && overlay.classList.contains("visible")),
+ Assert.ok(!overlay || !overlay.classList.contains("visible"),
"Test 4, overlay should be hidden.");
});
});
--- a/browser/base/content/test/plugins/browser_CTP_resize.js
+++ b/browser/base/content/test/plugins/browser_CTP_resize.js
@@ -41,17 +41,17 @@ add_task(async function() {
add_task(async function() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 2, Should have a click-to-play notification");
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(!(overlay && overlay.classList.contains("visible")),
+ Assert.ok(!overlay || overlay.classList.contains("minimal"),
"Test 2, overlay should be hidden.");
});
});
add_task(async function() {
await ContentTask.spawn(gTestBrowser, {}, async function() {
let plugin = content.document.getElementById("test");
plugin.style.width = "300px";
@@ -59,17 +59,17 @@ add_task(async function() {
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(gTestBrowser);
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(!(overlay && overlay.classList.contains("visible")),
+ Assert.ok(!overlay || overlay.classList.contains("minimal"),
"Test 3, overlay should be hidden.");
});
});
add_task(async function() {
await ContentTask.spawn(gTestBrowser, {}, async function() {
let plugin = content.document.getElementById("test");
@@ -99,17 +99,17 @@ add_task(async function() {
await ContentTask.spawn(gTestBrowser, {}, async function() {
content.document.getElementById("test").clientTop;
});
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
- Assert.ok(!(overlay && overlay.classList.contains("visible")),
+ Assert.ok(!overlay || overlay.classList.contains("minimal"),
"Test 5, overlay should be hidden.");
});
});
add_task(async function() {
await ContentTask.spawn(gTestBrowser, {}, async function() {
let plugin = content.document.getElementById("test");
plugin.style.height = "300px";
--- a/browser/base/content/test/plugins/browser_blocking.js
+++ b/browser/base/content/test/plugins/browser_blocking.js
@@ -35,41 +35,16 @@ add_task(async function() {
// Make sure the blocklist service(s) are running
Components.classes["@mozilla.org/extensions/blocklist;1"]
.getService(Components.interfaces.nsIBlocklistService);
let exmsg = await promiseInitContentBlocklistSvc(gBrowser.selectedBrowser);
ok(!exmsg, "exception: " + exmsg);
});
-add_task(async function() {
- // enable hard blocklisting for the next test
- await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginHard.xml", gTestBrowser);
-
- await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
- // Work around for delayed PluginBindingAttached
- await promiseUpdatePluginBindings(gTestBrowser);
-
- await promisePopupNotification("click-to-play-plugins");
-
- let notification = PopupNotifications.getNotification("click-to-play-plugins");
- ok(notification.dismissed, "Test 5: The plugin notification should be dismissed by default");
-
- await promiseForNotificationShown(notification);
-
- let pluginInfo = await promiseForPluginInfo("test");
- is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED, "Test 5, plugin fallback type should be PLUGIN_BLOCKLISTED");
-
- is(notification.options.pluginData.size, 1, "Test 5: Only the blocked plugin should be present in the notification");
- ok(PopupNotifications.panel.firstChild._buttonContainer.hidden, "Part 5: The blocked plugins notification should not have any buttons visible.");
-
- await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
-
// Tests a vulnerable, updatable plugin
add_task(async function() {
// enable hard blocklisting of test
await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
@@ -158,20 +133,20 @@ add_task(async function() {
Assert.ok(overlay && overlay.classList.contains("visible"),
"Test 18c, Plugin overlay should exist, not be hidden");
let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
Assert.ok(updateLink && updateLink.style.display != "block",
"Test 18c, Plugin should not have an update link");
});
- // check that click "Always allow" works with blocked plugins
+ // check that click "Allow" works with blocked plugins
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE,
"Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
ok(pluginInfo.activated, "Test 18c, Plugin should be activated");
let enabledState = getTestPluginEnabledState();
ok(enabledState, "Test 18c, Plugin enabled state should be STATE_CLICKTOPLAY");
});
@@ -249,20 +224,20 @@ add_task(async function() {
ok(notification, "Test 24a, Should have a click-to-play notification");
// Plugin should start as CTP
let pluginInfo = await promiseForPluginInfo("test");
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
"Test 24a, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
ok(!pluginInfo.activated, "Test 24a, Plugin should not be active.");
- // simulate "always allow"
+ // simulate "allow"
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 24a, Plugin should be active.");
await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
});
// the plugin is now blocklisted, so it should not automatically load
@@ -275,20 +250,20 @@ add_task(async function() {
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(notification, "Test 24b, Should have a click-to-play notification");
let pluginInfo = await promiseForPluginInfo("test");
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
"Test 24b, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
ok(!pluginInfo.activated, "Test 24b, Plugin should not be active.");
- // simulate "always allow"
+ // simulate "allow"
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 24b, Plugin should be active.");
clearAllPluginPermissions();
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
});
@@ -332,18 +307,10 @@ add_task(async function() {
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED,
"Test 26, plugin fallback type should be PLUGIN_BLOCKLISTED");
await ContentTask.spawn(gTestBrowser, null, async function() {
let plugin = content.document.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
Assert.ok(!objLoadingContent.activated, "Plugin should not be activated.");
});
-
- const testUrl = "http://test.url.com/";
-
- let firstPanelChild = PopupNotifications.panel.firstChild;
- let infoLink = document.getAnonymousElementByAttribute(firstPanelChild, "anonid",
- "click-to-play-plugins-notification-link");
- is(infoLink.href, testUrl,
- "Test 26, the notification URL needs to match the infoURL from the blocklist file.");
});
--- a/browser/base/content/test/plugins/browser_bug743421.js
+++ b/browser/base/content/test/plugins/browser_bug743421.js
@@ -56,17 +56,17 @@ add_task(async function() {
Assert.ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
});
// Click the activate button on doorhanger to make sure it works
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
await ContentTask.spawn(gTestBrowser, {}, async function() {
let plugin = content.document.getElementsByTagName("embed")[0];
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
Assert.ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
});
});
--- a/browser/base/content/test/plugins/browser_bug787619.js
+++ b/browser/base/content/test/plugins/browser_bug787619.js
@@ -50,16 +50,16 @@ add_task(async function() {
// check plugin state
pluginInfo = await promiseForPluginInfo("plugin");
ok(!pluginInfo.activated, "1b plugin should not be activated");
let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed &&
PopupNotifications.panel.firstChild;
await promiseForCondition(condition);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
// check plugin state
pluginInfo = await promiseForPluginInfo("plugin");
ok(pluginInfo.activated, "plugin should be activated");
is(gWrapperClickCount, 0, "wrapper should not have received any clicks");
});
--- a/browser/base/content/test/plugins/browser_pluginnotification.js
+++ b/browser/base/content/test/plugins/browser_pluginnotification.js
@@ -60,34 +60,39 @@ add_task(async function() {
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(gTestBrowser);
await promisePopupNotification("click-to-play-plugins");
let pluginInfo = await promiseForPluginInfo("test");
ok(!pluginInfo.activated, "Plugin should not be activated");
- // Simulate clicking the "Allow Now" button.
+ // Simulate clicking the "Allow" button.
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._secondaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Plugin should be activated");
// Simulate clicking the "Block" button.
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.secondaryButton.click();
pluginInfo = await promiseForPluginInfo("test");
ok(!pluginInfo.activated, "Plugin should not be activated");
+ let browserLoaded = BrowserTestUtils.browserLoaded(gTestBrowser);
+ gTestBrowser.reload();
+ await browserLoaded;
+ notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
+
// Simulate clicking the overlay
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let bounds = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
let left = (bounds.left + bounds.right) / 2;
let top = (bounds.top + bounds.bottom) / 2;
let utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
@@ -132,22 +137,22 @@ add_task(async function() {
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(gTestBrowser);
await promisePopupNotification("click-to-play-plugins");
let pluginInfo = await promiseForPluginInfo("test");
ok(!pluginInfo.activated, "Test 12a, Plugin should not be activated");
- // Simulate clicking the "Allow Always" button.
+ // Simulate clicking the "Allow" button.
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
await promiseForNotificationShown(notification);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 12a, Plugin should be activated");
});
// Test that the "Always" permission, when set for just the Test plugin,
// does not also allow the Second Test plugin.
add_task(async function() {
@@ -291,17 +296,17 @@ add_task(async function() {
.getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendMouseEvent("mousedown", 50, 50, 0, 1, 0, false, 0, 0);
utils.sendMouseEvent("mouseup", 50, 50, 0, 1, 0, false, 0, 0);
});
let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed &&
PopupNotifications.panel.firstChild;
await promiseForCondition(condition);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 19e, Plugin should not be activated");
clearAllPluginPermissions();
});
// Tests that a plugin in a div that goes from style="display: none" to
@@ -372,168 +377,32 @@ add_task(async function() {
let utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
});
let condition = () => !notification.dismissed && !!PopupNotifications.panel.firstChild;
await promiseForCondition(condition);
- PopupNotifications.panel.firstChild._primaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 20c, plugin should be activated");
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
"Test 20c, plugin should have overlay dims of 0px");
});
clearAllPluginPermissions();
});
-// Test having multiple different types of plugin on one page
-add_task(async function() {
- // contains three plugins, application/x-test, application/x-second-test x 2
- await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_two_types.html");
-
- // Work around for delayed PluginBindingAttached
- await promiseUpdatePluginBindings(gTestBrowser);
-
- let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 21a, Should have a click-to-play notification");
-
- // confirm all three are blocked by ctp at this point
- let ids = ["test", "secondtestA", "secondtestB"];
- for (let id of ids) {
- await ContentTask.spawn(gTestBrowser, { id }, async function(args) {
- let doc = content.document;
- let plugin = doc.getElementById(args.id);
- let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
- Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
- "Test 21a, plugin " + args.id + " should have click-to-play overlay with dims");
- });
-
- let pluginInfo = await promiseForPluginInfo(id);
- ok(!pluginInfo.activated, "Test 21a, Plugin with id=" + id + " should not be activated");
- }
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 21a, Should have a click-to-play notification");
-
- // we have to actually show the panel to get the bindings to instantiate
- await promiseForNotificationShown(notification);
-
- is(notification.options.pluginData.size, 2, "Test 21a, Should have two types of plugin in the notification");
-
- let centerAction = null;
- for (let action of notification.options.pluginData.values()) {
- if (action.pluginName == "Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "Test 21b, found center action for the Test plugin");
-
- let centerItem = null;
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- is(item.value, "block", "Test 21b, all plugins should start out blocked");
- if (item.action == centerAction) {
- centerItem = item;
- break;
- }
- }
- ok(centerItem, "Test 21b, found center item for the Test plugin");
-
- // Select the allow now option in the select drop down for Test Plugin
- centerItem.value = "allownow";
-
- // "click" the button to activate the Test plugin
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let pluginInfo = await promiseForPluginInfo("test");
- ok(pluginInfo.activated, "Test 21b, plugin should be activated");
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 21b, Should have a click-to-play notification");
-
- await promiseForNotificationShown(notification);
-
- ok(notification.options.pluginData.size == 2, "Test 21c, Should have one type of plugin in the notification");
-
- await ContentTask.spawn(gTestBrowser, null, async function() {
- let doc = content.document;
- let plugin = doc.getElementById("test");
- let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
- Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
- "Test 21c, plugin should have overlay dims of 0px");
- });
-
- ids = ["secondtestA", "secondtestB"];
- for (let id of ids) {
- await ContentTask.spawn(gTestBrowser, { id }, async function(args) {
- let doc = content.document;
- let plugin = doc.getElementById(args.id);
- let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
- Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
- "Test 21c, plugin " + args.id + " should have click-to-play overlay with zero dims");
- });
-
- let pluginInfoTmp = await promiseForPluginInfo(id);
- ok(!pluginInfoTmp.activated, "Test 21c, Plugin with id=" + id + " should not be activated");
- }
-
- centerAction = null;
- for (let action of notification.options.pluginData.values()) {
- if (action.pluginName == "Second Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "Test 21d, found center action for the Second Test plugin");
-
- centerItem = null;
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- if (item.action == centerAction) {
- is(item.value, "block", "Test 21d, test plugin 2 should start blocked");
- centerItem = item;
- break;
- } else {
- is(item.value, "allownow", "Test 21d, test plugin should be enabled");
- }
- }
- ok(centerItem, "Test 21d, found center item for the Second Test plugin");
-
- // Select the allow now option in the select drop down for Second Test Plguins
- centerItem.value = "allownow";
-
- // "click" the button to activate the Second Test plugins
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 21d, Should have a click-to-play notification");
-
- ids = ["test", "secondtestA", "secondtestB"];
- for (let id of ids) {
- await ContentTask.spawn(gTestBrowser, { id }, async function(args) {
- let doc = content.document;
- let plugin = doc.getElementById(args.id);
- let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
- Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
- "Test 21d, plugin " + args.id + " should have click-to-play overlay with zero dims");
- });
-
- let pluginInfoTmp = await promiseForPluginInfo(id);
- ok(pluginInfoTmp.activated, "Test 21d, Plugin with id=" + id + " should not be activated");
- }
-});
-
// Tests that a click-to-play plugin resets its activated state when changing types
add_task(async function() {
clearAllPluginPermissions();
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
@@ -608,17 +477,9 @@ add_task(async function() {
// Since the plugin notification is dismissed by default, reshow it.
await promiseForNotificationShown(notification);
let pluginInfo = await promiseForPluginInfo("test");
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED,
"Test 26, plugin fallback type should be PLUGIN_BLOCKLISTED");
ok(!pluginInfo.activated, "Plugin should be activated.");
-
- const testUrl = "http://test.url.com/";
-
- let firstPanelChild = PopupNotifications.panel.firstChild;
- let infoLink = document.getAnonymousElementByAttribute(firstPanelChild, "anonid",
- "click-to-play-plugins-notification-link");
- is(infoLink.href, testUrl,
- "Test 26, the notification URL needs to match the infoURL from the blocklist file.");
});
deleted file mode 100644
--- a/browser/base/content/test/plugins/browser_plugins_added_dynamically.js
+++ /dev/null
@@ -1,137 +0,0 @@
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://mochi.test:8888/");
-var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-
-var gTestBrowser = null;
-
-add_task(async function() {
- registerCleanupFunction(async function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("plugins.click_to_play");
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
- await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
- resetBlocklist();
- gBrowser.removeCurrentTab();
- window.focus();
- gTestBrowser = null;
- });
-});
-
-// "Activate" of a given type -> plugins of that type dynamically added should
-// automatically play.
-add_task(async function() {
- let newTab = BrowserTestUtils.addTab(gBrowser);
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
-
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
- Services.prefs.setBoolPref("plugins.click_to_play", true);
-
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
-});
-
-add_task(async function() {
- await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_add_dynamically.html");
-
- let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!notification, "Test 1a, Should not have a click-to-play notification");
-
- // Add a plugin of type test
- await ContentTask.spawn(gTestBrowser, {}, async function() {
- new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin("pluginone", "application/x-test"));
- });
-
- await promisePopupNotification("click-to-play-plugins");
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 1a, Should not have a click-to-play notification");
-
- await promiseForNotificationShown(notification);
-
- let centerAction = null;
- for (let action of notification.options.pluginData.values()) {
- if (action.pluginName == "Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "Test 2, found center action for the Test plugin");
-
- let centerItem = null;
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- is(item.value, "block", "Test 3, all plugins should start out blocked");
- if (item.action == centerAction) {
- centerItem = item;
- break;
- }
- }
- ok(centerItem, "Test 4, found center item for the Test plugin");
-
- // Select the allow now option in the select drop down for Test Plugin
- centerItem.value = "allownow";
-
- // "click" the button to activate the Test plugin
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let pluginInfo = await promiseForPluginInfo("pluginone");
- ok(pluginInfo.activated, "Test 5, plugin should be activated");
-
- // Add another plugin of type test
- await ContentTask.spawn(gTestBrowser, {}, async function() {
- new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin("plugintwo", "application/x-test"));
- });
-
- pluginInfo = await promiseForPluginInfo("plugintwo");
- ok(pluginInfo.activated, "Test 6, plugins should be activated");
-});
-
-// "Activate" of a given type -> plugins of other types dynamically added
-// should not automatically play.
-add_task(async function() {
- clearAllPluginPermissions();
-
- await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_add_dynamically.html");
-
- let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!notification, "Test 7, Should not have a click-to-play notification");
-
- // Add a plugin of type test
- await ContentTask.spawn(gTestBrowser, {}, async function() {
- new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin("pluginone", "application/x-test"));
- });
-
- await promisePopupNotification("click-to-play-plugins");
-
- notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 8, Should not have a click-to-play notification");
-
- await promiseForNotificationShown(notification);
-
- is(notification.options.pluginData.size, 1, "Should be one plugin action");
-
- let pluginInfo = await promiseForPluginInfo("pluginone");
- ok(!pluginInfo.activated, "Test 8, test plugin should be activated");
-
- let condition = () => !notification.dismissed &&
- PopupNotifications.panel.firstChild;
- await promiseForCondition(condition);
-
- // "click" the button to activate the Test plugin
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- pluginInfo = await promiseForPluginInfo("pluginone");
- ok(pluginInfo.activated, "Test 9, test plugin should be activated");
-
- await ContentTask.spawn(gTestBrowser, {}, async function() {
- new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin("plugintwo", "application/x-second-test"));
- });
-
- await promisePopupNotification("click-to-play-plugins");
-
- pluginInfo = await promiseForPluginInfo("pluginone");
- ok(pluginInfo.activated, "Test 10, plugins should be activated");
- pluginInfo = await promiseForPluginInfo("plugintwo");
- ok(!pluginInfo.activated, "Test 11, plugins should be activated");
-});
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -62,20 +62,17 @@ add_task(async function test1b() {
});
// Check the button status
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
"Shown");
popupNotification.reshow();
await promiseShown;
- let button1 = gPrivateWindow.PopupNotifications.panel.firstChild._primaryButton;
- let button2 = gPrivateWindow.PopupNotifications.panel.firstChild._secondaryButton;
- is(button1.getAttribute("action"), "_singleActivateNow", "Test 1b, Blocked plugin in private window should have a activate now button");
- ok(button2.hidden, "Test 1b, Blocked plugin in a private window should not have a secondary button");
+ is(gPrivateWindow.PopupNotifications.panel.firstChild.checkbox.hidden, true, "'Remember' checkbox should be hidden in private windows")
gPrivateWindow.close();
BrowserTestUtils.loadURI(gTestBrowser, gHttpTestRoot + "plugin_test.html");
await BrowserTestUtils.browserLoaded(gTestBrowser);
});
add_task(async function test2a() {
// enable test plugin on this site
@@ -89,17 +86,17 @@ add_task(async function test2a() {
});
// Simulate clicking the "Allow Now" button.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"Shown");
popupNotification.reshow();
await promiseShown;
- PopupNotifications.panel.firstChild._secondaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
await ContentTask.spawn(gTestBrowser, null, async function() {
let plugin = content.document.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let condition = () => objLoadingContent.activated;
await ContentTaskUtils.waitForCondition(condition, "Test 2a, Waited too long for plugin to activate");
});
});
@@ -118,18 +115,20 @@ add_task(async function test2c() {
ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
});
// Check the button status
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
"Shown");
popupNotification.reshow();
await promiseShown;
- let buttonContainer = gPrivateWindow.PopupNotifications.panel.firstChild._buttonContainer;
- ok(buttonContainer.hidden, "Test 2c, Activated plugin in a private window should not have visible buttons");
+ is(gPrivateWindow.PopupNotifications.panel.firstChild.secondaryButton.hidden, true,
+ "Test 2c, Activated plugin in a private window should not have visible 'Block' button.");
+ is(gPrivateWindow.PopupNotifications.panel.firstChild.checkbox.hidden, true,
+ "Test 2c, Activated plugin in a private window should not have visible 'Remember' checkbox.");
clearAllPluginPermissions();
gPrivateWindow.close();
BrowserTestUtils.loadURI(gTestBrowser, gHttpTestRoot + "plugin_test.html");
await BrowserTestUtils.browserLoaded(gTestBrowser);
});
@@ -139,22 +138,22 @@ add_task(async function test3a() {
ok(popupNotification, "Test 3a, Should have a click-to-play notification");
await ContentTask.spawn(gTestBrowser, null, function() {
let plugin = content.document.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 3a, Plugin should not be activated");
});
- // Simulate clicking the "Allow Always" button.
+ // Simulate clicking the "Allow" button.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"Shown");
popupNotification.reshow();
await promiseShown;
- PopupNotifications.panel.firstChild._secondaryButton.click();
+ PopupNotifications.panel.firstChild.button.click();
await ContentTask.spawn(gTestBrowser, null, async function() {
let plugin = content.document.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let condition = () => objLoadingContent.activated;
await ContentTaskUtils.waitForCondition(condition, "Test 3a, Waited too long for plugin to activate");
});
});
@@ -167,18 +166,20 @@ add_task(async function test3c() {
let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
ok(popupNotification, "Test 3c, Should have a click-to-play notification");
// Check the button status
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
"Shown");
popupNotification.reshow();
await promiseShown;
- let buttonContainer = gPrivateWindow.PopupNotifications.panel.firstChild._buttonContainer;
- ok(buttonContainer.hidden, "Test 3c, Activated plugin in a private window should not have visible buttons");
+ is(gPrivateWindow.PopupNotifications.panel.firstChild.secondaryButton.hidden, true,
+ "Test 2c, Activated plugin in a private window should not have visible 'Block' button.");
+ is(gPrivateWindow.PopupNotifications.panel.firstChild.checkbox.hidden, true,
+ "Test 2c, Activated plugin in a private window should not have visible 'Remember' checkbox.");
BrowserTestUtils.loadURI(gPrivateBrowser, gHttpTestRoot + "plugin_two_types.html");
await BrowserTestUtils.browserLoaded(gPrivateBrowser);
});
add_task(async function test3d() {
let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
ok(popupNotification, "Test 3d, Should have a click-to-play notification");