1 /* Any copyright is dedicated to the Public Domain.
2 https://creativecommons.org/publicdomain/zero/1.0/ */
7 * Tests that privileged scopes can access Web Locks and use them without
8 * being associated with a content global.
10 add_task(async function test_locks() {
11 Assert.ok(locks, "The locks global was imported.");
12 let { promise: firstPromise, resolve: firstResolve } =
13 Promise.withResolvers();
15 const LOCK_NAME = "Some lock";
17 await locks.request(LOCK_NAME, async lock => {
18 Assert.ok(lock, "Got the lock");
20 let { held: heldLocks } = await locks.query();
21 Assert.equal(heldLocks.length, 1, "Should only be 1 held lock");
22 Assert.equal(heldLocks[0].name, LOCK_NAME, "Got the right lock name");
23 Assert.equal(heldLocks[0].clientId, "", "Got an empty client ID");