Name Description Size
abrupt_completion_worker.js 660
activate_event_error_worker.js 110
async_waituntil_worker.js 1332
blocking_install_event_worker.js 589
browser-common.toml 1756
browser-dFPI.toml 166
browser.toml 64
browser_antitracking.js Set up a no-fetch-optimized ServiceWorker on a domain that will be covered by tracking protection (but is not yet). Once the SW is installed, activate TP and create a tab that embeds that tracking-site in an iframe. 3461
browser_antitracking_subiframes.js Set up a ServiceWorker on a domain that will be used as 3rd party iframe. That 3rd party frame should be controlled by the ServiceWorker. After that, we open a second iframe into the first one. That should not be controlled. 3412
browser_base_force_refresh.html 666
browser_cached_force_refresh.html 1580
browser_devtools_serviceworker_interception.js 7955
browser_download.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 2619
browser_download_canceled.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 6523
browser_force_refresh.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 2820
browser_head.js This file contains common functionality for ServiceWorker browser tests. Note that the normal auto-import mechanics for browser mochitests only handles "head.js", but we currently store all of our different varieties of mochitest in a single directory, which potentially results in a collision for similar heuristics for xpcshell. Many of the storage-related helpers in this file come from: https://searchfox.org/mozilla-central/source/dom/localstorage/test/unit/head.js 9538
browser_intercepted_channel_process_swap.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 3175
browser_intercepted_worker_script.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 2686
browser_navigation_fetch_fault_handling.js This test file tests our automatic recovery and any related mitigating heuristics that occur during intercepted navigation fetch request. Specifically, we should be resetting interception so that we go to the network in these cases and then potentially taking actions like unregistering the ServiceWorker and/or clearing QuotaManager-managed storage for the origin. See specific test permutations for specific details inline in the test. NOTE THAT CURRENTLY THIS TEST IS DISCUSSING MITIGATIONS THAT ARE NOT YET IMPLEMENTED, JUST PLANNED. These will be iterated on and added to the rest of the stack of patches on Bug 1503072. ## Test Mechanics ### Fetch Fault Injection We expose: - On nsIServiceWorkerInfo, the per-ServiceWorker XPCOM interface: - A mechanism for creating synthetic faults by setting the `nsIServiceWorkerInfo::testingInjectCancellation` attribute to a failing nsresult. The fault is applied at the beginning of the steps to dispatch the fetch event on the global. - A count of the number of times we experienced these navigation faults that had to be reset as `nsIServiceWorkerInfo::navigationFaultCount`. (This would also include real faults, but we only expect to see synthetic faults in this test.) - On nsIServiceWorkerRegistrationInfo, the per-registration XPCOM interface: - A readonly attribute that indicates how many times an origin storage usage check has been initiated. We also use: - `nsIServiceWorkerManager::addListener(nsIServiceWorkerManagerListener)` allows our test to listen for the unregistration of registrations. This allows us to be notified when unregistering or origin-clearing actions have been taken as a mitigation. ### General Test Approach For each test we: - Ensure/confirm the testing origin has no QuotaManager storage in use. - Install the ServiceWorker. - If we are testing the situation where we want to simulate the origin being near its quota limit, we also generate Cache API and IDB storage usage sufficient to put our origin over the threshold. - We run a quota check on the origin after doing this in order to make sure that we did this correctly and that we properly constrained the limit for the origin. We fail the test for test implementation reasons if we didn't accomplish this. - Verify a fetch navigation to the SW works without any fault injection, producing a result produced by the ServiceWorker. - Begin fault permutations in a loop, where for each pass of the loop: - We trigger a navigation which will result in an intercepted fetch which will fault. We wait until the navigation completes. - We verify that we got the request from the network. - We verify that the ServiceWorker's navigationFaultCount increased. - If this the count at which we expect a mitigation to take place, we wait for the registration to become unregistered AND: - We check whether the storage for the origin was cleared or not, which indicates which mitigation of the following happened: - Unregister the registration directly. - Clear the origin's data which will also unregister the registration as a side effect. - We check whether the registration indicates an origin quota check happened or not. ### Disk Usage Limits In order to avoid gratuitous disk I/O and related overheads, we limit QM ("temporary") storage to 10 MiB which ends up limiting group usage to 10 MiB. This lets us set a threshold situation where we claim that a SW needs at least 4 MiB of storage for installation/operation, meaning that any usage beyond 6 MiB in the group will constitute a need to clear the group or origin. We fill with the storage with 8 MiB of artificial usage to this end, storing 4 MiB in Cache API and 4 MiB in IDB. 10709
browser_navigationPreload_read_after_respondWith.js Test the FetchEvent.preloadResponse can be read after FetchEvent.respondWith() Step 1. register a ServiceWorker which only handles FetchEvent when request url includes navigationPreload_page.html. Otherwise, it alwasy fallbacks the fetch to the network. If the request url includes navigationPreload_page.html, it call FetchEvent.respondWith() with a new Resposne, and then call FetchEvent.waitUtil() to wait FetchEvent.preloadResponse and post the preloadResponse's text to clients. Step 2. Open a controlled page and register message event handler to receive the postMessage from ServiceWorker. Step 3. Create a iframe which url is navigationPreload_page.html, such that ServiceWorker can fake the response and then send preloadResponse's result. Step 4. Unregister the ServiceWorker and cleanup the environment. 3960
browser_remote_type_process_swap.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 4059
browser_storage_permission.js 9961
browser_storage_recovery.js 5430
browser_unregister_with_containers.js 5067
browser_userContextId_openWindow.js eslint-disable no-shadow 4350
bug1151916_driver.html 1663
bug1151916_worker.js 391
bug1240436_worker.js 58
chrome-common.toml 592
chrome-dFPI.toml 165
chrome.toml 63
chrome_helpers.js 1778
claim_clients
claim_oninstall_worker.js 191
claim_worker_1.js 800
claim_worker_2.js 885
close_test.js eslint-disable mozilla/no-comparison-or-assignment-inside-ok 596
console_monitor.js eslint-env mozilla/chrome-script 1061
controller
create_another_sharedWorker.html Shared workers: create antoehr sharedworekr client 189
download
download_canceled
empty.html 0
empty.js 0
empty_with_utils.html 256
error_reporting_helpers.js Helpers for use in tests that want to verify that localized error messages are logged during the test. Because most of our errors (ex: ServiceWorkerManager) generate nsIScriptError instances with flattened strings (the interpolated arguments aren't kept around), we load the string bundle and use it to derive the exact string message we expect for the given payload. 2616
eval_worker.js 49
eventsource
fetch
fetch.js 1005
fetch_event_worker.js 12395
file_blob_response_worker.js 1237
file_js_cache.html Add a tag script to save the bytecode 197
file_js_cache.js 69
file_js_cache_cleanup.js 399
file_js_cache_save_after_load.html Save the bytecode when all scripts are executed 223
file_js_cache_save_after_load.js 441
file_js_cache_syntax_error.html Do not save bytecode on compilation errors 215
file_js_cache_syntax_error.js 43
file_js_cache_with_sri.html Add a tag script to save the bytecode 294
file_notification_openWindow.html Bug 1578070 586
file_userContextId_openWindow.js 72
force_refresh_browser_worker.js 1135
force_refresh_worker.js 1358
ForceRefreshChild.sys.mjs 222
ForceRefreshParent.sys.mjs 2259
gtest
gzip_redirect_worker.js 329
header_checker.sjs 309
hello.html 116
importscript.sjs 358
importscript_worker.js 1068
install_event_error_worker.js 201
install_event_worker.js 61
intercepted_channel_process_swap_worker.js 139
isolated
lazy_worker.js 169
lorem_script.js 467
match_all_advanced_worker.js 130
match_all_client
match_all_client_id_worker.js 685
match_all_clients
match_all_properties_worker.js 675
match_all_worker.js 191
message_posting_worker.js 206
message_receiver.html 136
mochitest-common.toml 12435
mochitest-dFPI.toml 335
mochitest.toml 1385
navigationPreload_page.html 18
network_with_utils.html 264
nofetch_handler_worker.js 429
notification
notification_constructor_error.js 30
notification_get_sw.js 0
notification_openWindow_worker.js 785
notificationclick-otherwindow.html Bug 1114554 - controlled page 809
notificationclick.html Bug 1114554 - controlled page 646
notificationclick.js 654
notificationclick_focus.html Bug 1144660 - controlled page 666
notificationclick_focus.js 1364
notificationclose.html Bug 1265841 - controlled page 890
notificationclose.js 872
notify_loaded.js 42
onmessageerror_worker.js 1221
opaque_intercept_worker.js 998
open_window
openWindow_worker.js 5068
page_post_controlled.html 617
parse_error_worker.js 41
performance
pref
redirect.sjs 181
redirect_post.sjs 1094
redirect_serviceworker.sjs 205
register_https.html 446
sanitize
sanitize_worker.js 130
scope
script_file_upload.js eslint-env mozilla/chrome-script 508
self_update_worker.sjs 1186
server_file_upload.sjs 659
service_worker.js 268
service_worker_client.html controlled page 678
serviceworker.html 211
serviceworker_not_sharedworker.js 430
serviceworker_wrapper.js 2339
serviceworkerinfo_iframe.html 693
serviceworkermanager_iframe.html 913
serviceworkerregistrationinfo_iframe.html 772
sharedWorker_fetch.js 862
simple_fetch_worker.js 379
simpleregister
skip_waiting_installed_worker.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 192
skip_waiting_scope
source_message_posting_worker.js 436
storage_recovery_worker.sjs 705
streamfilter_server.sjs 213
streamfilter_worker.js 244
strict_mode_warning.js 86
sw_bad_mime_type.js 25
sw_bad_mime_type.js^headers^ 25
sw_clients
sw_file_upload.js 394
sw_respondwith_serviceworker.js 555
sw_storage_not_allow.js 1017
sw_with_navigationPreload.js 719
swa
test_abrupt_completion.html 4815
test_async_waituntil.html Test for Bug 1263304 2895
test_bad_script_cache.html Test updating a service worker with a bad script cache. 3192
test_bug1151916.html Bug 1151916 - Test principal is set on cached serviceworkers 2641
test_bug1240436.html Test for encoding of service workers 1017
test_bug1408734.html Bug 1408734 1614
test_claim.html Bug 1130684 - Test service worker clients claim onactivate 5418
test_claim_oninstall.html Bug 1130684 - Test service worker clients.claim oninstall 2326
test_controller.html Bug 1002570 - test controller instance. 2389
test_cookie_fetch.html Bug 1331680 - test access to cookies in the documents synthesized from service worker responses 2400
test_cross_origin_url_after_redirect.html Test access to a cross origin Request.url property from a service worker for a redirected intercepted iframe 1631
test_csp_upgrade-insecure_intercept.html Test that a CSP upgraded request can be intercepted by a service worker 2019
test_devtools_bypass_serviceworker.html Verify devtools can utilize nsIChannel::LOAD_BYPASS_SERVICE_WORKER to bypass the service worker 3303
test_devtools_track_serviceworker_time.html Bug 1251238 - track service worker install time 6977
test_empty_serviceworker.html Test that registering an empty service worker works 1304
test_enabled_pref.html Bug 1645054 - test dom.serviceWorkers.enabled preference 1434
test_error_reporting.html Test Error Reporting of Service Worker Failures 8396
test_escapedSlashes.html Test for escaped slashes in navigator.serviceWorker.register 2564
test_eval_allowed.html Bug 1160458 - CSP activated by default in Service Workers 1387
test_eval_allowed.html^headers^ 131
test_event_listener_leaks.html Bug 1447871 - Test some service worker leak conditions 1980
test_eventsource_intercept.html Bug 1182103 - Test EventSource scenarios with fetch interception 3583
test_fetch_event.html Bug 94048 - test install event. 2029
test_fetch_event_with_thirdpartypref.html Bug 94048 - test install event. 2586
test_fetch_integrity.html Test fetch.integrity on console report for serviceWorker and sharedWorker 6134
test_file_blob_response.html Bug 1253777 - Test interception using file blob response body 2259
test_file_blob_upload.html Bug 1203680 - Test interception of file blob uploads 4350
test_file_upload.html Bug 1424701 - Test for service worker + file upload 2065
test_force_refresh.html Bug 982726 - Test service worker post message 3443
test_gzip_redirect.html Bug 982726 - Test service worker post message 2680
test_hsts_upgrade_intercept.html Test that an HSTS upgraded request can be intercepted by a service worker 2460
test_https_fetch.html Bug 1133763 - test fetch event in HTTPS origins 2282
test_https_fetch_cloned_response.html Bug 1133763 - test fetch event in HTTPS origins with a cloned response 1889
test_https_origin_after_redirect.html Test the origin of a redirected response from a service worker 1963
test_https_origin_after_redirect_cached.html Test the origin of a redirected response from a service worker 1970
test_https_synth_fetch_from_cached_sw.html Bug 1156847 - test fetch event generating a synthesized response in HTTPS origins from a cached SW 2541
test_imagecache.html Bug 1202085 - Test that images from different controllers don't cached together 1898
test_imagecache_max_age.html Test that the image cache respects a synthesized image's Cache headers 2551
test_importscript.html Test service worker - script cache policy 2168
test_importscript_mixedcontent.html Bug 1198078 - test that we respect mixed content blocking in importScript() inside service workers 1899
test_install_event.html Bug 94048 - test install event. 5215
test_install_event_gc.html Test install event being GC'd before waitUntil fulfills 4471
test_installation_simple.html Bug 930348 - test stub Navigator ServiceWorker utilities. 7347
test_match_all.html Bug 982726 - test match_all not crashing 2348
test_match_all_advanced.html Bug 982726 - Test matchAll with multiple clients 2882
test_match_all_client_id.html Bug 1058311 - Test matchAll client id 2593
test_match_all_client_properties.html Bug 1058311 - Test matchAll clients properties 2693
test_navigationPreload_disable_crash.html Failure to create a Promise shouldn't crash 1847
test_navigator.html Bug 930348 - test stub Navigator ServiceWorker utilities. 1593
test_nofetch_handler.html Test for Bugs 1181127 and 1325101 1976
test_not_intercept_plugin.html Bug 1187766 - Test loading plugins scenarios with fetch interception. 2090
test_notification_constructor_error.html Bug XXXXXXX - Check that Notification constructor throws in ServiceWorkerGlobalScope 1724
test_notification_get.html ServiceWorkerRegistration.getNotifications() on main thread and worker thread. 4893
test_notification_openWindow.html Bug 1578070 3234
test_notificationclick-otherwindow.html Bug 1114554 - Test ServiceWorkerGlobalScope.notificationclick event. 2117
test_notificationclick.html Bug 1114554 - Test ServiceWorkerGlobalScope.notificationclick event. 2170
test_notificationclick_focus.html Bug 1144660 - Test client.focus() permissions on notification click 2140
test_notificationclose.html Bug 1265841 - Test ServiceWorkerGlobalScope.notificationclose event. 2198
test_onmessageerror.html Test onmessageerror event handlers 4282
test_opaque_intercept.html Bug 982726 - Test service worker post message 2992
test_openWindow.html Bug 1172870 - Test clients.openWindow 3454
test_origin_after_redirect.html Test the origin of a redirected response from a service worker 1924
test_origin_after_redirect_cached.html Test the origin of a redirected response from a service worker 1931
test_origin_after_redirect_to_https.html Test the origin of a redirected response from a service worker 1891
test_origin_after_redirect_to_https_cached.html Test the origin of a redirected response from a service worker 1898
test_post_message.html Bug 982726 - Test service worker post message 2372
test_post_message_advanced.html Bug 982726 - Test service worker post message advanced 3318
test_post_message_source.html Bug 1142015 - Test service worker post message source 1866
test_privateBrowsing.html Test for ServiceWorker - Private Browsing 2912
test_register_base.html Test that registering a service worker uses the docuemnt URI for the secure origin check 1039
test_register_https_in_http.html Bug 1172948 - Test that registering a service worker from inside an HTTPS iframe embedded in an HTTP iframe doesn't work 1259
test_sandbox_intercept.html Bug 1142727 - Test that sandboxed iframes are not intercepted 1870
test_sanitize.html Bug 1080109 - Clear ServiceWorker registrations for all domains 2660
test_sanitize_domain.html Bug 1080109 - Clear ServiceWorker registrations for specific domains 2985
test_scopes.html Bug 984048 - Test scope glob matching. 4720
test_script_loader_intercepted_js_cache.html Test for saving and loading bytecode in/from the necko cache 9546
test_self_update_worker.html Test for Bug 1432846 5008
test_service_worker_allowed.html Test the Service-Worker-Allowed header 2444
test_serviceworker.html Bug 1137245 - Allow IndexedDB usage in ServiceWorkers 2104
test_serviceworker_header.html Test that service worker scripts are fetched with a Service-Worker: script header 1311
test_serviceworker_interfaces.html Validate Interfaces Exposed to Service Workers 3608
test_serviceworker_interfaces.js eslint-disable mozilla/no-comparison-or-assignment-inside-ok 22094
test_serviceworker_not_sharedworker.html Bug 1141274 - test that service workers and shared workers are separate 2189
test_serviceworkerinfo.xhtml 3958
test_serviceworkermanager.xhtml 2752
test_serviceworkerregistrationinfo.xhtml 6741
test_skip_waiting.html Bug 1131352 - Add ServiceWorkerGlobalScope skipWaiting() 2467
test_streamfilter.html Test StreamFilter-monitored responses for ServiceWorker-intercepted requests 6416
test_strict_mode_warning.html Bug 1170550 - test registration of service worker scripts with a strict mode warning 1166
test_third_party_iframes.html Bug 1152899 - Disallow the interception of third-party iframes using service workers when the third-party cookie preference is set 7225
test_unregister.html Bug 984048 - Test unregister 3690
test_unresolved_fetch_interception.html Test for Bug 1188545 3814
test_worker_reference_gc_timeout.html Test for Bug 1317266 2273
test_workerUnregister.html Bug 982728 - Test ServiceWorkerGlobalScope.unregister 2398
test_workerUpdate.html Bug 1065366 - Test ServiceWorkerGlobalScope.update 1787
test_workerupdatefoundevent.html Bug 1131327 - Test ServiceWorkerRegistration.onupdatefound on ServiceWorker 2560
test_xslt.html Bug 1182113 - Test service worker XSLT interception 3195
thirdparty
unregister
unresolved_fetch_worker.js 501
update_worker.sjs " + Date.now() + " 468
updatefoundevent.html Bug 1131327 - Test ServiceWorkerRegistration.onupdatefound on ServiceWorker 319
utils.js Helper for browser tests to issue register calls from the content global and wait for the SW to progress to the active state, as most tests desire. From the ContentTask.spawn, use via `content.wrappedJSObject.registerAndWaitForActive`. 4118
window_party_iframes.html 342
worker.js 33
worker_unregister.js 420
worker_update.js 709
worker_updatefoundevent.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 553
worker_updatefoundevent2.js 15
worker2.js 14
worker3.js 14
workerUpdate
xslt
xslt_worker.js 1560