Bug 752461 - Hide click-to-play overlays when choosing "never activate plugins..." r=jaws

This commit is contained in:
David Keeler 2012-05-08 14:38:50 -07:00
parent e4cd7e32d8
commit 17b4af6713
2 changed files with 15 additions and 0 deletions

View File

@ -7348,6 +7348,7 @@ var gPluginHandler = {
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser); let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
if (notification) if (notification)
notification.remove(); notification.remove();
gPluginHandler._removeClickToPlayOverlays(contentWindow);
} }
}]; }];
let options = { dismissed: true }; let options = { dismissed: true };
@ -7356,6 +7357,16 @@ var gPluginHandler = {
mainAction, secondaryActions, options); mainAction, secondaryActions, options);
}, },
_removeClickToPlayOverlays: function PH_removeClickToPlayOverlays(aContentWindow) {
let doc = aContentWindow.document;
let cwu = aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
for (let plugin of cwu.plugins) {
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
overlay.style.visibility = "hidden";
}
},
// event listener for missing/blocklisted/outdated/carbonFailure plugins. // event listener for missing/blocklisted/outdated/carbonFailure plugins.
pluginUnavailable: function (plugin, eventType) { pluginUnavailable: function (plugin, eventType) {
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument

View File

@ -383,6 +383,8 @@ function test13b() {
var plugin = gTestBrowser.contentDocument.getElementById("test"); var plugin = gTestBrowser.contentDocument.getElementById("test");
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 13b, Plugin should not be activated"); ok(!objLoadingContent.activated, "Test 13b, Plugin should not be activated");
var overlay = gTestBrowser.contentDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay.style.visibility == "hidden", "Test 13b, Plugin should not have visible overlay");
gNextTest = test13c; gNextTest = test13c;
gTestBrowser.reload(); gTestBrowser.reload();
@ -395,6 +397,8 @@ function test13c() {
var plugin = gTestBrowser.contentDocument.getElementById("test"); var plugin = gTestBrowser.contentDocument.getElementById("test");
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 13c, Plugin should not be activated"); ok(!objLoadingContent.activated, "Test 13c, Plugin should not be activated");
var overlay = gTestBrowser.contentDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay.style.visibility == "hidden", "Test 13c, Plugin should not have visible overlay");
Services.perms.removeAll(); Services.perms.removeAll();
Services.prefs.setBoolPref("plugins.click_to_play", false); Services.prefs.setBoolPref("plugins.click_to_play", false);