gecko-dev/dom/serviceworkers/test
Blake Kaplan 19781c9ae7 Bug 1517406 - Resolve a race between the controlled iframe and the SW. r=asuth
Summary:

This test first creates a service worker and then an iframe. It expects the
iframe's first load to be through the network (and for the page's script to
fail to load). Once the page is set up and controlled by the SW, it reloads it
(a soft reload) and the script load is intercepted by the service worker and
we load a script that calls back into the test. However, there is currently no
guarantee that the service worker won't activate before the iframe load and
end up controlling the first load of the iframe.

With this patch, we delay the service worker's activation until we start
loading the iframe, allowing the first load to always be uncontrolled, thereby
resolving the race.

Reviewers: asuth

Reviewed By: asuth

Bug #: 1517406

Differential Revision: https://phabricator.services.mozilla.com/D15637

--HG--
extra : rebase_source : ff63b131b1a395289cda85ec4b46daa3022b08b4
2019-01-29 15:41:10 -05:00
..
claim_clients
controller
download Bug 1339461 - script-generated patch to convert foo.indexOf(...) == -1 to foo.includes(), r=Mossop. 2018-02-01 20:45:22 +01:00
download_canceled Bug 1436184 - Remove definitions of Ci, Cr, Cc, and Cu from httpd.js and .sjs files. r=florian 2018-02-06 15:03:13 -08:00
eventsource
fetch Bug 1463291: Move docShell getter from Document to Window. r=bz 2018-05-21 16:58:23 -07:00
gtest Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
isolated Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUtils.removeTab (simple part). r=dao 2018-03-19 11:16:45 +09:00
match_all_client
match_all_clients Bug 1446225 - Ensure client id's are consistently {}-less UUIDs. r=catalinb 2018-03-22 11:33:13 -04:00
notification
notification_alt
open_window
sanitize
scope
simpleregister
skip_waiting_scope
sw_clients
swa
thirdparty
unregister
workerUpdate
xslt
.eslintrc.js Bug 1512052 - Add more .eslintrc.js files for test directories. r=mossop 2018-12-11 13:15:08 +00:00
activate_event_error_worker.js
async_waituntil_worker.js
blocking_install_event_worker.js
browser_antitracking_subiframes.js Bug 1499995 - part 3 - Tests for nested iframes controlled by ServiceWorkers, r=ehsan 2018-10-25 10:44:12 +02:00
browser_antitracking.js Bug 1514594: Part 3 - Change ChromeUtils.import API. 2019-01-17 10:18:31 -08:00
browser_base_force_refresh.html
browser_cached_force_refresh.html
browser_devtools_serviceworker_interception.js Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian 2018-02-06 09:36:57 -08:00
browser_download_canceled.js Bug 1514594: Part 3 - Change ChromeUtils.import API. 2019-01-17 10:18:31 -08:00
browser_download.js Bug 1514594: Part 3 - Change ChromeUtils.import API. 2019-01-17 10:18:31 -08:00
browser_force_refresh.js Bug 1485305 - dom/ Ensure loadURI always passes a triggeringPrincipal() r=Nika 2018-08-29 15:47:29 +01:00
browser_storage_permission.js Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUtils.removeTab (simple part). r=dao 2018-03-19 11:16:45 +09:00
browser_storage_recovery.js Bug 1448141 P3 Add a browser chrome test verifying service workers handles its scripts being wiped. r=asuth 2018-04-02 07:50:22 -07:00
browser_unregister_with_containers.js Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUtils.removeTab (simple part). r=dao 2018-03-19 11:16:45 +09:00
browser_userContextId_openWindow.js Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUtils.removeTab (simple part). r=dao 2018-03-19 11:16:45 +09:00
browser.ini Bug 1499995 - part 3 - Tests for nested iframes controlled by ServiceWorkers, r=ehsan 2018-10-25 10:44:12 +02:00
bug1151916_driver.html
bug1151916_worker.js
bug1240436_worker.js
chrome_helpers.js Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian 2018-02-06 09:36:57 -08:00
chrome.ini
claim_oninstall_worker.js
claim_worker_1.js
claim_worker_2.js
close_test.js
console_monitor.js Bug 1514594: Part 3 - Change ChromeUtils.import API. 2019-01-17 10:18:31 -08:00
create_another_sharedWorker.html
empty_with_utils.html Bug 1495285 - browser test to check how ServiceWorkers intercept tracking resources, r=baku 2018-10-03 17:00:36 -04:00
empty.html
empty.js
error_reporting_helpers.js
eval_worker.js
fetch_event_worker.js
fetch.js
file_blob_response_worker.js
file_js_cache_cleanup.js Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian 2018-02-06 09:36:57 -08:00
file_js_cache_save_after_load.html
file_js_cache_save_after_load.js
file_js_cache_syntax_error.html
file_js_cache_syntax_error.js
file_js_cache_with_sri.html
file_js_cache.html
file_js_cache.js
file_userContextId_openWindow.js
force_refresh_browser_worker.js
force_refresh_worker.js
gzip_redirect_worker.js
header_checker.sjs
hello.html
importscript_worker.js Bug 1465670 P4 Fix test_importscript.html to expect spec behavior. r=asuth 2018-06-05 10:49:12 -07:00
importscript.sjs
install_event_error_worker.js
install_event_worker.js
lazy_worker.js
lorem_script.js
match_all_advanced_worker.js
match_all_client_id_worker.js
match_all_properties_worker.js Bug 1446225 - Ensure client id's are consistently {}-less UUIDs. r=catalinb 2018-03-22 11:33:13 -04:00
match_all_worker.js
message_posting_worker.js
message_receiver.html
mochitest.ini Bug 1517406 - Resolve a race between the controlled iframe and the SW. r=asuth 2019-01-29 15:41:10 -05:00
nofetch_handler_worker.js
notification_constructor_error.js
notification_get_sw.js
notificationclick_focus.html
notificationclick_focus.js
notificationclick-otherwindow.html
notificationclick.html
notificationclick.js
notificationclose.html
notificationclose.js
notify_loaded.js
onmessageerror_worker.js Bug 1399446 - implement ServiceWorkerGlobalScope and ServiceWorkerContainer onmessageerror event handlers r=edenchuang,baku 2018-10-22 21:22:25 +00:00
opaque_intercept_worker.js Bug 1517406 - Resolve a race between the controlled iframe and the SW. r=asuth 2019-01-29 15:41:10 -05:00
openWindow_worker.js Bug 1339461 - script-generated patch to convert foo.indexOf(...) == -1 to foo.includes(), r=Mossop. 2018-02-01 20:45:22 +01:00
page_post_controlled.html Bug 1499995 - part 3 - Tests for nested iframes controlled by ServiceWorkers, r=ehsan 2018-10-25 10:44:12 +02:00
parse_error_worker.js
redirect_post.sjs
redirect_serviceworker.sjs
redirect.sjs
register_https.html Bug 1455078: Implement [SecureContext] for ServiceWorkerContainer r=asuth 2018-08-22 15:22:40 +00:00
sanitize_worker.js Bug 1339461 - script-generated patch to convert foo.indexOf(...) == -1 to foo.includes(), r=Mossop. 2018-02-01 20:45:22 +01:00
script_file_upload.js Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian 2018-02-06 09:36:57 -08:00
self_update_worker.sjs Bug 1432846 - Add test for self updating service worker. r=bkelly 2018-03-02 11:40:59 +00:00
server_file_upload.sjs
service_worker_client.html
service_worker.js
serviceworker_not_sharedworker.js
serviceworker_wrapper.js Bug 1506642 - Don't try to test for various Push interfaces on GeckoView r=smaug 2018-12-10 22:19:26 +00:00
serviceworker.html
serviceworkerinfo_iframe.html
serviceworkermanager_iframe.html
serviceworkerregistrationinfo_iframe.html
sharedWorker_fetch.js
skip_waiting_installed_worker.js
source_message_posting_worker.js
storage_recovery_worker.sjs Bug 1448141 P3 Add a browser chrome test verifying service workers handles its scripts being wiped. r=asuth 2018-04-02 07:50:22 -07:00
strict_mode_warning.js
sw_bad_mime_type.js
sw_bad_mime_type.js^headers^
sw_file_upload.js
sw_storage_not_allow.js
test_async_waituntil.html Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian 2018-04-18 11:43:45 -07:00
test_bad_script_cache.html
test_bug1151916.html
test_bug1240436.html
test_bug1408734.html Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian 2018-04-18 11:43:45 -07:00
test_claim_oninstall.html
test_claim.html
test_client_focus.html
test_controller.html
test_cookie_fetch.html
test_cross_origin_url_after_redirect.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_csp_upgrade-insecure_intercept.html
test_devtools_bypass_serviceworker.html Bug 1446940 part 5. Stop getting docshells from windows via getInterface in dom/editor/etc code. r=kmag 2018-08-01 13:07:11 -04:00
test_devtools_track_serviceworker_time.html Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian 2018-02-06 09:36:57 -08:00
test_empty_serviceworker.html
test_error_reporting.html Bug 1354577 - require ServiceWorkerContainer.register() to only accept JavaScript MIME types r=edenchuang 2018-10-29 15:09:40 +00:00
test_escapedSlashes.html
test_eval_allowed.html
test_eval_allowed.html^headers^
test_event_listener_leaks.html Bug 1450358 P0 Factor the event listener runtime leak checking test into a reusable test framework. r=baku 2018-04-04 11:25:42 -07:00
test_eventsource_intercept.html
test_fetch_event_with_thirdpartypref.html Bug 1491939 - Part 4: Enable streams on a per-realm basis. Drop dom.streams.enabled and dom.workers.options.streams; use only javascript.options.streams. r=baku 2018-09-25 14:11:41 +00:00
test_fetch_event.html Bug 1491939 - Part 4: Enable streams on a per-realm basis. Drop dom.streams.enabled and dom.workers.options.streams; use only javascript.options.streams. r=baku 2018-09-25 14:11:41 +00:00
test_fetch_integrity.html Bug 1438945 - Part 5: SharedWorker browser test. r=asuth 2018-11-19 15:18:21 -08:00
test_file_blob_response.html
test_file_blob_upload.html
test_file_upload.html
test_force_refresh.html
test_gzip_redirect.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_hsts_upgrade_intercept.html
test_https_fetch_cloned_response.html
test_https_fetch.html
test_https_origin_after_redirect_cached.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_https_origin_after_redirect.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_https_synth_fetch_from_cached_sw.html
test_imagecache_max_age.html
test_imagecache.html
test_importscript_mixedcontent.html Bug 1499096 - Update tests using ok() to is();r=Standard8 2018-10-23 07:12:23 +00:00
test_importscript.html
test_install_event_gc.html
test_install_event.html
test_installation_simple.html Bug 1455078: Implement [SecureContext] for ServiceWorkerContainer r=asuth 2018-08-22 15:22:40 +00:00
test_match_all_advanced.html
test_match_all_client_id.html
test_match_all_client_properties.html
test_match_all.html
test_navigator.html Bug 1455078: Enable service worker testing in test r=asuth 2018-08-22 13:15:18 +00:00
test_nofetch_handler.html Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian 2018-04-18 11:43:45 -07:00
test_not_intercept_plugin.html Bug 1402892 - Update mochitests related to request.context. r=asuth 2018-04-11 13:23:27 +01:00
test_notification_constructor_error.html
test_notification_get.html
test_notificationclick_focus.html
test_notificationclick-otherwindow.html
test_notificationclick.html
test_notificationclose.html
test_onmessageerror.html Bug 1399446 - implement ServiceWorkerGlobalScope and ServiceWorkerContainer onmessageerror event handlers r=edenchuang,baku 2018-10-22 21:22:25 +00:00
test_opaque_intercept.html Bug 1517406 - Resolve a race between the controlled iframe and the SW. r=asuth 2019-01-29 15:41:10 -05:00
test_openWindow.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_origin_after_redirect_cached.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_origin_after_redirect_to_https_cached.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_origin_after_redirect_to_https.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_origin_after_redirect.html Backed out changeset 7c1aecbca3dd (bug 1498278) for causing leaks at at mozilla::extensions::ChannelWrapper::Get 2018-10-12 23:12:07 +03:00
test_post_message_advanced.html
test_post_message_source.html
test_post_message.html
test_privateBrowsing.html Bug 1514594: Part 3 - Change ChromeUtils.import API. 2019-01-17 10:18:31 -08:00
test_register_base.html Bug 1455078: Implement [SecureContext] for ServiceWorkerContainer r=asuth 2018-08-22 15:22:40 +00:00
test_register_https_in_http.html
test_sandbox_intercept.html
test_sanitize_domain.html Bug 1252998 - StorageActivityService - part 4 - Introduce ServiceWorkerCleanUp.jsm to clean up ServiceWorker data, r=asuth 2018-04-18 18:19:12 +02:00
test_sanitize.html Bug 1499096 - Update tests using ok() to is();r=Standard8 2018-10-23 07:12:23 +00:00
test_scopes.html Bug 1515989 - Fix this test to use the service worker manager in the parent. r=asuth 2018-12-21 21:51:40 +00:00
test_script_loader_intercepted_js_cache.html
test_self_update_worker.html Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian 2018-04-18 11:43:45 -07:00
test_service_worker_allowed.html
test_serviceworker_header.html
test_serviceworker_interfaces.html Bug 1506642 - Don't try to test for various Push interfaces on GeckoView r=smaug 2018-12-10 22:19:26 +00:00
test_serviceworker_interfaces.js Bug 1506642 - Don't try to test for various Push interfaces on GeckoView r=smaug 2018-12-10 22:19:26 +00:00
test_serviceworker_not_sharedworker.html
test_serviceworker.html
test_serviceworkerinfo.xul
test_serviceworkermanager.xul
test_serviceworkerregistrationinfo.xul
test_skip_waiting.html
test_strict_mode_warning.html
test_third_party_iframes.html Bug 1501978 - Part 2: Remove the browser.contentblocking.enabled pref from the tests that set it to true needlessly r=baku 2018-10-30 07:47:56 +00:00
test_unregister.html
test_unresolved_fetch_interception.html Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian 2018-04-18 11:43:45 -07:00
test_worker_reference_gc_timeout.html Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian 2018-04-18 11:43:45 -07:00
test_workerUnregister.html
test_workerUpdate.html
test_workerupdatefoundevent.html Bug 1434599 - Enable test_workerupdatefoundevent.html. r=bkelly 2018-02-02 06:12:00 +02:00
test_xslt.html
unresolved_fetch_worker.js
update_worker.sjs
updatefoundevent.html
utils.js Bug 1499995 - part 3 - Tests for nested iframes controlled by ServiceWorkers, r=ehsan 2018-10-25 10:44:12 +02:00
worker2.js
worker3.js
worker_unregister.js
worker_update.js Bug 1456466 P3 Fix tests to expect ServiceWorkerRegistration.update() to resolve with a registration. r=baku 2018-04-26 13:52:30 -07:00
worker_updatefoundevent2.js
worker_updatefoundevent.js Bug 1434599 - Enable test_workerupdatefoundevent.html. r=bkelly 2018-02-02 06:12:00 +02:00
worker.js
xslt_worker.js