gecko-dev/dom/serviceworkers
Luca Greco 7f7e073259 Bug 1638099 - Cover with an explicit xpcshell test the expected service worker lifecycle events on addon reload and browser restart. r=asuth,mixedpuppy
This patch introduce an additional xpcshell test task (built on top of the other one added in D119799)
which cover explicitly the following behaviors:
- the extension service worker registrations are expected to:
  - not be unregistered if the addon is shutting down as part of the application shutdown
  - to be unregistered if the addon is disabled (while the application is not shutting down)
- the extension service worker is expected to:
  - receive the "install" and "activate" lifecycle events when the service worker is registered for the first time
    or if the addon is disabled and then re-enabled while the application is not shutting down
  - not receive the "install" and "activate" lifecycle events when a previously active worker
    is spawned again (in particular after the entire application is restarted)

Ideally these behavior shoud be tested by restarting the browser instance as in a real Browser instance
but asserting all these behavior from a marionette test would be a bit trickier (but I still plan to
take a look into that, at least to cover with a marionette test a subset of the expected behaviors on
browser restart).

As an additional side note, the test case introduced in this test is currently assuming that we
may not proceed with D119531, and so to avoid to hit the issue described in that patch description
this patch is currently introducing an additional test-only method to nsIServiceWorkerManager
(named reloadRegistrationsForTest) which currently does the bare minimum to mock the "Browser restart"
scenario.

If on the contrary, we decide to proceed further with D119531, the new nsIServiceWorkerManager.reloadRegistrationsForTest
helper would not be needed anymore (because we would just use the existing ServiceWorkerRegistrationInfo instance which
is basically in the same state that the new one loaded from the ServiceWorkerRegistar would be, besides the issue with the
stale WebExtensionPolicy instance stored in the principal associated to the previous service worker registration).

Differential Revision: https://phabricator.services.mozilla.com/D120351
2021-07-26 17:52:26 +00:00
..
test Bug 1720410 - Unregister SW when reach navigation fault threshold. r=dom-worker-reviewers,asuth 2021-07-20 23:35:11 +00:00
FetchEventOpChild.cpp Bug 1720410 - Unregister SW when reach navigation fault threshold. r=dom-worker-reviewers,asuth 2021-07-20 23:35:11 +00:00
FetchEventOpChild.h Bug 1503072 - Add mitigation to bypass SW on navigation fault. r=dom-worker-reviewers,necko-reviewers,valentin,edenchuang 2021-07-12 21:10:26 +00:00
FetchEventOpParent.cpp
FetchEventOpParent.h
FetchEventOpProxyChild.cpp
FetchEventOpProxyChild.h
FetchEventOpProxyParent.cpp Bug 1626555 - Add dom/serviceworkers to the list of non-unified-build-compatible directories. r=sg 2020-11-10 11:55:00 +00:00
FetchEventOpProxyParent.h
IPCNavigationPreloadState.ipdlh Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
IPCServiceWorkerDescriptor.ipdlh Bug 1689147 - Part 5: Change comparable to an extended attribute, r=mccr8 2021-02-09 16:50:23 +00:00
IPCServiceWorkerRegistrationDescriptor.ipdlh Bug 1689147 - Part 5: Change comparable to an extended attribute, r=mccr8 2021-02-09 16:50:23 +00:00
moz.build Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
NavigationPreloadManager.cpp Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
NavigationPreloadManager.h Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
PFetchEventOp.ipdl
PFetchEventOpProxy.ipdl
PServiceWorker.ipdl Bug 1720688 - Support extended attribute syntax in protocol declarations, r=mccr8 2021-07-22 02:24:43 +00:00
PServiceWorkerContainer.ipdl Bug 1720688 - Support extended attribute syntax in protocol declarations, r=mccr8 2021-07-22 02:24:43 +00:00
PServiceWorkerManager.ipdl Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
PServiceWorkerRegistration.ipdl Bug 1720688 - Support extended attribute syntax in protocol declarations, r=mccr8 2021-07-22 02:24:43 +00:00
RemoteServiceWorkerContainerImpl.cpp
RemoteServiceWorkerContainerImpl.h
RemoteServiceWorkerImpl.cpp
RemoteServiceWorkerImpl.h
RemoteServiceWorkerRegistrationImpl.cpp Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
RemoteServiceWorkerRegistrationImpl.h Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorker.cpp Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
ServiceWorker.h
ServiceWorkerActors.cpp Bug 1626555 - Add dom/serviceworkers to the list of non-unified-build-compatible directories. r=sg 2020-11-10 11:55:00 +00:00
ServiceWorkerActors.h
ServiceWorkerChild.cpp Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerChild.h Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerCloneData.cpp Bug 1673424 - Fix includes around StructuredCloneData.h. 2020-11-23 16:07:01 +00:00
ServiceWorkerCloneData.h Bug 1673424 - Fix includes around StructuredCloneData.h. 2020-11-23 16:07:01 +00:00
ServiceWorkerContainer.cpp Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
ServiceWorkerContainer.h Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerContainerChild.cpp Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerContainerChild.h Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerContainerParent.cpp Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerContainerParent.h
ServiceWorkerContainerProxy.cpp Bug 1679272 - Include ScopeExit.h exactly where used. r=andi 2020-12-07 14:25:59 +00:00
ServiceWorkerContainerProxy.h Bug 1626555 - Add dom/serviceworkers to the list of non-unified-build-compatible directories. r=sg 2020-11-10 11:55:00 +00:00
ServiceWorkerDescriptor.cpp
ServiceWorkerDescriptor.h
ServiceWorkerEvents.cpp Bug 1712725 - Stop clearing JS things when calling mozilla::DropJSObjects. r=mccr8 2021-05-27 08:35:40 +00:00
ServiceWorkerEvents.h Bug 1617822 - Implement FetchEvent.handled r=dom-workers-and-storage-reviewers,asuth 2020-10-29 17:18:28 +00:00
ServiceWorkerInfo.cpp Bug 1503072 - Navigation fault interception test support. r=dom-worker-reviewers,edenchuang 2021-07-12 21:10:26 +00:00
ServiceWorkerInfo.h Bug 1503072 - Navigation fault interception test support. r=dom-worker-reviewers,edenchuang 2021-07-12 21:10:26 +00:00
ServiceWorkerInterceptController.cpp Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
ServiceWorkerInterceptController.h
ServiceWorkerIPCUtils.h Bug 1677466 - Move ParamTraits specializations with extra dependencies out of IPCMessageUtils.h. r=mccr8 2020-12-10 11:09:21 +00:00
ServiceWorkerJob.cpp
ServiceWorkerJob.h
ServiceWorkerJobQueue.cpp
ServiceWorkerJobQueue.h
ServiceWorkerManager.cpp Bug 1638099 - Cover with an explicit xpcshell test the expected service worker lifecycle events on addon reload and browser restart. r=asuth,mixedpuppy 2021-07-26 17:52:26 +00:00
ServiceWorkerManager.h Bug 1503072 - Navigation fault interception test support. r=dom-worker-reviewers,edenchuang 2021-07-12 21:10:26 +00:00
ServiceWorkerManagerChild.h Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
ServiceWorkerManagerParent.cpp Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
ServiceWorkerManagerParent.h Bug 1496997 - Remove a chunk of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg 2021-06-08 21:02:54 +00:00
ServiceWorkerOp.cpp Bug 1503072 - Navigation fault interception test support. r=dom-worker-reviewers,edenchuang 2021-07-12 21:10:26 +00:00
ServiceWorkerOp.h Bug 1617822 - Implement FetchEvent.handled r=dom-workers-and-storage-reviewers,asuth 2020-10-29 17:18:28 +00:00
ServiceWorkerOpArgs.ipdlh Bug 1503072 - Navigation fault interception test support. r=dom-worker-reviewers,edenchuang 2021-07-12 21:10:26 +00:00
ServiceWorkerOpPromise.h
ServiceWorkerParent.cpp
ServiceWorkerParent.h
ServiceWorkerPrivate.cpp Bug 1503072 - Add mitigation to bypass SW on navigation fault. r=dom-worker-reviewers,necko-reviewers,valentin,edenchuang 2021-07-12 21:10:26 +00:00
ServiceWorkerPrivate.h
ServiceWorkerPrivateImpl.cpp Bug 1638099 - Ensure spawning a new service worker for a disabled webextension does fail. r=asuth 2021-07-26 17:52:25 +00:00
ServiceWorkerPrivateImpl.h
ServiceWorkerProxy.cpp Bug 1679272 - Include ScopeExit.h exactly where used. r=andi 2020-12-07 14:25:59 +00:00
ServiceWorkerProxy.h Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerRegisterJob.cpp
ServiceWorkerRegisterJob.h
ServiceWorkerRegistrar.cpp Bug 1638099 - Cover with an explicit xpcshell test the expected service worker lifecycle events on addon reload and browser restart. r=asuth,mixedpuppy 2021-07-26 17:52:26 +00:00
ServiceWorkerRegistrar.h Bug 1638099 - Cover with an explicit xpcshell test the expected service worker lifecycle events on addon reload and browser restart. r=asuth,mixedpuppy 2021-07-26 17:52:26 +00:00
ServiceWorkerRegistrarTypes.ipdlh Bug 1564235 - P5 Save NavigationPreload data into serviceworker.txt. r=dom-worker-reviewers,asuth 2021-06-10 06:01:28 +00:00
ServiceWorkerRegistration.cpp Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerRegistration.h Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerRegistrationChild.cpp Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerRegistrationChild.h Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerRegistrationDescriptor.cpp
ServiceWorkerRegistrationDescriptor.h
ServiceWorkerRegistrationInfo.cpp Bug 1720410 - Unregister SW when reach navigation fault threshold. r=dom-worker-reviewers,asuth 2021-07-20 23:35:11 +00:00
ServiceWorkerRegistrationInfo.h Bug 1564235 - P4 Save NavigationPreload data in ServiceWorkerRegistration Info. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerRegistrationListener.h
ServiceWorkerRegistrationParent.cpp Bug 1564235 - P4 Save NavigationPreload data in ServiceWorkerRegistration Info. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerRegistrationParent.h Bug 1564235 - P3 Create IPC for NavigationPreload in PServiceWorkerRegistration.ipdl. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerRegistrationProxy.cpp Bug 1564235 - P4 Save NavigationPreload data in ServiceWorkerRegistration Info. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerRegistrationProxy.h Bug 1564235 - P4 Save NavigationPreload data in ServiceWorkerRegistration Info. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00
ServiceWorkerScriptCache.cpp Bug 1708448 - Move property and element functions into js/public/PropertyAndElement.h. r=nbp 2021-07-13 11:52:42 +00:00
ServiceWorkerScriptCache.h Bug 1626555 - Add dom/serviceworkers to the list of non-unified-build-compatible directories. r=sg 2020-11-10 11:55:00 +00:00
ServiceWorkerShutdownBlocker.cpp Bug 1711090 - Part 3: Add some missing nsITimerCallback queryinterface targets, r=KrisWright,necko-reviewers,kershaw 2021-05-18 20:45:17 +00:00
ServiceWorkerShutdownBlocker.h Bug 1588152 - Eliminate redundant profile-change-teardown observer. r=asuth 2020-10-30 18:44:54 +00:00
ServiceWorkerShutdownState.cpp Bug 1496997 - Remove rest of child intercept code from dom/serviceworkers r=asuth,dom-workers-and-storage-reviewers,sg,jdescottes,nchevobbe 2021-06-08 21:02:54 +00:00
ServiceWorkerShutdownState.h Bug 1677466 - Move ParamTraits specializations with extra dependencies out of IPCMessageUtils.h. r=mccr8 2020-12-10 11:09:21 +00:00
ServiceWorkerUnregisterCallback.cpp
ServiceWorkerUnregisterCallback.h
ServiceWorkerUnregisterJob.cpp Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerUnregisterJob.h
ServiceWorkerUpdateJob.cpp Bug 1626555 - Add dom/serviceworkers to the list of non-unified-build-compatible directories. r=sg 2020-11-10 11:55:00 +00:00
ServiceWorkerUpdateJob.h Bug 1660470 - Add missing include directives/forward declarations. r=nika 2020-11-23 16:21:38 +00:00
ServiceWorkerUtils.cpp Bug 1496997 - Remove ServiceWorkerParentInterceptEnabled() and callers r=asuth,dom-workers-and-storage-reviewers,necko-reviewers,dragana 2021-06-08 21:02:55 +00:00
ServiceWorkerUtils.h Bug 1564235 - P4 Save NavigationPreload data in ServiceWorkerRegistration Info. r=dom-worker-reviewers,asuth 2021-06-10 06:01:27 +00:00