mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-19 13:47:31 +09:00
[PALEMOON] Bug 757726 - Populate Preferences' Applications list using PluginHost
This commit is contained in:
parent
acb5d5839b
commit
db3fa722db
1 changed files with 20 additions and 18 deletions
|
|
@ -8,15 +8,10 @@
|
||||||
//****************************************************************************//
|
//****************************************************************************//
|
||||||
// Constants & Enumeration Values
|
// Constants & Enumeration Values
|
||||||
|
|
||||||
/*
|
|
||||||
#ifndef XP_MACOSX
|
|
||||||
*/
|
|
||||||
var Cc = Components.classes;
|
var Cc = Components.classes;
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
var Cr = Components.results;
|
var Cr = Components.results;
|
||||||
/*
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
Components.utils.import('resource://gre/modules/Services.jsm');
|
Components.utils.import('resource://gre/modules/Services.jsm');
|
||||||
|
|
||||||
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
|
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
|
* We create an instance of this wrapper for each entry we might display
|
||||||
* in the prefpane, and we compose the instances from various sources,
|
* 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,
|
* We don't implement all the original nsIHandlerInfo functionality,
|
||||||
* just the stuff that the prefpane needs.
|
* just the stuff that the prefpane needs.
|
||||||
|
|
@ -272,7 +267,7 @@ HandlerInfoWrapper.prototype = {
|
||||||
// What to do with content of this type.
|
// What to do with content of this type.
|
||||||
get preferredAction() {
|
get preferredAction() {
|
||||||
// If we have an enabled plugin, then the action is to use that plugin.
|
// 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;
|
return kActionUsePlugin;
|
||||||
|
|
||||||
// If the action is to use a helper app, but we don't have a preferred
|
// 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,
|
// 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
|
// even though we never ask for content handled by a plugin, so special case
|
||||||
// plugin-handled types by returning false here.
|
// plugin-handled types by returning false here.
|
||||||
if (this.plugin && this.handledOnlyByPlugin)
|
if (this.pluginName && this.handledOnlyByPlugin)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If this is a protocol type and the preferred action is "save to disk",
|
// 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.
|
* check the pref ourselves to find out if it's enabled.
|
||||||
*/
|
*/
|
||||||
_loadPluginHandlers: function() {
|
_loadPluginHandlers: function() {
|
||||||
for (let i = 0; i < navigator.plugins.length; ++i) {
|
"use strict";
|
||||||
let plugin = navigator.plugins[i];
|
|
||||||
for (let j = 0; j < plugin.length; ++j) {
|
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||||
let type = plugin[j].type;
|
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;
|
let handlerInfoWrapper;
|
||||||
if (type in this._handledTypes)
|
if (type in this._handledTypes)
|
||||||
|
|
@ -1080,7 +1082,7 @@ var gApplicationsPane = {
|
||||||
this._handledTypes[type] = handlerInfoWrapper;
|
this._handledTypes[type] = handlerInfoWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
handlerInfoWrapper.plugin = plugin;
|
handlerInfoWrapper.pluginName = pluginTag.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1274,7 +1276,7 @@ var gApplicationsPane = {
|
||||||
|
|
||||||
case kActionUsePlugin:
|
case kActionUsePlugin:
|
||||||
return this._prefsBundle.getFormattedString("usePluginIn",
|
return this._prefsBundle.getFormattedString("usePluginIn",
|
||||||
[aHandlerInfo.plugin.name,
|
[aHandlerInfo.pluginName,
|
||||||
this._brandShortName]);
|
this._brandShortName]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1456,11 +1458,11 @@ var gApplicationsPane = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a menu item for the plugin.
|
// Create a menu item for the plugin.
|
||||||
if (handlerInfo.plugin) {
|
if (handlerInfo.pluginName) {
|
||||||
var pluginMenuItem = document.createElement("menuitem");
|
var pluginMenuItem = document.createElement("menuitem");
|
||||||
pluginMenuItem.setAttribute("action", kActionUsePlugin);
|
pluginMenuItem.setAttribute("action", kActionUsePlugin);
|
||||||
let label = this._prefsBundle.getFormattedString("usePluginIn",
|
let label = this._prefsBundle.getFormattedString("usePluginIn",
|
||||||
[handlerInfo.plugin.name,
|
[handlerInfo.pluginName,
|
||||||
this._brandShortName]);
|
this._brandShortName]);
|
||||||
pluginMenuItem.setAttribute("label", label);
|
pluginMenuItem.setAttribute("label", label);
|
||||||
pluginMenuItem.setAttribute("tooltiptext", label);
|
pluginMenuItem.setAttribute("tooltiptext", label);
|
||||||
|
|
@ -1623,7 +1625,7 @@ var gApplicationsPane = {
|
||||||
// Set the plugin state if we're enabling or disabling a plugin.
|
// Set the plugin state if we're enabling or disabling a plugin.
|
||||||
if (action == kActionUsePlugin)
|
if (action == kActionUsePlugin)
|
||||||
handlerInfo.enablePluginType();
|
handlerInfo.enablePluginType();
|
||||||
else if (handlerInfo.plugin && !handlerInfo.isDisabledPluginType)
|
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
||||||
handlerInfo.disablePluginType();
|
handlerInfo.disablePluginType();
|
||||||
|
|
||||||
// Set the preferred application handler.
|
// Set the preferred application handler.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue