--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -48,17 +48,18 @@ var gPluginHandler = {
this.showClickToPlayNotification(msg.target, msg.data.plugins, msg.data.showNow,
msg.principal, msg.data.location);
break;
case "PluginContent:RemoveNotification":
this.removeNotification(msg.target, msg.data.name);
break;
case "PluginContent:UpdateHiddenPluginUI":
this.updateHiddenPluginUI(msg.target, msg.data.haveInsecure, msg.data.actions,
- msg.principal, msg.data.location);
+ msg.principal, msg.data.location)
+ .catch(Cu.reportError);
break;
case "PluginContent:HideNotificationBar":
this.hideNotificationBar(msg.target, msg.data.name);
break;
case "PluginContent:InstallSinglePlugin":
this.installSinglePlugin(msg.data.pluginInfo);
break;
case "PluginContent:ShowPluginCrashedNotification":
@@ -299,20 +300,36 @@ var gPluginHandler = {
hideNotificationBar(browser, name) {
let notificationBox = gBrowser.getNotificationBox(browser);
let notification = notificationBox.getNotificationWithValue(name);
if (notification)
notificationBox.removeNotification(notification, true);
},
- updateHiddenPluginUI(browser, haveInsecure, actions,
+ infobarBlockedForURI(uri) {
+ return new Promise((resolve, reject) => {
+ let tableName = Services.prefs.getStringPref("urlclassifier.flashInfobarTable", "");
+ if (!tableName) {
+ resolve(false);
+ }
+ let classifier = Cc["@mozilla.org/url-classifier/dbservice;1"]
+ .getService(Ci.nsIURIClassifier);
+ classifier.asyncClassifyLocalWithTables(uri, tableName, (c, list) => {
+ resolve(list.length > 0);
+ });
+ });
+ },
+
+ async updateHiddenPluginUI(browser, haveInsecure, actions,
principal, location) {
let origin = principal.originNoSuffix;
+ let shouldShowNotification = !(await this.infobarBlockedForURI(browser.documentURI));
+
// It is possible that we've received a message from the frame script to show
// the hidden plugin notification for a principal that no longer matches the one
// that the browser's content now has assigned (ie, the browser has browsed away
// after the message was sent, but before the message was received). In that case,
// we should just ignore the message.
if (!principal.equals(browser.contentPrincipal)) {
return;
}
@@ -437,25 +454,27 @@ var gPluginHandler = {
notificationBox.PRIORITY_INFO_HIGH, buttons,
notificationCallback);
if (haveInsecure) {
n.classList.add("pluginVulnerable");
}
}
if (actions.length == 0) {
- hideNotification();
+ shouldShowNotification = false;
+ }
+ if (shouldShowNotification &&
+ Services.perms.testPermissionFromPrincipal(principal, "plugin-hidden-notification") ==
+ Ci.nsIPermissionManager.DENY_ACTION) {
+ shouldShowNotification = false;
+ }
+ if (shouldShowNotification) {
+ showNotification();
} else {
- let notificationPermission = Services.perms.testPermissionFromPrincipal(
- principal, "plugin-hidden-notification");
- if (notificationPermission == Ci.nsIPermissionManager.DENY_ACTION) {
- hideNotification();
- } else {
- showNotification();
- }
+ hideNotification();
}
},
contextMenuCommand(browser, plugin, command) {
browser.messageManager.sendAsyncMessage("BrowserPlugins:ContextMenuCommand",
{ command }, { plugin });
},