From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- remote/shared/webdriver/test/xpcshell/head.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 remote/shared/webdriver/test/xpcshell/head.js (limited to 'remote/shared/webdriver/test/xpcshell/head.js') diff --git a/remote/shared/webdriver/test/xpcshell/head.js b/remote/shared/webdriver/test/xpcshell/head.js new file mode 100644 index 0000000000..ddc5573d78 --- /dev/null +++ b/remote/shared/webdriver/test/xpcshell/head.js @@ -0,0 +1,15 @@ +async function doGC() { + // Run GC and CC a few times to make sure that as much as possible is freed. + const numCycles = 3; + for (let i = 0; i < numCycles; i++) { + Cu.forceGC(); + Cu.forceCC(); + await new Promise(resolve => Cu.schedulePreciseShrinkingGC(resolve)); + } + + const MemoryReporter = Cc[ + "@mozilla.org/memory-reporter-manager;1" + ].getService(Ci.nsIMemoryReporterManager); + + await new Promise(resolve => MemoryReporter.minimizeMemoryUsage(resolve)); +} -- cgit v1.2.3