mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1106353 - [gcli] Extend addon
to handle click-to-play. r=mratcliffe
--HG-- extra : rebase_source : e3aa43777d03493bdd53f2b40daf5e2cfb2d0ad5
This commit is contained in:
parent
36e70e85b0
commit
c4bd398fc2
@ -126,6 +126,67 @@ function* spawnTest() {
|
|||||||
exec: {
|
exec: {
|
||||||
output: 'Test Plug-in 1.0.0.0 enabled.'
|
output: 'Test Plug-in 1.0.0.0 enabled.'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
setup: 'addon ctp Test_Plug-in_1.0.0.0',
|
||||||
|
check: {
|
||||||
|
input: 'addon ctp Test_Plug-in_1.0.0.0',
|
||||||
|
hints: '',
|
||||||
|
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
|
||||||
|
status: 'VALID',
|
||||||
|
args: {
|
||||||
|
command: { name: 'addon ctp' },
|
||||||
|
addon: {
|
||||||
|
value: function(addon) {
|
||||||
|
is(addon.name, 'Test Plug-in', 'test plugin name');
|
||||||
|
},
|
||||||
|
status: 'VALID'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exec: {
|
||||||
|
output: 'Test Plug-in 1.0.0.0 set to click-to-play.'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
setup: 'addon ctp OpenH264_Video_Codec_provided_by_Cisco_Systems,_Inc._null',
|
||||||
|
check: {
|
||||||
|
input: 'addon ctp OpenH264_Video_Codec_provided_by_Cisco_Systems,_Inc._null',
|
||||||
|
hints: '',
|
||||||
|
status: 'VALID',
|
||||||
|
args: {
|
||||||
|
command: { name: 'addon ctp' },
|
||||||
|
addon: {
|
||||||
|
value: function(addon) {
|
||||||
|
is(addon.name, 'OpenH264 Video Codec provided by Cisco Systems, Inc.', 'openh264');
|
||||||
|
},
|
||||||
|
status: 'VALID'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exec: {
|
||||||
|
output: 'OpenH264 Video Codec provided by Cisco Systems, Inc. null cannot be set to click-to-play.'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
setup: 'addon ctp Mochitest_1.0',
|
||||||
|
check: {
|
||||||
|
input: 'addon ctp Mochitest_1.0',
|
||||||
|
hints: '',
|
||||||
|
status: 'VALID',
|
||||||
|
args: {
|
||||||
|
command: { name: 'addon ctp' },
|
||||||
|
addon: {
|
||||||
|
value: function(addon) {
|
||||||
|
is(addon.name, 'Mochitest', 'mochitest');
|
||||||
|
},
|
||||||
|
status: 'VALID'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exec: {
|
||||||
|
output: 'Mochitest 1.0 cannot be set to click-to-play because it is not a plugin.'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -279,6 +279,41 @@ var items = [
|
|||||||
|
|
||||||
return l10n.lookupFormat("addonAlreadyDisabled", [ name ]);
|
return l10n.lookupFormat("addonAlreadyDisabled", [ name ]);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "command",
|
||||||
|
runAt: "client",
|
||||||
|
name: "addon ctp",
|
||||||
|
description: l10n.lookup("addonCtpDesc"),
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
name: "addon",
|
||||||
|
type: "addon",
|
||||||
|
description: l10n.lookup("addonNameDesc")
|
||||||
|
}
|
||||||
|
],
|
||||||
|
exec: function(args, context) {
|
||||||
|
let name = (args.addon.name + " " + args.addon.version).trim();
|
||||||
|
if (args.addon.type !== "plugin") {
|
||||||
|
return l10n.lookupFormat("addonCantCtp", [ name ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!args.addon.userDisabled ||
|
||||||
|
args.addon.userDisabled === true) {
|
||||||
|
args.addon.userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE;
|
||||||
|
|
||||||
|
if (args.addon.userDisabled !== AddonManager.STATE_ASK_TO_ACTIVATE) {
|
||||||
|
// Some plugins (e.g. OpenH264 shipped with Firefox) cannot be set to
|
||||||
|
// click-to-play. Handle this.
|
||||||
|
|
||||||
|
return l10n.lookupFormat("addonNoCtp", [ name ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l10n.lookupFormat("addonCtp", [ name ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l10n.lookupFormat("addonAlreadyCtp", [ name ]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -836,6 +836,30 @@ addonAlreadyDisabled=%S is already disabled.
|
|||||||
# command when an add-on is disabled.
|
# command when an add-on is disabled.
|
||||||
addonDisabled=%S disabled.
|
addonDisabled=%S disabled.
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (addonCtpDesc) A very short description of the
|
||||||
|
# 'addon ctp <type>' command. This string is designed to be shown in a menu
|
||||||
|
# alongside the command name, which is why it should be as short as possible.
|
||||||
|
addonCtpDesc=Set the specified plugin to click-to-play.
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (addonCtp) Used in the output of the 'addon ctp'
|
||||||
|
# command when a plugin is set to click-to-play.
|
||||||
|
addonCtp=%S set to click-to-play.
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (addonAlreadyCtp) Used in the output of the
|
||||||
|
# 'addon ctp' command when an attempt is made to set a plugin to
|
||||||
|
# click-to-play that is already set to click-to-play.
|
||||||
|
addonAlreadyCtp=%S is already set to click-to-play.
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (addonCantCtp) Used in the output of the 'addon
|
||||||
|
# ctp' command when an attempt is made to set an addon to click-to-play,
|
||||||
|
# but the addon is not a plugin.
|
||||||
|
addonCantCtp=%S cannot be set to click-to-play because it is not a plugin.
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (addonNoCtp) Used in the output of the 'addon
|
||||||
|
# ctp' command when an attempt is made to set an addon to click-to-play,
|
||||||
|
# but the plugin cannot be set to click-to-play for some reason.
|
||||||
|
addonNoCtp=%S cannot be set to click-to-play.
|
||||||
|
|
||||||
# LOCALIZATION NOTE (exportDesc) A very short description of the 'export'
|
# LOCALIZATION NOTE (exportDesc) A very short description of the 'export'
|
||||||
# command. This string is designed to be shown in a menu alongside the command
|
# command. This string is designed to be shown in a menu alongside the command
|
||||||
# name, which is why it should be as short as possible.
|
# name, which is why it should be as short as possible.
|
||||||
|
Loading…
Reference in New Issue
Block a user