Changeset 286284 in webkit


Ignore:
Timestamp:
Nov 29, 2021 9:24:37 PM (8 months ago)
Author:
Chris Dumez
Message:

Add initial implementation for the Web Lock API
https://bugs.webkit.org/show_bug.cgi?id=233289

Reviewed by Geoff Garen.

LayoutTests/imported/w3c:

Rebaseline Web Locks WPT tests now that they are all passing.

  • web-platform-tests/web-locks/acquire.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/acquire.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/acquire.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/clientids.tentative.https-expected.txt:
  • web-platform-tests/web-locks/frames.tentative.https-expected.txt:
  • web-platform-tests/web-locks/held.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/held.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/held.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/idlharness.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/idlharness.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/idlharness.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/ifAvailable.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/ifAvailable.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/ifAvailable.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/lock-attributes.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/lock-attributes.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/lock-attributes.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/mode-exclusive.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/mode-exclusive.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/mode-exclusive.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/mode-mixed.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/mode-mixed.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/mode-mixed.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/mode-shared.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/mode-shared.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/mode-shared.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/opaque-origin.tentative.https-expected.txt:
  • web-platform-tests/web-locks/query-empty.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/query-empty.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/query-empty.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/query-ordering.tentative.https-expected.txt:
  • web-platform-tests/web-locks/query.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/query.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/resource-names.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/resource-names.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/resource-names.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/signal.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/signal.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/signal.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/steal.tentative.https.any-expected.txt:
  • web-platform-tests/web-locks/steal.tentative.https.any.serviceworker-expected.txt:
  • web-platform-tests/web-locks/steal.tentative.https.any.worker-expected.txt:
  • web-platform-tests/web-locks/workers.tentative.https-expected.txt:

Source/WebCore:

Add initial implementation for the Web Lock API as per:

The implementation is complete and passes all the WPT tests. However,
to reduce the patch size, the current implementation only works within
a single WebProcess. In a follow-up, I'll update the implementation so
that the registry lives in the UIProcess and the WebProcess just does
IPC.

No new tests, rebaselined existing tests.

  • CMakeLists.txt:
  • DerivedSources-input.xcfilelist:
  • DerivedSources-output.xcfilelist:
  • DerivedSources.make:
  • Modules/web-locks/WebLock.cpp:

(WebCore::WebLock::create):
(WebCore::WebLock::WebLock):

  • Modules/web-locks/WebLock.h:

(WebCore::WebLock::identifier const):

  • Modules/web-locks/WebLockGrantedCallback.idl:
  • Modules/web-locks/WebLockIdentifier.h: Copied from Source/WebCore/Modules/web-locks/WebLockGrantedCallback.idl.
  • Modules/web-locks/WebLockManager.cpp:

(WebCore::clientOriginFromContext):
(WebCore::WebLockManager::LockRequest::isValid const):
(WebCore::WebLockManager::create):
(WebCore::WebLockManager::WebLockManager):
(WebCore::WebLockManager::request):
(WebCore::WebLockManager::didCompleteLockRequest):
(WebCore::WebLockManager::requestLockOnMainThread):
(WebCore::WebLockManager::releaseLockOnMainThread):
(WebCore::WebLockManager::abortLockRequestOnMainThread):
(WebCore::WebLockManager::queryOnMainThread):
(WebCore::WebLockManager::query):
(WebCore::WebLockManager::signalToAbortTheRequest):
(WebCore::WebLockManager::settleReleasePromise):
(WebCore::WebLockManager::stop):
(WebCore::WebLockManager::virtualHasPendingActivity const):
(WebCore::WebLockManager::activeDOMObjectName const):

  • Modules/web-locks/WebLockManager.h:
  • Modules/web-locks/WebLockManager.idl:
  • Modules/web-locks/WebLockManagerSnapshot.h: Copied from Source/WebCore/Modules/web-locks/WebLock.h.

(WebCore::WebLockManagerSnapshot::Info::isolatedCopy const):
(WebCore::WebLockManagerSnapshot::isolatedCopy const):

  • Modules/web-locks/WebLockManagerSnapshot.idl: Copied from Source/WebCore/Modules/web-locks/WebLockGrantedCallback.idl.
  • Modules/web-locks/WebLockRegistry.cpp: Added.

(WebCore::WebLockRegistry::registryForOrigin):
(WebCore::WebLockRegistry::WebLockRegistry):
(WebCore::WebLockRegistry::~WebLockRegistry):
(WebCore::WebLockRegistry::requestLock):
(WebCore::WebLockRegistry::releaseLock):
(WebCore::WebLockRegistry::abortLockRequest):
(WebCore::WebLockRegistry::isGrantable const):
(WebCore::WebLockRegistry::processLockRequestQueue):
(WebCore::WebLockRegistry::snapshot):
(WebCore::WebLockRegistry::clientIsGoingAway):

  • Modules/web-locks/WebLockRegistry.h: Copied from Source/WebCore/Modules/web-locks/WebLock.h.
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDOMConvertPromise.h:

