Files
tubestation/toolkit/components/backgroundtasks/tests/BackgroundTask_jsdebugger.jsm
Nick Alexander 5c6479a485 Bug 1686344 - Add test for --backgroundtask --jsdebugger --wait-for-jsdebugger. r=devtools-reviewers,jdescottes
This version is as simple as I can make it.  It simply expects the JS
debugger to stop on the breakpoint added automatically by the
backgroundtask debugger command line processing (using
`setBreakpointOnLoad`) and disconnects, expecting the task to continue
execution and exit with exit code 0.

In the future, we'd like to interact with the task environment, for example to:

1. stop on the automatic breakpoint
2. continue
3. stop on a `debugger;`
4. set the task's exit code from a failure code to exit code 0
5. continue
6. verifies the tasks's exit code is 0.

Sadly my attempts to do this fail intermittently in automation.

Differential Revision: https://phabricator.services.mozilla.com/D139156
2022-03-03 03:38:40 +00:00

28 lines
825 B
JavaScript

/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* This task is intended to be interrupted by the JS debugger in tests.
*
* This task exposes its `exitCode` so that in the future the JS
* debugger can change its exit code dynamically from a failing exit
* code to exit code 0.
*/
var EXPORTED_SYMBOLS = ["runBackgroundTask"];
function runBackgroundTask(commandLine) {
// In the future, will be modifed by the JS debugger (to 0, success).
var exposedExitCode = 0;
console.error(
`runBackgroundTask: will exit with exitCode: ${exposedExitCode}`
);
return exposedExitCode;
}