function allTestProcs() { return ChromeUtils.getAllDOMProcesses().filter(
p => p.remoteType == TEST_REMOTE_TYPE
);
}
add_task(async function headlessContentProcessKeepAlive() {
let testProcesses = allTestProcs();
equal(testProcesses.length, 0);
// Start the process, it should appear in the list.
let keepAlive =
await ChromeUtils.ensureHeadlessContentProcess(TEST_REMOTE_TYPE);
let domProcess = keepAlive.domProcess;
// Invalidating the keep alive should lead to the process being shut down.
keepAlive.invalidateKeepAlive();
// Wait for the process to be shut down.
await new Promise(resolve => {
Services.obs.addObserver(function obs(subject, topic) {
equal(topic, "ipc:content-shutdown"); if (
subject.QueryInterface(Ci.nsIPropertyBag2).getProperty("childID") ==
domProcess.childID
) {
Services.obs.removeObserver(obs, "ipc:content-shutdown");
resolve();
}
}, "ipc:content-shutdown");
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.