forked from mirrors/gecko-dev
This establishes a high water mark for code loaded (even after a short delay) by a background task that does nothing. Code loaded here means: 1) Chrome JSMs imported using `ChromeUtils.import`; 2) XPCOM services, generally long-lived, loaded using `do_getService` or `Services.*` or an equivalent; 3) XPCOM components defined in JavaScript and loaded via `chrome.manifest` entries. At this time background tasks do not load any of category 3. The distinction is made because they are reported separately by Gecko. This test is browser-chrome to make it easy/possible to work with packaged builds. Differential Revision: https://phabricator.services.mozilla.com/D98095
19 lines
668 B
JavaScript
19 lines
668 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/. */
|
|
|
|
var EXPORTED_SYMBOLS = ["runBackgroundTask"];
|
|
|
|
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
|
|
|
function runBackgroundTask(commandLine) {
|
|
let delay = 10;
|
|
if (commandLine.length) {
|
|
delay = Number.parseInt(commandLine.getArgument(0));
|
|
}
|
|
|
|
console.error(`runBackgroundTask: wait ${delay} seconds`);
|
|
|
|
return new Promise(resolve => setTimeout(resolve, delay * 1000));
|
|
}
|