Bug 981258 - Clean up breakpoints manually before finishing the browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js test; r=past

This commit is contained in:
Nick Fitzgerald 2014-03-11 09:42:49 -07:00
parent de5985045e
commit 472c449ff9

View File

@ -21,42 +21,59 @@ function test() {
gEvents = gDebugger.EVENTS;
Task.spawn(function* () {
yield waitForSourceShown(gPanel, CODE_URL);
try {
// Pause and set our breakpoints.
yield doInterrupt();
yield promise.all([
gPanel.addBreakpoint({
url: CODE_URL,
line: 2
}),
gPanel.addBreakpoint({
url: CODE_URL,
line: 3
}),
gPanel.addBreakpoint({
url: CODE_URL,
line: 4
})
]);
yield waitForSourceShown(gPanel, CODE_URL);
// Should hit the first breakpoint on reload.
yield promise.all([
reloadActiveTab(gPanel, gEvents.SOURCE_SHOWN),
waitForCaretUpdated(gPanel, 2)
]);
// Pause and set our breakpoints.
yield doInterrupt();
const [bp1, bp2, bp3] = yield promise.all([
setBreakpoint({
url: CODE_URL,
line: 2
}),
setBreakpoint({
url: CODE_URL,
line: 3
}),
setBreakpoint({
url: CODE_URL,
line: 4
})
]);
// And should hit the other breakpoints as we resume.
yield promise.all([
doResume(),
waitForCaretUpdated(gPanel, 3)
]);
yield promise.all([
doResume(),
waitForCaretUpdated(gPanel, 4)
]);
// Should hit the first breakpoint on reload.
yield promise.all([
reloadActiveTab(gPanel, gEvents.SOURCE_SHOWN),
waitForCaretUpdated(gPanel, 2)
]);
yield resumeDebuggerThenCloseAndFinish(gPanel);
// And should hit the other breakpoints as we resume.
yield promise.all([
doResume(),
waitForCaretUpdated(gPanel, 3)
]);
yield promise.all([
doResume(),
waitForCaretUpdated(gPanel, 4)
]);
// Clean up the breakpoints.
yield promise.all([
rdpInvoke(bp1, bp1.remove),
rdpInvoke(bp2, bp1.remove),
rdpInvoke(bp3, bp1.remove),
]);
yield resumeDebuggerThenCloseAndFinish(gPanel);
} catch (e) {
DevToolsUtils.reportException(
"browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js",
e
);
ok(false);
}
});
});
@ -76,4 +93,15 @@ function test() {
function doInterrupt() {
return rdpInvoke(gThreadClient, gThreadClient.interrupt);
}
function setBreakpoint(location) {
let deferred = promise.defer();
gThreadClient.setBreakpoint(location, ({ error, message }, bpClient) => {
if (error) {
deferred.reject(error + ": " + message);
}
deferred.resolve(bpClient);
});
return deferred.promise;
}
}