Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 793338 - Implement blocklist click-to-play plugin notification po…

…pup UI. r=jaws a=akeybl
  • Loading branch information...
commit eb41fa6ab5a1e923658cb01ba3e305acd63eca95 1 parent 5aba864
@mozkeeler mozkeeler authored
View
32 browser/base/content/browser-plugins.js
@@ -435,8 +435,29 @@ var gPluginHandler = {
let centerActions = [];
for (let pluginName in pluginsDictionary) {
+ let plugin = pluginsDictionary[pluginName][0];
+ let warn = false;
+ let warningText = "";
+ let updateLink = Services.urlFormatter.formatURLPref("plugins.update.url");
+ if (plugin.pluginFallbackType) {
+ if (plugin.pluginFallbackType ==
+ Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE) {
+ warn = true;
+ warningText = gNavigatorBundle.getString("vulnerableUpdatablePluginWarning");
+ }
+ else if (plugin.pluginFallbackType ==
+ Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE) {
+ warn = true;
+ warningText = gNavigatorBundle.getString("vulnerableNoUpdatePluginWarning");
+ updateLink = "";
+ }
+ }
+
let action = {
message: pluginName,
+ warn: warn,
+ warningText: warningText,
+ updateLink: updateLink,
label: gNavigatorBundle.getString("activateSinglePlugin"),
callback: function() {
let plugins = gPluginHandler._getPluginsByName(cwu, this.message);
@@ -468,6 +489,17 @@ var gPluginHandler = {
callback: function() { gPluginHandler.activatePlugins(contentWindow); }
};
let centerActions = gPluginHandler._makeCenterActions(aBrowser);
+ let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ let haveVulnerablePlugin = cwu.plugins.some(function(plugin) {
+ let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
+ return (gPluginHandler.canActivatePlugin(objLoadingContent) &&
+ (objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE ||
+ objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE));
+ });
+ if (haveVulnerablePlugin) {
+ messageString = gNavigatorBundle.getString("vulnerablePluginsMessage");
+ }
let secondaryActions = [{
label: gNavigatorBundle.getString("activatePluginsMessage.always"),
accessKey: gNavigatorBundle.getString("activatePluginsMessage.always.accesskey"),
View
43 browser/base/content/urlbarBindings.xml
@@ -1431,17 +1431,25 @@
<binding id="center-item">
<content align="center">
- <xul:hbox flex="1" align="center" class="center-item-box"
- xbl:inherits="padbottom">
- <xul:image class="center-item-icon"
- xbl:inherits="src=itemicon"/>
- <xul:description class="center-item-label"
- xbl:inherits="xbl:text=itemtext"/>
- <xul:spacer flex="1"/>
- <xul:button class="popup-notification-menubutton center-item-button"
- oncommand="document.getBindingParent(this).runCallback();"
- xbl:inherits="label=buttonlabel"/>
- </xul:hbox>
+ <xul:vbox flex="1" class="center-item-box"
+ xbl:inherits="warn,showseparator,padbottom">
+ <xul:hbox flex="1" align="center">
+ <xul:image class="center-item-icon"
+ xbl:inherits="src=itemicon"/>
+ <xul:description class="center-item-label"
+ xbl:inherits="xbl:text=itemtext"/>
+ <xul:spacer flex="1"/>
+ <xul:button class="popup-notification-menubutton center-item-button"
+ oncommand="document.getBindingParent(this).runCallback();"
+ xbl:inherits="label=buttonlabel"/>
+ </xul:hbox>
+ <xul:hbox flex="1" align="center" class="center-item-warning">
+ <xul:image class="center-item-warning-icon"/>
+ <xul:label class="center-item-warning-description" xbl:inherits="xbl:text=warningText"/>
+ <xul:label xbl:inherits="href=updateLink" value="&checkForUpdates;" class="text-link"/>
+ <xul:spacer flex="1"/>
+ </xul:hbox>
+ </xul:vbox>
</content>
<resources>
<stylesheet src="chrome://global/skin/notification.css"/>
@@ -1511,13 +1519,26 @@
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let popupnotification = this;
let item = null;
+ let prev = null;
this.notification.options.centerActions.forEach(function(action) {
action.popupnotification = popupnotification;
item = document.createElementNS(XUL_NS, "popupnotification-centeritem");
item.action = action;
item.setAttribute("itemtext", action.message);
item.setAttribute("buttonlabel", action.label);
+ item.setAttribute("warn", action.warn);
+ item.setAttribute("warningText", action.warningText);
+ item.setAttribute("updateLink", action.updateLink);
+ if (prev &&
+ (prev.getAttribute("warn") == "true" ||
+ item.getAttribute("warn") == "true")) {
+ item.setAttribute("showseparator", true);
+ if (prev.getAttribute("warn") != "true") {
+ prev.setAttribute("padbottom", true);
+ }
+ }
popupnotification.appendChild(item);
+ prev = item;
});
if (item != null) {
item.setAttribute("padbottom", "true");
View
5 browser/locales/en-US/chrome/browser/browser.properties
@@ -128,8 +128,13 @@ activatePluginsMessage.never=Never activate plugins for this site
activatePluginsMessage.never.accesskey=N
activateSinglePlugin=Activate
PluginClickToPlay=Click here to activate the %S plugin.
+# LOCALIZATION NOTE - "vulnerable" indicates there is a security bug in the
+# plugin that is being exploited by attackers.
PluginVulnerableUpdatable=This plugin is vulnerable and should be updated.
PluginVulnerableNoUpdate=This plugin has security vulnerabilities.
+vulnerableUpdatablePluginWarning=Outdated Version!
+vulnerableNoUpdatePluginWarning=Vulnerable Plugin!
+vulnerablePluginsMessage=Some plugins have been deactivated for your safety.
pluginInfo.unknownPlugin=Unknown
# Sanitize
View
41 browser/themes/gnomestripe/browser.css
@@ -2883,6 +2883,47 @@ panel[type="arrow"][popupid="click-to-play-plugins"] > .panel-arrowcontainer > .
margin-bottom: 4px;
}
+.center-item-box[warn="true"] {
+ background-image: url("chrome://mozapps/skin/extensions/stripes-info-negative-small.png");
+ background-repeat: repeat-x;
+ padding-top: 7px;
+ -moz-padding-end: 11px;
+ padding-bottom: 9px;
+ -moz-padding-start: 16px;
+}
+
+.center-item-box[padbottom="true"][warn="true"] {
+ padding-bottom: 7px;
+}
+
+.center-item-box[showseparator="true"] {
+ border-top: 1px solid hsla(211,79%,6%,.1);
+}
+
+.center-item-box[warn="false"] > .center-item-warning {
+ display: none;
+}
+
+.center-item-warning > .text-link {
+ color: #3d8cd7;
+}
+
+.center-item-warning > .text-link[href=""] {
+ display: none;
+}
+
+.center-item-warning-icon {
+ background-image: url("chrome://mozapps/skin/extensions/alerticon-info-negative.png");
+ background-repeat: no-repeat;
+ width: 16px;
+ height: 15px;
+ margin-bottom: 4px;
+}
+
+.center-item-warning-description {
+ color: #828282;
+}
+
.center-item-button {
min-width: 0;
}
View
41 browser/themes/pinstripe/browser.css
@@ -3615,6 +3615,47 @@ panel[type="arrow"][popupid="click-to-play-plugins"] > .panel-arrowcontainer > .
-moz-margin-end: 6px;
}
+.center-item-box[warn="true"] {
+ background-image: url("chrome://mozapps/skin/extensions/stripes-info-negative-small.png");
+ background-repeat: repeat-x;
+ padding-top: 3px;
+ -moz-padding-end: 11px;
+ padding-bottom: 9px;
+ -moz-padding-start: 16px;
+}
+
+.center-item-box[padbottom="true"][warn="true"] {
+ padding-bottom: 7px;
+}
+
+.center-item-box[showseparator="true"] {
+ border-top: 1px solid hsla(211,79%,6%,.1);
+}
+
+.center-item-box[warn="false"] > .center-item-warning {
+ display: none;
+}
+
+.center-item-warning > .text-link {
+ color: #3d8cd7;
+}
+
+.center-item-warning > .text-link[href=""] {
+ display: none;
+}
+
+.center-item-warning-icon {
+ background-image: url("chrome://mozapps/skin/extensions/alerticon-info-negative.png");
+ background-repeat: no-repeat;
+ width: 16px;
+ height: 15px;
+ margin-bottom: 4px;
+}
+
+.center-item-warning-description {
+ color: #828282;
+}
+
.center-item-button {
min-width: 0;
}
View
38 browser/themes/winstripe/browser.css
@@ -3584,6 +3584,44 @@ chatbox[minimized="true"] {
margin-bottom: 4px;
}
+.center-item-box[warn="true"] {
+ background-image: url("chrome://mozapps/skin/extensions/stripes-info-negative-small.png");
+ background-repeat: repeat-x;
+ padding: 8px 16px 6px 16px;
+}
+
+.center-item-box[padbottom="true"][warn="true"] {
+ padding-bottom: 4px;
+}
+
+.center-item-box[showseparator="true"] {
+ border-top: 1px solid hsla(211,79%,6%,.1);
+}
+
+.center-item-box[warn="false"] > .center-item-warning {
+ display: none;
+}
+
+.center-item-warning > .text-link {
+ color: #3d8cd7;
+}
+
+.center-item-warning > .text-link[href=""] {
+ display: none;
+}
+
+.center-item-warning-icon {
+ background-image: url("chrome://mozapps/skin/extensions/alerticon-info-negative.png");
+ background-repeat: no-repeat;
+ width: 16px;
+ height: 15px;
+ margin-bottom: 4px;
+}
+
+.center-item-warning-description {
+ color: #828282;
+}
+
.center-item-button {
min-width: 0;
}
View
2  toolkit/locales/en-US/chrome/global/notification.dtd
@@ -5,3 +5,5 @@
<!ENTITY closeNotification.tooltip "Close this message">
<!ENTITY closeNotificationItem.label "Not Now">
+
+<!ENTITY checkForUpdates "Check for updates…">
View
BIN  toolkit/themes/pinstripe/mozapps/extensions/stripes-info-negative-small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  toolkit/themes/pinstripe/mozapps/jar.mn
@@ -38,6 +38,7 @@ toolkit.jar:
skin/classic/mozapps/extensions/stripes-error.png (extensions/stripes-error.png)
skin/classic/mozapps/extensions/stripes-info-positive.png (extensions/stripes-info-positive.png)
skin/classic/mozapps/extensions/stripes-info-negative.png (extensions/stripes-info-negative.png)
+ skin/classic/mozapps/extensions/stripes-info-negative-small.png (extensions/stripes-info-negative-small.png)
skin/classic/mozapps/extensions/alerticon-warning.png (extensions/alerticon-warning.png)
skin/classic/mozapps/extensions/alerticon-error.png (extensions/alerticon-error.png)
skin/classic/mozapps/extensions/alerticon-info-positive.png (extensions/alerticon-info-positive.png)
View
BIN  toolkit/themes/winstripe/mozapps/extensions/stripes-info-negative-small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  toolkit/themes/winstripe/mozapps/jar.mn
@@ -45,6 +45,7 @@ toolkit.jar:
skin/classic/mozapps/extensions/stripes-error.png (extensions/stripes-error.png)
skin/classic/mozapps/extensions/stripes-info-positive.png (extensions/stripes-info-positive.png)
skin/classic/mozapps/extensions/stripes-info-negative.png (extensions/stripes-info-negative.png)
+ skin/classic/mozapps/extensions/stripes-info-negative-small.png (extensions/stripes-info-negative-small.png)
skin/classic/mozapps/extensions/alerticon-warning.png (extensions/alerticon-warning.png)
skin/classic/mozapps/extensions/alerticon-error.png (extensions/alerticon-error.png)
skin/classic/mozapps/extensions/alerticon-info-positive.png (extensions/alerticon-info-positive.png)
@@ -125,6 +126,7 @@ toolkit.jar:
skin/classic/aero/mozapps/extensions/stripes-error.png (extensions/stripes-error.png)
skin/classic/aero/mozapps/extensions/stripes-info-positive.png (extensions/stripes-info-positive.png)
skin/classic/aero/mozapps/extensions/stripes-info-negative.png (extensions/stripes-info-negative.png)
+ skin/classic/aero/mozapps/extensions/stripes-info-negative-small.png (extensions/stripes-info-negative-small.png)
skin/classic/aero/mozapps/extensions/alerticon-warning.png (extensions/alerticon-warning.png)
skin/classic/aero/mozapps/extensions/alerticon-error.png (extensions/alerticon-error.png)
skin/classic/aero/mozapps/extensions/alerticon-info-positive.png (extensions/alerticon-info-positive.png)
Please sign in to comment.
Something went wrong with that request. Please try again.