зеркало из https://github.com/mozilla/pjs.git
Bug 410124 - "Support plugin blocklist notification" [p=twanno@lycos.nl (Teune van Steeg) r=Neil sr=jag]
This commit is contained in:
Родитель
9737d616e3
Коммит
2b3151c143
|
@ -480,6 +480,10 @@
|
|||
this.missingPlugins[pluginInfo.mimetype] = pluginInfo;
|
||||
|
||||
if (!this.getNotificationWithValue("missing-plugins")) {
|
||||
var blockedNotification = this.getNotificationWithValue("blocked-plugins");
|
||||
if (blockedNotification)
|
||||
blockedNotification.close();
|
||||
|
||||
var self = this;
|
||||
var messageString = this._stringBundle.GetStringFromName("missingpluginsMessage.title");
|
||||
var buttons = [{
|
||||
|
@ -501,6 +505,84 @@
|
|||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="PluginBlocklisted">
|
||||
<![CDATA[
|
||||
// Since we are expecting also untrusted events, make sure
|
||||
// that the target is a plugin
|
||||
if (!(event.target instanceof Components.interfaces.nsIObjectLoadingContent))
|
||||
return;
|
||||
|
||||
if (this._prefs.getBoolPref("plugins.hide_infobar_for_missing_plugin"))
|
||||
return;
|
||||
|
||||
var pluginInfo = this.getPluginInfo(event.target);
|
||||
this.missingPlugins[pluginInfo.mimetype] = pluginInfo;
|
||||
|
||||
if (this.getNotificationWithValue("missing-plugins") ||
|
||||
this.getNotificationWithValue("blocked-plugins"))
|
||||
return;
|
||||
|
||||
var self = this;
|
||||
var messageString = this._stringBundle.GetStringFromName("blockedpluginsMessage.title");
|
||||
var buttons = [{
|
||||
label: this._stringBundle.GetStringFromName("blockedpluginsMessage.infoButton.label"),
|
||||
accessKey: this._stringBundle.GetStringFromName("blockedpluginsMessage.infoButton.accesskey"),
|
||||
popup: null,
|
||||
callback: function getBlocklistInfo() {
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Components.interfaces.nsIURLFormatter);
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
|
||||
const kExistingWindow = Components.interfaces.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW;
|
||||
const kNewWindow = Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWWINDOW;
|
||||
|
||||
var browserWin;
|
||||
var whereToOpen = self._prefs.getIntPref("browser.link.open_external");
|
||||
|
||||
if (whereToOpen != kNewWindow) {
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
browserWin = windowManager.getMostRecentWindow("navigator:browser");
|
||||
}
|
||||
|
||||
if (!browserWin) {
|
||||
var browserURL = "chrome://navigator/content/navigator.xul";
|
||||
try {
|
||||
browserURL = self._prefs.getCharPref("browser.chromeURL");
|
||||
} catch (ex) {}
|
||||
|
||||
window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", url);
|
||||
} else {
|
||||
if (whereToOpen == kExistingWindow)
|
||||
browserWin.loadURI(url);
|
||||
else {
|
||||
// new tab
|
||||
var browser = browserWin.getBrowser();
|
||||
var newTab = browser.addTab(url);
|
||||
browser.selectedTab = newTab;
|
||||
}
|
||||
browserWin.content.focus();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
label: this._stringBundle.GetStringFromName("blockedpluginsMessage.searchButton.label"),
|
||||
accessKey: this._stringBundle.GetStringFromName("blockedpluginsMessage.searchButton.accesskey"),
|
||||
popup: null,
|
||||
callback: function openPluginInstallerWizard() {
|
||||
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
||||
"", "chrome,resizable=yes",
|
||||
{plugins: self.missingPlugins, browser: self.activeBrowser});
|
||||
}
|
||||
}];
|
||||
|
||||
const priority = this.PRIORITY_WARNING_MEDIUM;
|
||||
const iconURL = "chrome://mozapps/skin/plugins/pluginGeneric.png";
|
||||
this.appendNotification(messageString, "blocked-plugins",
|
||||
iconURL, priority, buttons);
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="NewPluginInstalled">
|
||||
<![CDATA[
|
||||
this.missingPlugins = {};
|
||||
|
|
|
@ -2,6 +2,12 @@ missingpluginsMessage.title=Additional plugins are required to display all the m
|
|||
missingpluginsMessage.button.label=Install Missing Plugins...
|
||||
missingpluginsMessage.button.accesskey=I
|
||||
|
||||
blockedpluginsMessage.title=Some plugins required by this page have been blocked for your protection.
|
||||
blockedpluginsMessage.infoButton.label=Details...
|
||||
blockedpluginsMessage.infoButton.accesskey=D
|
||||
blockedpluginsMessage.searchButton.label=Update Plugins...
|
||||
blockedpluginsMessage.searchButton.accesskey=U
|
||||
|
||||
popupWarning=%S prevented this site from opening a popup window.
|
||||
popupWarningMultiple=%S prevented this site from opening %S popup windows.
|
||||
popupWarningButton=Preferences
|
||||
|
|
Загрузка…
Ссылка в новой задаче