summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/preferences
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-25 15:26:02 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-25 15:26:02 +0200
commitda0a9f854ff5d2d2a78dae776cc0a6bd75e9765a (patch)
tree48dc461567337b45e9e3a95f93974b2fc88d1161 /application/palemoon/components/preferences
parente437d80133c96096460bf9418f17f25a65a2db46 (diff)
downloadUXP-da0a9f854ff5d2d2a78dae776cc0a6bd75e9765a.tar
UXP-da0a9f854ff5d2d2a78dae776cc0a6bd75e9765a.tar.gz
UXP-da0a9f854ff5d2d2a78dae776cc0a6bd75e9765a.tar.lz
UXP-da0a9f854ff5d2d2a78dae776cc0a6bd75e9765a.tar.xz
UXP-da0a9f854ff5d2d2a78dae776cc0a6bd75e9765a.zip
[PALEMOON] Bug 757726 - Populate Preferences' Applications list using PluginHost
Diffstat (limited to 'application/palemoon/components/preferences')
-rw-r--r--application/palemoon/components/preferences/applications.js38
1 files changed, 20 insertions, 18 deletions
diff --git a/application/palemoon/components/preferences/applications.js b/application/palemoon/components/preferences/applications.js
index 5768de708..4388f290e 100644
--- a/application/palemoon/components/preferences/applications.js
+++ b/application/palemoon/components/preferences/applications.js
@@ -8,15 +8,10 @@
//****************************************************************************//
// Constants & Enumeration Values
-/*
-#ifndef XP_MACOSX
-*/
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cr = Components.results;
-/*
-#endif
-*/
+
Components.utils.import('resource://gre/modules/Services.jsm');
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
@@ -158,7 +153,7 @@ function isFeedType(t) {
*
* We create an instance of this wrapper for each entry we might display
* in the prefpane, and we compose the instances from various sources,
- * including navigator.plugins and the handler service.
+ * including plugins and the handler service.
*
* We don't implement all the original nsIHandlerInfo functionality,
* just the stuff that the prefpane needs.
@@ -272,7 +267,7 @@ HandlerInfoWrapper.prototype = {
// What to do with content of this type.
get preferredAction() {
// If we have an enabled plugin, then the action is to use that plugin.
- if (this.plugin && !this.isDisabledPluginType)
+ if (this.pluginName && !this.isDisabledPluginType)
return kActionUsePlugin;
// If the action is to use a helper app, but we don't have a preferred
@@ -308,7 +303,7 @@ HandlerInfoWrapper.prototype = {
// of any user configuration, and the default in that case is to always ask,
// even though we never ask for content handled by a plugin, so special case
// plugin-handled types by returning false here.
- if (this.plugin && this.handledOnlyByPlugin)
+ if (this.pluginName && this.handledOnlyByPlugin)
return false;
// If this is a protocol type and the preferred action is "save to disk",
@@ -1064,10 +1059,17 @@ var gApplicationsPane = {
* check the pref ourselves to find out if it's enabled.
*/
_loadPluginHandlers: function() {
- for (let i = 0; i < navigator.plugins.length; ++i) {
- let plugin = navigator.plugins[i];
- for (let j = 0; j < plugin.length; ++j) {
- let type = plugin[j].type;
+ "use strict";
+
+ let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
+ let pluginTags = pluginHost.getPluginTags();
+
+ for (let i = 0; i < pluginTags.length; ++i) {
+ let pluginTag = pluginTags[i];
+
+ let mimeTypes = pluginTag.getMimeTypes();
+ for (let j = 0; j < mimeTypes.length; ++j) {
+ let type = mimeTypes[j];
let handlerInfoWrapper;
if (type in this._handledTypes)
@@ -1080,7 +1082,7 @@ var gApplicationsPane = {
this._handledTypes[type] = handlerInfoWrapper;
}
- handlerInfoWrapper.plugin = plugin;
+ handlerInfoWrapper.pluginName = pluginTag.name;
}
}
},
@@ -1274,7 +1276,7 @@ var gApplicationsPane = {
case kActionUsePlugin:
return this._prefsBundle.getFormattedString("usePluginIn",
- [aHandlerInfo.plugin.name,
+ [aHandlerInfo.pluginName,
this._brandShortName]);
}
},
@@ -1456,11 +1458,11 @@ var gApplicationsPane = {
}
// Create a menu item for the plugin.
- if (handlerInfo.plugin) {
+ if (handlerInfo.pluginName) {
var pluginMenuItem = document.createElement("menuitem");
pluginMenuItem.setAttribute("action", kActionUsePlugin);
let label = this._prefsBundle.getFormattedString("usePluginIn",
- [handlerInfo.plugin.name,
+ [handlerInfo.pluginName,
this._brandShortName]);
pluginMenuItem.setAttribute("label", label);
pluginMenuItem.setAttribute("tooltiptext", label);
@@ -1623,7 +1625,7 @@ var gApplicationsPane = {
// Set the plugin state if we're enabling or disabling a plugin.
if (action == kActionUsePlugin)
handlerInfo.enablePluginType();
- else if (handlerInfo.plugin && !handlerInfo.isDisabledPluginType)
+ else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
handlerInfo.disablePluginType();
// Set the preferred application handler.