summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-locks/lock-attributes.https.any.js
blob: d1c03103e0b7d7cf460b51e7cd974a7615c89955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// META: title=Web Locks API: Lock Attributes
// META: global=window,dedicatedworker,sharedworker,serviceworker

'use strict';

promise_test(async t => {
  await navigator.locks.request('resource', lock => {
    assert_equals(lock.name, 'resource');
    assert_equals(lock.mode, 'exclusive');
  });
}, 'Lock attributes reflect requested properties (exclusive)');

promise_test(async t => {
  await navigator.locks.request('resource', {mode: 'shared'}, lock => {
    assert_equals(lock.name, 'resource');
    assert_equals(lock.mode, 'shared');
  });
}, 'Lock attributes reflect requested properties (shared)');