--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -240,26 +240,21 @@ var gPluginHandler = {
// If this is a new notification, create a pluginData map, otherwise append
let pluginData;
if (notification) {
pluginData = notification.options.pluginData;
} else {
pluginData = new Map();
}
- let hasInactivePlugins = true;
- for (var pluginInfo of plugins) {
+ for (let pluginInfo of plugins) {
if (pluginData.has(pluginInfo.permissionString)) {
continue;
}
- if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
- hasInactivePlugins = false;
- }
-
// If a block contains an infoURL, we should always prefer that to the default
// URL that we construct in-product, even for other blocklist types.
let url = Services.blocklist.getPluginInfoURL(pluginInfo.pluginTag);
if (pluginInfo.blocklistState != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) {
if (!url) {
url = Services.blocklist.getPluginBlocklistURL(pluginInfo.pluginTag);
}
@@ -282,40 +277,95 @@ var gPluginHandler = {
if (showNow) {
notification.options.primaryPlugin = primaryPluginPermission;
notification.reshow();
browser.messageManager.sendAsyncMessage("BrowserPlugins:NotificationShown");
}
return;
}
- let options = {
- dismissed: !showNow,
- persistent: showNow,
- eventCallback: this._clickToPlayNotificationEventCallback,
- primaryPlugin: primaryPluginPermission,
- pluginData,
- principal,
- extraAttr: hasInactivePlugins ? "inactive" : "active",
- };
+ if (plugins.length == 1) {
+ let pluginInfo = plugins[0];
+ // If a block contains an infoURL, we should always prefer that to the default
+ // URL that we construct in-product, even for other blocklist types.
+ let url = Services.blocklist.getPluginInfoURL(pluginInfo.pluginTag);
+
+ if (pluginInfo.blocklistState != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) {
+ if (!url) {
+ url = Services.blocklist.getPluginBlocklistURL(pluginInfo.pluginTag);
+ }
+ } else {
+ url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "clicktoplay";
+ }
+ pluginInfo.detailsLink = url;
+
+ let chromeWin = window.QueryInterface(Ci.nsIDOMChromeWindow);
+ let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWin);
+
+ let active = pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
+
+ let options = {
+ dismissed: !showNow,
+ hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
+ persistent: showNow,
+ eventCallback: this._clickToPlayNotificationEventCallback,
+ primaryPlugin: primaryPluginPermission,
+ popupIconClass: "plugin-icon",
+ extraAttr: active ? "active" : "inactive",
+ pluginData,
+ principal,
+ };
+
+ let description = gNavigatorBundle.getString("flashActivate.message");
- let badge = document.getElementById("plugin-icon-badge");
- badge.setAttribute("animate", "true");
- badge.addEventListener("animationend", function animListener(event) {
- if (event.animationName == "blink-badge" &&
- badge.hasAttribute("animate")) {
- badge.removeAttribute("animate");
- badge.removeEventListener("animationend", animListener);
+ let badge = document.getElementById("plugin-icon-badge");
+ badge.setAttribute("animate", "true");
+ badge.addEventListener("animationend", function animListener(event) {
+ if (event.animationName == "blink-badge" &&
+ badge.hasAttribute("animate")) {
+ badge.removeAttribute("animate");
+ badge.removeEventListener("animationend", animListener);
+ }
+ });
+
+ let mainAction = {
+ callback: ({checkboxChecked}) => {
+ if (checkboxChecked) {
+ this._updatePluginPermission(notification, pluginInfo, "allowalways");
+ } else if (active) {
+ this._updatePluginPermission(notification, pluginInfo, "continue");
+ } else {
+ this._updatePluginPermission(notification, pluginInfo, "allownow");
+ }
+ },
+ label: gNavigatorBundle.getString("flashActivate.allow"),
+ accessKey: gNavigatorBundle.getString("flashActivate.allow.accesskey"),
+ dismiss: true,
+ };
+
+ let secondaryActions = null;
+ if (!isWindowPrivate) {
+ options.checkbox = {
+ label: gNavigatorBundle.getString("flashActivate.remember"),
+ };
+ secondaryActions = [{
+ callback: ({checkboxChecked}) => {
+ this._updatePluginPermission(notification, pluginInfo, "block");
+ },
+ label: gNavigatorBundle.getString("flashActivate.noAllow"),
+ accessKey: gNavigatorBundle.getString("flashActivate.noAllow.accesskey"),
+ dismiss: true,
+ }];
}
- });
- PopupNotifications.show(browser, "click-to-play-plugins",
- "", "plugins-notification-icon",
- null, null, options);
- browser.messageManager.sendAsyncMessage("BrowserPlugins:NotificationShown");
+ notification = PopupNotifications.show(browser, "click-to-play-plugins",
+ description, "plugins-notification-icon",
+ mainAction, secondaryActions, options);
+ browser.messageManager.sendAsyncMessage("BrowserPlugins:NotificationShown");
+ }
},
removeNotification(browser, name) {
let notification = PopupNotifications.getNotification(name, browser);
if (notification)
PopupNotifications.remove(notification);
},
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -931,21 +931,16 @@ html|*#fullscreen-exit-button {
pointer-events: none;
-moz-stack-sizing: ignore;
}
#addon-progress-notification {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#addon-progress-notification");
}
-#click-to-play-plugins-notification {
- -moz-binding: url("chrome://browser/content/urlbarBindings.xml#click-to-play-plugins-notification");
-}
-
-
.plugin-popupnotification-centeritem {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#plugin-popupnotification-center-item");
}
browser[tabmodalPromptShowing] {
-moz-user-focus: none !important;
}
--- a/browser/base/content/popup-notifications.inc
+++ b/browser/base/content/popup-notifications.inc
@@ -2,17 +2,16 @@
<panel id="notification-popup"
type="arrow"
position="after_start"
hidden="true"
orient="vertical"
noautofocus="true"
role="alert"/>
-
<popupnotification id="webRTC-shareDevices-notification" hidden="true">
<popupnotificationcontent id="webRTC-selectCamera" orient="vertical">
<label value="&getUserMedia.selectCamera.label;"
accesskey="&getUserMedia.selectCamera.accesskey;"
control="webRTC-selectCamera-menulist"/>
<menulist id="webRTC-selectCamera-menulist">
<menupopup id="webRTC-selectCamera-menupopup"/>
</menulist>
--- a/browser/base/content/test/plugins/browser.ini
+++ b/browser/base/content/test/plugins/browser.ini
@@ -59,35 +59,31 @@ 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_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
@@ -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_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,30 +60,30 @@ 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");
// Simulate clicking the overlay
await ContentTask.spawn(gTestBrowser, null, async function() {
let doc = content.document;
let plugin = doc.getElementById("test");
@@ -132,22 +132,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 +291,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 +372,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 +472,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");
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -2654,402 +2654,16 @@ file, You can obtain one at http://mozil
<setter><!-- This should be used only in automated tests -->
document.getAnonymousElementByAttribute(this, "anonid",
"center-item-menulist").value = val;
</setter>
</property>
</implementation>
</binding>
- <binding id="click-to-play-plugins-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
- <content align="start" style="width: &pluginNotification.width;;">
- <xul:vbox flex="1" align="stretch" class="click-to-play-plugins-notification-main-box"
- xbl:inherits="popupid">
- <xul:hbox class="click-to-play-plugins-notification-description-box" flex="1" align="start">
- <xul:description class="click-to-play-plugins-outer-description" flex="1">
- <html:span anonid="click-to-play-plugins-notification-description" />
- <html:br/>
- <xul:label class="text-link click-to-play-plugins-notification-link popup-notification-learnmore-link"
- anonid="click-to-play-plugins-notification-link" />
- </xul:description>
- </xul:hbox>
- <xul:grid anonid="click-to-play-plugins-notification-center-box"
- class="click-to-play-plugins-notification-center-box">
- <xul:columns>
- <xul:column flex="1"/>
- <xul:column/>
- </xul:columns>
- <xul:rows>
- <children includes="row"/>
- <xul:hbox pack="start" anonid="plugin-notification-showbox">
- <xul:button label="&pluginNotification.showAll.label;"
- accesskey="&pluginNotification.showAll.accesskey;"
- class="plugin-notification-showbutton"
- oncommand="document.getBindingParent(this)._setState(2)"/>
- </xul:hbox>
- </xul:rows>
- </xul:grid>
- <xul:hbox anonid="button-container"
- class="click-to-play-plugins-notification-button-container"
- pack="center" align="center">
- <xul:button anonid="primarybutton"
- class="click-to-play-popup-button popup-notification-button"
- oncommand="document.getBindingParent(this)._onButton(this)"
- flex="1"/>
- <xul:button anonid="secondarybutton"
- default="true"
- class="click-to-play-popup-button popup-notification-button"
- oncommand="document.getBindingParent(this)._onButton(this);"
- flex="1"/>
- </xul:hbox>
- <xul:box hidden="true">
- <children/>
- </xul:box>
- </xul:vbox>
- </content>
- <resources>
- <stylesheet src="chrome://global/skin/notification.css"/>
- </resources>
- <implementation>
- <field name="_states">
- ({SINGLE: 0, MULTI_COLLAPSED: 1, MULTI_EXPANDED: 2})
- </field>
- <field name="_primaryButton">
- document.getAnonymousElementByAttribute(this, "anonid", "primarybutton");
- </field>
- <field name="_secondaryButton">
- document.getAnonymousElementByAttribute(this, "anonid", "secondarybutton")
- </field>
- <field name="_buttonContainer">
- document.getAnonymousElementByAttribute(this, "anonid", "button-container")
- </field>
- <field name="_brandShortName">
- document.getElementById("bundle_brand").getString("brandShortName")
- </field>
- <field name="_items">[]</field>
- <constructor><![CDATA[
- const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- let sortedActions = [];
- for (let action of this.notification.options.pluginData.values()) {
- sortedActions.push(action);
- }
- sortedActions.sort((a, b) => a.pluginName.localeCompare(b.pluginName));
-
- for (let action of sortedActions) {
- let item = document.createElementNS(XUL_NS, "row");
- item.setAttribute("class", "plugin-popupnotification-centeritem");
- item.action = action;
- this.appendChild(item);
- this._items.push(item);
- }
- switch (this._items.length) {
- case 0:
- PopupNotifications._dismiss();
- break;
- case 1:
- this._setState(this._states.SINGLE);
- break;
- default:
- if (this.notification.options.primaryPlugin) {
- this._setState(this._states.MULTI_COLLAPSED);
- } else {
- this._setState(this._states.MULTI_EXPANDED);
- }
- }
- ]]></constructor>
- <method name="_setState">
- <parameter name="state" />
- <body><![CDATA[
- var grid = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-center-box");
-
- if (this._states.SINGLE == state) {
- grid.hidden = true;
- this._setupSingleState();
- return;
- }
-
- let prePath = this.notification.options.principal.URI.prePath;
- this._setupDescription("pluginActivateMultiple.message", null, prePath);
-
- var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
-
- var dialogStrings = Services.strings.createBundle("chrome://global/locale/dialog.properties");
- this._primaryButton.label = dialogStrings.GetStringFromName("button-accept");
- this._primaryButton.setAttribute("default", "true");
-
- this._secondaryButton.label = dialogStrings.GetStringFromName("button-cancel");
- this._primaryButton.setAttribute("action", "_multiAccept");
- this._secondaryButton.setAttribute("action", "_cancel");
-
- grid.hidden = false;
-
- if (this._states.MULTI_COLLAPSED == state) {
- for (let child of this.childNodes) {
- if (child.tagName != "row") {
- continue;
- }
- child.hidden = this.notification.options.primaryPlugin !=
- child.action.permissionString;
- }
- showBox.hidden = false;
- } else {
- for (let child of this.childNodes) {
- if (child.tagName != "row") {
- continue;
- }
- child.hidden = false;
- }
- showBox.hidden = true;
- }
- this._setupLink(null);
- ]]></body>
- </method>
- <method name="_setupSingleState">
- <body><![CDATA[
- var action = this._items[0].action;
- var prePath = action.pluginPermissionPrePath;
- let chromeWin = window.QueryInterface(Ci.nsIDOMChromeWindow);
- let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWin);
-
- let label, linkLabel, button1, button2;
-
- if (action.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
- button1 = {
- label: "pluginBlockNow.label",
- accesskey: "pluginBlockNow.accesskey",
- action: "_singleBlock"
- };
- button2 = {
- label: "pluginContinue.label",
- accesskey: "pluginContinue.accesskey",
- action: "_singleContinue",
- default: true
- };
- switch (action.blocklistState) {
- case Ci.nsIBlocklistService.STATE_NOT_BLOCKED:
- label = "pluginEnabled.message";
- linkLabel = "pluginActivate.learnMore";
- break;
-
- case Ci.nsIBlocklistService.STATE_BLOCKED:
- Cu.reportError(Error("Cannot happen!"));
- break;
-
- case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
- label = "pluginEnabledOutdated.message";
- linkLabel = "pluginActivate.updateLabel";
- break;
-
- case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
- label = "pluginEnabledVulnerable.message";
- linkLabel = "pluginActivate.riskLabel"
- break;
-
- default:
- Cu.reportError(Error("Unexpected blocklist state"));
- }
-
- // TODO: temporary compromise, remove this once bug 892487 is fixed
- if (isWindowPrivate) {
- this._buttonContainer.hidden = true;
- }
- } else if (action.pluginTag.enabledState == Ci.nsIPluginTag.STATE_DISABLED) {
- let linkElement =
- document.getAnonymousElementByAttribute(
- this, "anonid", "click-to-play-plugins-notification-link");
- linkElement.textContent = gNavigatorBundle.getString("pluginActivateDisabled.manage");
- linkElement.setAttribute("onclick", "gPluginHandler.managePlugins()");
-
- let descElement = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
- descElement.textContent = gNavigatorBundle.getFormattedString(
- "pluginActivateDisabled.message", [action.pluginName, this._brandShortName]) + " ";
- this._buttonContainer.hidden = true;
- return;
- } else if (action.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
- let descElement = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
- descElement.textContent = gNavigatorBundle.getFormattedString(
- "pluginActivateBlocked.message", [action.pluginName, this._brandShortName]) + " ";
- this._setupLink("pluginActivate.learnMore", action.detailsLink);
- this._buttonContainer.hidden = true;
- return;
- } else {
- button1 = {
- label: "pluginActivateNow.label",
- accesskey: "pluginActivateNow.accesskey",
- action: "_singleActivateNow"
- };
- button2 = {
- label: "pluginActivateAlways.label",
- accesskey: "pluginActivateAlways.accesskey",
- action: "_singleActivateAlways"
- };
- switch (action.blocklistState) {
- case Ci.nsIBlocklistService.STATE_NOT_BLOCKED:
- label = "pluginActivate2.message";
- linkLabel = "pluginActivate.learnMore";
- button2.default = true;
- break;
-
- case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
- label = "pluginActivateOutdated.message";
- linkLabel = "pluginActivate.updateLabel";
- button1.default = true;
- break;
-
- case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
- label = "pluginActivateVulnerable.message";
- linkLabel = "pluginActivate.riskLabel"
- button1.default = true;
- break;
-
- default:
- Cu.reportError(Error("Unexpected blocklist state"));
- }
-
- // TODO: temporary compromise, remove this once bug 892487 is fixed
- if (isWindowPrivate) {
- button1.default = true;
- this._secondaryButton.hidden = true;
- }
- }
- this._setupDescription(label, action.pluginName, prePath);
- this._setupLink(linkLabel, action.detailsLink);
-
- this._primaryButton.label = gNavigatorBundle.getString(button1.label);
- this._primaryButton.accessKey = gNavigatorBundle.getString(button1.accesskey);
- this._primaryButton.setAttribute("action", button1.action);
-
- this._secondaryButton.label = gNavigatorBundle.getString(button2.label);
- this._secondaryButton.accessKey = gNavigatorBundle.getString(button2.accesskey);
- this._secondaryButton.setAttribute("action", button2.action);
- if (button1.default) {
- this._primaryButton.setAttribute("default", "true");
- } else if (button2.default) {
- this._secondaryButton.setAttribute("default", "true");
- }
- ]]></body>
- </method>
- <method name="_setupDescription">
- <parameter name="baseString" />
- <parameter name="pluginName" /> <!-- null for the multiple-plugin case -->
- <parameter name="prePath" />
- <body><![CDATA[
- var span = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
- while (span.lastChild) {
- span.removeChild(span.lastChild);
- }
-
- var args = ["__prepath__", this._brandShortName];
- if (pluginName) {
- args.unshift(pluginName);
- }
- var bases = gNavigatorBundle.getFormattedString(baseString, args).
- split("__prepath__", 2);
-
- span.appendChild(document.createTextNode(bases[0]));
- var prePathSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "em");
- prePathSpan.appendChild(document.createTextNode(prePath));
- span.appendChild(prePathSpan);
- span.appendChild(document.createTextNode(bases[1] + " "));
- ]]></body>
- </method>
- <method name="_setupLink">
- <parameter name="linkString"/>
- <parameter name="linkUrl" />
- <body><![CDATA[
- var link = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-link");
- if (!linkString || !linkUrl) {
- link.hidden = true;
- return;
- }
-
- link.hidden = false;
- link.textContent = gNavigatorBundle.getString(linkString);
- link.href = linkUrl;
- ]]></body>
- </method>
- <method name="_onButton">
- <parameter name="aButton" />
- <body><![CDATA[
- let methodName = aButton.getAttribute("action");
- this[methodName]();
- ]]></body>
- </method>
- <method name="_singleActivateNow">
- <body><![CDATA[
- gPluginHandler._updatePluginPermission(this.notification,
- this._items[0].action,
- "allownow");
- this._cancel();
- ]]></body>
- </method>
- <method name="_singleBlock">
- <body><![CDATA[
- gPluginHandler._updatePluginPermission(this.notification,
- this._items[0].action,
- "block");
- this._cancel();
- ]]></body>
- </method>
- <method name="_singleActivateAlways">
- <body><![CDATA[
- gPluginHandler._updatePluginPermission(this.notification,
- this._items[0].action,
- "allowalways");
- this._cancel();
- ]]></body>
- </method>
- <method name="_singleContinue">
- <body><![CDATA[
- gPluginHandler._updatePluginPermission(this.notification,
- this._items[0].action,
- "continue");
- this._cancel();
- ]]></body>
- </method>
- <method name="_multiAccept">
- <body><![CDATA[
- for (let item of this._items) {
- let action = item.action;
- if (action.pluginTag.enabledState == Ci.nsIPluginTag.STATE_DISABLED ||
- action.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
- continue;
- }
- gPluginHandler._updatePluginPermission(this.notification,
- item.action, item.value);
- }
- this._cancel();
- ]]></body>
- </method>
- <method name="_cancel">
- <body><![CDATA[
- PopupNotifications._dismiss();
- ]]></body>
- </method>
- <method name="_accept">
- <parameter name="aEvent" />
- <body><![CDATA[
- if (aEvent.defaultPrevented)
- return;
- aEvent.preventDefault();
- if (this._primaryButton.getAttribute("default") == "true") {
- this._primaryButton.click();
- } else if (this._secondaryButton.getAttribute("default") == "true") {
- this._secondaryButton.click();
- }
- ]]></body>
- </method>
- </implementation>
- <handlers>
- <!-- The _accept method checks for .defaultPrevented so that if focus is in a button,
- enter activates the button and not this default action -->
- <handler event="keypress" keycode="VK_RETURN" group="system" action="this._accept(event);"/>
- </handlers>
- </binding>
-
<!-- This binding is only retained for add-ons compatibility -->
<binding id="menuitem-iconic-tooltip" extends="chrome://global/content/bindings/menu.xml#menuitem-iconic">
<implementation>
<constructor><![CDATA[
this.setAttribute("tooltiptext", this.getAttribute("acceltext"));
// TODO: Simplify this to this.setAttribute("acceltext", "") once bug
// 592424 is fixed
document.getAnonymousElementByAttribute(this, "anonid", "accel").firstChild.setAttribute("value", "");
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -321,16 +321,25 @@ pluginActivateNow.accesskey=N
# plugin.
pluginActivateAlways.label=Allow and Remember
pluginActivateAlways.accesskey=R
pluginBlockNow.label=Block Plugin
pluginBlockNow.accesskey=B
pluginContinue.label=Continue Allowing
pluginContinue.accesskey=C
+# TODO - these aren't finalized, and won't be landed like this. Subsequent patch will
+# finalize.
+flashActivate.message=Do you want to allow Flash to run on this site? Only allow Flash on sites you trust.
+flashActivate.remember=Remember this decision
+flashActivate.noAllow=Don’t Allow
+flashActivate.allow=Allow
+flashActivate.noAllow.accesskey=D
+flashActivate.allow.accesskey=A
+
# in-page UI
PluginClickToActivate=Activate %S.
PluginVulnerableUpdatable=This plugin is vulnerable and should be updated.
PluginVulnerableNoUpdate=This plugin has security vulnerabilities.
# infobar UI
pluginContinueBlocking.label=Continue Blocking
pluginContinueBlocking.accesskey=B
--- a/browser/themes/shared/notification-icons.inc.css
+++ b/browser/themes/shared/notification-icons.inc.css
@@ -199,34 +199,35 @@ html|*#webRTC-previewVideo {
.popup-notification-icon[popupid="addon-install-complete"] {
list-style-image: url(chrome://browser/skin/addons/addon-install-installed.svg);
}
.popup-notification-icon[popupid="addon-install-restart"] {
list-style-image: url(chrome://browser/skin/addons/addon-install-restart.svg);
}
-.popup-notification-icon[popupid="click-to-play-plugins"] {
- list-style-image: url(chrome://mozapps/skin/plugins/pluginBlocked-64.png);
-}
-
/* OFFLINE APPS */
.popup-notification-icon[popupid*="offline-app-requested"],
.popup-notification-icon[popupid="offline-app-usage"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
/* PLUGINS */
.plugin-icon {
list-style-image: url(chrome://browser/skin/notification-icons/plugin.svg);
transition: fill 1.5s;
}
+.plugin-blocked-icon {
+ list-style-image: url(chrome://browser/skin/notification-icons/plugin-blocked.svg);
+ transition: fill 1.5s;
+}
+
#plugin-icon-badge {
list-style-image: url(chrome://browser/skin/notification-icons/plugin-badge.svg);
opacity: 0;
transition: opacity 1.5s;
}
#plugins-notification-icon[extraAttr="inactive"] > .plugin-icon {
fill: #bfbfbf;
--- a/toolkit/themes/osx/mozapps/jar.mn
+++ b/toolkit/themes/osx/mozapps/jar.mn
@@ -17,17 +17,16 @@ toolkit.jar:
* skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
skin/classic/mozapps/extensions/update.css (extensions/update.css)
skin/classic/mozapps/extensions/eula.css (extensions/eula.css)
skin/classic/mozapps/extensions/blocklist.css (extensions/blocklist.css)
* skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
- skin/classic/mozapps/plugins/pluginBlocked-64.png (plugins/pluginBlocked-64.png)
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
skin/classic/mozapps/plugins/pluginHelp-16.png (plugins/pluginHelp-16.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/profile/profileSelection.css (profile/profileSelection.css)
skin/classic/mozapps/profile/profileicon-selected.png (profile/profileicon-selected.png)
skin/classic/mozapps/update/buttons.png (update/buttons.png)
* skin/classic/mozapps/update/updates.css (update/updates.css)
skin/classic/mozapps/viewsource/viewsource.css (viewsource/viewsource.css)
deleted file mode 100644
index 56b8a3322d9d5054480d8ae5d70386ecfe51ea0b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/toolkit/themes/shared/non-mac.jar.inc.mn
+++ b/toolkit/themes/shared/non-mac.jar.inc.mn
@@ -63,17 +63,16 @@
skin/classic/mozapps/extensions/blocklist.css (../../windows/mozapps/extensions/blocklist.css)
skin/classic/mozapps/extensions/update.css (../../windows/mozapps/extensions/update.css)
skin/classic/mozapps/extensions/discover-logo.png (../../windows/mozapps/extensions/discover-logo.png)
skin/classic/mozapps/extensions/rating-won.png (../../windows/mozapps/extensions/rating-won.png)
skin/classic/mozapps/extensions/rating-not-won.png (../../windows/mozapps/extensions/rating-not-won.png)
skin/classic/mozapps/extensions/cancel.png (../../windows/mozapps/extensions/cancel.png)
skin/classic/mozapps/extensions/eula.css (../../windows/mozapps/extensions/eula.css)
skin/classic/mozapps/handling/handling.css (../../windows/mozapps/handling/handling.css)
- skin/classic/mozapps/plugins/pluginBlocked-64.png (../../windows/mozapps/plugins/pluginBlocked-64.png)
skin/classic/mozapps/plugins/pluginHelp-16.png (../../windows/mozapps/plugins/pluginHelp-16.png)
skin/classic/mozapps/profile/profileSelection.css (../../windows/mozapps/profile/profileSelection.css)
skin/classic/mozapps/update/downloadButtons.png (../../windows/mozapps/update/downloadButtons.png)
* skin/classic/mozapps/xpinstall/xpinstallConfirm.css (../../windows/mozapps/extensions/xpinstallConfirm.css)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
deleted file mode 100644
index 3263cc1be981199ee8a5502ef3d047995e1c0331..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001