Bug 1093349 - Add prettyPrinting and blackBoxing traits and hide buttons in debugger conditionally. r=past, a=me
This commit is contained in:
@@ -215,6 +215,8 @@ let DebuggerController = {
|
|||||||
yield this._startTracingTab(traceActor);
|
yield this._startTracingTab(traceActor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._hideUnsupportedFeatures();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,6 +233,16 @@ let DebuggerController = {
|
|||||||
this.activeThread = null;
|
this.activeThread = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_hideUnsupportedFeatures: function() {
|
||||||
|
if (this.client.mainRoot.traits.noPrettyPrinting) {
|
||||||
|
DebuggerView.Sources.hidePrettyPrinting();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.client.mainRoot.traits.noBlackBoxing) {
|
||||||
|
DebuggerView.Sources.hideBlackBoxing();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called for each location change in the debugged tab.
|
* Called for each location change in the debugged tab.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -546,6 +546,24 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hidePrettyPrinting: function() {
|
||||||
|
this._prettyPrintButton.style.display = 'none';
|
||||||
|
|
||||||
|
if (this._blackBoxButton.style.display === 'none') {
|
||||||
|
let sep = document.querySelector('#sources-toolbar .devtools-separator');
|
||||||
|
sep.style.display = 'none';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
hideBlackBoxing: function() {
|
||||||
|
this._blackBoxButton.style.display = 'none';
|
||||||
|
|
||||||
|
if (this._prettyPrintButton.style.display === 'none') {
|
||||||
|
let sep = document.querySelector('#sources-toolbar .devtools-separator');
|
||||||
|
sep.style.display = 'none';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks a breakpoint as selected in this sources container.
|
* Marks a breakpoint as selected in this sources container.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -235,6 +235,8 @@ skip-if = e10s
|
|||||||
skip-if = e10s
|
skip-if = e10s
|
||||||
[browser_dbg_globalactor.js]
|
[browser_dbg_globalactor.js]
|
||||||
skip-if = e10s
|
skip-if = e10s
|
||||||
|
[browser_dbg_hide-toolbar-buttons.js]
|
||||||
|
skip-if = e10s
|
||||||
[browser_dbg_hit-counts-01.js]
|
[browser_dbg_hit-counts-01.js]
|
||||||
skip-if = e10s
|
skip-if = e10s
|
||||||
[browser_dbg_hit-counts-02.js]
|
[browser_dbg_hit-counts-02.js]
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bug 1093349: Test that the pretty-printing and blackboxing buttons
|
||||||
|
* are hidden if the server doesn't support them
|
||||||
|
*/
|
||||||
|
|
||||||
|
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html";
|
||||||
|
|
||||||
|
let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
|
||||||
|
let { RootActor } = devtools.require("devtools/server/actors/root");
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
let gTab, gDebuggee, gPanel, gDebugger;
|
||||||
|
let gEditor, gSources, gBreakpoints, gBreakpointsAdded, gBreakpointsRemoving;
|
||||||
|
|
||||||
|
RootActor.prototype.traits.noBlackBoxing = true;
|
||||||
|
RootActor.prototype.traits.noPrettyPrinting = true;
|
||||||
|
|
||||||
|
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||||
|
let document = aPanel.panelWin.document;
|
||||||
|
let ppButton = document.querySelector('#pretty-print');
|
||||||
|
let bbButton = document.querySelector('#black-box');
|
||||||
|
let sep = document.querySelector('#sources-toolbar .devtools-separator');
|
||||||
|
|
||||||
|
is(ppButton.style.display, 'none', 'The pretty-print button is hidden');
|
||||||
|
is(bbButton.style.display, 'none', 'The blackboxing button is hidden');
|
||||||
|
is(sep.style.display, 'none', 'The separator is hidden');
|
||||||
|
closeDebuggerAndFinish(aPanel)
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -145,7 +145,11 @@ RootActor.prototype = {
|
|||||||
// adds new rules to the page
|
// adds new rules to the page
|
||||||
addNewRule: true,
|
addNewRule: true,
|
||||||
// Whether the dom node actor implements the getUniqueSelector method
|
// Whether the dom node actor implements the getUniqueSelector method
|
||||||
getUniqueSelector: true
|
getUniqueSelector: true,
|
||||||
|
// Whether the debugger server supports
|
||||||
|
// blackboxing/pretty-printing (not supported in Fever Dream yet)
|
||||||
|
noBlackBoxing: false,
|
||||||
|
noPrettyPrinting: false
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user