Bug 1209344 - remove debug button from about:addons r=mossop

--HG--
extra : transplant_source : %DF-u%83%B8%A5%9E%EA%B5%8D%9B%B1%92G%02m%08%BE%3D%E3
This commit is contained in:
Robert Helmer 2015-12-13 09:02:17 -08:00
Родитель 4d97d84ae2
Коммит 1f3b89a6c7
10 изменённых файлов: 0 добавлений и 218 удалений

Просмотреть файл

@ -105,8 +105,6 @@
<!ENTITY cmd.installAddon.accesskey "I">
<!ENTITY cmd.uninstallAddon.label "Remove">
<!ENTITY cmd.uninstallAddon.accesskey "R">
<!ENTITY cmd.debugAddon.label "Debug">
<!ENTITY cmd.debugAddon.accesskey "B">
<!ENTITY cmd.showPreferencesWin.label "Options">
<!ENTITY cmd.showPreferencesWin.tooltip "Change this add-on's options">
<!ENTITY cmd.showPreferencesUnix.label "Preferences">

Просмотреть файл

@ -24,10 +24,6 @@ const SIGNING_REQUIRED = CONSTANTS.REQUIRE_SIGNING ?
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() {
return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
BrowserToolboxProcess;
});
XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
"resource:///modules/experiments/Experiments.jsm");
@ -39,8 +35,6 @@ const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled";
const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden";
const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory";
const PREF_ADDON_DEBUGGING_ENABLED = "devtools.chrome.enabled";
const PREF_REMOTE_DEBUGGING_ENABLED = "devtools.debugger.remote-enabled";
const LOADING_MSG_DELAY = 100;
@ -164,9 +158,6 @@ function initialize(event) {
}
gViewController.loadInitialView(view);
Services.prefs.addObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged, false);
Services.prefs.addObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged, false);
}
function notifyInitialized() {
@ -187,8 +178,6 @@ function shutdown() {
gEventManager.shutdown();
gViewController.shutdown();
Services.obs.removeObserver(sendEMPong, "EM-ping");
Services.prefs.removeObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged);
Services.prefs.removeObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged);
}
function sendEMPong(aSubject, aTopic, aData) {
@ -1077,20 +1066,6 @@ var gViewController = {
}
},
cmd_debugItem: {
doCommand: function(aAddon) {
BrowserToolboxProcess.init({ addonID: aAddon.id });
},
isEnabled: function(aAddon) {
let debuggerEnabled = Services.prefs.
getBoolPref(PREF_ADDON_DEBUGGING_ENABLED);
let remoteEnabled = Services.prefs.
getBoolPref(PREF_REMOTE_DEBUGGING_ENABLED);
return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled;
}
},
cmd_showItemPreferences: {
isEnabled: function(aAddon) {
if (!aAddon ||
@ -3717,12 +3692,6 @@ var gUpdatesView = {
}
};
function debuggingPrefChanged() {
gViewController.updateState();
gViewController.updateCommands();
gViewController.notifyViewChanged();
}
var gDragDrop = {
onDragOver: function(aEvent) {
var types = aEvent.dataTransfer.types;

Просмотреть файл

@ -877,11 +877,6 @@
tooltiptext="&cmd.showPreferencesUnix.tooltip;"
#endif
oncommand="document.getBindingParent(this).showPreferences();"/>
<!-- label="&cmd.debugAddon.label;" -->
<xul:button anonid="debug-btn" class="addon-control debug"
label="&cmd.debugAddon.label;"
oncommand="document.getBindingParent(this).debug();"/>
<xul:button anonid="enable-btn" class="addon-control enable"
label="&cmd.enableAddon.label;"
oncommand="document.getBindingParent(this).userDisabled = false;"/>
@ -1020,10 +1015,6 @@
document.getAnonymousElementByAttribute(this, "anonid",
"enable-btn");
</field>
<field name="_debugBtn">
document.getAnonymousElementByAttribute(this, "anonid",
"debug-btn");
</field>
<field name="_disableBtn">
document.getAnonymousElementByAttribute(this, "anonid",
"disable-btn");
@ -1370,12 +1361,6 @@
this.mAddon.install.state != AddonManager.STATE_INSTALLED);
this._showStatus(showProgress ? "progress" : "none");
let debuggable = this.mAddon.isDebuggable &&
Services.prefs.getBoolPref('devtools.chrome.enabled') &&
Services.prefs.getBoolPref('devtools.debugger.remote-enabled');
this._debugBtn.disabled = this._debugBtn.hidden = !debuggable
if (this.mAddon.type == "experiment") {
this.removeAttribute("notification");
let prefix = "experiment.";
@ -1557,12 +1542,6 @@
]]></body>
</method>
<method name="debug">
<body><![CDATA[
gViewController.doCommand("cmd_debugItem", this.mAddon);
]]></body>
</method>
<method name="showPreferences">
<body><![CDATA[
gViewController.doCommand("cmd_showItemPreferences", this.mAddon);

Просмотреть файл

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

Просмотреть файл

@ -6944,10 +6944,6 @@ AddonWrapper.prototype = {
return ops;
},
get isDebuggable() {
return this.isActive && addonFor(this).bootstrap;
},
get permissions() {
return addonFor(this).permissions();
},

Просмотреть файл

@ -33,7 +33,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak
[browser_bug679604.js]
[browser_bug714593.js]
[browser_bug590347.js]
[browser_debug_button.js]
[browser_details.js]
[browser_discovery.js]
skip-if = e10s # Bug ?????? - test times out on try on all platforms, but works locally for markh!

Просмотреть файл

@ -1,112 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Tests debug button for addons in list view
*/
var { Promise } = Components.utils.import("resource://gre/modules/Promise.jsm", {});
var { Task } = Components.utils.import("resource://gre/modules/Task.jsm", {});
const getDebugButton = node =>
node.ownerDocument.getAnonymousElementByAttribute(node, "anonid", "debug-btn");
const addonDebuggingEnabled = bool =>
Services.prefs.setBoolPref("devtools.chrome.enabled", !!bool);
const remoteDebuggingEnabled = bool =>
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", !!bool);
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
var gProvider = new MockProvider();
gProvider.createAddons([{
id: "non-debuggable@tests.mozilla.org",
name: "No debug",
description: "foo"
},
{
id: "debuggable@tests.mozilla.org",
name: "Debuggable",
description: "bar",
isDebuggable: true
}]);
Task.spawn(function* () {
addonDebuggingEnabled(false);
remoteDebuggingEnabled(false);
yield testDOM((nondebug, debuggable) => {
is(nondebug.disabled, true,
"addon:disabled::remote:disabled button is disabled for legacy addons");
is(nondebug.hidden, true,
"addon:disabled::remote:disabled button is hidden for legacy addons");
is(debuggable.disabled, true,
"addon:disabled::remote:disabled button is disabled for debuggable addons");
is(debuggable.hidden, true,
"addon:disabled::remote:disabled button is hidden for debuggable addons");
});
addonDebuggingEnabled(true);
remoteDebuggingEnabled(false);
yield testDOM((nondebug, debuggable) => {
is(nondebug.disabled, true,
"addon:enabled::remote:disabled button is disabled for legacy addons");
is(nondebug.disabled, true,
"addon:enabled::remote:disabled button is hidden for legacy addons");
is(debuggable.disabled, true,
"addon:enabled::remote:disabled button is disabled for debuggable addons");
is(debuggable.disabled, true,
"addon:enabled::remote:disabled button is hidden for debuggable addons");
});
addonDebuggingEnabled(false);
remoteDebuggingEnabled(true);
yield testDOM((nondebug, debuggable) => {
is(nondebug.disabled, true,
"addon:disabled::remote:enabled button is disabled for legacy addons");
is(nondebug.disabled, true,
"addon:disabled::remote:enabled button is hidden for legacy addons");
is(debuggable.disabled, true,
"addon:disabled::remote:enabled button is disabled for debuggable addons");
is(debuggable.disabled, true,
"addon:disabled::remote:enabled button is hidden for debuggable addons");
});
addonDebuggingEnabled(true);
remoteDebuggingEnabled(true);
yield testDOM((nondebug, debuggable) => {
is(nondebug.disabled, true,
"addon:enabled::remote:enabled button is disabled for legacy addons");
is(nondebug.disabled, true,
"addon:enabled::remote:enabled button is hidden for legacy addons");
is(debuggable.disabled, false,
"addon:enabled::remote:enabled button is enabled for debuggable addons");
is(debuggable.hidden, false,
"addon:enabled::remote:enabled button is visible for debuggable addons");
});
finish();
});
function testDOM (testCallback) {
let deferred = Promise.defer();
open_manager("addons://list/extension", function(aManager) {
const {document} = aManager;
const addonList = document.getElementById("addon-list");
const nondebug = addonList.querySelector("[name='No debug']");
const debuggable = addonList.querySelector("[name='Debuggable']");
testCallback.apply(null, [nondebug, debuggable].map(getDebugButton));
close_manager(aManager, deferred.resolve);
});
return deferred.promise;
}
}

Просмотреть файл

@ -76,7 +76,6 @@ var gRestorePrefs = [{name: PREF_LOGGING_ENABLED},
{name: "extensions.getAddons.search.url"},
{name: "extensions.getAddons.cache.enabled"},
{name: "devtools.chrome.enabled"},
{name: "devtools.debugger.remote-enabled"},
{name: PREF_SEARCH_MAXRESULTS},
{name: PREF_STRICT_COMPAT},
{name: PREF_CHECK_COMPATIBILITY}];
@ -1113,7 +1112,6 @@ function MockAddon(aId, aName, aType, aOperationsRequiringRestart) {
this.type = aType || "extension";
this.version = "";
this.isCompatible = true;
this.isDebuggable = false;
this.providesUpdatesSecurely = true;
this.blocklistState = 0;
this._appDisabled = false;

Просмотреть файл

@ -1,36 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var ADDONS = [
"test_bootstrap2_1", // restartless addon
"test_bootstrap1_4", // old-school addon
"test_jetpack" // sdk addon
];
var IDS = [
"bootstrap1@tests.mozilla.org",
"bootstrap2@tests.mozilla.org",
"jetpack@tests.mozilla.org"
];
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
startupManager();
AddonManager.checkCompatibility = false;
installAllFiles(ADDONS.map(do_get_addon), function () {
restartManager();
AddonManager.getAddonsByIDs(IDS, function([a1, a2, a3]) {
do_check_eq(a1.isDebuggable, false);
do_check_eq(a2.isDebuggable, true);
do_check_eq(a3.isDebuggable, true);
do_test_finished();
});
}, true);
}

Просмотреть файл

@ -205,7 +205,6 @@ skip-if = os == "android"
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
run-sequentially = Uses hardcoded ports in xpi files.
[test_isDebuggable.js]
[test_locale.js]
[test_locked.js]
[test_locked2.js]