зеркало из https://github.com/mozilla/gecko-dev.git
Bug 480242 - "Always ask" doesn't work for Plugins. r=Unfocused
This commit is contained in:
Родитель
566db30172
Коммит
30fd62f102
|
@ -292,6 +292,14 @@ HandlerInfoWrapper.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
set preferredAction(aNewValue) {
|
set preferredAction(aNewValue) {
|
||||||
|
// If the action is to use the plugin,
|
||||||
|
// we must set the preferred action to "save to disk".
|
||||||
|
// But only if it's not currently the preferred action.
|
||||||
|
if ((aNewValue == kActionUsePlugin) &&
|
||||||
|
(this.preferredAction != Ci.nsIHandlerInfo.saveToDisk)) {
|
||||||
|
aNewValue = Ci.nsIHandlerInfo.saveToDisk;
|
||||||
|
}
|
||||||
|
|
||||||
// We don't modify the preferred action if the new action is to use a plugin
|
// We don't modify the preferred action if the new action is to use a plugin
|
||||||
// because handler info objects don't understand our custom "use plugin"
|
// because handler info objects don't understand our custom "use plugin"
|
||||||
// value. Also, leaving it untouched means that we can automatically revert
|
// value. Also, leaving it untouched means that we can automatically revert
|
||||||
|
@ -1644,33 +1652,31 @@ var gApplicationsPane = {
|
||||||
var typeItem = this._list.selectedItem;
|
var typeItem = this._list.selectedItem;
|
||||||
var handlerInfo = this._handledTypes[typeItem.type];
|
var handlerInfo = this._handledTypes[typeItem.type];
|
||||||
|
|
||||||
if (aActionItem.hasAttribute("alwaysAsk")) {
|
let action = parseInt(aActionItem.getAttribute("action"), 10);
|
||||||
|
|
||||||
|
// Set the plugin state if we're enabling or disabling a plugin.
|
||||||
|
if (action == kActionUsePlugin)
|
||||||
|
handlerInfo.enablePluginType();
|
||||||
|
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
||||||
|
handlerInfo.disablePluginType();
|
||||||
|
|
||||||
|
// Set the preferred application handler.
|
||||||
|
// We leave the existing preferred app in the list when we set
|
||||||
|
// the preferred action to something other than useHelperApp so that
|
||||||
|
// legacy datastores that don't have the preferred app in the list
|
||||||
|
// of possible apps still include the preferred app in the list of apps
|
||||||
|
// the user can choose to handle the type.
|
||||||
|
if (action == Ci.nsIHandlerInfo.useHelperApp)
|
||||||
|
handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
|
||||||
|
|
||||||
|
// Set the "always ask" flag.
|
||||||
|
if (action == Ci.nsIHandlerInfo.alwaysAsk)
|
||||||
handlerInfo.alwaysAskBeforeHandling = true;
|
handlerInfo.alwaysAskBeforeHandling = true;
|
||||||
}
|
else
|
||||||
else if (aActionItem.hasAttribute("action")) {
|
|
||||||
let action = parseInt(aActionItem.getAttribute("action"));
|
|
||||||
|
|
||||||
// Set the plugin state if we're enabling or disabling a plugin.
|
|
||||||
if (action == kActionUsePlugin)
|
|
||||||
handlerInfo.enablePluginType();
|
|
||||||
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
|
||||||
handlerInfo.disablePluginType();
|
|
||||||
|
|
||||||
// Set the preferred application handler.
|
|
||||||
// We leave the existing preferred app in the list when we set
|
|
||||||
// the preferred action to something other than useHelperApp so that
|
|
||||||
// legacy datastores that don't have the preferred app in the list
|
|
||||||
// of possible apps still include the preferred app in the list of apps
|
|
||||||
// the user can choose to handle the type.
|
|
||||||
if (action == Ci.nsIHandlerInfo.useHelperApp)
|
|
||||||
handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
|
|
||||||
|
|
||||||
// Set the "always ask" flag.
|
|
||||||
handlerInfo.alwaysAskBeforeHandling = false;
|
handlerInfo.alwaysAskBeforeHandling = false;
|
||||||
|
|
||||||
// Set the preferred action.
|
// Set the preferred action.
|
||||||
handlerInfo.preferredAction = action;
|
handlerInfo.preferredAction = action;
|
||||||
}
|
|
||||||
|
|
||||||
handlerInfo.store();
|
handlerInfo.store();
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,14 @@ HandlerInfoWrapper.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
set preferredAction(aNewValue) {
|
set preferredAction(aNewValue) {
|
||||||
|
// If the action is to use the plugin,
|
||||||
|
// we must set the preferred action to "save to disk".
|
||||||
|
// But only if it's not currently the preferred action.
|
||||||
|
if ((aNewValue == kActionUsePlugin) &&
|
||||||
|
(this.preferredAction != Ci.nsIHandlerInfo.saveToDisk)) {
|
||||||
|
aNewValue = Ci.nsIHandlerInfo.saveToDisk;
|
||||||
|
}
|
||||||
|
|
||||||
// We don't modify the preferred action if the new action is to use a plugin
|
// We don't modify the preferred action if the new action is to use a plugin
|
||||||
// because handler info objects don't understand our custom "use plugin"
|
// because handler info objects don't understand our custom "use plugin"
|
||||||
// value. Also, leaving it untouched means that we can automatically revert
|
// value. Also, leaving it untouched means that we can automatically revert
|
||||||
|
@ -1636,33 +1644,31 @@ var gApplicationsPane = {
|
||||||
var typeItem = this._list.selectedItem;
|
var typeItem = this._list.selectedItem;
|
||||||
var handlerInfo = this._handledTypes[typeItem.type];
|
var handlerInfo = this._handledTypes[typeItem.type];
|
||||||
|
|
||||||
if (aActionItem.hasAttribute("alwaysAsk")) {
|
let action = parseInt(aActionItem.getAttribute("action"));
|
||||||
|
|
||||||
|
// Set the plugin state if we're enabling or disabling a plugin.
|
||||||
|
if (action == kActionUsePlugin)
|
||||||
|
handlerInfo.enablePluginType();
|
||||||
|
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
||||||
|
handlerInfo.disablePluginType();
|
||||||
|
|
||||||
|
// Set the preferred application handler.
|
||||||
|
// We leave the existing preferred app in the list when we set
|
||||||
|
// the preferred action to something other than useHelperApp so that
|
||||||
|
// legacy datastores that don't have the preferred app in the list
|
||||||
|
// of possible apps still include the preferred app in the list of apps
|
||||||
|
// the user can choose to handle the type.
|
||||||
|
if (action == Ci.nsIHandlerInfo.useHelperApp)
|
||||||
|
handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
|
||||||
|
|
||||||
|
// Set the "always ask" flag.
|
||||||
|
if (action == Ci.nsIHandlerInfo.alwaysAsk)
|
||||||
handlerInfo.alwaysAskBeforeHandling = true;
|
handlerInfo.alwaysAskBeforeHandling = true;
|
||||||
}
|
else
|
||||||
else if (aActionItem.hasAttribute("action")) {
|
|
||||||
let action = parseInt(aActionItem.getAttribute("action"));
|
|
||||||
|
|
||||||
// Set the plugin state if we're enabling or disabling a plugin.
|
|
||||||
if (action == kActionUsePlugin)
|
|
||||||
handlerInfo.enablePluginType();
|
|
||||||
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
|
||||||
handlerInfo.disablePluginType();
|
|
||||||
|
|
||||||
// Set the preferred application handler.
|
|
||||||
// We leave the existing preferred app in the list when we set
|
|
||||||
// the preferred action to something other than useHelperApp so that
|
|
||||||
// legacy datastores that don't have the preferred app in the list
|
|
||||||
// of possible apps still include the preferred app in the list of apps
|
|
||||||
// the user can choose to handle the type.
|
|
||||||
if (action == Ci.nsIHandlerInfo.useHelperApp)
|
|
||||||
handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
|
|
||||||
|
|
||||||
// Set the "always ask" flag.
|
|
||||||
handlerInfo.alwaysAskBeforeHandling = false;
|
handlerInfo.alwaysAskBeforeHandling = false;
|
||||||
|
|
||||||
// Set the preferred action.
|
// Set the preferred action.
|
||||||
handlerInfo.preferredAction = action;
|
handlerInfo.preferredAction = action;
|
||||||
}
|
|
||||||
|
|
||||||
handlerInfo.store();
|
handlerInfo.store();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче