fune/dom/serviceworkers
Andrew Sutherland b21cc21e8a Bug 1775784 - Improve worker shutdown ordering. r=dom-worker-reviewers,smaug
This patch simplifies and cleans up the RemoteWorker state machine by:
- (In a previous patch in the stack) making PRemoteWorker refcounted instead of
  ManualAlloc allows us to eliminate use of ThreadSafeWeakPtr and some legwork
  that was attempting to ensure we only drop references to RemoteWorkerChild on
  the "Worker Launcher" thread.
  - Although we are not allowed to call IPC methods on a different thread, we
    can absolutely add and remove refcounts on other threads as needed.
  - This allowed removal of the `SelfHolder` class as well as a number of calls
    to NS_ProxyRelease.
  - This allowed removal of the `{get,m}RemoteWorkerControllerWeakRef` hack.
- Adding 2 optional lambda callbacks to the WorkerPrivate constructor that will
  be notified on the parent thread in order to simplify tracking the state of
  the worker:
  - CancellationCallback: Invoked when the parent thread tells the worker to
    cancel itself.  This can be the automatic result of a script load error,
    a call to `self.close()`, or an explicit call to Cancel() by the parent.
    - Note that cancellation was always being initiated by the parent thread,
      even in the case of `self.close()`!
  - TerminationCallback: Invoked when the worker thread has finished and the
    WorkerPrivate's self-ref is about to be dropped.  This indicates that the
    worker transitioned to Killing and fully completed that process.
- Changing the RemoteWorkerChild to always perform state transitions on the
  owning parent thread (although the state may be checked from other threads,
  more in the code comments).
  - The CancellationCallback mechanism replaces a complicated use of
    WorkerRefs.  This allowed removal of ReleaseWorkerRunnable.
  - In general this reduces the number of permutations of thread interactions
    we have to worry about.
- Changing the RemoteWorkerChild to only report that the worker has finished
  shutting down as a result of the TerminationCallback rather than when the
  worker has transitioned to Cancelling.
- Changing the states to better represent the worker's state in terms of
  WorkerStatus terminology.

Some related cleanups:
- Use of mechanisms provided by IPC:
  - RemoteWorkerChild had an mOwningEventTarget with a GetOwningEventTarget
    getter that we were able to replace with the IPC-maintained
    GetActorEventTarget().
  - We replaced the `mIPCActive` with use of IPC's CanSend().
- MOZ_LOG logging was added under "RemoteWorkerChild".

