mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 514327 - Detect outdated plugins and offer upgrade path. ui-r=beltzner, r=dtownsend,josh
This commit is contained in:
parent
17b9b7b0ab
commit
9cdc2ead10
@ -568,8 +568,12 @@ pref("plugin.default_plugin_disabled", true);
|
||||
// plugin finder service url
|
||||
pref("pfs.datasource.url", "https://pfs.mozilla.org/plugins/PluginFinderService.php?mimetype=%PLUGIN_MIMETYPE%&appID=%APP_ID%&appVersion=%APP_VERSION%&clientOS=%CLIENT_OS%&chromeLocale=%CHROME_LOCALE%&appRelease=%APP_RELEASE%");
|
||||
|
||||
// by default we show an infobar message when pages require plugins the user has not installed
|
||||
// by default we show an infobar message when pages require plugins the user has not installed, or are outdated
|
||||
pref("plugins.hide_infobar_for_missing_plugin", false);
|
||||
pref("plugins.hide_infobar_for_outdated_plugin", false);
|
||||
|
||||
pref("plugins.update.url", "https://www.mozilla.com/%LOCALE%/plugins/");
|
||||
pref("plugins.update.notifyUser", false);
|
||||
|
||||
#ifdef XP_WIN
|
||||
pref("browser.preferences.instantApply", false);
|
||||
|
@ -1074,6 +1074,7 @@ function prepareForStartup() {
|
||||
// binding can't fire trusted ones (runs with page privileges).
|
||||
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, true, true);
|
||||
gBrowser.addEventListener("PluginBlocklisted", gMissingPluginInstaller.newMissingPlugin, true, true);
|
||||
gBrowser.addEventListener("PluginOutdated", gMissingPluginInstaller.newMissingPlugin, true, true);
|
||||
gBrowser.addEventListener("PluginDisabled", gMissingPluginInstaller.newDisabledPlugin, true, true);
|
||||
gBrowser.addEventListener("NewPluginInstalled", gMissingPluginInstaller.refreshBrowser, false);
|
||||
gBrowser.addEventListener("NewTab", BrowserOpenTab, false);
|
||||
@ -5899,14 +5900,18 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
|
||||
// so don't stomp on the page developers toes.
|
||||
|
||||
if (aEvent.type != "PluginBlocklisted" &&
|
||||
aEvent.type != "PluginOutdated" &&
|
||||
!(aEvent.target instanceof HTMLObjectElement)) {
|
||||
aEvent.target.addEventListener("click",
|
||||
gMissingPluginInstaller.installSinglePlugin,
|
||||
true);
|
||||
}
|
||||
|
||||
let hideBarPrefName = aEvent.type == "PluginOutdated" ?
|
||||
"plugins.hide_infobar_for_outdated_plugin" :
|
||||
"plugins.hide_infobar_for_missing_plugin";
|
||||
try {
|
||||
if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin"))
|
||||
if (gPrefService.getBoolPref(hideBarPrefName))
|
||||
return;
|
||||
} catch (ex) {} // if the pref is missing, treat it as false, which shows the infobar
|
||||
|
||||
@ -5921,14 +5926,44 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
|
||||
|
||||
var notificationBox = gBrowser.getNotificationBox(browser);
|
||||
|
||||
// If there is already a missing plugin notification then do nothing
|
||||
if (notificationBox.getNotificationWithValue("missing-plugins"))
|
||||
// Should only display one of these warnings per page.
|
||||
// In order of priority, they are: outdated > missing > blocklisted
|
||||
|
||||
// If there is already an outdated plugin notification then do nothing
|
||||
if (notificationBox.getNotificationWithValue("outdated-plugins"))
|
||||
return;
|
||||
var blockedNotification = notificationBox.getNotificationWithValue("blocked-plugins");
|
||||
var missingNotification = notificationBox.getNotificationWithValue("missing-plugins");
|
||||
var priority = notificationBox.PRIORITY_WARNING_MEDIUM;
|
||||
|
||||
function showBlocklistInfo() {
|
||||
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Ci.nsIURLFormatter);
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
gBrowser.loadOneTab(url, {inBackground: false});
|
||||
return true;
|
||||
}
|
||||
|
||||
function showOutdatedPluginsInfo() {
|
||||
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Ci.nsIURLFormatter);
|
||||
var url = formatter.formatURLPref("plugins.update.url");
|
||||
gBrowser.loadOneTab(url, {inBackground: false});
|
||||
return true;
|
||||
}
|
||||
|
||||
function showPluginsMissing() {
|
||||
// get the urls of missing plugins
|
||||
var missingPluginsArray = gBrowser.selectedBrowser.missingPlugins;
|
||||
if (missingPluginsArray) {
|
||||
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
||||
"PFSWindow", "chrome,centerscreen,resizable=yes",
|
||||
{plugins: missingPluginsArray, browser: gBrowser.selectedBrowser});
|
||||
}
|
||||
}
|
||||
|
||||
if (aEvent.type == "PluginBlocklisted") {
|
||||
if (blockedNotification)
|
||||
if (blockedNotification || missingNotification)
|
||||
return;
|
||||
|
||||
let iconURL = "chrome://mozapps/skin/plugins/pluginBlocked-16.png";
|
||||
@ -5937,19 +5972,41 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
|
||||
label: gNavigatorBundle.getString("blockedpluginsMessage.infoButton.label"),
|
||||
accessKey: gNavigatorBundle.getString("blockedpluginsMessage.infoButton.accesskey"),
|
||||
popup: null,
|
||||
callback: blocklistInfo
|
||||
callback: showBlocklistInfo
|
||||
}, {
|
||||
label: gNavigatorBundle.getString("blockedpluginsMessage.searchButton.label"),
|
||||
accessKey: gNavigatorBundle.getString("blockedpluginsMessage.searchButton.accesskey"),
|
||||
popup: null,
|
||||
callback: pluginsMissing
|
||||
callback: showOutdatedPluginsInfo
|
||||
}];
|
||||
|
||||
notificationBox.appendNotification(messageString, "blocked-plugins",
|
||||
iconURL, priority, buttons);
|
||||
}
|
||||
else if (aEvent.type == "PluginOutdated") {
|
||||
// Cancel any notification about blocklisting/missing plugins
|
||||
if (blockedNotification)
|
||||
blockedNotification.close();
|
||||
if (missingNotification)
|
||||
missingNotification.close();
|
||||
|
||||
let iconURL = "chrome://mozapps/skin/plugins/pluginOutdated-16.png";
|
||||
let messageString = gNavigatorBundle.getString("outdatedpluginsMessage.title");
|
||||
let buttons = [{
|
||||
label: gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.label"),
|
||||
accessKey: gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.accesskey"),
|
||||
popup: null,
|
||||
callback: showOutdatedPluginsInfo
|
||||
}];
|
||||
|
||||
notificationBox.appendNotification(messageString, "outdated-plugins",
|
||||
iconURL, priority, buttons);
|
||||
}
|
||||
else if (aEvent.type == "PluginNotFound") {
|
||||
// Cancel any notification about blocklisting
|
||||
if (missingNotification)
|
||||
return;
|
||||
|
||||
// Cancel any notification about blocklisting plugins
|
||||
if (blockedNotification)
|
||||
blockedNotification.close();
|
||||
|
||||
@ -5959,7 +6016,7 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
|
||||
label: gNavigatorBundle.getString("missingpluginsMessage.button.label"),
|
||||
accessKey: gNavigatorBundle.getString("missingpluginsMessage.button.accesskey"),
|
||||
popup: null,
|
||||
callback: pluginsMissing
|
||||
callback: showPluginsMissing
|
||||
}];
|
||||
|
||||
notificationBox.appendNotification(messageString, "missing-plugins",
|
||||
@ -5994,26 +6051,6 @@ missingPluginInstaller.prototype.refreshBrowser = function(aEvent) {
|
||||
browser.reload();
|
||||
}
|
||||
|
||||
function blocklistInfo()
|
||||
{
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Components.interfaces.nsIURLFormatter);
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
gBrowser.loadOneTab(url, {inBackground: false});
|
||||
return true;
|
||||
}
|
||||
|
||||
function pluginsMissing()
|
||||
{
|
||||
// get the urls of missing plugins
|
||||
var missingPluginsArray = gBrowser.selectedBrowser.missingPlugins;
|
||||
if (missingPluginsArray) {
|
||||
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
||||
"PFSWindow", "chrome,centerscreen,resizable=yes",
|
||||
{plugins: missingPluginsArray, browser: gBrowser.selectedBrowser});
|
||||
}
|
||||
}
|
||||
|
||||
var gMissingPluginInstaller = new missingPluginInstaller();
|
||||
|
||||
function convertFromUnicode(charset, str)
|
||||
|
@ -52,6 +52,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/distribution.js");
|
||||
|
||||
const PREF_EM_NEW_ADDONS_LIST = "extensions.newAddons";
|
||||
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
|
||||
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
|
||||
|
||||
// We try to backup bookmarks at idle times, to avoid doing that at shutdown.
|
||||
// Number of idle seconds before trying to backup bookmarks. 15 minutes.
|
||||
@ -334,6 +336,11 @@ BrowserGlue.prototype = {
|
||||
if (this._isPlacesDatabaseLocked) {
|
||||
this._showPlacesLockedNotificationBox();
|
||||
}
|
||||
|
||||
// If there are plugins installed that are outdated, and the user hasn't
|
||||
// been warned about them yet, open the plugins update page.
|
||||
if (this._prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
|
||||
this._showPluginUpdatePage();
|
||||
},
|
||||
|
||||
_onQuitRequest: function(aCancelQuit, aQuitType)
|
||||
@ -526,6 +533,18 @@ BrowserGlue.prototype = {
|
||||
var box = notifyBox.appendNotification(notifyRightsText, "about-rights", null, notifyBox.PRIORITY_INFO_LOW, buttons);
|
||||
box.persistence = 3; // arbitrary number, just so bar sticks around for a bit
|
||||
},
|
||||
|
||||
_showPluginUpdatePage : function () {
|
||||
this._prefs.setBoolPref(PREF_PLUGINS_NOTIFYUSER, false);
|
||||
|
||||
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Ci.nsIURLFormatter);
|
||||
var updateUrl = formatter.formatURLPref(PREF_PLUGINS_UPDATEURL);
|
||||
|
||||
var win = this.getMostRecentBrowserWindow();
|
||||
var browser = win.gBrowser;
|
||||
browser.selectedTab = browser.addTab(updateUrl);
|
||||
},
|
||||
|
||||
// returns the (cached) Sanitizer constructor
|
||||
get Sanitizer()
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWebNavigationInfo.h"
|
||||
#include "nsIScriptChannel.h"
|
||||
#include "nsIBlocklistService.h"
|
||||
|
||||
#include "nsPluginError.h"
|
||||
|
||||
@ -197,6 +198,9 @@ nsPluginErrorEvent::Run()
|
||||
case ePluginBlocklisted:
|
||||
type = NS_LITERAL_STRING("PluginBlocklisted");
|
||||
break;
|
||||
case ePluginOutdated:
|
||||
type = NS_LITERAL_STRING("PluginOutdated");
|
||||
break;
|
||||
default:
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1734,14 +1738,14 @@ nsObjectLoadingContent::Instantiate(nsIObjectFrame* aFrame,
|
||||
IsPluginEnabledByExtension(aURI, typeToUse);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
if (!aURI) {
|
||||
// We need some URI. If we have nothing else, use the base URI.
|
||||
// XXX(biesi): The code used to do this. Not sure why this is correct...
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
|
||||
GetObjectBaseURI(thisContent, getter_AddRefs(baseURI));
|
||||
aURI = baseURI;
|
||||
}
|
||||
@ -1754,6 +1758,24 @@ nsObjectLoadingContent::Instantiate(nsIObjectFrame* aFrame,
|
||||
|
||||
mInstantiating = oldInstantiatingValue;
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> pluginInstance;
|
||||
aFrame->GetPluginInstance(*getter_AddRefs(pluginInstance));
|
||||
if (pluginInstance) {
|
||||
nsCOMPtr<nsIPluginTag> pluginTag;
|
||||
nsCOMPtr<nsIPluginHost> host(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
|
||||
host->GetPluginTagForInstance(pluginInstance, getter_AddRefs(pluginTag));
|
||||
|
||||
nsCOMPtr<nsIBlocklistService> blocklist =
|
||||
do_GetService("@mozilla.org/extensions/blocklist;1");
|
||||
if (blocklist) {
|
||||
PRUint32 blockState = nsIBlocklistService::STATE_NOT_BLOCKED;
|
||||
blocklist->GetPluginBlocklistState(pluginTag, EmptyString(),
|
||||
EmptyString(), &blockState);
|
||||
if (blockState == nsIBlocklistService::STATE_OUTDATED)
|
||||
FirePluginError(thisContent, ePluginOutdated);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ enum PluginSupportState {
|
||||
ePluginDisabled, // The plugin has been explicitly disabled by the
|
||||
// user.
|
||||
ePluginBlocklisted, // The plugin is blocklisted and disabled
|
||||
ePluginOutdated, // The plugin is considered outdated, but not disabled
|
||||
ePluginOtherState // Something else (e.g. not a plugin at all as far
|
||||
// as we can tell).
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ interface nsIPluginStreamListener;
|
||||
[ref] native nsIStreamListenerRef(nsIStreamListener *);
|
||||
[ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
|
||||
|
||||
[scriptable, uuid(23E8FD98-A625-4B08-BE1A-F7CC18A5B106)]
|
||||
[scriptable, uuid(30C7C529-B05C-4950-B5B8-9AF673E46521)]
|
||||
interface nsIPluginHost : nsISupports
|
||||
{
|
||||
[noscript] void init();
|
||||
@ -278,6 +278,13 @@ interface nsIPluginHost : nsISupports
|
||||
* copy the string value if you need it longer than that.
|
||||
*/
|
||||
[noscript] void getPluginName(in nsIPluginInstance aInstance, [shared] out string aPluginName);
|
||||
|
||||
/**
|
||||
* Get the plugin tag associated with a given plugin instance.
|
||||
* @param aInstance the plugin instance object
|
||||
* @return plugin tag object
|
||||
*/
|
||||
[noscript] nsIPluginTag getPluginTagForInstance(in nsIPluginInstance aInstance);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -4239,6 +4239,8 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||
// put newer plugins first to weed out dups and catch upgrades, see bug 119966
|
||||
pluginFilesArray.Sort();
|
||||
|
||||
PRBool warnOutdated = PR_FALSE;
|
||||
|
||||
// finally, go through the array, looking at each entry and continue processing it
|
||||
for (PRUint32 i = 0; i < pluginFilesArray.Length(); i++) {
|
||||
pluginFileinDirectory &pfd = pluginFilesArray[i];
|
||||
@ -4347,6 +4349,8 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||
pluginTag->Mark(NS_PLUGIN_FLAG_BLOCKLISTED);
|
||||
else if (state == nsIBlocklistService::STATE_SOFTBLOCKED && !seenBefore)
|
||||
enabled = PR_FALSE;
|
||||
else if (state == nsIBlocklistService::STATE_OUTDATED && !seenBefore)
|
||||
warnOutdated = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4395,6 +4399,10 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||
pluginTag->RegisterWithCategoryManager(mOverrideInternalTypes);
|
||||
}
|
||||
}
|
||||
|
||||
if (warnOutdated)
|
||||
mPrefService->SetBoolPref("plugins.update.notifyUser", PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -5842,6 +5850,23 @@ nsPluginHost::GetPluginName(nsIPluginInstance *aPluginInstance,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginHost::GetPluginTagForInstance(nsIPluginInstance *aPluginInstance,
|
||||
nsIPluginTag **aPluginTag)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginInstance);
|
||||
NS_ENSURE_ARG_POINTER(aPluginTag);
|
||||
|
||||
nsPluginInstanceTag *plugin =
|
||||
gActivePluginList ? gActivePluginList->find(aPluginInstance) : nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(plugin && plugin->mPluginTag, NS_ERROR_FAILURE);
|
||||
|
||||
*aPluginTag = plugin->mPluginTag;
|
||||
NS_ADDREF(*aPluginTag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginHost::AddUnusedLibrary(PRLibrary * aLibrary)
|
||||
{
|
||||
if (!mUnusedLibraries.Contains(aLibrary)) // don't add duplicates
|
||||
|
@ -233,6 +233,7 @@ richlistitem[compatible="false"] .notifyBadge,
|
||||
richlistitem[providesUpdatesSecurely="false"] .notifyBadge,
|
||||
richlistitem[blocklisted="true"] .notifyBadge,
|
||||
richlistitem[blocklistedsoft="true"] .notifyBadge,
|
||||
richlistitem[outdated="true"] .notifyBadge,
|
||||
richlistitem[satisfiesDependencies="false"] .notifyBadge,
|
||||
richlistitem[loading="true"] .updateBadge {
|
||||
display: -moz-box;
|
||||
@ -242,10 +243,11 @@ richlistitem[loading="true"] .updateBadge {
|
||||
richlistitem[compatible="true"] .incompatibleBox,
|
||||
richlistitem[providesUpdatesSecurely="true"] .insecureUpdateBox,
|
||||
richlistitem[satisfiesDependencies="true"] .needsDependenciesBox,
|
||||
richlistitem:not([blocklisted="true"]):not([blocklistedsoft="true"]) .blocklistedBox,
|
||||
richlistitem[blocklistedsoft="false"]:not([selected="true"]) .blocklistedBox,
|
||||
richlistitem:not([blocklisted="true"]):not([blocklistedsoft="true"]):not([outdated="true"]) .blocklistedBox,
|
||||
richlistitem[blocklistedsoft="false"][outdated="false"]:not([selected="true"]) .blocklistedBox,
|
||||
richlistitem[blocklisted="false"] .blocklistedLabel,
|
||||
richlistitem[blocklistedsoft="false"] .softBlocklistedLabel,
|
||||
richlistitem[outdated="false"] .outdatedLabel,
|
||||
richlistitem[opType="needs-uninstall"] .blocklistedBox,
|
||||
richlistitem[opType="needs-uninstall"] .incompatibleBox,
|
||||
richlistitem[opType="needs-uninstall"] .needsDependenciesBox,
|
||||
|
@ -47,6 +47,8 @@ const nsIIOService = Components.interfaces.nsIIOService;
|
||||
const nsIFileProtocolHandler = Components.interfaces.nsIFileProtocolHandler;
|
||||
const nsIURL = Components.interfaces.nsIURL;
|
||||
const nsIAppStartup = Components.interfaces.nsIAppStartup;
|
||||
const nsIBlocklistService = Components.interfaces.nsIBlocklistService;
|
||||
const nsIPrefBranch2 = Components.interfaces.nsIPrefBranch2;
|
||||
|
||||
var gView = null;
|
||||
var gExtensionManager = null;
|
||||
@ -58,6 +60,7 @@ var gInSafeMode = false;
|
||||
var gCheckCompat = true;
|
||||
var gCheckUpdateSecurity = true;
|
||||
var gUpdatesOnly = false;
|
||||
var gPluginUpdateUrl = null;
|
||||
var gAppID = "";
|
||||
var gPref = null;
|
||||
var gPriorityCount = 0;
|
||||
@ -104,6 +107,7 @@ const PREF_UPDATE_NOTIFYUSER = "extensions.update.notifyUser";
|
||||
const PREF_GETADDONS_SHOWPANE = "extensions.getAddons.showPane";
|
||||
const PREF_GETADDONS_REPOSITORY = "extensions.getAddons.repository";
|
||||
const PREF_GETADDONS_MAXRESULTS = "extensions.getAddons.maxResults";
|
||||
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
|
||||
|
||||
const URI_GENERIC_ICON_XPINSTALL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
|
||||
const URI_GENERIC_ICON_THEME = "chrome://mozapps/skin/extensions/themeGeneric.png";
|
||||
@ -321,6 +325,7 @@ function showView(aView) {
|
||||
["availableUpdateVersion", "?availableUpdateVersion"],
|
||||
["blocklisted", "?blocklisted"],
|
||||
["blocklistedsoft", "?blocklistedsoft"],
|
||||
["outdated", "?outdated"],
|
||||
["compatible", "?compatible"],
|
||||
["description", "?description"],
|
||||
["downloadURL", "?downloadURL"],
|
||||
@ -395,7 +400,8 @@ function showView(aView) {
|
||||
case "plugins":
|
||||
prefURL = PREF_EXTENSIONS_GETMOREPLUGINSURL;
|
||||
types = [ [ ["plugin", "true", null] ] ];
|
||||
showCheckUpdatesAll = false;
|
||||
if (!gPluginUpdateUrl)
|
||||
showCheckUpdatesAll = false;
|
||||
break;
|
||||
case "updates":
|
||||
document.getElementById("updates-view").hidden = false;
|
||||
@ -479,13 +485,19 @@ function showView(aView) {
|
||||
|
||||
var isThemes = aView == "themes";
|
||||
|
||||
if (aView == "themes" || aView == "extensions") {
|
||||
var el = document.getElementById("installFileButton");
|
||||
el.setAttribute("tooltiptext", el.getAttribute(isThemes ? "tooltiptextthemes" :
|
||||
"tooltiptextaddons"));
|
||||
el = document.getElementById("checkUpdatesAllButton");
|
||||
el.setAttribute("tooltiptext", el.getAttribute(isThemes ? "tooltiptextthemes" :
|
||||
"tooltiptextaddons"));
|
||||
if (aView == "themes" || aView == "extensions" || aView == "plugins") {
|
||||
var tooltipAttr = "";
|
||||
if (aView == "extensions")
|
||||
tooltipAttr = "tooltiptextaddons";
|
||||
else
|
||||
tooltipAttr = "tooltiptext" + aView;
|
||||
|
||||
var el = document.getElementById("checkUpdatesAllButton");
|
||||
el.setAttribute("tooltiptext", el.getAttribute(tooltipAttr));
|
||||
if (aView != "plugins") {
|
||||
el = document.getElementById("installFileButton");
|
||||
el.setAttribute("tooltiptext", el.getAttribute(tooltipAttr));
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("installFileButton").hidden = !showInstallFile;
|
||||
@ -988,6 +1000,8 @@ function initPluginsDS()
|
||||
|
||||
function rebuildPluginsDS()
|
||||
{
|
||||
var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"]
|
||||
.getService(nsIBlocklistService);
|
||||
var phs = Components.classes["@mozilla.org/plugin/host;1"]
|
||||
.getService(Components.interfaces.nsIPluginHost);
|
||||
var plugins = phs.getPluginTags({ });
|
||||
@ -1017,18 +1031,17 @@ function rebuildPluginsDS()
|
||||
if (/<A\s+HREF=[^>]*>/i.test(plugin.description))
|
||||
homepageURL = /<A\s+HREF=["']?([^>"'\s]*)/i.exec(plugin.description)[1];
|
||||
|
||||
gPlugins[name][desc] = { filename : plugin.filename,
|
||||
version : plugin.version,
|
||||
homepageURL : homepageURL,
|
||||
disabled : plugin.disabled,
|
||||
blocklisted : plugin.blocklisted,
|
||||
plugins : [] };
|
||||
gPlugins[name][desc] = { filename : plugin.filename,
|
||||
version : plugin.version,
|
||||
homepageURL : homepageURL,
|
||||
blocklistState : blocklist.getPluginBlocklistState(plugin),
|
||||
disabled : plugin.disabled,
|
||||
blocklisted : plugin.blocklisted,
|
||||
plugins : [] };
|
||||
}
|
||||
gPlugins[name][desc].plugins.push(plugin);
|
||||
}
|
||||
|
||||
var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"]
|
||||
.getService(Components.interfaces.nsIBlocklistService);
|
||||
for (var pluginName in gPlugins) {
|
||||
for (var pluginDesc in gPlugins[pluginName]) {
|
||||
plugin = gPlugins[pluginName][pluginDesc];
|
||||
@ -1064,12 +1077,16 @@ function rebuildPluginsDS()
|
||||
gRDF.GetResource(PREFIX_NS_EM + "blocklisted"),
|
||||
gRDF.GetLiteral(plugin.blocklisted ? "true" : "false"),
|
||||
true);
|
||||
var softblocked = blocklist.getPluginBlocklistState(plugin) ==
|
||||
Components.interfaces.nsIBlocklistService.STATE_SOFTBLOCKED;
|
||||
var softblocked = plugin.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;
|
||||
gPluginsDS.Assert(pluginNode,
|
||||
gRDF.GetResource(PREFIX_NS_EM + "blocklistedsoft"),
|
||||
gRDF.GetLiteral(softblocked ? "true" : "false"),
|
||||
true);
|
||||
var outdated = plugin.blocklistState == nsIBlocklistService.STATE_OUTDATED;
|
||||
gPluginsDS.Assert(pluginNode,
|
||||
gRDF.GetResource(PREFIX_NS_EM + "outdated"),
|
||||
gRDF.GetLiteral((outdated && gPluginUpdateUrl) ? "true" : "false"),
|
||||
true);
|
||||
gPluginsDS.Assert(pluginNode,
|
||||
gRDF.GetResource(PREFIX_NS_EM + "compatible"),
|
||||
gRDF.GetLiteral("true"),
|
||||
@ -1105,7 +1122,7 @@ function Startup()
|
||||
{
|
||||
gExtensionStrings = document.getElementById("extensionsStrings");
|
||||
gPref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch2);
|
||||
.getService(nsIPrefBranch2);
|
||||
var defaultPref = gPref.QueryInterface(Components.interfaces.nsIPrefService)
|
||||
.getDefaultBranch(null);
|
||||
try {
|
||||
@ -1144,6 +1161,10 @@ function Startup()
|
||||
gCheckUpdateSecurity = gPref.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
|
||||
} catch(e) { }
|
||||
|
||||
try {
|
||||
gPluginUpdateUrl = gPref.getCharPref(PREF_PLUGINS_UPDATEURL);
|
||||
} catch(e) { }
|
||||
|
||||
gPref.addObserver(PREF_DSS_SKIN_TO_SELECT, gPrefObserver, false);
|
||||
gPref.addObserver(PREF_GENERAL_SKINS_SELECTEDSKIN, gPrefObserver, false);
|
||||
|
||||
@ -2383,6 +2404,10 @@ function updateGlobalCommands() {
|
||||
disableInstallUpdate = false;
|
||||
disableRestartButton();
|
||||
}
|
||||
else if (gView == "plugins") {
|
||||
if (gPluginUpdateUrl)
|
||||
disableUpdateCheck = false;
|
||||
}
|
||||
else {
|
||||
var children = gExtensionsView.children;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
@ -2425,6 +2450,11 @@ function hideUpdateInfo()
|
||||
function checkUpdatesAll() {
|
||||
if (isOffline("offlineUpdateMsg2"))
|
||||
return;
|
||||
|
||||
if (gView == "plugins") {
|
||||
openURL(gPluginUpdateUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isXPInstallEnabled())
|
||||
return;
|
||||
|
@ -94,6 +94,7 @@
|
||||
<property name="isCompatible" onget="return this.getAttribute('compatible') == 'true';"/>
|
||||
<property name="isBlocklisted" onget="return this.getAttribute('blocklisted') == 'true';"/>
|
||||
<property name="isSoftBlocklisted" onget="return this.getAttribute('blocklistedsoft') == 'true';"/>
|
||||
<property name="isOutdated" onget="return this.getAttribute('outdated') == 'true';"/>
|
||||
<property name="isDisabled" onget="return this.getAttribute('isDisabled') == 'true';"/>
|
||||
<property name="providesUpdatesSecurely" onget="return this.getAttribute('providesUpdatesSecurely') == 'true';"/>
|
||||
<property name="satisfiesDependencies" onget="return this.getAttribute('satisfiesDependencies') == 'true';"/>
|
||||
@ -136,6 +137,7 @@
|
||||
<xul:hbox flex="1" class="blocklistedBox attention" align="center">
|
||||
<xul:label class="blocklistedLabel" value="&blocklisted.label;" crop="end"/>
|
||||
<xul:label class="softBlocklistedLabel" value="&softBlocklisted.label;" crop="end"/>
|
||||
<xul:label class="outdatedLabel" value="&outdated.label;" crop="end"/>
|
||||
<xul:label anonid="blocklistMoreInfo" class="text-link" value="&moreInfo.label;"
|
||||
onclick="if (event.button == 0) { openURL(this.getAttribute('moreInfoURL')); }" />
|
||||
</xul:hbox>
|
||||
@ -146,14 +148,17 @@
|
||||
<implementation implements="nsIAccessibleProvider, nsIDOMXULSelectControlItemElement">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
if (this.isBlocklisted || this.isSoftBlocklisted) {
|
||||
if (this.isBlocklisted || this.isSoftBlocklisted || this.isOutdated) {
|
||||
try {
|
||||
var blocklistMoreInfo = document.getAnonymousElementByAttribute(this, "anonid", "blocklistMoreInfo");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Components.interfaces.nsIURLFormatter);
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
if (this.isOutdated)
|
||||
var url = formatter.formatURLPref("plugins.update.url");
|
||||
else
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
blocklistMoreInfo.setAttribute("moreInfoURL", url);
|
||||
} catch(e) {
|
||||
blocklistMoreInfo.hidden = true;
|
||||
@ -241,6 +246,7 @@
|
||||
<xul:hbox flex="1" class="blocklistedBox attention" align="center">
|
||||
<xul:label class="blocklistedLabel" value="&blocklisted.label;" crop="end"/>
|
||||
<xul:label class="softBlocklistedLabel" value="&softBlocklisted.label;" crop="end"/>
|
||||
<xul:label class="outdatedLabel" value="&outdated.label;" crop="end"/>
|
||||
<xul:label anonid="blocklistMoreInfo" class="text-link" value="&moreInfo.label;"
|
||||
onclick="if (event.button == 0) { openURL(this.getAttribute('moreInfoURL')); }" />
|
||||
</xul:hbox>
|
||||
@ -285,14 +291,17 @@
|
||||
<implementation implements="nsIAccessibleProvider, nsIDOMXULSelectControlItemElement">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
if (this.isBlocklisted || this.isSoftBlocklisted) {
|
||||
if (this.isBlocklisted || this.isSoftBlocklisted || this.isOutdated) {
|
||||
try {
|
||||
var blocklistMoreInfo = document.getAnonymousElementByAttribute(this, "anonid", "blocklistMoreInfo");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Components.interfaces.nsIURLFormatter);
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
if (this.isOutdated)
|
||||
var url = formatter.formatURLPref("plugins.update.url");
|
||||
else
|
||||
var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
|
||||
blocklistMoreInfo.setAttribute("moreInfoURL", url);
|
||||
} catch(e) {
|
||||
blocklistMoreInfo.hidden = true;
|
||||
|
@ -261,6 +261,7 @@
|
||||
accesskey="&cmd.checkUpdatesAll.accesskey;"
|
||||
tooltiptextaddons="&cmd.checkUpdatesAllAddon.tooltip;"
|
||||
tooltiptextthemes="&cmd.checkUpdatesAllTheme.tooltip;"
|
||||
tooltiptextplugins="&cmd.checkUpdatesAllPlugin.tooltip;"
|
||||
command="cmd_checkUpdatesAll"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="skipDialogButton" label="&cmd.skip.label;"
|
||||
|
@ -54,6 +54,7 @@ const PREF_BLOCKLIST_URL = "extensions.blocklist.url";
|
||||
const PREF_BLOCKLIST_ENABLED = "extensions.blocklist.enabled";
|
||||
const PREF_BLOCKLIST_INTERVAL = "extensions.blocklist.interval";
|
||||
const PREF_BLOCKLIST_LEVEL = "extensions.blocklist.level";
|
||||
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
|
||||
const PREF_GENERAL_USERAGENT_LOCALE = "general.useragent.locale";
|
||||
const PREF_PARTNER_BRANCH = "app.partner.";
|
||||
const PREF_APP_DISTRIBUTION = "distribution.id";
|
||||
@ -67,6 +68,7 @@ const URI_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blo
|
||||
const DEFAULT_SEVERITY = 3;
|
||||
const DEFAULT_LEVEL = 2;
|
||||
const MAX_BLOCK_LEVEL = 3;
|
||||
const SEVERITY_OUTDATED = 0;
|
||||
|
||||
const MODE_RDONLY = 0x01;
|
||||
const MODE_WRONLY = 0x02;
|
||||
@ -820,10 +822,13 @@ Blocklist.prototype = {
|
||||
|
||||
for (var i = 0; i < blockEntry.versions.length; i++) {
|
||||
if (blockEntry.versions[i].includesItem(plugin.version, appVersion,
|
||||
toolkitVersion))
|
||||
return blockEntry.versions[i].severity >= gBlocklistLevel ?
|
||||
Ci.nsIBlocklistService.STATE_BLOCKED :
|
||||
Ci.nsIBlocklistService.STATE_SOFTBLOCKED;
|
||||
toolkitVersion)) {
|
||||
if (blockEntry.versions[i].severity >= gBlocklistLevel)
|
||||
return Ci.nsIBlocklistService.STATE_BLOCKED;
|
||||
if (blockEntry.versions[i].severity == SEVERITY_OUTDATED)
|
||||
return Ci.nsIBlocklistService.STATE_OUTDATED;
|
||||
return Ci.nsIBlocklistService.STATE_SOFTBLOCKED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -875,14 +880,19 @@ Blocklist.prototype = {
|
||||
plugins[i].disabled = true;
|
||||
}
|
||||
else if (!plugins[i].disabled && state != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) {
|
||||
addonList.push({
|
||||
name: plugins[i].name,
|
||||
version: plugins[i].version,
|
||||
icon: "chrome://mozapps/skin/plugins/pluginGeneric.png",
|
||||
disable: false,
|
||||
blocked: state == Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
item: plugins[i]
|
||||
});
|
||||
if (state == Ci.nsIBlocklistService.STATE_OUTDATED) {
|
||||
gPref.setBoolPref(PREF_PLUGINS_NOTIFYUSER, true);
|
||||
}
|
||||
else {
|
||||
addonList.push({
|
||||
name: plugins[i].name,
|
||||
version: plugins[i].version,
|
||||
icon: "chrome://mozapps/skin/plugins/pluginGeneric.png",
|
||||
disable: false,
|
||||
blocked: state == Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
item: plugins[i]
|
||||
});
|
||||
}
|
||||
}
|
||||
plugins[i].blocklisted = state == Ci.nsIBlocklistService.STATE_BLOCKED;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<emItems>
|
||||
<emItem id="test_bug455906_4@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_5@tests.mozilla.org">
|
||||
<versionRange severity="1"/>
|
||||
|
@ -3,31 +3,31 @@
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<emItems>
|
||||
<emItem id="test_bug455906_1@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_2@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_3@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_4@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_5@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_6@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
<emItem id="test_bug455906_7@tests.mozilla.org">
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</emItem>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
<pluginItem>
|
||||
<match name="name" exp="^test_bug455906"/>
|
||||
<versionRange severity="0"/>
|
||||
<versionRange severity="-1"/>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
||||
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<pluginItems>
|
||||
<pluginItem>
|
||||
<match name="name" exp="^test_bug514327_1"/>
|
||||
</pluginItem>
|
||||
<pluginItem>
|
||||
<match name="name" exp="^test_bug514327_2"/>
|
||||
<versionRange severity="0"/>
|
||||
</pluginItem>
|
||||
<pluginItem>
|
||||
<match name="name" exp="^test_bug514327_3"/>
|
||||
<versionRange severity="0"/>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<pluginItems>
|
||||
<pluginItem>
|
||||
<match name="name" exp="Test Plug-in"/>
|
||||
<versionRange severity="0"/>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
</blocklist>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<pluginItems>
|
||||
<pluginItem>
|
||||
<match name="name" exp="test_bug514327_1"/>
|
||||
</pluginItem>
|
||||
<pluginItem>
|
||||
<match name="name" exp="test_bug514327_outdated"/>
|
||||
<versionRange severity="0"/>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<pluginItems>
|
||||
<pluginItem>
|
||||
<match name="name" exp="test_bug514327_2"/>
|
||||
</pluginItem>
|
||||
<pluginItem>
|
||||
<match name="name" exp="test_bug514327_outdated"/>
|
||||
<versionRange severity="0"/>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
93
toolkit/mozapps/extensions/test/unit/test_bug514327_1.js
Normal file
93
toolkit/mozapps/extensions/test/unit/test_bug514327_1.js
Normal file
@ -0,0 +1,93 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blair McBride <bmcbride@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const nsIBLS = Ci.nsIBlocklistService;
|
||||
|
||||
var PLUGINS = [{
|
||||
// blocklisted - default severity
|
||||
name: "test_bug514327_1",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false
|
||||
},
|
||||
{
|
||||
// outdated - severity of "0"
|
||||
name: "test_bug514327_2",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false
|
||||
},
|
||||
{
|
||||
// outdated - severity of "0"
|
||||
name: "test_bug514327_3",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false
|
||||
},
|
||||
{
|
||||
// not blocklisted, not outdated
|
||||
name: "test_bug514327_4",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false,
|
||||
outdated: false
|
||||
}];
|
||||
|
||||
|
||||
function run_test() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
var source = do_get_file("data/test_bug514327_1.xml");
|
||||
source.copyTo(gProfD, "blocklist.xml");
|
||||
|
||||
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS);
|
||||
|
||||
// blocked (sanity check)
|
||||
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED);
|
||||
|
||||
// outdated
|
||||
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == nsIBLS.STATE_OUTDATED);
|
||||
|
||||
// outdated
|
||||
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == nsIBLS.STATE_OUTDATED);
|
||||
|
||||
// not blocked
|
||||
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
|
||||
}
|
72
toolkit/mozapps/extensions/test/unit/test_bug514327_2.js
Normal file
72
toolkit/mozapps/extensions/test/unit/test_bug514327_2.js
Normal file
@ -0,0 +1,72 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blair McBride <bmcbride@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const nsIBLS = Ci.nsIBlocklistService;
|
||||
|
||||
// Finds the test nsIPluginTag
|
||||
function get_test_plugintag() {
|
||||
var host = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
var tags = host.getPluginTags({});
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
if (tags[i].name == "Test Plug-in")
|
||||
return tags[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
var source = do_get_file("data/test_bug514327_2.xml");
|
||||
source.copyTo(gProfD, "blocklist.xml");
|
||||
|
||||
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS);
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
||||
var plugin = get_test_plugintag();
|
||||
if (!plugin)
|
||||
do_throw("Plugin tag not found");
|
||||
|
||||
// should be marked as outdated by the blocklist
|
||||
do_check_true(blocklist.getPluginBlocklistState(plugin, "1", "1.9") == nsIBLS.STATE_OUTDATED);
|
||||
|
||||
// should indicate that a warning should be shown
|
||||
do_check_true(prefs.getBoolPref("plugins.update.notifyUser"));
|
||||
}
|
194
toolkit/mozapps/extensions/test/unit/test_bug514327_3.js
Normal file
194
toolkit/mozapps/extensions/test/unit/test_bug514327_3.js
Normal file
@ -0,0 +1,194 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blair McBride <bmcbride@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
do_load_httpd_js();
|
||||
|
||||
|
||||
const nsIBLS = Ci.nsIBlocklistService;
|
||||
const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
|
||||
|
||||
var gBlocklist = null;
|
||||
var gPrefs = null;
|
||||
var gTestserver = null;
|
||||
|
||||
var gNextTestPart = null;
|
||||
|
||||
|
||||
var PLUGINS = [{
|
||||
// Tests a plugin whose state goes from not-blocked, to outdated
|
||||
name: "test_bug514327_outdated",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false
|
||||
}, {
|
||||
// Used to trigger the blocklist dialog, which indicates the blocklist has updated
|
||||
name: "test_bug514327_1",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false
|
||||
}, {
|
||||
// Used to trigger the blocklist dialog, which indicates the blocklist has updated
|
||||
name: "test_bug514327_2",
|
||||
version: "5",
|
||||
disabled: false,
|
||||
blocklisted: false
|
||||
} ];
|
||||
|
||||
|
||||
// A fake plugin host for the blocklist service to use
|
||||
var PluginHost = {
|
||||
getPluginTags: function(countRef) {
|
||||
countRef.value = PLUGINS.length;
|
||||
return PLUGINS;
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIPluginHost)
|
||||
|| iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
var PluginHostFactory = {
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return PluginHost.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
// Don't need the full interface, attempts to call other methods will just
|
||||
// throw which is just fine
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
// Should only include one item
|
||||
do_check_eq(arguments.wrappedJSObject.list.length, 1);
|
||||
// And that item should be the blocked plugin, not the outdated one
|
||||
var item = arguments.wrappedJSObject.list[0];
|
||||
do_check_true(item.item instanceof Ci.nsIPluginTag);
|
||||
do_check_neq(item.name, "test_bug514327_outdated");
|
||||
|
||||
// Call the next test after the blocklist has finished up
|
||||
do_timeout(0, "gNextTestPart()");
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIWindowWatcher)
|
||||
|| iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
var WindowWatcherFactory = {
|
||||
createInstance: function createInstance(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return WindowWatcher.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(Components.ID("{721c3e73-969e-474b-a6dc-059fd288c428}"),
|
||||
"Fake Plugin Host",
|
||||
"@mozilla.org/plugin/host;1", PluginHostFactory);
|
||||
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
|
||||
"Fake Window Watcher",
|
||||
"@mozilla.org/embedcomp/window-watcher;1", WindowWatcherFactory);
|
||||
|
||||
|
||||
function do_update_blocklist(aDatafile, aNextPart) {
|
||||
gNextTestPart = aNextPart;
|
||||
|
||||
gPrefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + aDatafile);
|
||||
gBlocklist.QueryInterface(Ci.nsITimerCallback).notify(null);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
gTestserver = new nsHttpServer();
|
||||
gTestserver.registerDirectory("/data/", do_get_file("data"));
|
||||
gTestserver.start(4444);
|
||||
|
||||
|
||||
// initialize the blocklist with no entries
|
||||
var source = do_get_file("data/test_bug514327_3_empty.xml");
|
||||
source.copyTo(gProfD, "blocklist.xml");
|
||||
|
||||
gPrefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2);
|
||||
gBlocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS);
|
||||
|
||||
// should NOT be marked as outdated by the blocklist
|
||||
do_check_true(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
|
||||
|
||||
do_test_pending();
|
||||
|
||||
// update blocklist with data that marks the plugin as outdated
|
||||
do_update_blocklist("test_bug514327_3_outdated_1.xml", test_part_1);
|
||||
}
|
||||
|
||||
function test_part_1() {
|
||||
// plugin should now be marked as outdated
|
||||
do_check_true(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_OUTDATED);
|
||||
// and the notifyUser pref should be set to true
|
||||
do_check_true(gPrefs.getBoolPref("plugins.update.notifyUser"));
|
||||
|
||||
// preternd the user has been notified, reset the pref
|
||||
gPrefs.setBoolPref("plugins.update.notifyUser", false);
|
||||
|
||||
// update blocklist with data that marks the plugin as outdated
|
||||
do_update_blocklist("test_bug514327_3_outdated_2.xml", test_part_2);
|
||||
}
|
||||
|
||||
function test_part_2() {
|
||||
// plugin should still be marked as outdated
|
||||
do_check_true(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_OUTDATED);
|
||||
// and the notifyUser pref should NOT be set to true, as the plugin was already outdated
|
||||
do_check_false(gPrefs.getBoolPref("plugins.update.notifyUser"));
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
function finish() {
|
||||
gTestserver.stop(do_test_finished);
|
||||
}
|
@ -53,6 +53,7 @@ const PREF_APP_UPDATE_LOG_BRANCH = "app.update.log.";
|
||||
const PREF_UPDATE_TEST_LOOP = "app.update.test.loop";
|
||||
const PREF_UPDATE_NEVER_BRANCH = "app.update.never.";
|
||||
const PREF_AUTO_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
|
||||
|
||||
const UPDATE_TEST_LOOP_INTERVAL = 2000;
|
||||
|
||||
@ -538,6 +539,62 @@ var gCheckingPage = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The "You have outdated plugins" page
|
||||
*/
|
||||
var gPluginsPage = {
|
||||
/**
|
||||
* URL of the plugin updates page
|
||||
*/
|
||||
_url: null,
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
onPageShow: function() {
|
||||
if (gPref.getPrefType(PREF_PLUGINS_UPDATEURL) == gPref.PREF_INVALID) {
|
||||
gUpdates.wiz.goTo("noupdatesfound");
|
||||
return;
|
||||
}
|
||||
|
||||
var formatter = CoC["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(CoI.nsIURLFormatter);
|
||||
this._url = formatter.formatURLPref(PREF_PLUGINS_UPDATEURL);
|
||||
var link = document.getElementById("pluginupdateslink");
|
||||
link.setAttribute("href", this._url);
|
||||
|
||||
|
||||
var phs = CoC["@mozilla.org/plugin/host;1"].
|
||||
getService(CoI.nsIPluginHost);
|
||||
var plugins = phs.getPluginTags({});
|
||||
var blocklist = CoC["@mozilla.org/extensions/blocklist;1"].
|
||||
getService(CoI.nsIBlocklistService);
|
||||
|
||||
var hasOutdated = false;
|
||||
for (let i = 0; i < plugins.length; i++) {
|
||||
let pluginState = blocklist.getPluginBlocklistState(plugins[i]);
|
||||
if (pluginState == CoI.nsIBlocklistService.STATE_OUTDATED) {
|
||||
hasOutdated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasOutdated) {
|
||||
gUpdates.wiz.goTo("noupdatesfound");
|
||||
return;
|
||||
}
|
||||
|
||||
gUpdates.setButtons(null, null, "okButton", true);
|
||||
gUpdates.wiz.getButton("finish").focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Finish button clicked.
|
||||
*/
|
||||
onWizardFinish: function() {
|
||||
openURL(this._url);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The "No Updates Are Available" page
|
||||
*/
|
||||
|
@ -72,21 +72,30 @@
|
||||
|
||||
<wizardpage id="dummy" pageid="dummy" firstpage="true"/>
|
||||
|
||||
<wizardpage id="checking" pageid="checking" next="noupdatesfound"
|
||||
<wizardpage id="checking" pageid="checking" next="pluginupdatesfound"
|
||||
label="&checking.title;" object="gCheckingPage"
|
||||
onpageshow="gCheckingPage.onPageShow();">
|
||||
<label>&updateCheck.label;</label>
|
||||
<separator class="thin"/>
|
||||
<progressmeter id="checkingProgress" mode="undetermined" hidden="true"/>
|
||||
</wizardpage>
|
||||
|
||||
|
||||
<wizardpage id="pluginupdatesfound" pageid="pluginupdatesfound"
|
||||
label="&pluginupdatesfound.title;"
|
||||
object="gPluginsPage" onpageshow="gPluginsPage.onPageShow();">
|
||||
<label>&pluginupdatesfound.label;</label>
|
||||
<separator class="thin"/>
|
||||
<label id="pluginupdateslink" class="text-link"
|
||||
onclick="openUpdateURL(event);">&pluginupdateslink.label;</label>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="noupdatesfound" pageid="noupdatesfound"
|
||||
label="&noupdatesfound.title;" object="gNoUpdatesPage"
|
||||
onpageshow="gNoUpdatesPage.onPageShow();">
|
||||
<label id="noUpdatesAutoEnabled" hidden="true">&noupdatesautoenabled.intro;</label>
|
||||
<label id="noUpdatesAutoDisabled" hidden="true">&noupdatesautodisabled.intro;</label>
|
||||
</wizardpage>
|
||||
|
||||
|
||||
<wizardpage id="incompatibleCheck" pageid="incompatibleCheck"
|
||||
next="updatesfound" label="&incompatibleCheck.title;"
|
||||
object="gIncompatibleCheckPage"
|
||||
|
@ -15,6 +15,7 @@ toolkit.jar:
|
||||
+ skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
|
||||
+ skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
|
||||
+ skin/classic/mozapps/plugins/pluginBlocked-16.png (plugins/pluginBlocked-16.png)
|
||||
+ skin/classic/mozapps/plugins/pluginOutdated-16.png (plugins/pluginOutdated-16.png)
|
||||
+ skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
|
||||
+ skin/classic/mozapps/viewsource/viewsource.css (viewsource/viewsource.css)
|
||||
+ skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (xpinstall/xpinstallItemGeneric.png)
|
||||
|
BIN
toolkit/themes/gnomestripe/mozapps/plugins/pluginOutdated-16.png
Normal file
BIN
toolkit/themes/gnomestripe/mozapps/plugins/pluginOutdated-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 830 B |
@ -25,6 +25,7 @@ toolkit.jar:
|
||||
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
|
||||
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
|
||||
skin/classic/mozapps/plugins/pluginBlocked-16.png (plugins/pluginBlocked-16.png)
|
||||
skin/classic/mozapps/plugins/pluginOutdated-16.png (plugins/pluginOutdated-16.png)
|
||||
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
|
||||
skin/classic/mozapps/profile/profileicon-selected.png (profile/profileicon-selected.png)
|
||||
skin/classic/mozapps/profile/profileSelection.css (profile/profileSelection.css)
|
||||
|
BIN
toolkit/themes/pinstripe/mozapps/plugins/pluginOutdated-16.png
Normal file
BIN
toolkit/themes/pinstripe/mozapps/plugins/pluginOutdated-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 823 B |
@ -31,6 +31,7 @@ toolkit.jar:
|
||||
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
|
||||
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
|
||||
skin/classic/mozapps/plugins/pluginBlocked-16.png (plugins/pluginBlocked-16.png)
|
||||
skin/classic/mozapps/plugins/pluginOutdated-16.png (plugins/pluginOutdated-16.png)
|
||||
skin/classic/mozapps/plugins/pluginInstallerWizard.css (plugins/pluginInstallerWizard.css)
|
||||
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
|
||||
skin/classic/mozapps/profile/profileSelection.css (profile/profileSelection.css)
|
||||
@ -71,6 +72,7 @@ toolkit.jar:
|
||||
skin/classic/aero/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked-aero.png)
|
||||
skin/classic/aero/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16-aero.png)
|
||||
skin/classic/aero/mozapps/plugins/pluginBlocked-16.png (plugins/pluginBlocked-16-aero.png)
|
||||
skin/classic/aero/mozapps/plugins/pluginOutdated-16.png (plugins/pluginOutdated-16-aero.png)
|
||||
skin/classic/aero/mozapps/plugins/pluginInstallerWizard.css (plugins/pluginInstallerWizard.css)
|
||||
skin/classic/aero/mozapps/profile/profileicon.png (profile/profileicon-aero.png)
|
||||
skin/classic/aero/mozapps/profile/profileSelection.css (profile/profileSelection.css)
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 638 B |
BIN
toolkit/themes/winstripe/mozapps/plugins/pluginOutdated-16.png
Normal file
BIN
toolkit/themes/winstripe/mozapps/plugins/pluginOutdated-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 699 B |
@ -51,6 +51,9 @@ interface nsIBlocklistService : nsISupports
|
||||
const unsigned long STATE_SOFTBLOCKED = 1;
|
||||
// Indicates that the item should be blocked and never used.
|
||||
const unsigned long STATE_BLOCKED = 2;
|
||||
// Indicates that the item is considered outdated, and there is a known
|
||||
// update available.
|
||||
const unsigned long STATE_OUTDATED = 3;
|
||||
|
||||
/**
|
||||
* Determine if an item is blocklisted
|
||||
|
Loading…
Reference in New Issue
Block a user