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,20 +21,22 @@ function test() {
gEvents = gDebugger.EVENTS; gEvents = gDebugger.EVENTS;
Task.spawn(function* () { Task.spawn(function* () {
try {
yield waitForSourceShown(gPanel, CODE_URL); yield waitForSourceShown(gPanel, CODE_URL);
// Pause and set our breakpoints. // Pause and set our breakpoints.
yield doInterrupt(); yield doInterrupt();
yield promise.all([ const [bp1, bp2, bp3] = yield promise.all([
gPanel.addBreakpoint({ setBreakpoint({
url: CODE_URL, url: CODE_URL,
line: 2 line: 2
}), }),
gPanel.addBreakpoint({ setBreakpoint({
url: CODE_URL, url: CODE_URL,
line: 3 line: 3
}), }),
gPanel.addBreakpoint({ setBreakpoint({
url: CODE_URL, url: CODE_URL,
line: 4 line: 4
}) })
@ -56,7 +58,22 @@ function test() {
waitForCaretUpdated(gPanel, 4) 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); 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() { function doInterrupt() {
return rdpInvoke(gThreadClient, gThreadClient.interrupt); 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;
}
} }