gecko-dev/dom/serviceworkers
Andrea Marchesini 8ae9152b88 Bug 1193373 - Support Permissions API in Worker Context, r=manuel,webidl,asuth,smaug
This commit exposes the Permissions API to DOM Workers. It achieves this goal
by introducing a thread-safe bridge between `PermissionStatus` and the
`PermissionObserver`: the `PermissionStatusSink` object.

Actors:
- The `PermissionObserver` is a main-thread-only singleton that monitors
  permission change events and propagates the notification to the right sink
  objects.
- The `PermissionStatus` is the DOM object exposed to the global. It's not
  thread-safe.
- The `PermissionStatusSink` is the new bridge introduced by this commit.

The `PermissionStatusSink` lifetime:
- This object is kept alive on the current thread by the `PermissionStatus` and
  on the main thread by the `PermissionObserver`.
- The `PermissionStatus` creates the object on its creation thread. When
  `PermissionStatus` object is released (or disconnected from the owner, it
  disentangles itself from the `PermissionStatusSink`. The disentangle
  operation triggers the un-registration procedure from the
  `PermissionObserver` on the main thread.
- A weak `WorkerRef` is used to monitor the worker's lifetime.

Permission change notification:
- When the  `PermissionObserver` is notified for a permission-change event, it
  notifies all the `PermissionStatusSink`. This happens on the main thread (see
  `MaybeUpdatedByOnMainThread` and `MaybeUpdatedByNotifyOnlyOnMainThread`).
- Using `MozPromise`, the `PermissionStatusSink` computes the permission action
  (`PermissionChangedOnMainThread`) on the main thread, then informs the
  parent `PermissionStatus` object on its creation thread.
- The `PermissionStatus` object converts the action to the DOM
  `PermissionState` and dispatches an event.

Differential Revision: https://phabricator.services.mozilla.com/D224594
2024-10-11 06:53:48 +00:00
..
docs
test Bug 1193373 - Support Permissions API in Worker Context, r=manuel,webidl,asuth,smaug 2024-10-11 06:53:48 +00:00
FetchEventOpChild.cpp Bug 1914632 - delete the actors during shutdown for worker keepalive requests.r=edenchuang 2024-09-24 17:10:06 +00:00
FetchEventOpChild.h Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
FetchEventOpParent.cpp Backed out 5 changesets (bug 1672493) for causing serviceworker related perma failures. CLOSED TREE 2024-06-27 13:02:33 +03:00
FetchEventOpParent.h Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille 2023-03-27 07:20:25 +00:00
FetchEventOpProxyChild.cpp Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille 2023-03-27 07:20:25 +00:00
FetchEventOpProxyChild.h Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
FetchEventOpProxyParent.cpp Backed out 5 changesets (bug 1672493) for causing serviceworker related perma failures. CLOSED TREE 2024-06-27 13:02:33 +03:00
FetchEventOpProxyParent.h
IPCNavigationPreloadState.ipdlh
IPCServiceWorkerDescriptor.ipdlh
IPCServiceWorkerRegistrationDescriptor.ipdlh
moz.build Bug 1869590 - Batch 19 - convert remaining mochitest ini to toml. r=aryx,necko-reviewers,devtools-reviewers,dom-storage-reviewers,asuth,valentin,nchevobbe 2023-12-13 15:44:04 +00:00
NavigationPreloadManager.cpp
NavigationPreloadManager.h
PFetchEventOp.ipdl Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
PFetchEventOpProxy.ipdl Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
PServiceWorker.ipdl
PServiceWorkerContainer.ipdl
PServiceWorkerManager.ipdl
PServiceWorkerRegistration.ipdl
ServiceWorker.cpp Bug 1904442 - Rename GlobalTeardownObserver::GetOwner to GetOwnerWindow. r=smaug,media-playback-reviewers,dom-storage-reviewers,aosmond,padenot,asuth 2024-07-01 11:49:59 +00:00
ServiceWorker.h
ServiceWorkerActors.cpp Bug 1899749 - Use profiler markers for getting performance data r=dom-worker-reviewers,smaug,profiler-reviewers,aabh,asuth,perftest-reviewers,sparky 2024-07-26 12:54:36 +00:00
ServiceWorkerActors.h
ServiceWorkerChild.cpp
ServiceWorkerChild.h
ServiceWorkerCloneData.cpp
ServiceWorkerCloneData.h
ServiceWorkerContainer.cpp Bug 1899749 - Use profiler markers for getting performance data r=dom-worker-reviewers,smaug,profiler-reviewers,aabh,asuth,perftest-reviewers,sparky 2024-07-26 12:54:36 +00:00
ServiceWorkerContainer.h
ServiceWorkerContainerChild.cpp
ServiceWorkerContainerChild.h
ServiceWorkerContainerParent.cpp
ServiceWorkerContainerParent.h
ServiceWorkerContainerProxy.cpp Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu 2023-10-10 08:51:12 +00:00
ServiceWorkerContainerProxy.h
ServiceWorkerDescriptor.cpp
ServiceWorkerDescriptor.h
ServiceWorkerEvents.cpp Bug 1915228 - Remove expired telemetry scalars sw.cors_res_for_so_req_count and sw.alternative_body_used_count, r=chutten. 2024-08-28 19:44:31 +00:00
ServiceWorkerEvents.h Bug 1910698 - Add a struct to represent JS caller location and more general warning source location. r=smaug,necko-reviewers,anti-tracking-reviewers,dom-storage-reviewers,pbz,kershaw,janv 2024-08-01 17:12:48 +00:00
ServiceWorkerInfo.cpp Bug 1640839 - Stop generating count of WebIDL enum values, use standard enum traits instead. r=mccr8 2024-03-02 07:50:25 +00:00
ServiceWorkerInfo.h
ServiceWorkerInterceptController.cpp
ServiceWorkerInterceptController.h
ServiceWorkerIPCUtils.h Bug 1640839 - Add IPC serializer for WebIDL enums. r=mccr8,jgilbert,media-playback-reviewers,dom-storage-reviewers,janv,padenot 2024-03-02 07:50:22 +00:00
ServiceWorkerJob.cpp
ServiceWorkerJob.h
ServiceWorkerJobQueue.cpp
ServiceWorkerJobQueue.h
ServiceWorkerManager.cpp Bug 1915228 - Remove expired telemetry scalars serviceworker.registrations and serviceworker.running_max, r=chutten,jesup. 2024-08-28 19:44:31 +00:00
ServiceWorkerManager.h Bug 1915228 - Remove expired telemetry scalars serviceworker.registrations and serviceworker.running_max, r=chutten,jesup. 2024-08-28 19:44:31 +00:00
ServiceWorkerManagerChild.h
ServiceWorkerManagerParent.cpp Bug 1884623 - Update more jsm references in production code and docs in dom/. r=emilio 2024-03-11 15:26:28 +00:00
ServiceWorkerManagerParent.h
ServiceWorkerOp.cpp Bug 1915228 - Remove expired telemetry scalars sw.cors_res_for_so_req_count and sw.alternative_body_used_count, r=chutten. 2024-08-28 19:44:31 +00:00
ServiceWorkerOp.h Backed out 5 changesets (bug 1672493) for causing serviceworker related perma failures. CLOSED TREE 2024-06-27 13:02:33 +03:00
ServiceWorkerOpArgs.ipdlh Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
ServiceWorkerOpPromise.h Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille 2023-03-27 07:20:25 +00:00
ServiceWorkerParent.cpp
ServiceWorkerParent.h
ServiceWorkerPrivate.cpp Bug 1923501 - Fix WPT workers/shared-worker-options-mismatch.html, r=asuth 2024-10-08 23:05:04 +00:00
ServiceWorkerPrivate.h Bug 1824847: Maintain number of active WebTransports per document for controlling BFCache entry r=smaug,saschanaz 2023-04-15 03:32:38 +00:00
ServiceWorkerProxy.cpp Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu 2023-10-10 08:51:12 +00:00
ServiceWorkerProxy.h
ServiceWorkerQuotaUtils.cpp Bug 1915419 - Extend deleteDataFromSite to support OriginAttributesPattern filtering. r=anti-tracking-reviewers,timhuang 2024-09-24 09:17:56 +00:00
ServiceWorkerQuotaUtils.h
ServiceWorkerRegisterJob.cpp Bug 1899749 - Use profiler markers for getting performance data r=dom-worker-reviewers,smaug,profiler-reviewers,aabh,asuth,perftest-reviewers,sparky 2024-07-26 12:54:36 +00:00
ServiceWorkerRegisterJob.h
ServiceWorkerRegistrar.cpp Backed out changeset 4b1409597101 (bug 1920718) for causing bp bustages on rapl.cpp. 2024-10-08 23:27:18 +03:00
ServiceWorkerRegistrar.h
ServiceWorkerRegistrarTypes.ipdlh
ServiceWorkerRegistration.cpp Bug 1903766 - Add perftests for service worker update r=perftest-reviewers,dom-worker-reviewers,sparky,asuth 2024-08-02 19:04:40 +00:00
ServiceWorkerRegistration.h
ServiceWorkerRegistrationChild.cpp
ServiceWorkerRegistrationChild.h
ServiceWorkerRegistrationDescriptor.cpp Bug 1764731 - Disable service worker assert for IPC fuzzing. r=asuth 2024-07-15 15:01:02 +00:00
ServiceWorkerRegistrationDescriptor.h
ServiceWorkerRegistrationInfo.cpp Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu 2023-10-10 08:51:12 +00:00
ServiceWorkerRegistrationInfo.h
ServiceWorkerRegistrationListener.h
ServiceWorkerRegistrationParent.cpp Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille 2023-03-27 07:20:25 +00:00
ServiceWorkerRegistrationParent.h
ServiceWorkerRegistrationProxy.cpp Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu 2023-10-10 08:51:12 +00:00
ServiceWorkerRegistrationProxy.h
ServiceWorkerScriptCache.cpp Bug 1899138 - Set the IsInThirdPartyContext for the loadInfo of the channel that loads worker scripts. r=asuth 2024-05-29 08:57:47 +00:00
ServiceWorkerScriptCache.h Bug 1887719 - More consistently use UTF8String/nsCString for URLs. r=necko-reviewers,webidl,anti-tracking-reviewers,places-reviewers,jari,kershaw,janv,smaug,hsivonen 2024-04-04 11:49:57 +00:00
ServiceWorkerShutdownBlocker.cpp
ServiceWorkerShutdownBlocker.h
ServiceWorkerShutdownState.cpp Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu 2023-10-10 08:51:12 +00:00
ServiceWorkerShutdownState.h
ServiceWorkerUnregisterCallback.cpp
ServiceWorkerUnregisterCallback.h
ServiceWorkerUnregisterJob.cpp Bug 1645054 - Disable/purge service workers when dom.serviceWorkers.enabled is false r=dom-worker-reviewers,necko-reviewers,asuth,webdriver-reviewers,whimboo 2023-02-28 15:57:55 +00:00
ServiceWorkerUnregisterJob.h Bug 1645054 - Disable/purge service workers when dom.serviceWorkers.enabled is false r=dom-worker-reviewers,necko-reviewers,asuth,webdriver-reviewers,whimboo 2023-02-28 15:57:55 +00:00
ServiceWorkerUpdateJob.cpp Bug 1913624 - Remove expired telemetry histogram SERVICE_WORKER_UPDATED, r=chutten. 2024-08-20 10:26:53 +00:00
ServiceWorkerUpdateJob.h
ServiceWorkerUtils.cpp Bug 1908664 - Add nsIPrincipal::GetIsInPrivateBrowsing r=media-playback-reviewers,anti-tracking-reviewers,dom-storage-reviewers,padenot,asuth,pbz 2024-07-26 17:47:51 +00:00
ServiceWorkerUtils.h