mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
Bug 876277 - Cleanup debugger blackboxing tests, r=past
This commit is contained in:
parent
c6070c7529
commit
26617b332b
@ -5,72 +5,52 @@
|
||||
* Test that if we black box a source and then refresh, it is still black boxed.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "binary_search.html";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
|
||||
testBlackBoxSource();
|
||||
waitForSourceShown(gPanel, ".coffee")
|
||||
.then(testBlackBoxSource)
|
||||
.then(testBlackBoxReload)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
once(gDebugger, "Debugger:SourceShown", function () {
|
||||
const checkbox = gDebugger.document.querySelector(".side-menu-widget-item-checkbox");
|
||||
ok(checkbox, "Should get the checkbox for black boxing the source");
|
||||
ok(checkbox.checked, "Should not be black boxed by default");
|
||||
const checkbox = gDebugger.document.querySelector(".side-menu-widget-item-checkbox");
|
||||
ok(checkbox, "Should get the checkbox for black boxing the source.");
|
||||
ok(checkbox.checked, "Should not be black boxed by default.");
|
||||
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("blackboxchange", function (event, sourceClient) {
|
||||
ok(sourceClient.isBlackBoxed, "The source should be black boxed now");
|
||||
ok(!checkbox.checked, "The checkbox should no longer be checked.");
|
||||
|
||||
testBlackBoxReload();
|
||||
});
|
||||
|
||||
checkbox.click();
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange").then(aSource => {
|
||||
ok(aSource.isBlackBoxed, "The source should be black boxed now.");
|
||||
ok(!checkbox.checked, "The checkbox should no longer be checked.");
|
||||
});
|
||||
|
||||
checkbox.click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testBlackBoxReload() {
|
||||
once(gDebugger, "Debugger:SourceShown", function () {
|
||||
return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
|
||||
const checkbox = gDebugger.document.querySelector(".side-menu-widget-item-checkbox");
|
||||
ok(checkbox, "Should get the checkbox for black boxing the source");
|
||||
ok(!checkbox.checked, "Should still be black boxed");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
ok(checkbox, "Should get the checkbox for black boxing the source.");
|
||||
ok(!checkbox.checked, "Should still be black boxed.");
|
||||
});
|
||||
|
||||
gDebuggee.location.reload();
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
});
|
||||
|
@ -6,82 +6,63 @@
|
||||
* view.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "blackboxing_blackboxme.js"
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
let gFrames;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gFrames = gDebugger.DebuggerView.StackFrames;
|
||||
|
||||
testBlackBoxSource();
|
||||
waitForSourceShown(gPanel, BLACKBOXME_URL)
|
||||
.then(testBlackBoxSource)
|
||||
.then(testBlackBoxStack)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
once(gDebugger, "Debugger:SourceShown", function () {
|
||||
const checkbox = getBlackBoxCheckbox(BLACKBOXME_URL);
|
||||
ok(checkbox, "Should get the checkbox for blackBoxing the source");
|
||||
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("blackboxchange", function (event, sourceClient) {
|
||||
ok(sourceClient.isBlackBoxed, "The source should be black boxed now");
|
||||
|
||||
testBlackBoxStack();
|
||||
});
|
||||
|
||||
checkbox.click();
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange").then(aSource => {
|
||||
ok(aSource.isBlackBoxed, "The source should be black boxed now.");
|
||||
});
|
||||
|
||||
getBlackBoxCheckbox(BLACKBOXME_URL).click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testBlackBoxStack() {
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("framesadded", function () {
|
||||
const frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 3,
|
||||
"Should only get 3 frames");
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
|
||||
"And one of them should be the combined black boxed frames");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
let finished = waitForSourceAndCaretAndScopes(gPanel, ".html", 21).then(() => {
|
||||
is(gFrames.itemCount, 3,
|
||||
"Should only get 3 frames.");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
|
||||
"And one of them should be the combined black boxed frames.");
|
||||
});
|
||||
|
||||
gDebuggee.runTest();
|
||||
// Spin the event loop before causing the debuggee to pause, to allow
|
||||
// this function to return first.
|
||||
executeSoon(() => gDebuggee.runTest());
|
||||
return finished;
|
||||
}
|
||||
|
||||
function getBlackBoxCheckbox(url) {
|
||||
function getBlackBoxCheckbox(aUrl) {
|
||||
return gDebugger.document.querySelector(
|
||||
".side-menu-widget-item[tooltiptext=\""
|
||||
+ url + "\"] .side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
".side-menu-widget-item[tooltiptext=\"" + aUrl + "\"] " +
|
||||
".side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gFrames = null;
|
||||
});
|
||||
|
@ -6,88 +6,63 @@
|
||||
* view when we are already paused.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "blackboxing_blackboxme.js"
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
let gFrames;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gFrames = gDebugger.DebuggerView.StackFrames;
|
||||
|
||||
once(gDebugger, "Debugger:SourceShown", function () {
|
||||
testBlackBoxStack();
|
||||
});
|
||||
waitForSourceAndCaretAndScopes(gPanel, ".html", 21)
|
||||
.then(testBlackBoxStack)
|
||||
.then(testBlackBoxSource)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
|
||||
gDebuggee.runTest();
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxStack() {
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("framesadded", function () {
|
||||
const frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 6,
|
||||
"Should get 6 frames");
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe-black-boxed").length, 0,
|
||||
"And none of them are black boxed");
|
||||
|
||||
testBlackBoxSource();
|
||||
});
|
||||
|
||||
gDebuggee.runTest();
|
||||
is(gFrames.itemCount, 6,
|
||||
"Should get 6 frames.");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 0,
|
||||
"And none of them are black boxed.");
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
const checkbox = getBlackBoxCheckbox(BLACKBOXME_URL);
|
||||
ok(checkbox, "Should get the checkbox for black boxing the source");
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange").then(aSource => {
|
||||
ok(aSource.isBlackBoxed, "The source should be black boxed now.");
|
||||
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("blackboxchange", function (event, sourceClient) {
|
||||
ok(sourceClient.isBlackBoxed, "The source should be black boxed now");
|
||||
|
||||
const frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 3,
|
||||
"Should only get 3 frames");
|
||||
is(frames.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
|
||||
"And one of them is the combined black boxed frames");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
is(gFrames.itemCount, 3,
|
||||
"Should only get 3 frames.");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
|
||||
"And one of them should be the combined black boxed frames.");
|
||||
});
|
||||
|
||||
checkbox.click();
|
||||
getBlackBoxCheckbox(BLACKBOXME_URL).click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function getBlackBoxCheckbox(url) {
|
||||
function getBlackBoxCheckbox(aUrl) {
|
||||
return gDebugger.document.querySelector(
|
||||
".side-menu-widget-item[tooltiptext=\""
|
||||
+ url + "\"] .side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
".side-menu-widget-item[tooltiptext=\"" + aUrl + "\"] " +
|
||||
".side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gFrames = null;
|
||||
});
|
||||
|
@ -6,78 +6,62 @@
|
||||
* for all of them.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_blackboxing.html";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
let gFrames;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gFrames = gDebugger.DebuggerView.StackFrames;
|
||||
|
||||
once(gDebugger, "Debugger:SourceShown", function () {
|
||||
blackBoxSources();
|
||||
});
|
||||
waitForSourceShown(gPanel, BLACKBOXME_URL)
|
||||
.then(blackBoxSources)
|
||||
.then(testBlackBoxStack)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function blackBoxSources() {
|
||||
let timesFired = 0;
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addListener("blackboxchange", function _onBlackBoxChange() {
|
||||
if (++timesFired !== 3) {
|
||||
return;
|
||||
}
|
||||
activeThread.removeListener("blackboxchange", _onBlackBoxChange);
|
||||
|
||||
activeThread.addOneTimeListener("framesadded", testStackFrames);
|
||||
gDebuggee.one();
|
||||
}, false);
|
||||
|
||||
getBlackBoxCheckbox(EXAMPLE_URL + "blackboxing_one.js").click();
|
||||
getBlackBoxCheckbox(EXAMPLE_URL + "blackboxing_two.js").click();
|
||||
getBlackBoxCheckbox(EXAMPLE_URL + "blackboxing_three.js").click();
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange", 3);
|
||||
getBlackBoxCheckbox(EXAMPLE_URL + "code_blackboxing_one.js").click();
|
||||
getBlackBoxCheckbox(EXAMPLE_URL + "code_blackboxing_two.js").click();
|
||||
getBlackBoxCheckbox(EXAMPLE_URL + "code_blackboxing_three.js").click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testStackFrames() {
|
||||
const frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 4,
|
||||
"Should get 4 frames (one -> two -> three -> doDebuggerStatement)");
|
||||
is(frames.querySelectorAll(".dbg-stackframe-black-boxed").length, 3,
|
||||
"And one, two, and three should each have their own black boxed frame.");
|
||||
function testBlackBoxStack() {
|
||||
let finished = waitForSourceAndCaretAndScopes(gPanel, ".html", 21).then(() => {
|
||||
is(gFrames.itemCount, 4,
|
||||
"Should get 4 frames (one -> two -> three -> doDebuggerStatement).");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 3,
|
||||
"And 'one', 'two', and 'three' should each have their own black boxed frame.");
|
||||
});
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
// Spin the event loop before causing the debuggee to pause, to allow
|
||||
// this function to return first.
|
||||
executeSoon(() => gDebuggee.one());
|
||||
return finished;
|
||||
}
|
||||
|
||||
function getBlackBoxCheckbox(url) {
|
||||
function getBlackBoxCheckbox(aUrl) {
|
||||
return gDebugger.document.querySelector(
|
||||
".side-menu-widget-item[tooltiptext=\""
|
||||
+ url + "\"] .side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
".side-menu-widget-item[tooltiptext=\"" + aUrl + "\"] " +
|
||||
".side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gFrames = null;
|
||||
});
|
||||
|
@ -2,67 +2,61 @@
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that we get a stack frame for each black boxed source, not a single one
|
||||
* for all of them.
|
||||
* Test that a "this source is blackboxed" message is shown when necessary
|
||||
* and can be properly dismissed.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "binary_search.html";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
let gDeck;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gDeck = gDebugger.document.getElementById("editor-deck");
|
||||
|
||||
once(gDebugger, "Debugger:SourceShown", testSourceEditorShown);
|
||||
waitForSourceShown(gPanel, ".coffee")
|
||||
.then(testSourceEditorShown)
|
||||
.then(blackBoxSource)
|
||||
.then(testBlackBoxMessageShown)
|
||||
.then(clickStopBlackBoxingButton)
|
||||
.then(testSourceEditorShownAgain)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSourceEditorShown() {
|
||||
const deck = gDebugger.document.getElementById("editor-deck");
|
||||
is(deck.selectedIndex, "0",
|
||||
"The first item in the deck should be selected (the source editor)");
|
||||
blackBoxSource();
|
||||
is(gDeck.selectedIndex, "0",
|
||||
"The first item in the deck should be selected (the source editor).");
|
||||
}
|
||||
|
||||
function blackBoxSource() {
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("blackboxchange", testBlackBoxMessageShown);
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange");
|
||||
getAnyBlackBoxCheckbox().click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testBlackBoxMessageShown() {
|
||||
const deck = gDebugger.document.getElementById("editor-deck");
|
||||
is(deck.selectedIndex, "1",
|
||||
"The second item in the deck should be selected (the black box message)");
|
||||
clickStopBlackBoxingButton();
|
||||
is(gDeck.selectedIndex, "1",
|
||||
"The second item in the deck should be selected (the black box message).");
|
||||
}
|
||||
|
||||
function clickStopBlackBoxingButton() {
|
||||
const button = gDebugger.document.getElementById("black-boxed-message-button");
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("blackboxchange", testSourceEditorShownAgain);
|
||||
button.click();
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange");
|
||||
getEditorBlackboxMessageButton().click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testSourceEditorShownAgain() {
|
||||
const deck = gDebugger.document.getElementById("editor-deck");
|
||||
is(deck.selectedIndex, "0",
|
||||
"The first item in the deck should be selected again (the source editor)");
|
||||
closeDebuggerAndFinish();
|
||||
is(gDeck.selectedIndex, "0",
|
||||
"The first item in the deck should be selected again (the source editor).");
|
||||
}
|
||||
|
||||
function getAnyBlackBoxCheckbox() {
|
||||
@ -70,17 +64,14 @@ function getAnyBlackBoxCheckbox() {
|
||||
".side-menu-widget-item .side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
function getEditorBlackboxMessageButton() {
|
||||
return gDebugger.document.getElementById("black-boxed-message-button");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gDeck = null;
|
||||
});
|
||||
|
@ -5,66 +5,52 @@
|
||||
* Test that clicking the black box checkbox doesn't select that source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_blackboxing.html";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
let gSources;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
once(gDebugger, "Debugger:SourceShown", testBlackBox);
|
||||
waitForSourceShown(gPanel, ".js")
|
||||
.then(testBlackBox)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBox() {
|
||||
const sources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
const selectedUrl = sources.selectedItem.attachment.source.url;
|
||||
const selectedUrl = gSources.selectedValue;
|
||||
const checkbox = getDifferentBlackBoxCheckbox(selectedUrl);
|
||||
ok(checkbox, "We should be able to grab a checkbox");
|
||||
ok(checkbox, "We should be able to grab a different checkbox.");
|
||||
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("blackboxchange", function () {
|
||||
is(selectedUrl,
|
||||
sources.selectedItem.attachment.source.url,
|
||||
"The same source should be selected");
|
||||
closeDebuggerAndFinish();
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange").then(() => {
|
||||
is(selectedUrl, gSources.selectedValue,
|
||||
"The same source should still be selected.");
|
||||
});
|
||||
|
||||
checkbox.click();
|
||||
return finished;
|
||||
}
|
||||
|
||||
function getDifferentBlackBoxCheckbox(url) {
|
||||
function getDifferentBlackBoxCheckbox(aUrl) {
|
||||
return gDebugger.document.querySelector(
|
||||
".side-menu-widget-item:not([tooltiptext=\""
|
||||
+ url + "\"]) .side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
".side-menu-widget-item:not([tooltiptext=\"" + aUrl + "\"]) " +
|
||||
".side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gSources = null;
|
||||
});
|
||||
|
@ -6,81 +6,61 @@
|
||||
* currently paused frame's source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_blackboxing.html";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
let gTab, gDebuggee, gPanel, gDebugger;
|
||||
let gSources;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
resumed = true;
|
||||
function test() {
|
||||
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
once(gDebugger, "Debugger:SourceShown", runTest);
|
||||
});
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
const { activeThread } = gDebugger.DebuggerController;
|
||||
activeThread.addOneTimeListener("paused", function () {
|
||||
const sources = gDebugger.DebuggerView.Sources;
|
||||
const selectedUrl = sources.selectedItem.attachment.source.url;
|
||||
|
||||
once(gDebugger, "Debugger:SourceShown", function () {
|
||||
const newSelectedUrl = sources.selectedItem.attachment.source.url;
|
||||
isnot(selectedUrl, newSelectedUrl,
|
||||
"Should not have the same url selected");
|
||||
|
||||
activeThread.addOneTimeListener("blackboxchange", function () {
|
||||
isnot(sources.selectedItem.attachment.source.url,
|
||||
selectedUrl,
|
||||
"The selected source did not change");
|
||||
closeDebuggerAndFinish();
|
||||
waitForSourceAndCaretAndScopes(gPanel, ".html", 21)
|
||||
.then(testBlackBox)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.then(null, aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
|
||||
getBlackBoxCheckbox(newSelectedUrl).click();
|
||||
gDebuggee.runTest();
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBox() {
|
||||
const selectedUrl = gSources.selectedValue;
|
||||
|
||||
let finished = waitForSourceShown(gPanel, "blackboxme.js").then(() => {
|
||||
const newSelectedUrl = gSources.selectedValue;
|
||||
isnot(selectedUrl, newSelectedUrl,
|
||||
"Should not have the same url selected.");
|
||||
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange").then(() => {
|
||||
is(gSources.selectedValue, newSelectedUrl,
|
||||
"The selected source did not change.");
|
||||
});
|
||||
|
||||
getDifferentSource(selectedUrl).click();
|
||||
getBlackBoxCheckbox(newSelectedUrl).click()
|
||||
return finished;
|
||||
});
|
||||
|
||||
gDebuggee.runTest();
|
||||
gSources.selectedIndex = 0;
|
||||
return finished;
|
||||
}
|
||||
|
||||
function getDifferentSource(url) {
|
||||
function getBlackBoxCheckbox(aUrl) {
|
||||
return gDebugger.document.querySelector(
|
||||
".side-menu-widget-item:not([tooltiptext=\""
|
||||
+ url + "\"])");
|
||||
}
|
||||
|
||||
function getBlackBoxCheckbox(url) {
|
||||
return gDebugger.document.querySelector(
|
||||
".side-menu-widget-item[tooltiptext=\""
|
||||
+ url + "\"] .side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
function once(target, event, callback) {
|
||||
target.addEventListener(event, function _listener(...args) {
|
||||
target.removeEventListener(event, _listener, false);
|
||||
callback.apply(null, args);
|
||||
}, false);
|
||||
".side-menu-widget-item[tooltiptext=\"" + aUrl + "\"] " +
|
||||
".side-menu-widget-item-checkbox");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gSources = null;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user