[TychoAM] Make the Add-ons Manager conditionally devtools free

This commit is contained in:
NTD 2018-05-01 16:14:17 -04:00 • committed by Roy Tam
commit c9446a4319
4 changed files with 27 additions and 0 deletions

View file

@ -18,10 +18,12 @@ Cu.import("resource://gre/modules/addons/AddonRepository.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
#ifdef MOZ_DEVTOOLS
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
BrowserToolboxProcess;
});
#endif
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
@ -1002,6 +1004,7 @@ var gViewController = {
}
},
#ifdef MOZ_DEVTOOLS
cmd_debugItem: {
doCommand: function cmd_debugItem_doCommand(aAddon) {
BrowserToolboxProcess.init({ addonID: aAddon.id });
@ -1015,6 +1018,7 @@ var gViewController = {
return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled;
}
},
#endif
cmd_showItemPreferences: {
isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) {

View file

@ -1628,11 +1628,13 @@
]]></body>
</method>
#ifdef MOZ_DEVTOOLS
<method name="debug">
<body><![CDATA[
gViewController.doCommand("cmd_debugItem", this.mAddon);
]]></body>
</method>
#endif
<method name="showPreferences">
<body><![CDATA[

View file

@ -53,8 +53,10 @@
<menuitem id="menuitem_uninstallItem" command="cmd_uninstallItem"
label="&cmd.uninstallAddon.label;"
accesskey="&cmd.uninstallAddon.accesskey;"/>
#ifdef MOZ_DEVTOOLS
<menuitem id="menuitem_debugItem" command="cmd_debugItem"
label="&cmd.debugAddon.label;"/>
#endif
<menuseparator id="addonitem-menuseparator" />
<menuitem id="menuitem_preferences" command="cmd_showItemPreferences"
#ifdef XP_WIN
@ -101,7 +103,9 @@
<command id="cmd_findItemUpdates"/>
<command id="cmd_showItemPreferences"/>
<command id="cmd_showItemAbout"/>
#ifdef MOZ_DEVTOOLS
<command id="cmd_debugItem"/>
#endif
<command id="cmd_enableItem"/>
<command id="cmd_disableItem"/>
<command id="cmd_installItem"/>
@ -631,9 +635,11 @@
#endif
command="cmd_showItemPreferences"/>
<spacer flex="1"/>
#ifdef MOZ_DEVTOOLS
<button id="detail-debug-btn" class="addon-control debug"
label="Debug"
command="cmd_debugItem" />
#endif
<button id="detail-enable-btn" class="addon-control enable"
label="&cmd.enableAddon.label;"
accesskey="&cmd.enableAddon.accesskey;"