Differential Revision: https://phabricator.services.mozilla.com/D164644
2023-03-14 23:57:57 +00:00
..
docs
test Backed out 5 changesets (bug 1809843) for causing Cargo related build bustages. CLOSED TREE 2023-03-13 13:53:26 +02:00
FetchEventOpChild.cpp Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +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 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.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
FetchEventOpProxyChild.cpp Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +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 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.h
IPCNavigationPreloadState.ipdlh
IPCServiceWorkerDescriptor.ipdlh Bug 1775062 - Fix various using statements to use properly qualified names. r=nika,necko-reviewers,valentin 2023-01-25 10:52:10 +00:00
IPCServiceWorkerRegistrationDescriptor.ipdlh Bug 1775062 - Fix various using statements to use properly qualified names. r=nika,necko-reviewers,valentin 2023-01-25 10:52:10 +00:00
moz.build Bug 1762078 - Blocking SerivceWorker interception for no_cors cross-origin range request. r=dom-worker-reviewers,karlt 2022-10-19 21:38:04 +00:00
NavigationPreloadManager.cpp Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
NavigationPreloadManager.h Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
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 1748313 - Fix unified build failures hit after adding webidl bindings for the proxy WebExtensions API namespace. r=asuth,willdurand 2023-02-01 19:36:09 +00:00
ServiceWorker.h Bug 1748313 - Fix unified build failures hit after adding webidl bindings for the proxy WebExtensions API namespace. r=asuth,willdurand 2023-02-01 19:36:09 +00:00
ServiceWorkerActors.cpp
ServiceWorkerActors.h
ServiceWorkerChild.cpp Bug 1715547 - Remove ServiceWorker::Inner r=dom-worker-reviewers,asuth 2022-09-29 18:26:00 +00:00
ServiceWorkerChild.h Bug 1715547 - Remove ServiceWorker::Inner r=dom-worker-reviewers,asuth 2022-09-29 18:26:00 +00:00
ServiceWorkerCloneData.cpp
ServiceWorkerCloneData.h
ServiceWorkerContainer.cpp Bug 1715547 - Remove ServiceWorkerContainer::Inner r=dom-worker-reviewers,asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerContainer.h Bug 1715547 - Remove ServiceWorkerContainer::Inner r=dom-worker-reviewers,asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerContainerChild.cpp Bug 1715547 - Remove ServiceWorkerContainer::Inner r=dom-worker-reviewers,asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerContainerChild.h Bug 1715547 - Remove ServiceWorkerContainer::Inner r=dom-worker-reviewers,asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerContainerParent.cpp
ServiceWorkerContainerParent.h
ServiceWorkerContainerProxy.cpp
ServiceWorkerContainerProxy.h
ServiceWorkerDescriptor.cpp
ServiceWorkerDescriptor.h
ServiceWorkerEvents.cpp Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerEvents.h
ServiceWorkerInfo.cpp
ServiceWorkerInfo.h
ServiceWorkerInterceptController.cpp Bug 1643611 - Stop intercepting requests in embed and object elements r=edenchuang 2022-11-21 17:33:13 +00:00
ServiceWorkerInterceptController.h
ServiceWorkerIPCUtils.h
ServiceWorkerJob.cpp
ServiceWorkerJob.h
ServiceWorkerJobQueue.cpp
ServiceWorkerJobQueue.h
ServiceWorkerManager.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
ServiceWorkerManager.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
ServiceWorkerManagerChild.h
ServiceWorkerManagerParent.cpp
ServiceWorkerManagerParent.h
ServiceWorkerOp.cpp Bug 1775784 - Improve worker shutdown ordering. r=dom-worker-reviewers,smaug 2023-03-14 23:57:57 +00:00
ServiceWorkerOp.h Bug 1775784 - Improve worker shutdown ordering. r=dom-worker-reviewers,smaug 2023-03-14 23:57:57 +00: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 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
ServiceWorkerParent.cpp
ServiceWorkerParent.h
ServiceWorkerPrivate.cpp Bug 1810816 - P4 Report the preload response timing for ServiceWorker NavigationPreload. r=dom-worker-reviewers,asuth 2023-02-23 02:52:54 +00:00
ServiceWorkerPrivate.h Bug 1715547 - Remove ServiceWorkerPrivate::Inner r=asuth,dom-worker-reviewers 2022-09-29 18:26:00 +00:00
ServiceWorkerProxy.cpp
ServiceWorkerProxy.h
ServiceWorkerQuotaUtils.cpp
ServiceWorkerQuotaUtils.h
ServiceWorkerRegisterJob.cpp
ServiceWorkerRegisterJob.h
ServiceWorkerRegistrar.cpp Bug 1809753 - Part 3: Replace all callers of GetCurrentEventTarget with GetCurrentSerialEventTarget, r=mccr8,necko-reviewers,valentin 2023-01-16 23:14:11 +00:00
ServiceWorkerRegistrar.h
ServiceWorkerRegistrarTypes.ipdlh
ServiceWorkerRegistration.cpp Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerRegistration.h Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerRegistrationChild.cpp Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerRegistrationChild.h Bug 1715547 - Remove ServiceWorkerRegistration::Inner r=asuth 2022-09-29 18:25:59 +00:00
ServiceWorkerRegistrationDescriptor.cpp
ServiceWorkerRegistrationDescriptor.h
ServiceWorkerRegistrationInfo.cpp
ServiceWorkerRegistrationInfo.h
ServiceWorkerRegistrationListener.h
ServiceWorkerRegistrationParent.cpp
ServiceWorkerRegistrationParent.h
ServiceWorkerRegistrationProxy.cpp
ServiceWorkerRegistrationProxy.h
ServiceWorkerScriptCache.cpp
ServiceWorkerScriptCache.h
ServiceWorkerShutdownBlocker.cpp
ServiceWorkerShutdownBlocker.h
ServiceWorkerShutdownState.cpp
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
ServiceWorkerUpdateJob.h
ServiceWorkerUtils.cpp Bug 1748313 - Fix unified build failures hit after adding webidl bindings for the proxy WebExtensions API namespace. r=asuth,willdurand 2023-02-01 19:36:09 +00:00
ServiceWorkerUtils.h Bug 1748313 - Fix unified build failures hit after adding webidl bindings for the proxy WebExtensions API namespace. r=asuth,willdurand 2023-02-01 19:36:09 +00:00