1
0
Fork 0
firefox/toolkit/mozapps/update/tests/data/updateMutexTestChild.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

35 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This is the script that runs in the child xpcshell process when using
// TestUpdateMutexCrossProcess, like we do in
// unit_aus_update/canCheckForAndCanApplyUpdates.js.
// The main thing this script does is try to acquire update mutex in the same
// fake environment in which the parent runs, which we must set up.
// This requires that our command line defines of the relevant helper functions
// from xpcshellUtilsAUS.js, which are:
/* global registerCustomDirProvider */
/* global resetSyncManagerLock */
/* global EXIT_CODE */
print("child process is running");
registerCustomDirProvider();
resetSyncManagerLock();
var updateMutex = Cc["@mozilla.org/updates/update-mutex;1"].createInstance(
Ci.nsIUpdateMutex
);
if (!updateMutex.tryLock()) {
quit(EXIT_CODE.FAILED_TO_ACQUIRE_UPDATE_MUTEX);
}
// Wait for 60 seconds, then exit. We expect that the parent will kill us first.
print(
"child process should now have the update mutex; will exit in 60 seconds"
);
simulateNoScriptActivity(60);
print("child process exiting now");
updateMutex.unlock();