fune/devtools/server/tests/unit/test_conditional_breakpoint-02.js
Michael Brennan 8229796378 Bug 1325989 - Resolve ESLint issues in devtools/server/tests/unit. r=jryans
--HG--
extra : rebase_source : 855f1da9fc88af46e8be78c94762a90df29cb75f
2017-03-18 12:26:05 +01:00

63 lines
2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable no-shadow, max-nested-callbacks */
"use strict";
/**
* Check conditional breakpoint when condition evaluates to false.
*/
var gDebuggee;
var gClient;
var gThreadClient;
function run_test() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-conditional-breakpoint");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect().then(function () {
attachTestTabAndResume(gClient, "test-conditional-breakpoint",
function (response, tabClient, threadClient) {
gThreadClient = threadClient;
test_simple_breakpoint();
});
});
do_test_pending();
}
function test_simple_breakpoint() {
gThreadClient.addOneTimeListener("paused", function (event, packet) {
let source = gThreadClient.source(packet.frame.where.source);
source.setBreakpoint({
line: 3,
condition: "a === 2"
}, function (response, bpClient) {
gThreadClient.addOneTimeListener("paused", function (event, packet) {
// Check the return value.
do_check_eq(packet.why.type, "debuggerStatement");
do_check_eq(packet.frame.where.line, 4);
// Remove the breakpoint.
bpClient.remove(function (response) {
gThreadClient.resume(function () {
finishClient(gClient);
});
});
});
// Continue until the breakpoint is hit.
gThreadClient.resume();
});
});
/* eslint-disable */
Components.utils.evalInSandbox("debugger;\n" + // 1
"var a = 1;\n" + // 2
"var b = 2;\n" + // 3
"debugger;", // 4
gDebuggee,
"1.8",
"test.js",
1);
/* eslint-enable */
}