(WebCore::Converter<IDLPromise<T>>::convert):
Update Converter<IDLPromise<T>>::convert() to deal with worker termination similarly to
what is done is some other places (e.g. DeferredPromise::handleTerminationExceptionIfNeeded(()).
I had to make this fix because one of the WPT tests was hitting a debug assertions in JSC on
worker termination otherwise.

  • page/NavigatorBase.cpp:

(WebCore::NavigatorBase::locks):

Source/WTF:

Update Deque::removeAllMatching() to return the number of items removed, similarly
to the corresponding API on Vector.

  • wtf/Deque.h:

(WTF::inlineCapacity>::removeAllMatching):

Location:
trunk
Files:
1 added
61 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r286259 r286284  
     12021-11-29  Chris Dumez  <cdumez@apple.com>
     2
     3        Add initial implementation for the Web Lock API
     4        https://bugs.webkit.org/show_bug.cgi?id=233289
     5
     6        Reviewed by Geoff Garen.
     7
     8        Rebaseline Web Locks WPT tests now that they are all passing.
     9
     10        * web-platform-tests/web-locks/acquire.tentative.https.any-expected.txt:
     11        * web-platform-tests/web-locks/acquire.tentative.https.any.serviceworker-expected.txt:
     12        * web-platform-tests/web-locks/acquire.tentative.https.any.worker-expected.txt:
     13        * web-platform-tests/web-locks/clientids.tentative.https-expected.txt:
     14        * web-platform-tests/web-locks/frames.tentative.https-expected.txt:
     15        * web-platform-tests/web-locks/held.tentative.https.any-expected.txt:
     16        * web-platform-tests/web-locks/held.tentative.https.any.serviceworker-expected.txt:
     17        * web-platform-tests/web-locks/held.tentative.https.any.worker-expected.txt:
     18        * web-platform-tests/web-locks/idlharness.tentative.https.any-expected.txt:
     19        * web-platform-tests/web-locks/idlharness.tentative.https.any.serviceworker-expected.txt:
     20        * web-platform-tests/web-locks/idlharness.tentative.https.any.worker-expected.txt:
     21        * web-platform-tests/web-locks/ifAvailable.tentative.https.any-expected.txt:
     22        * web-platform-tests/web-locks/ifAvailable.tentative.https.any.serviceworker-expected.txt:
     23        * web-platform-tests/web-locks/ifAvailable.tentative.https.any.worker-expected.txt:
     24        * web-platform-tests/web-locks/lock-attributes.tentative.https.any-expected.txt:
     25        * web-platform-tests/web-locks/lock-attributes.tentative.https.any.serviceworker-expected.txt:
     26        * web-platform-tests/web-locks/lock-attributes.tentative.https.any.worker-expected.txt:
     27        * web-platform-tests/web-locks/mode-exclusive.tentative.https.any-expected.txt:
     28        * web-platform-tests/web-locks/mode-exclusive.tentative.https.any.serviceworker-expected.txt:
     29        * web-platform-tests/web-locks/mode-exclusive.tentative.https.any.worker-expected.txt:
     30        * web-platform-tests/web-locks/mode-mixed.tentative.https.any-expected.txt:
     31        * web-platform-tests/web-locks/mode-mixed.tentative.https.any.serviceworker-expected.txt:
     32        * web-platform-tests/web-locks/mode-mixed.tentative.https.any.worker-expected.txt:
     33        * web-platform-tests/web-locks/mode-shared.tentative.https.any-expected.txt:
     34        * web-platform-tests/web-locks/mode-shared.tentative.https.any.serviceworker-expected.txt:
     35        * web-platform-tests/web-locks/mode-shared.tentative.https.any.worker-expected.txt:
     36        * web-platform-tests/web-locks/opaque-origin.tentative.https-expected.txt:
     37        * web-platform-tests/web-locks/query-empty.tentative.https.any-expected.txt:
     38        * web-platform-tests/web-locks/query-empty.tentative.https.any.serviceworker-expected.txt:
     39        * web-platform-tests/web-locks/query-empty.tentative.https.any.worker-expected.txt:
     40        * web-platform-tests/web-locks/query-ordering.tentative.https-expected.txt:
     41        * web-platform-tests/web-locks/query.tentative.https.any-expected.txt:
     42        * web-platform-tests/web-locks/query.tentative.https.any.worker-expected.txt:
     43        * web-platform-tests/web-locks/resource-names.tentative.https.any-expected.txt:
     44        * web-platform-tests/web-locks/resource-names.tentative.https.any.serviceworker-expected.txt:
     45        * web-platform-tests/web-locks/resource-names.tentative.https.any.worker-expected.txt:
     46        * web-platform-tests/web-locks/signal.tentative.https.any-expected.txt:
     47        * web-platform-tests/web-locks/signal.tentative.https.any.serviceworker-expected.txt:
     48        * web-platform-tests/web-locks/signal.tentative.https.any.worker-expected.txt:
     49        * web-platform-tests/web-locks/steal.tentative.https.any-expected.txt:
     50        * web-platform-tests/web-locks/steal.tentative.https.any.serviceworker-expected.txt:
     51        * web-platform-tests/web-locks/steal.tentative.https.any.worker-expected.txt:
     52        * web-platform-tests/web-locks/workers.tentative.https-expected.txt:
     53
    1542021-11-29  Chris Fleizach  <cfleizach@apple.com>
    255
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/acquire.tentative.https.any-expected.txt

    r285012 r286284  
    11
    22PASS navigator.locks.request requires a name and a callback
    3 FAIL mode must be "shared" or "exclusive" promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     3PASS mode must be "shared" or "exclusive"
    44PASS The 'steal' and 'ifAvailable' options are mutually exclusive
    55PASS The 'steal' option must be used with exclusive locks
     
    77PASS The 'signal' and 'ifAvailable' options are mutually exclusive
    88PASS callback must be a function
    9 FAIL navigator.locks.request's returned promise resolves after lock is released promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    10 FAIL Returned Promise rejects if callback throws synchronously promise_rejects_exactly: result should reject function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." but we expected it to throw object "[object Object]"
    11 FAIL Returned Promise rejects if callback throws asynchronously promise_rejects_exactly: result should reject function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." but we expected it to throw object "[object Object]"
     9PASS navigator.locks.request's returned promise resolves after lock is released
     10PASS Returned Promise rejects if callback throws synchronously
     11PASS Returned Promise rejects if callback throws asynchronously
    1212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/acquire.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    1 
    2 Harness Error (FAIL), message = Unhandled rejection: The operation is not supported.
    31
    42PASS navigator.locks.request requires a name and a callback
    5 FAIL mode must be "shared" or "exclusive" promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     3PASS mode must be "shared" or "exclusive"
    64PASS The 'steal' and 'ifAvailable' options are mutually exclusive
    75PASS The 'steal' option must be used with exclusive locks
     
    97PASS The 'signal' and 'ifAvailable' options are mutually exclusive
    108PASS callback must be a function
    11 FAIL navigator.locks.request's returned promise resolves after lock is released promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    12 FAIL Returned Promise rejects if callback throws synchronously promise_rejects_exactly: result should reject function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." but we expected it to throw object "[object Object]"
    13 FAIL Returned Promise rejects if callback throws asynchronously promise_rejects_exactly: result should reject function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." but we expected it to throw object "[object Object]"
     9PASS navigator.locks.request's returned promise resolves after lock is released
     10PASS Returned Promise rejects if callback throws synchronously
     11PASS Returned Promise rejects if callback throws asynchronously
    1412
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/acquire.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    22PASS navigator.locks.request requires a name and a callback
    3 FAIL mode must be "shared" or "exclusive" promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     3PASS mode must be "shared" or "exclusive"
    44PASS The 'steal' and 'ifAvailable' options are mutually exclusive
    55PASS The 'steal' option must be used with exclusive locks
     
    77PASS The 'signal' and 'ifAvailable' options are mutually exclusive
    88PASS callback must be a function
    9 FAIL navigator.locks.request's returned promise resolves after lock is released promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    10 FAIL Returned Promise rejects if callback throws synchronously promise_rejects_exactly: result should reject function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." but we expected it to throw object "[object Object]"
    11 FAIL Returned Promise rejects if callback throws asynchronously promise_rejects_exactly: result should reject function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." but we expected it to throw object "[object Object]"
     9PASS navigator.locks.request's returned promise resolves after lock is released
     10PASS Returned Promise rejects if callback throws synchronously
     11PASS Returned Promise rejects if callback throws asynchronously
    1212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/clientids.tentative.https-expected.txt

    r285954 r286284  
    11
    22
    3 FAIL Client IDs match between Locks API and Service Workers assert_equals: clientIds should match, but are different expected "15-85" but got "NotSupportedError: The operation is not supported."
     3PASS Client IDs match between Locks API and Service Workers
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/frames.tentative.https-expected.txt

    r285012 r286284  
    1 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    21
    3 Harness Error (TIMEOUT), message = null
     2PASS Window and Frame - shared mode
     3PASS Window and Frame - exclusive mode
     4PASS Frame and Frame - exclusive mode
     5PASS Terminated Frame with held lock
     6PASS Navigated Frame with held lock
     7PASS Navigated Frame with pending request
     8PASS Removed Frame with pending request
     9PASS Removed Frame as lock is granted
    410
    5 TIMEOUT Window and Frame - shared mode Test timed out
    6 NOTRUN Window and Frame - exclusive mode
    7 NOTRUN Frame and Frame - exclusive mode
    8 NOTRUN Terminated Frame with held lock
    9 NOTRUN Navigated Frame with held lock
    10 NOTRUN Navigated Frame with pending request
    11 NOTRUN Removed Frame with pending request
    12 NOTRUN Removed Frame as lock is granted
    13 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/held.tentative.https.any-expected.txt

    r285012 r286284  
    1 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
     1CONSOLE MESSAGE: Unhandled Promise Rejection: Error: this uncaught rejection is expected
    22
    3 Harness Error (TIMEOUT), message = null
     3PASS callback's result is promisified if not async
     4PASS lock is held until callback's returned promise resolves
     5PASS lock is held until callback's returned promise rejects
     6PASS held lock prevents the same client from acquiring it
    47
    5 FAIL callback's result is promisified if not async promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 TIMEOUT lock is held until callback's returned promise resolves Test timed out
    7 NOTRUN lock is held until callback's returned promise rejects
    8 NOTRUN held lock prevents the same client from acquiring it
    9 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/held.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 Harness Error (TIMEOUT), message = null
     2PASS callback's result is promisified if not async
     3PASS lock is held until callback's returned promise resolves
     4PASS lock is held until callback's returned promise rejects
     5PASS held lock prevents the same client from acquiring it
    36
    4 FAIL callback's result is promisified if not async promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 TIMEOUT lock is held until callback's returned promise resolves Test timed out
    6 NOTRUN lock is held until callback's returned promise rejects
    7 NOTRUN held lock prevents the same client from acquiring it
    8 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/held.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 Harness Error (TIMEOUT), message = null
     2PASS callback's result is promisified if not async
     3PASS lock is held until callback's returned promise resolves
     4PASS lock is held until callback's returned promise rejects
     5PASS held lock prevents the same client from acquiring it
    36
    4 FAIL callback's result is promisified if not async promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 TIMEOUT lock is held until callback's returned promise resolves Test timed out
    6 NOTRUN lock is held until callback's returned promise rejects
    7 NOTRUN held lock prevents the same client from acquiring it
    8 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/idlharness.tentative.https.any-expected.txt

    r285012 r286284  
    4040PASS Lock interface: attribute name
    4141PASS Lock interface: attribute mode
    42 FAIL Lock must be primary interface of lock assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    43 FAIL Stringification of lock assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    44 FAIL Lock interface: lock must inherit property "name" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    45 FAIL Lock interface: lock must inherit property "mode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
     42PASS Lock must be primary interface of lock
     43PASS Stringification of lock
     44PASS Lock interface: lock must inherit property "name" with the proper type
     45PASS Lock interface: lock must inherit property "mode" with the proper type
    4646PASS Navigator interface: attribute locks
    4747PASS Navigator interface: navigator must inherit property "locks" with the proper type
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/idlharness.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    4040PASS Lock interface: attribute name
    4141PASS Lock interface: attribute mode
    42 FAIL Lock must be primary interface of lock assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    43 FAIL Stringification of lock assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    44 FAIL Lock interface: lock must inherit property "name" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    45 FAIL Lock interface: lock must inherit property "mode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
     42PASS Lock must be primary interface of lock
     43PASS Stringification of lock
     44PASS Lock interface: lock must inherit property "name" with the proper type
     45PASS Lock interface: lock must inherit property "mode" with the proper type
    4646PASS WorkerNavigator interface: attribute locks
    4747PASS WorkerNavigator interface: navigator must inherit property "locks" with the proper type
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/idlharness.tentative.https.any.worker-expected.txt

    r285012 r286284  
    4040PASS Lock interface: attribute name
    4141PASS Lock interface: attribute mode
    42 FAIL Lock must be primary interface of lock assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    43 FAIL Stringification of lock assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    44 FAIL Lock interface: lock must inherit property "name" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
    45 FAIL Lock interface: lock must inherit property "mode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: lock"
     42PASS Lock must be primary interface of lock
     43PASS Stringification of lock
     44PASS Lock interface: lock must inherit property "name" with the proper type
     45PASS Lock interface: lock must inherit property "mode" with the proper type
    4646PASS WorkerNavigator interface: attribute locks
    4747PASS WorkerNavigator interface: navigator must inherit property "locks" with the proper type
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/ifAvailable.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock request with ifAvailable - lock available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock request with ifAvailable - lock not available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL Lock request with ifAvailable - lock not available, callback throws promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Lock request with ifAvailable - unrelated lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL Shared lock request with ifAvailable - shared lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL Exclusive lock request with ifAvailable - shared lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Shared lock request with ifAvailable - exclusive lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Returned Promise rejects if callback throws synchronously promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    10 FAIL Returned Promise rejects if async callback yields rejected promise promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    11 FAIL Locks are available once previous release is processed promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock request with ifAvailable - lock available
     3PASS Lock request with ifAvailable - lock not available
     4PASS Lock request with ifAvailable - lock not available, callback throws
     5PASS Lock request with ifAvailable - unrelated lock held
     6PASS Shared lock request with ifAvailable - shared lock held
     7PASS Exclusive lock request with ifAvailable - shared lock held
     8PASS Shared lock request with ifAvailable - exclusive lock held
     9PASS Returned Promise rejects if callback throws synchronously
     10PASS Returned Promise rejects if async callback yields rejected promise
     11PASS Locks are available once previous release is processed
    1212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/ifAvailable.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 FAIL Lock request with ifAvailable - lock available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock request with ifAvailable - lock not available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL Lock request with ifAvailable - lock not available, callback throws promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Lock request with ifAvailable - unrelated lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL Shared lock request with ifAvailable - shared lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL Exclusive lock request with ifAvailable - shared lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Shared lock request with ifAvailable - exclusive lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Returned Promise rejects if callback throws synchronously promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    10 FAIL Returned Promise rejects if async callback yields rejected promise promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    11 FAIL Locks are available once previous release is processed promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock request with ifAvailable - lock available
     3PASS Lock request with ifAvailable - lock not available
     4PASS Lock request with ifAvailable - lock not available, callback throws
     5PASS Lock request with ifAvailable - unrelated lock held
     6PASS Shared lock request with ifAvailable - shared lock held
     7PASS Exclusive lock request with ifAvailable - shared lock held
     8PASS Shared lock request with ifAvailable - exclusive lock held
     9PASS Returned Promise rejects if callback throws synchronously
     10PASS Returned Promise rejects if async callback yields rejected promise
     11PASS Locks are available once previous release is processed
    1212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/ifAvailable.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock request with ifAvailable - lock available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock request with ifAvailable - lock not available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL Lock request with ifAvailable - lock not available, callback throws promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Lock request with ifAvailable - unrelated lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL Shared lock request with ifAvailable - shared lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL Exclusive lock request with ifAvailable - shared lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Shared lock request with ifAvailable - exclusive lock held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Returned Promise rejects if callback throws synchronously promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    10 FAIL Returned Promise rejects if async callback yields rejected promise promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    11 FAIL Locks are available once previous release is processed promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock request with ifAvailable - lock available
     3PASS Lock request with ifAvailable - lock not available
     4PASS Lock request with ifAvailable - lock not available, callback throws
     5PASS Lock request with ifAvailable - unrelated lock held
     6PASS Shared lock request with ifAvailable - shared lock held
     7PASS Exclusive lock request with ifAvailable - shared lock held
     8PASS Shared lock request with ifAvailable - exclusive lock held
     9PASS Returned Promise rejects if callback throws synchronously
     10PASS Returned Promise rejects if async callback yields rejected promise
     11PASS Locks are available once previous release is processed
    1212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/lock-attributes.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock attributes reflect requested properties (exclusive) promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock attributes reflect requested properties (shared) promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock attributes reflect requested properties (exclusive)
     3PASS Lock attributes reflect requested properties (shared)
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/lock-attributes.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 FAIL Lock attributes reflect requested properties (exclusive) promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock attributes reflect requested properties (shared) promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock attributes reflect requested properties (exclusive)
     3PASS Lock attributes reflect requested properties (shared)
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/lock-attributes.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock attributes reflect requested properties (exclusive) promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock attributes reflect requested properties (shared) promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock attributes reflect requested properties (exclusive)
     3PASS Lock attributes reflect requested properties (shared)
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-exclusive.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Requests for distinct resources can be granted promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Requests for distinct resources can be granted
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-exclusive.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Requests for distinct resources can be granted promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Requests for distinct resources can be granted
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-exclusive.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Requests for distinct resources can be granted promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Requests for distinct resources can be granted
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-mixed.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Releasing exclusive lock grants multiple shared locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL An exclusive lock between shared locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Releasing exclusive lock grants multiple shared locks
     4PASS An exclusive lock between shared locks
    55
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-mixed.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 Harness Error (FAIL), message = Unhandled rejection: The operation is not supported.
     2PASS Lock requests are granted in order
     3PASS Releasing exclusive lock grants multiple shared locks
     4PASS An exclusive lock between shared locks
    35
    4 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Releasing exclusive lock grants multiple shared locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL An exclusive lock between shared locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-mixed.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Releasing exclusive lock grants multiple shared locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL An exclusive lock between shared locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Releasing exclusive lock grants multiple shared locks
     4PASS An exclusive lock between shared locks
    55
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-shared.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Shared locks are not exclusive promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Shared locks are not exclusive
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-shared.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Shared locks are not exclusive promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Shared locks are not exclusive
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/mode-shared.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock requests are granted in order promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Shared locks are not exclusive promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock requests are granted in order
     3PASS Shared locks are not exclusive
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/opaque-origin.tentative.https-expected.txt

    r285012 r286284  
    11
    2 FAIL navigator.locks.request() in non-sandboxed iframe should not throw assert_equals: navigator.locks.request() should not throw expected "no exception" but got "NotSupportedError"
    3 FAIL navigator.locks.request() in sandboxed iframe should throw SecurityError assert_equals: Exception should be SecurityError expected "SecurityError" but got "NotSupportedError"
    4 FAIL navigator.locks.query() in non-sandboxed iframe should not throw assert_equals: navigator.locks.request() should not throw expected "no exception" but got "NotSupportedError"
    5 FAIL navigator.locks.query() in sandboxed iframe should throw SecurityError assert_equals: Exception should be SecurityError expected "SecurityError" but got "NotSupportedError"
     2PASS navigator.locks.request() in non-sandboxed iframe should not throw
     3PASS navigator.locks.request() in sandboxed iframe should throw SecurityError
     4PASS navigator.locks.query() in non-sandboxed iframe should not throw
     5PASS navigator.locks.query() in sandboxed iframe should throw SecurityError
    66
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/query-empty.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL query() returns dictionary with empty arrays when no locks are held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS query() returns dictionary with empty arrays when no locks are held
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/query-empty.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 FAIL query() returns dictionary with empty arrays when no locks are held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS query() returns dictionary with empty arrays when no locks are held
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/query-empty.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL query() returns dictionary with empty arrays when no locks are held promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS query() returns dictionary with empty arrays when no locks are held
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/query-ordering.tentative.https-expected.txt

    r285012 r286284  
    1 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    21
    3 Harness Error (TIMEOUT), message = null
     2PASS Requests appear in state in order made.
    43
    5 TIMEOUT Requests appear in state in order made. Test timed out
    6 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/query.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 Harness Error (TIMEOUT), message = null
     2PASS query() returns dictionaries with expected properties
     3PASS query() reports individual held locks
     4PASS query() reports multiple held locks
     5PASS query() reports pending and held locks
     6PASS query() reports held shared locks with appropriate count
     7PASS query() reports pending shared locks with appropriate count
     8PASS query() reports the same clientId for held locks from the same context
     9PASS query() reports different ids for held locks from different contexts
     10PASS query() can observe a deadlock
    311
    4 FAIL query() returns dictionaries with expected properties promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL query() reports individual held locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL query() reports multiple held locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL query() reports pending and held locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL query() reports held shared locks with appropriate count promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL query() reports pending shared locks with appropriate count promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    10 FAIL query() reports the same clientId for held locks from the same context promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    11 TIMEOUT query() reports different ids for held locks from different contexts Test timed out
    12 NOTRUN query() can observe a deadlock
    13 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/query.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL query() returns dictionaries with expected properties promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL query() reports individual held locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL query() reports multiple held locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL query() reports pending and held locks promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL query() reports held shared locks with appropriate count promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL query() reports pending shared locks with appropriate count promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL query() reports the same clientId for held locks from the same context promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS query() returns dictionaries with expected properties
     3PASS query() reports individual held locks
     4PASS query() reports multiple held locks
     5PASS query() reports pending and held locks
     6PASS query() reports held shared locks with appropriate count
     7PASS query() reports pending shared locks with appropriate count
     8PASS query() reports the same clientId for held locks from the same context
    99FAIL query() reports different ids for held locks from different contexts promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: Worker"
    1010FAIL query() can observe a deadlock promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: Worker"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/resource-names.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL DOMString:  promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL DOMString: 0x61 0x62 0x63 0x0 0x64 0x65 0x66 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL DOMString: 0xD800 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL DOMString: 0xDC00 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL DOMString: 0xDC00 0xD800 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL DOMString: 0xFFFF promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Resource names that are not valid UTF-16 are not mangled promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Names cannot start with "-" promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS DOMString:
     3PASS DOMString: 0x61 0x62 0x63 0x0 0x64 0x65 0x66
     4PASS DOMString: 0xD800
     5PASS DOMString: 0xDC00
     6PASS DOMString: 0xDC00 0xD800
     7PASS DOMString: 0xFFFF
     8PASS Resource names that are not valid UTF-16 are not mangled
     9PASS Names cannot start with "-"
    1010
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/resource-names.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 FAIL DOMString:  promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL DOMString: 0x61 0x62 0x63 0x0 0x64 0x65 0x66 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL DOMString: 0xD800 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL DOMString: 0xDC00 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL DOMString: 0xDC00 0xD800 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL DOMString: 0xFFFF promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Resource names that are not valid UTF-16 are not mangled promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Names cannot start with "-" promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS DOMString:
     3PASS DOMString: 0x61 0x62 0x63 0x0 0x64 0x65 0x66
     4PASS DOMString: 0xD800
     5PASS DOMString: 0xDC00
     6PASS DOMString: 0xDC00 0xD800
     7PASS DOMString: 0xFFFF
     8PASS Resource names that are not valid UTF-16 are not mangled
     9PASS Names cannot start with "-"
    1010
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/resource-names.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL DOMString:  promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL DOMString: 0x61 0x62 0x63 0x0 0x64 0x65 0x66 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL DOMString: 0xD800 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL DOMString: 0xDC00 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL DOMString: 0xDC00 0xD800 promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL DOMString: 0xFFFF promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Resource names that are not valid UTF-16 are not mangled promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Names cannot start with "-" promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS DOMString:
     3PASS DOMString: 0x61 0x62 0x63 0x0 0x64 0x65 0x66
     4PASS DOMString: 0xD800
     5PASS DOMString: 0xDC00
     6PASS DOMString: 0xDC00 0xD800
     7PASS DOMString: 0xFFFF
     8PASS Resource names that are not valid UTF-16 are not mangled
     9PASS Names cannot start with "-"
    1010
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/signal.tentative.https.any-expected.txt

    r285012 r286284  
    1 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    2 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    3 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    4 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    5 CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
    6 
    7 Harness Error (FAIL), message = Unhandled rejection: The operation is not supported.
    81
    92PASS The signal option must be an AbortSignal
    10 FAIL Passing an already aborted signal aborts promise_rejects_dom: Request should reject with AbortError function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20
    11 FAIL An aborted request results in AbortError promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    12 FAIL Abort after a timeout promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    13 FAIL Signal that is not aborted promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    14 FAIL Synchronously signaled abort promise_rejects_dom: Request should abort function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20
    15 TIMEOUT Abort signaled after lock granted Test timed out
    16 NOTRUN Abort signaled after lock released
    17 NOTRUN Abort should process the next pending lock request
     3PASS Passing an already aborted signal aborts
     4PASS An aborted request results in AbortError
     5PASS Abort after a timeout
     6PASS Signal that is not aborted
     7PASS Synchronously signaled abort
     8PASS Abort signaled after lock granted
     9PASS Abort signaled after lock released
     10PASS Abort should process the next pending lock request
    1811
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/signal.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    1 
    2 Harness Error (TIMEOUT), message = null
    31
    42PASS The signal option must be an AbortSignal
    5 FAIL Passing an already aborted signal aborts promise_rejects_dom: Request should reject with AbortError function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20
    6 FAIL An aborted request results in AbortError promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL Abort after a timeout promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Signal that is not aborted promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Synchronously signaled abort promise_rejects_dom: Request should abort function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20
    10 TIMEOUT Abort signaled after lock granted Test timed out
    11 NOTRUN Abort signaled after lock released
    12 NOTRUN Abort should process the next pending lock request
     3PASS Passing an already aborted signal aborts
     4PASS An aborted request results in AbortError
     5PASS Abort after a timeout
     6PASS Signal that is not aborted
     7PASS Synchronously signaled abort
     8PASS Abort signaled after lock granted
     9PASS Abort signaled after lock released
     10PASS Abort should process the next pending lock request
    1311
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/signal.tentative.https.any.worker-expected.txt

    r285012 r286284  
    1 
    2 Harness Error (TIMEOUT), message = null
    31
    42PASS The signal option must be an AbortSignal
    5 FAIL Passing an already aborted signal aborts promise_rejects_dom: Request should reject with AbortError function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20
    6 FAIL An aborted request results in AbortError promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL Abort after a timeout promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Signal that is not aborted promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Synchronously signaled abort promise_rejects_dom: Request should abort function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20
    10 TIMEOUT Abort signaled after lock granted Test timed out
    11 NOTRUN Abort signaled after lock released
    12 NOTRUN Abort should process the next pending lock request
     3PASS Passing an already aborted signal aborts
     4PASS An aborted request results in AbortError
     5PASS Abort after a timeout
     6PASS Signal that is not aborted
     7PASS Synchronously signaled abort
     8PASS Abort signaled after lock granted
     9PASS Abort signaled after lock released
     10PASS Abort should process the next pending lock request
    1311
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/steal.tentative.https.any-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock not available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL Broken lock's release promise rejects promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Requested lock's release promise is deferred promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL Last caller wins promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock available
     3PASS Lock not available
     4PASS Broken lock's release promise rejects
     5PASS Requested lock's release promise is deferred
     6PASS Last caller wins
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/steal.tentative.https.any.serviceworker-expected.txt

    r285954 r286284  
    11
    2 Harness Error (FAIL), message = Unhandled rejection: The operation is not supported.
     2PASS Lock available
     3PASS Lock not available
     4PASS Broken lock's release promise rejects
     5PASS Requested lock's release promise is deferred
     6PASS Last caller wins
    37
    4 FAIL Lock available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Lock not available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL Broken lock's release promise rejects promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    7 FAIL Requested lock's release promise is deferred promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    8 FAIL Last caller wins promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/steal.tentative.https.any.worker-expected.txt

    r285012 r286284  
    11
    2 FAIL Lock available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    3 FAIL Lock not available promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    4 FAIL Broken lock's release promise rejects promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    5 FAIL Requested lock's release promise is deferred promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    6 FAIL Last caller wins promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     2PASS Lock available
     3PASS Lock not available
     4PASS Broken lock's release promise rejects
     5PASS Requested lock's release promise is deferred
     6PASS Last caller wins
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-locks/workers.tentative.https-expected.txt

    r285012 r286284  
    11
    2 Harness Error (TIMEOUT), message = null
     2PASS Window and Worker - shared mode
     3PASS Window and Worker - exclusive mode
     4PASS Worker and Worker - exclusive mode
     5PASS Terminated Worker - exclusive mode
    36
    4 TIMEOUT Window and Worker - shared mode Test timed out
    5 NOTRUN Window and Worker - exclusive mode
    6 NOTRUN Worker and Worker - exclusive mode
    7 NOTRUN Terminated Worker - exclusive mode
    8 
  • trunk/Source/WTF/ChangeLog

    r286272 r286284  
     12021-11-29  Chris Dumez  <cdumez@apple.com>
     2
     3        Add initial implementation for the Web Lock API
     4        https://bugs.webkit.org/show_bug.cgi?id=233289
     5
     6        Reviewed by Geoff Garen.
     7
     8        Update Deque::removeAllMatching() to return the number of items removed, similarly
     9        to the corresponding API on Vector.
     10
     11        * wtf/Deque.h:
     12        (WTF::inlineCapacity>::removeAllMatching):
     13
    1142021-11-29  David Kilzer  <ddkilzer@apple.com>
    215
  • trunk/Source/WTF/wtf/Deque.h

    r281270 r286284  
    9595    void remove(const_iterator&);
    9696   
    97     template<typename Func> void removeAllMatching(const Func&);
     97    template<typename Func> size_t removeAllMatching(const Func&);
    9898   
    9999    // This is a priority enqueue. The callback is given a value, and if it returns true, then this
     
    562562template<typename T, size_t inlineCapacity>
    563563template<typename Func>
    564 inline void Deque<T, inlineCapacity>::removeAllMatching(const Func& func)
    565 {
    566     size_t count = size();
    567     while (count--) {
    568         T value = takeFirst();
     564inline size_t Deque<T, inlineCapacity>::removeAllMatching(const Func& func)
     565{
     566    auto oldSize = size();
     567    for (size_t i = 0; i < oldSize; ++i) {
     568        auto value = takeFirst();
    569569        if (!func(value))
    570570            append(WTFMove(value));
    571571    }
     572    return size() - oldSize;
    572573}
    573574
  • trunk/Source/WebCore/CMakeLists.txt

    r286161 r286284  
    561561    Modules/web-locks/WebLockGrantedCallback.idl
    562562    Modules/web-locks/WebLockManager.idl
     563    Modules/web-locks/WebLockManagerSnapshot.idl
    563564    Modules/web-locks/WebLockMode.idl
    564565
  • trunk/Source/WebCore/ChangeLog

    r286282 r286284  
     12021-11-29  Chris Dumez  <cdumez@apple.com>
     2
     3        Add initial implementation for the Web Lock API
     4        https://bugs.webkit.org/show_bug.cgi?id=233289
     5
     6        Reviewed by Geoff Garen.
     7
     8        Add initial implementation for the Web Lock API as per:
     9        - https://wicg.github.io/web-locks/#lockmanager
     10
     11        The implementation is complete and passes all the WPT tests. However,
     12        to reduce the patch size, the current implementation only works within
     13        a single WebProcess. In a follow-up, I'll update the implementation so
     14        that the registry lives in the UIProcess and the WebProcess just does
     15        IPC.
     16
     17        No new tests, rebaselined existing tests.
     18
     19        * CMakeLists.txt:
     20        * DerivedSources-input.xcfilelist:
     21        * DerivedSources-output.xcfilelist:
     22        * DerivedSources.make:
     23        * Modules/web-locks/WebLock.cpp:
     24        (WebCore::WebLock::create):
     25        (WebCore::WebLock::WebLock):
     26        * Modules/web-locks/WebLock.h:
     27        (WebCore::WebLock::identifier const):
     28        * Modules/web-locks/WebLockGrantedCallback.idl:
     29        * Modules/web-locks/WebLockIdentifier.h: Copied from Source/WebCore/Modules/web-locks/WebLockGrantedCallback.idl.
     30        * Modules/web-locks/WebLockManager.cpp:
     31        (WebCore::clientOriginFromContext):
     32        (WebCore::WebLockManager::LockRequest::isValid const):
     33        (WebCore::WebLockManager::create):
     34        (WebCore::WebLockManager::WebLockManager):
     35        (WebCore::WebLockManager::request):
     36        (WebCore::WebLockManager::didCompleteLockRequest):
     37        (WebCore::WebLockManager::requestLockOnMainThread):
     38        (WebCore::WebLockManager::releaseLockOnMainThread):
     39        (WebCore::WebLockManager::abortLockRequestOnMainThread):
     40        (WebCore::WebLockManager::queryOnMainThread):
     41        (WebCore::WebLockManager::query):
     42        (WebCore::WebLockManager::signalToAbortTheRequest):
     43        (WebCore::WebLockManager::settleReleasePromise):
     44        (WebCore::WebLockManager::stop):
     45        (WebCore::WebLockManager::virtualHasPendingActivity const):
     46        (WebCore::WebLockManager::activeDOMObjectName const):
     47        * Modules/web-locks/WebLockManager.h:
     48        * Modules/web-locks/WebLockManager.idl:
     49        * Modules/web-locks/WebLockManagerSnapshot.h: Copied from Source/WebCore/Modules/web-locks/WebLock.h.
     50        (WebCore::WebLockManagerSnapshot::Info::isolatedCopy const):
     51        (WebCore::WebLockManagerSnapshot::isolatedCopy const):
     52        * Modules/web-locks/WebLockManagerSnapshot.idl: Copied from Source/WebCore/Modules/web-locks/WebLockGrantedCallback.idl.
     53        * Modules/web-locks/WebLockRegistry.cpp: Added.
     54        (WebCore::WebLockRegistry::registryForOrigin):
     55        (WebCore::WebLockRegistry::WebLockRegistry):
     56        (WebCore::WebLockRegistry::~WebLockRegistry):
     57        (WebCore::WebLockRegistry::requestLock):
     58        (WebCore::WebLockRegistry::releaseLock):
     59        (WebCore::WebLockRegistry::abortLockRequest):
     60        (WebCore::WebLockRegistry::isGrantable const):
     61        (WebCore::WebLockRegistry::processLockRequestQueue):
     62        (WebCore::WebLockRegistry::snapshot):
     63        (WebCore::WebLockRegistry::clientIsGoingAway):
     64        * Modules/web-locks/WebLockRegistry.h: Copied from Source/WebCore/Modules/web-locks/WebLock.h.
     65        * Sources.txt:
     66        * WebCore.xcodeproj/project.pbxproj:
     67
     68        * bindings/js/JSDOMConvertPromise.h:
     69        (WebCore::Converter<IDLPromise<T>>::convert):
     70        Update Converter<IDLPromise<T>>::convert() to deal with worker termination similarly to
     71        what is done is some other places (e.g. DeferredPromise::handleTerminationExceptionIfNeeded(()).
     72        I had to make this fix because one of the WPT tests was hitting a debug assertions in JSC on
     73        worker termination otherwise.
     74
     75        * page/NavigatorBase.cpp:
     76        (WebCore::NavigatorBase::locks):
     77
    1782021-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
    279
  • trunk/Source/WebCore/DerivedSources-input.xcfilelist

    r286019 r286284  
    641641$(PROJECT_DIR)/Modules/web-locks/WebLockGrantedCallback.idl
    642642$(PROJECT_DIR)/Modules/web-locks/WebLockManager.idl
     643$(PROJECT_DIR)/Modules/web-locks/WebLockManagerSnapshot.idl
    643644$(PROJECT_DIR)/Modules/web-locks/WebLockMode.idl
    644645$(PROJECT_DIR)/Modules/webaudio/AnalyserNode.idl
  • trunk/Source/WebCore/DerivedSources-output.xcfilelist

    r286019 r286284  
    27142714$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebLockManager.cpp
    27152715$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebLockManager.h
     2716$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebLockManagerSnapshot.cpp
     2717$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebLockManagerSnapshot.h
    27162718$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebLockMode.cpp
    27172719$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebLockMode.h
  • trunk/Source/WebCore/DerivedSources.make

    r286019 r286284  
    544544    $(WebCore)/Modules/web-locks/WebLockGrantedCallback.idl \
    545545    $(WebCore)/Modules/web-locks/WebLockManager.idl \
     546    $(WebCore)/Modules/web-locks/WebLockManagerSnapshot.idl \
    546547    $(WebCore)/Modules/web-locks/WebLockMode.idl \
    547548    $(WebCore)/Modules/webaudio/AnalyserNode.idl \
  • trunk/Source/WebCore/Modules/web-locks/WebLock.cpp

    r285012 r286284  
    2828namespace WebCore {
    2929
    30 Ref<WebLock> WebLock::create(const String& name, WebLockMode mode)
     30Ref<WebLock> WebLock::create(WebLockIdentifier identifier, const String& name, WebLockMode mode)
    3131{
    32     return adoptRef(*new WebLock(name, mode));
     32    return adoptRef(*new WebLock(identifier, name, mode));
    3333}
    3434
    35 WebLock::WebLock(const String& name, WebLockMode mode)
    36     : m_name(name)
     35WebLock::WebLock(WebLockIdentifier identifier, const String& name, WebLockMode mode)
     36    : m_identifier(identifier)
     37    , m_name(name)
    3738    , m_mode(mode)
    3839{
  • trunk/Source/WebCore/Modules/web-locks/WebLock.h

    r285012 r286284  
    2525#pragma once
    2626
     27#include "ProcessQualified.h"
     28#include "WebLockIdentifier.h"
    2729#include "WebLockMode.h"
    2830#include <wtf/RefCounted.h>
     
    3335class WebLock : public RefCounted<WebLock> {
    3436public:
    35     static Ref<WebLock> create(const String& name, WebLockMode);
     37    static Ref<WebLock> create(WebLockIdentifier, const String& name, WebLockMode);
    3638
     39    WebLockIdentifier identifier() const { return m_identifier; }
    3740    const String& name() const { return m_name; }
    3841    WebLockMode mode() const { return m_mode; }
    3942
    4043private:
    41     WebLock(const String& name, WebLockMode);
     44    WebLock(WebLockIdentifier, const String& name, WebLockMode);
    4245
     46    WebLockIdentifier m_identifier;
    4347    String m_name;
    4448    WebLockMode m_mode;
  • trunk/Source/WebCore/Modules/web-locks/WebLockGrantedCallback.idl

    r285012 r286284  
    2323 */
    2424
    25 callback WebLockGrantedCallback = Promise<any> (WebLock? webLock);
     25[
     26    RethrowException
     27] callback WebLockGrantedCallback = Promise<any> (WebLock? webLock);
  • trunk/Source/WebCore/Modules/web-locks/WebLockIdentifier.h

    r286283 r286284  
    2323 */
    2424
    25 callback WebLockGrantedCallback = Promise<any> (WebLock? webLock);
     25#pragma once
     26
     27#include <wtf/Forward.h>
     28
     29namespace WebCore {
     30
     31template<typename> class ProcessQualified;
     32
     33enum WebLockIdentifierType { };
     34using WebLockIdentifier = ProcessQualified<ObjectIdentifier<WebLockIdentifierType>>;
     35
     36} // namespace
     37
  • trunk/Source/WebCore/Modules/web-locks/WebLockManager.cpp

    r285012 r286284  
    2626#include "WebLockManager.h"
    2727
     28#include "Document.h"
    2829#include "ExceptionCode.h"
     30#include "ExceptionOr.h"
     31#include "JSDOMPromise.h"
     32#include "JSWebLockManagerSnapshot.h"
     33#include "NavigatorBase.h"
     34#include "SecurityOrigin.h"
    2935#include "WebLockGrantedCallback.h"
     36#include "WebLockManagerSnapshot.h"
     37#include "WebLockRegistry.h"
     38#include <wtf/CompletionHandler.h>
     39#include <wtf/RunLoop.h>
    3040
    3141namespace WebCore {
    3242
    33 Ref<WebLockManager> WebLockManager::create()
    34 {
    35     return adoptRef(*new WebLockManager);
    36 }
    37 
    38 WebLockManager::WebLockManager()
    39 {
    40 }
    41 
    42 void WebLockManager::request(const String& name, Ref<WebLockGrantedCallback>&&, Ref<DeferredPromise>&& promise)
     43static std::optional<ClientOrigin> clientOriginFromContext(ScriptExecutionContext* context)
     44{
     45    if (!context)
     46        return std::nullopt;
     47    auto* origin = context->securityOrigin();
     48    if (!origin || origin->isUnique())
     49        return std::nullopt;
     50    return { { context->topOrigin().data(), origin->data() } };
     51}
     52
     53struct WebLockManager::LockRequest {
     54    WebLockIdentifier lockIdentifier;
     55    String name;
     56    WebLockMode mode { WebLockMode::Exclusive };
     57    RefPtr<WebLockGrantedCallback> grantedCallback;
     58    RefPtr<AbortSignal> signal;
     59
     60    bool isValid() const { return !!lockIdentifier; }
     61};
     62
     63Ref<WebLockManager> WebLockManager::create(NavigatorBase& navigator)
     64{
     65    auto manager = adoptRef(*new WebLockManager(navigator));
     66    manager->suspendIfNeeded();
     67    return manager;
     68}
     69
     70WebLockManager::WebLockManager(NavigatorBase& navigator)
     71    : ActiveDOMObject(navigator.scriptExecutionContext())
     72    , m_clientOrigin(clientOriginFromContext(navigator.scriptExecutionContext()))
     73{
     74}
     75
     76WebLockManager::~WebLockManager()
     77{
     78    clientIsGoingAway();
     79}
     80
     81void WebLockManager::request(const String& name, Ref<WebLockGrantedCallback>&& grantedCallback, Ref<DeferredPromise>&& promise)
     82{
     83    request(name, { }, WTFMove(grantedCallback), WTFMove(promise));
     84}
     85
     86void WebLockManager::request(const String& name, Options&& options, Ref<WebLockGrantedCallback>&& grantedCallback, Ref<DeferredPromise>&& releasePromise)
    4387{
    4488    UNUSED_PARAM(name);
    45     promise->reject(NotSupportedError);
    46 }
    47 
    48 void WebLockManager::request(const String& name, Options&&, Ref<WebLockGrantedCallback>&&, Ref<DeferredPromise>&& promise)
    49 {
    50     UNUSED_PARAM(name);
    51     promise->reject(NotSupportedError);
     89    if (!scriptExecutionContext()) {
     90        releasePromise->reject(InvalidStateError, "Context is invalid"_s);
     91        return;
     92    }
     93    auto& context = *scriptExecutionContext();
     94    if ((is<Document>(context) && !downcast<Document>(context).isFullyActive())) {
     95        releasePromise->reject(InvalidStateError, "Responsible document is not fully active"_s);
     96        return;
     97    }
     98
     99    if (!m_clientOrigin) {
     100        releasePromise->reject(SecurityError, "Context's origin is opaque"_s);
     101        return;
     102    }
     103
     104    if (name.startsWith('-')) {
     105        releasePromise->reject(NotSupportedError, "Lock name cannot start with '-'"_s);
     106        return;
     107    }
     108
     109    if (options.steal && options.ifAvailable) {
     110        releasePromise->reject(NotSupportedError, "WebLockOptions's steal and ifAvailable cannot both be true"_s);
     111        return;
     112    }
     113
     114    if (options.steal && options.mode != WebLockMode::Exclusive) {
     115        releasePromise->reject(NotSupportedError, "WebLockOptions's steal is true but mode is not 'exclusive'"_s);
     116        return;
     117    }
     118
     119    if (options.signal && (options.steal || options.ifAvailable)) {
     120        releasePromise->reject(NotSupportedError, "WebLockOptions's steal and ifAvailable need to be false when a signal is provided"_s);
     121        return;
     122    }
     123
     124    if (options.signal && options.signal->aborted()) {
     125        releasePromise->reject(AbortError, "WebLockOptions's signal is aborted"_s);
     126        return;
     127    }
     128
     129    WebLockIdentifier lockIdentifier = WebLockIdentifier::generateThreadSafe();
     130    m_releasePromises.add(lockIdentifier, WTFMove(releasePromise));
     131
     132    if (options.signal) {
     133        options.signal->addAlgorithm([weakThis = WeakPtr { *this }, lockIdentifier]() mutable {
     134            if (weakThis)
     135                weakThis->signalToAbortTheRequest(lockIdentifier);
     136        });
     137    }
     138
     139    m_pendingRequests.add(lockIdentifier, LockRequest { lockIdentifier, name, options.mode, WTFMove(grantedCallback), WTFMove(options.signal) });
     140
     141    requestLockOnMainThread(lockIdentifier, name, options, [weakThis = WeakPtr { *this }, lockIdentifier](bool success) mutable {
     142        if (weakThis)
     143            weakThis->didCompleteLockRequest(lockIdentifier, success);
     144    }, [weakThis = WeakPtr { *this }, lockIdentifier](Exception&& exception) mutable {
     145        if (weakThis)
     146            weakThis->settleReleasePromise(lockIdentifier, WTFMove(exception));
     147    });
     148}
     149
     150void WebLockManager::didCompleteLockRequest(WebLockIdentifier lockIdentifier, bool success)
     151{
     152    queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [this, weakThis = WeakPtr { *this }, lockIdentifier, success]() mutable {
     153        auto request = m_pendingRequests.take(lockIdentifier);
     154        if (!request.isValid())
     155            return;
     156
     157        if (success) {
     158            if (request.signal && request.signal->aborted()) {
     159                releaseLockOnMainThread(request.lockIdentifier, request.name);
     160                return;
     161            }
     162
     163            auto lock = WebLock::create(request.lockIdentifier, request.name, request.mode);
     164            auto result = request.grantedCallback->handleEvent(lock.ptr());
     165            RefPtr<DOMPromise> waitingPromise = result.type() == CallbackResultType::Success ? result.releaseReturnValue() : nullptr;
     166            if (!waitingPromise) {
     167                releaseLockOnMainThread(request.lockIdentifier, request.name);
     168                settleReleasePromise(request.lockIdentifier, Exception { ExistingExceptionError });
     169                return;
     170            }
     171
     172            DOMPromise::whenPromiseIsSettled(waitingPromise->globalObject(), waitingPromise->promise(), [this, weakThis = WTFMove(weakThis), lockIdentifier = request.lockIdentifier, name = request.name, waitingPromise] {
     173                if (!weakThis)
     174                    return;
     175                releaseLockOnMainThread(lockIdentifier, name);
     176                settleReleasePromise(lockIdentifier, static_cast<JSC::JSValue>(waitingPromise->promise()));
     177            });
     178        } else {
     179            auto result = request.grantedCallback->handleEvent(nullptr);
     180            RefPtr<DOMPromise> waitingPromise = result.type() == CallbackResultType::Success ? result.releaseReturnValue() : nullptr;
     181            if (!waitingPromise) {
     182                settleReleasePromise(request.lockIdentifier, Exception { ExistingExceptionError });
     183                return;
     184            }
     185            settleReleasePromise(request.lockIdentifier, static_cast<JSC::JSValue>(waitingPromise->promise()));
     186        }
     187    });
     188}
     189
     190void WebLockManager::requestLockOnMainThread(WebLockIdentifier lockIdentifier, const String& name, const Options& options, Function<void(bool)>&& grantedHandler, Function<void(Exception&&)>&& releaseHandler)
     191{
     192    ensureOnMainThread([contextIdentifier = scriptExecutionContext()->identifier(), clientOrigin = crossThreadCopy(*m_clientOrigin), name = crossThreadCopy(name), mode = options.mode, steal = options.steal, ifAvailable = options.ifAvailable, lockIdentifier, grantedHandler = WTFMove(grantedHandler), releaseHandler = WTFMove(releaseHandler)]() mutable {
     193        WebLockRegistry::registryForOrigin(clientOrigin)->requestLock(lockIdentifier, contextIdentifier, name, mode, steal, ifAvailable, [contextIdentifier, grantedHandler = WTFMove(grantedHandler)] (bool success) mutable {
     194            ScriptExecutionContext::ensureOnContextThread(contextIdentifier, [grantedHandler = WTFMove(grantedHandler), success](auto&) mutable {
     195                grantedHandler(success);
     196            });
     197        }, [contextIdentifier, releaseHandler = WTFMove(releaseHandler)](Exception&& exception) mutable {
     198            ScriptExecutionContext::ensureOnContextThread(contextIdentifier, [releaseHandler = WTFMove(releaseHandler), exception = crossThreadCopy(exception)](auto&) mutable {
     199                releaseHandler(WTFMove(exception));
     200            });
     201        });
     202    });
     203}
     204
     205void WebLockManager::releaseLockOnMainThread(WebLockIdentifier lockIdentifier, const String& name)
     206{
     207    ensureOnMainThread([clientOrigin = crossThreadCopy(*m_clientOrigin), lockIdentifier, name = crossThreadCopy(name)] {
     208        WebLockRegistry::registryForOrigin(clientOrigin)->releaseLock(lockIdentifier, name);
     209    });
     210}
     211
     212void WebLockManager::abortLockRequestOnMainThread(WebLockIdentifier lockIdentifier, const String& name, CompletionHandler<void(bool)>&& completionHandler)
     213{
     214    ensureOnMainThread([contextIdentifier = scriptExecutionContext()->identifier(), clientOrigin = crossThreadCopy(*m_clientOrigin), lockIdentifier, name = crossThreadCopy(name), completionHandler = WTFMove(completionHandler)]() mutable {
     215        WebLockRegistry::registryForOrigin(clientOrigin)->abortLockRequest(lockIdentifier, name, [contextIdentifier, completionHandler = WTFMove(completionHandler)](bool wasAborted) mutable {
     216            ScriptExecutionContext::ensureOnContextThread(contextIdentifier, [completionHandler = WTFMove(completionHandler), wasAborted](auto&) mutable {
     217                completionHandler(wasAborted);
     218            });
     219        });
     220    });
     221}
     222
     223void WebLockManager::queryOnMainThread(CompletionHandler<void(Snapshot&&)>&& completionHandler)
     224{
     225    ensureOnMainThread([contextIdentifier = scriptExecutionContext()->identifier(), clientOrigin = crossThreadCopy(*m_clientOrigin), completionHandler = WTFMove(completionHandler)]() mutable {
     226        WebLockRegistry::registryForOrigin(clientOrigin)->snapshot([contextIdentifier, completionHandler = WTFMove(completionHandler)](Snapshot&& snapshot) mutable {
     227            ScriptExecutionContext::ensureOnContextThread(contextIdentifier, [completionHandler = WTFMove(completionHandler), snapshot = crossThreadCopy(snapshot)](auto&) mutable {
     228                completionHandler(WTFMove(snapshot));
     229            });
     230        });
     231    });
    52232}
    53233
    54234void WebLockManager::query(Ref<DeferredPromise>&& promise)
    55235{
    56     promise->reject(NotSupportedError);
     236    if (!scriptExecutionContext()) {
     237        promise->reject(InvalidStateError, "Context is invalid"_s);
     238        return;
     239    }
     240    auto& context = *scriptExecutionContext();
     241    if ((is<Document>(context) && !downcast<Document>(context).isFullyActive())) {
     242        promise->reject(InvalidStateError, "Responsible document is not fully active"_s);
     243        return;
     244    }
     245
     246    if (!m_clientOrigin) {
     247        promise->reject(SecurityError, "Context's origin is opaque"_s);
     248        return;
     249    }
     250
     251    queryOnMainThread([weakThis = WeakPtr { *this }, promise = WTFMove(promise)](Snapshot&& snapshot) mutable {
     252        if (!weakThis)
     253            return;
     254
     255        weakThis->queueTaskKeepingObjectAlive(*weakThis, TaskSource::DOMManipulation, [promise = WTFMove(promise), snapshot = WTFMove(snapshot)]() mutable {
     256            promise->resolve<IDLDictionary<Snapshot>>(WTFMove(snapshot));
     257        });
     258    });
     259}
     260
     261// https://wicg.github.io/web-locks/#signal-to-abort-the-request
     262void WebLockManager::signalToAbortTheRequest(WebLockIdentifier lockIdentifier)
     263{
     264    if (!scriptExecutionContext())
     265        return;
     266
     267    auto requestsIterator = m_pendingRequests.find(lockIdentifier);
     268    if (requestsIterator == m_pendingRequests.end())
     269        return;
     270    auto& request = requestsIterator->value;
     271
     272    abortLockRequestOnMainThread(request.lockIdentifier, request.name, [weakThis = WeakPtr { *this }, lockIdentifier](bool wasAborted) {
     273        if (wasAborted && weakThis)
     274            weakThis->m_pendingRequests.remove(lockIdentifier);
     275    });
     276    settleReleasePromise(lockIdentifier, Exception { AbortError, "Lock request was aborted via AbortSignal" });
     277}
     278
     279void WebLockManager::settleReleasePromise(WebLockIdentifier lockIdentifier, ExceptionOr<JSC::JSValue>&& result)
     280{
     281    auto releasePromise = m_releasePromises.take(lockIdentifier);
     282    if (!releasePromise)
     283        return;
     284
     285    if (result.hasException())
     286        releasePromise->reject(result.releaseException());
     287    else
     288        releasePromise->resolveWithJSValue(result.releaseReturnValue());
     289}
     290
     291void WebLockManager::stop()
     292{
     293    clientIsGoingAway();
     294}
     295
     296void WebLockManager::clientIsGoingAway()
     297{
     298    if (m_pendingRequests.isEmpty() && m_releasePromises.isEmpty())
     299        return;
     300
     301    m_pendingRequests.clear();
     302    m_releasePromises.clear();
     303
     304    ensureOnMainThread([clientOrigin = crossThreadCopy(*m_clientOrigin), contextIdentifier = scriptExecutionContext()->identifier()] {
     305        WebLockRegistry::registryForOrigin(clientOrigin)->clientIsGoingAway(contextIdentifier);
     306    });
     307}
     308
     309bool WebLockManager::virtualHasPendingActivity() const
     310{
     311    return !m_pendingRequests.isEmpty() || !m_releasePromises.isEmpty();
     312}
     313
     314const char* WebLockManager::activeDOMObjectName() const
     315{
     316    return "WebLockManager";
    57317}
    58318
  • trunk/Source/WebCore/Modules/web-locks/WebLockManager.h

    r285012 r286284  
    2626
    2727#include "AbortSignal.h"
     28#include "ActiveDOMObject.h"
     29#include "ClientOrigin.h"
     30#include "WebLockIdentifier.h"
    2831#include "WebLockMode.h"
    2932#include <wtf/RefCounted.h>
     33#include <wtf/WeakPtr.h>
    3034
    3135namespace WebCore {
    3236
    3337class DeferredPromise;
     38class NavigatorBase;
    3439class WebLockGrantedCallback;
    3540
    36 class WebLockManager : public RefCounted<WebLockManager> {
     41struct ClientOrigin;
     42struct WebLockManagerSnapshot;
     43
     44class WebLockManager : public RefCounted<WebLockManager>, public CanMakeWeakPtr<WebLockManager>, public ActiveDOMObject {
    3745public:
    38     static Ref<WebLockManager> create();
     46    static Ref<WebLockManager> create(NavigatorBase&);
     47    ~WebLockManager();
    3948
    4049    struct Options {
     
    4554    };
    4655
    47     struct Info {
    48         String name;
    49         WebLockMode mode { WebLockMode::Exclusive };
    50         String clientId;
    51     };
    52 
    53     struct Snapshot {
    54         Vector<Info> held;
    55         Vector<Info> pending;
    56     };
     56    using Snapshot = WebLockManagerSnapshot;
    5757
    5858    void request(const String& name, Ref<WebLockGrantedCallback>&&, Ref<DeferredPromise>&&);
    5959    void request(const String& name, Options&&, Ref<WebLockGrantedCallback>&&, Ref<DeferredPromise>&&);
    60 
    6160    void query(Ref<DeferredPromise>&&);
    6261
    6362private:
    64     WebLockManager();
     63    explicit WebLockManager(NavigatorBase&);
     64
     65    void requestLockOnMainThread(WebLockIdentifier, const String& name, const Options&, Function<void(bool)>&&, Function<void(Exception&&)>&& releaseHandler);
     66    void releaseLockOnMainThread(WebLockIdentifier, const String& name);
     67    void abortLockRequestOnMainThread(WebLockIdentifier, const String& name, CompletionHandler<void(bool)>&&);
     68    void queryOnMainThread(CompletionHandler<void(Snapshot&&)>&&);
     69
     70    void didCompleteLockRequest(WebLockIdentifier, bool success);
     71    void settleReleasePromise(WebLockIdentifier, ExceptionOr<JSC::JSValue>&&);
     72    void signalToAbortTheRequest(WebLockIdentifier);
     73    void clientIsGoingAway();
     74
     75    // ActiveDOMObject.
     76    void stop() final;
     77    const char* activeDOMObjectName() const final;
     78    bool virtualHasPendingActivity() const final;
     79
     80    const std::optional<ClientOrigin> m_clientOrigin;
     81    HashMap<WebLockIdentifier, RefPtr<DeferredPromise>> m_releasePromises;
     82
     83    struct LockRequest;
     84    HashMap<WebLockIdentifier, LockRequest> m_pendingRequests;
    6585};
    6686
  • trunk/Source/WebCore/Modules/web-locks/WebLockManager.idl

    r286218 r286284  
    2424
    2525[
     26    ActiveDOMObject,
    2627    EnabledBySetting=WebLocksAPIEnabled,
    2728    Exposed=(Window,Worker),
    2829    InterfaceName=LockManager,
    29     ImplementationLacksVTable,
    3030    SecureContext
    3131] interface WebLockManager {
     
    4242    AbortSignal signal;
    4343};
    44 
    45 dictionary WebLockManagerSnapshot {
    46     sequence<WebLockInfo> held;
    47     sequence<WebLockInfo> pending;
    48 };
    49 
    50 dictionary WebLockInfo {
    51     DOMString name;
    52     WebLockMode mode;
    53     DOMString clientId;
    54 };
  • trunk/Source/WebCore/Modules/web-locks/WebLockManagerSnapshot.h

    r286283 r286284  
    2626
    2727#include "WebLockMode.h"
    28 #include <wtf/RefCounted.h>
     28#include <wtf/CrossThreadCopier.h>
     29#include <wtf/Vector.h>
    2930#include <wtf/text/WTFString.h>
    3031
    3132namespace WebCore {
    3233
    33 class WebLock : public RefCounted<WebLock> {
    34 public:
    35     static Ref<WebLock> create(const String& name, WebLockMode);
     34struct WebLockManagerSnapshot {
     35    struct Info {
     36        String name;
     37        WebLockMode mode { WebLockMode::Exclusive };
     38        String clientId;
    3639
    37     const String& name() const { return m_name; }
    38     WebLockMode mode() const { return m_mode; }
     40        Info isolatedCopy() const { return { name.isolatedCopy(), mode, clientId.isolatedCopy() }; }
     41    };
    3942
    40 private:
    41     WebLock(const String& name, WebLockMode);
     43    Vector<Info> held;
     44    Vector<Info> pending;
    4245
    43     String m_name;
    44     WebLockMode m_mode;
     46    WebLockManagerSnapshot isolatedCopy() const { return { crossThreadCopy(held), crossThreadCopy(pending) }; }
    4547};
    4648
  • trunk/Source/WebCore/Modules/web-locks/WebLockManagerSnapshot.idl

    r286283 r286284  
    2323 */
    2424
    25 callback WebLockGrantedCallback = Promise<any> (WebLock? webLock);
     25[
     26    JSGenerateToJSObject
     27] dictionary WebLockManagerSnapshot {
     28    sequence<WebLockInfo> held;
     29    sequence<WebLockInfo> pending;
     30};
     31
     32[
     33    JSGenerateToJSObject
     34] dictionary WebLockInfo {
     35    DOMString name;
     36    WebLockMode mode;
     37    DOMString clientId;
     38};
  • trunk/Source/WebCore/Modules/web-locks/WebLockRegistry.h

    r286283 r286284  
    2525#pragma once
    2626
     27#include "ClientOrigin.h"
     28#include "ScriptExecutionContextIdentifier.h"
     29#include "WebLockIdentifier.h"
     30#include "WebLockManager.h"
    2731#include "WebLockMode.h"
     32#include <wtf/Deque.h>
     33#include <wtf/HashMap.h>
    2834#include <wtf/RefCounted.h>
     35#include <wtf/WeakPtr.h>
    2936#include <wtf/text/WTFString.h>
    3037
    3138namespace WebCore {
    3239
    33 class WebLock : public RefCounted<WebLock> {
     40class Exception;
     41struct WebLockManagerSnapshot;
     42
     43class WebLockRegistry : public RefCounted<WebLockRegistry>, public CanMakeWeakPtr<WebLockRegistry> {
    3444public:
    35     static Ref<WebLock> create(const String& name, WebLockMode);
     45    static Ref<WebLockRegistry> registryForOrigin(const ClientOrigin&);
     46    ~WebLockRegistry();
    3647
    37     const String& name() const { return m_name; }
    38     WebLockMode mode() const { return m_mode; }
     48    void requestLock(WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void(Exception&&)>&& releaseHandler);
     49    void releaseLock(WebLockIdentifier, const String& name);
     50    void abortLockRequest(WebLockIdentifier, const String& name, CompletionHandler<void(bool)>&&);
     51    void snapshot(CompletionHandler<void(WebLockManagerSnapshot&&)>&&);
     52    void clientIsGoingAway(ScriptExecutionContextIdentifier);
    3953
    4054private:
    41     WebLock(const String& name, WebLockMode);
     55    explicit WebLockRegistry(const ClientOrigin&);
    4256
    43     String m_name;
    44     WebLockMode m_mode;
     57    struct LockInfo;
     58    struct LockRequest;
     59
     60    bool isGrantable(const LockRequest&) const;
     61    void processLockRequestQueue(const String& name, Deque<LockRequest>&);
     62
     63    const ClientOrigin m_origin;
     64    HashMap<String, Deque<LockRequest>> m_lockRequestQueueMap;
     65    HashMap<String, Vector<LockInfo>> m_heldLocks;
    4566};
    4667
  • trunk/Source/WebCore/Sources.txt

    r286203 r286284  
    289289Modules/web-locks/WebLock.cpp
    290290Modules/web-locks/WebLockManager.cpp
     291Modules/web-locks/WebLockRegistry.cpp
    291292Modules/webaudio/AnalyserNode.cpp
    292293Modules/webaudio/AsyncAudioDecoder.cpp
     
    40004001JSWebLockGrantedCallback.cpp
    40014002JSWebLockManager.cpp
     4003JSWebLockManagerSnapshot.cpp
    40024004JSWebLockMode.cpp
    40034005JSWebSocket.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r286259 r286284  
    13191319                4644F7F9272A1C210055599E /* WebLockManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4644F7F0272A1C160055599E /* WebLockManager.h */; };
    13201320                4644F7FA272A1C250055599E /* WebLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 4644F7F3272A1C160055599E /* WebLock.h */; };
     1321                464CAF09274331A7003B9E41 /* WebLockRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 464CAF0827433199003B9E41 /* WebLockRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13211322                4650AD1926FCCA650047F7AD /* WorkerThreadMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4650AD1726FCCA5A0047F7AD /* WorkerThreadMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13221323                465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; };
     
    91059106                4644F7F4272A1C160055599E /* WebLockManager.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebLockManager.idl; sourceTree = "<group>"; };
    91069107                4644F7F5272A1C160055599E /* WebLockMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebLockMode.idl; sourceTree = "<group>"; };
     9108                464CAF0627433198003B9E41 /* WebLockRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebLockRegistry.cpp; sourceTree = "<group>"; };
     9109                464CAF0827433199003B9E41 /* WebLockRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebLockRegistry.h; sourceTree = "<group>"; };
    91079110                4650AD1726FCCA5A0047F7AD /* WorkerThreadMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerThreadMode.h; sourceTree = "<group>"; };
    91089111                465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecksCocoa.mm; sourceTree = "<group>"; };
     
    91229125                4672AA9726B0942100E6EC38 /* CrossOriginOpenerPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrossOriginOpenerPolicy.h; sourceTree = "<group>"; };
    91239126                467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; };
     9127                467802B02747117B00DA9FB6 /* WebLockManagerSnapshot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebLockManagerSnapshot.h; sourceTree = "<group>"; };
     9128                467802B22747118500DA9FB6 /* WebLockIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebLockIdentifier.h; sourceTree = "<group>"; };
    91249129                4682D1FF1F79782300C863DB /* StoredCredentialsPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StoredCredentialsPolicy.h; sourceTree = "<group>"; };
    91259130                468344DC1EDDFA5F00B7795B /* DOMRectList.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMRectList.idl; sourceTree = "<group>"; };
     
    91859190                46E0C0DD23C006B4005E47AE /* DragEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DragEvent.idl; sourceTree = "<group>"; };
    91869191                46E139F623D8B8E70075848E /* HTTPCookieAcceptPolicyCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPCookieAcceptPolicyCocoa.h; sourceTree = "<group>"; };
     9192                46E66ECB2747123400B22A38 /* WebLockManagerSnapshot.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebLockManagerSnapshot.idl; sourceTree = "<group>"; };
    91879193                46E791451F97E01700199739 /* JSVisibilityState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVisibilityState.cpp; sourceTree = "<group>"; };
    91889194                46E791461F97E01700199739 /* JSVisibilityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVisibilityState.h; sourceTree = "<group>"; };
     
    2128321289                                4644F7EE272A1C160055599E /* WebLockGrantedCallback.h */,
    2128421290                                4644F7F2272A1C160055599E /* WebLockGrantedCallback.idl */,
     21291                                467802B22747118500DA9FB6 /* WebLockIdentifier.h */,
    2128521292                                4644F7ED272A1C160055599E /* WebLockManager.cpp */,
    2128621293                                4644F7F0272A1C160055599E /* WebLockManager.h */,
    2128721294                                4644F7F4272A1C160055599E /* WebLockManager.idl */,
     21295                                467802B02747117B00DA9FB6 /* WebLockManagerSnapshot.h */,
     21296                                46E66ECB2747123400B22A38 /* WebLockManagerSnapshot.idl */,
    2128821297                                4644F7EB272A1C160055599E /* WebLockMode.h */,
    2128921298                                4644F7F5272A1C160055599E /* WebLockMode.idl */,
     21299                                464CAF0627433198003B9E41 /* WebLockRegistry.cpp */,
     21300                                464CAF0827433199003B9E41 /* WebLockRegistry.h */,
    2129021301                        );
    2129121302                        path = "web-locks";
     
    3753637547                                4644F7F9272A1C210055599E /* WebLockManager.h in Headers */,
    3753737548                                4644F7F7272A1C1B0055599E /* WebLockMode.h in Headers */,
     37549                                464CAF09274331A7003B9E41 /* WebLockRegistry.h in Headers */,
    3753837550                                07F5CFF52582A51D00662EF5 /* WebMAudioUtilitiesCocoa.h in Headers */,
    3753937551                                0709D78F1AE55554004E42F8 /* WebMediaSessionManager.h in Headers */,
  • trunk/Source/WebCore/bindings/js/JSDOMConvertPromise.h

    r285098 r286284  
    2929#include "JSDOMConvertBase.h"
    3030#include "JSDOMPromise.h"
     31#include "WorkerGlobalScope.h"
    3132
    3233namespace WebCore {
     
    4950        auto* promise = JSC::JSPromise::resolvedPromise(globalObject, value);
    5051        if (scope.exception()) {
     52            auto* scriptExecutionContext = globalObject->scriptExecutionContext();
     53            if (is<WorkerGlobalScope>(scriptExecutionContext)) {
     54                auto& scriptController = *downcast<WorkerGlobalScope>(*scriptExecutionContext).script();
     55                bool terminatorCausedException = vm.isTerminationException(scope.exception());
     56                if (terminatorCausedException || scriptController.isTerminatingExecution()) {
     57                    scriptController.forbidExecution();
     58                    return nullptr;
     59                }
     60            }
    5161            exceptionThrower(lexicalGlobalObject, scope);
    5262            return nullptr;
  • trunk/Source/WebCore/page/NavigatorBase.cpp

    r285429 r286284  
    154154{
    155155    if (!m_webLockManager)
    156         m_webLockManager = WebLockManager::create();
     156        m_webLockManager = WebLockManager::create(*this);
    157157
    158158    return *m_webLockManager;
Note: See TracChangeset for help on using the changeset viewer.