Bug 934503 - Activated hidden plugins should not show the hidden plugin notification icon, r=jaws

--HG--
extra : rebase_source : bdae17aa44e5fbe60d724b3ad98f679da9c851f1
This commit is contained in:
Benjamin Smedberg 2013-11-05 16:43:53 -05:00
parent 792ace36fa
commit 646382fbac
2 changed files with 39 additions and 5 deletions

View File

@ -903,14 +903,21 @@ var gPluginHandler = {
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
for (let plugin of cwu.plugins) {
let fallbackType = plugin.pluginFallbackType;
if (fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY) {
continue;
}
let info = this._getPluginInfo(plugin);
if (!actions.has(info.permissionString)) {
continue;
}
let fallbackType = info.fallbackType;
if (fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
actions.delete(info.permissionString);
if (actions.size == 0) {
break;
}
continue;
}
if (fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY) {
continue;
}
let overlay = this.getPluginUI(plugin, "main");
if (!overlay) {
continue;

View File

@ -844,5 +844,32 @@ function test25() {
ok(notification, "Test 25: There should be a plugin notification even if the plugin was immediately removed");
ok(notification.dismissed, "Test 25: The notification should be dismissed by default");
finishTest();
prepareTest(() => executeSoon(test26), gTestRoot + "plugin_small.html");
}
function test26() {
let notification = PopupNotifications.getNotification("click-to-play-plugins");
ok(notification, "Test 26: There should be a plugin notification");
waitForCondition(() => gBrowser.ownerDocument.
getElementById("plugins-notification-icon").classList.
contains("plugin-hidden"),
() => {
// Don't use setTestPluginEnabledState here because we already saved the
// prior value
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
prepareTest(test27, gTestRoot + "plugin_small.html");
},
"Test 26, expected the plugin notification icon to be highlighted");
}
function test27() {
let notification = PopupNotifications.getNotification("click-to-play-plugins");
ok(notification, "Test 27: There should be a plugin notification");
waitForCondition(() => !gBrowser.ownerDocument.
getElementById("plugins-notification-icon").classList.
contains("plugin-hidden"),
finishTest,
"Test 27, expected the plugin notification icon to not be highlighted");
}