mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
Bug 987890 - Hide unused tools when using addon debugger. r=jryans
This commit is contained in:
parent
fc8d68521b
commit
906440ab37
@ -85,6 +85,7 @@ support-files =
|
||||
[browser_dbg_addonactor.js]
|
||||
[browser_dbg_addon-sources.js]
|
||||
[browser_dbg_addon-modules.js]
|
||||
[browser_dbg_addon-panels.js]
|
||||
[browser_dbg_auto-pretty-print-01.js]
|
||||
[browser_dbg_auto-pretty-print-02.js]
|
||||
[browser_dbg_bfcache.js]
|
||||
|
80
browser/devtools/debugger/test/browser_dbg_addon-panels.js
Normal file
80
browser/devtools/debugger/test/browser_dbg_addon-panels.js
Normal file
@ -0,0 +1,80 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Ensure that only panels that are relevant to the addon debugger
|
||||
// display in the toolbox
|
||||
|
||||
const ADDON3_URL = EXAMPLE_URL + "addon3.xpi";
|
||||
|
||||
let gAddon, gClient, gThreadClient, gDebugger, gSources;
|
||||
|
||||
function test() {
|
||||
Task.spawn(function () {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init(() => true);
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
let iframe = document.createElement("iframe");
|
||||
document.documentElement.appendChild(iframe);
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
|
||||
let connected = promise.defer();
|
||||
gClient.connect(connected.resolve);
|
||||
yield connected.promise;
|
||||
|
||||
yield installAddon();
|
||||
let debuggerPanel = yield initAddonDebugger(gClient, ADDON3_URL, iframe);
|
||||
gDebugger = debuggerPanel.panelWin;
|
||||
gThreadClient = gDebugger.gThreadClient;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
testPanels(iframe);
|
||||
yield uninstallAddon();
|
||||
yield closeConnection();
|
||||
yield debuggerPanel._toolbox.destroy();
|
||||
iframe.remove();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
function installAddon () {
|
||||
return addAddon(ADDON3_URL).then(aAddon => {
|
||||
gAddon = aAddon;
|
||||
});
|
||||
}
|
||||
|
||||
function testPanels(frame) {
|
||||
let tabs = frame.contentDocument.getElementById("toolbox-tabs").children;
|
||||
let expectedTabs = ["options", "jsdebugger"];
|
||||
|
||||
is(tabs.length, 2, "displaying only 2 tabs in addon debugger");
|
||||
Array.forEach(tabs, (tab, i) => {
|
||||
let toolName = expectedTabs[i];
|
||||
is(tab.getAttribute("toolid"), toolName, "displaying " + toolName);
|
||||
});
|
||||
}
|
||||
|
||||
function uninstallAddon() {
|
||||
return removeAddon(gAddon);
|
||||
}
|
||||
|
||||
function closeConnection () {
|
||||
let deferred = promise.defer();
|
||||
gClient.close(deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gClient = null;
|
||||
gAddon = null;
|
||||
gThreadClient = null;
|
||||
gDebugger = null;
|
||||
gSources = null;
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
});
|
@ -242,6 +242,10 @@ TabTarget.prototype = {
|
||||
return !this.isLocalTab;
|
||||
},
|
||||
|
||||
get isAddon() {
|
||||
return !!(this._form && this._form.addonActor);
|
||||
},
|
||||
|
||||
get isLocalTab() {
|
||||
return !!this._tab;
|
||||
},
|
||||
|
@ -97,7 +97,7 @@ Tools.webConsole = {
|
||||
},
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
return true;
|
||||
return !target.isAddon;
|
||||
},
|
||||
build: function(iframeWindow, toolbox) {
|
||||
let panel = new WebConsolePanel(iframeWindow, toolbox);
|
||||
@ -124,7 +124,7 @@ Tools.inspector = {
|
||||
},
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
return true;
|
||||
return !target.isAddon;
|
||||
},
|
||||
|
||||
build: function(iframeWindow, toolbox) {
|
||||
@ -171,7 +171,7 @@ Tools.styleEditor = {
|
||||
inMenu: true,
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
return true;
|
||||
return !target.isAddon;
|
||||
},
|
||||
|
||||
build: function(iframeWindow, toolbox) {
|
||||
@ -191,7 +191,7 @@ Tools.shaderEditor = {
|
||||
tooltip: l10n("ToolboxShaderEditor.tooltip", shaderEditorStrings),
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
return true;
|
||||
return !target.isAddon;
|
||||
},
|
||||
|
||||
build: function(iframeWindow, toolbox) {
|
||||
@ -215,7 +215,7 @@ Tools.jsprofiler = {
|
||||
inMenu: true,
|
||||
|
||||
isTargetSupported: function (target) {
|
||||
return true;
|
||||
return !target.isAddon;
|
||||
},
|
||||
|
||||
build: function (frame, target) {
|
||||
@ -240,7 +240,7 @@ Tools.netMonitor = {
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
let root = target.client.mainRoot;
|
||||
return root.traits.networkMonitor || !target.isApp;
|
||||
return !target.isAddon && (root.traits.networkMonitor || !target.isApp);
|
||||
},
|
||||
|
||||
build: function(iframeWindow, toolbox) {
|
||||
@ -261,7 +261,7 @@ Tools.scratchpad = {
|
||||
inMenu: false,
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
return target.isRemote;
|
||||
return !target.isAddon && target.isRemote;
|
||||
},
|
||||
|
||||
build: function(iframeWindow, toolbox) {
|
||||
|
Loading…
Reference in New Issue
Block a user