[PALEMOON] Bug 863773 - Changes the way plugin handlers are loaded at the preferences applications pane. Uses enabledPlugin attribute from each navigator.mimeTypes to find the actual plugin used to handle the mime type

This commit is contained in:
janekptacijarabaci 2018-07-26 04:31:11 +02:00 committed by Roy Tam
commit 55b65909aa

View file

@ -1069,29 +1069,20 @@ var gApplicationsPane = {
_loadPluginHandlers: function() {
"use strict";
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let pluginTags = pluginHost.getPluginTags();
let mimeTypes = navigator.mimeTypes;
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)
handlerInfoWrapper = this._handledTypes[type];
else {
let wrappedHandlerInfo =
this._mimeSvc.getFromTypeAndExtension(type, null);
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
handlerInfoWrapper.handledOnlyByPlugin = true;
this._handledTypes[type] = handlerInfoWrapper;
}
handlerInfoWrapper.pluginName = pluginTag.name;
for (let mimeType of mimeTypes) {
let handlerInfoWrapper;
if (mimeType.type in this._handledTypes) {
handlerInfoWrapper = this._handledTypes[mimeType.type];
} else {
let wrappedHandlerInfo =
this._mimeSvc.getFromTypeAndExtension(mimeType.type, null);
handlerInfoWrapper = new HandlerInfoWrapper(mimeType.type, wrappedHandlerInfo);
handlerInfoWrapper.handledOnlyByPlugin = true;
this._handledTypes[mimeType.type] = handlerInfoWrapper;
}
handlerInfoWrapper.pluginName = mimeType.enabledPlugin.name;
}
},