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 db8f0e31ca
commit 5c6f11d71c
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);
if (notification)
notification.remove();
gPluginHandler._removeClickToPlayOverlays(contentWindow);
}
}];
let options = { dismissed: true };
@ -7356,6 +7357,16 @@ var gPluginHandler = {
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.
pluginUnavailable: function (plugin, eventType) {
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument

View File

@ -383,6 +383,8 @@ function test13b() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
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;
gTestBrowser.reload();
@ -395,6 +397,8 @@ function test13c() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
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.prefs.setBoolPref("plugins.click_to_play", false);