1
0
Fork 0
firefox/toolkit/components/backgroundhangmonitor/tests/child_cause_hang.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

26 lines
829 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function ensureProfilerInitialized() {
if (Services.profiler.IsActive()) {
return;
}
// Starting and stopping the profiler with the "stackwalk" flag will cause the
// profiler's stackwalking features to be synchronously initialized. This
// should prevent us from not initializing BHR quickly enough.
let features = ["stackwalk"];
Services.profiler.StartProfiler(1000, 10, features);
Services.profiler.StopProfiler();
}
add_task(async function childCauseHang() {
ensureProfilerInitialized();
executeSoon(() => {
let startTime = Date.now();
// eslint-disable-next-line no-empty
while (Date.now() - startTime < 2000) {}
});
await do_await_remote_message("bhr_hangs_detected");
});