servo/tests/wpt/web-platform-tests/workers
2019-04-20 01:07:12 -04:00
..
baseurl Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d 2018-07-18 22:07:44 +00:00
constructors Update web-platform-tests to revision 122a4672fa0dc554a6e7528fa3487fd907c792ee 2019-03-23 23:57:08 -04:00
examples Update web-platform-tests to revision a589fd30bc64bb4d40e1d6854e07accca69b8472 2019-01-18 22:11:13 -05:00
interfaces Update web-platform-tests to revision 122a4672fa0dc554a6e7528fa3487fd907c792ee 2019-03-23 23:57:08 -04:00
modules Update web-platform-tests to revision 4657e102531b29ebfbf73b547693288c51c8b8c0 2019-04-20 01:07:12 -04:00
non-automated Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
semantics Update web-platform-tests to revision 122a4672fa0dc554a6e7528fa3487fd907c792ee 2019-03-23 23:57:08 -04:00
support Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
data-url-shared-window.html Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317 2018-01-09 12:52:27 -05:00
data-url-shared.html Update web-platform-tests to revision 3678c44dfe811f93a796285e9531ee34d7d15682 2018-02-27 22:03:50 -05:00
data-url.html Update web-platform-tests to revision 0fe9f012a8ee5503b728a379705a6c5286ba1e96 2018-02-23 21:56:20 -05:00
dedicated-worker-from-blob-url.window.js Update web-platform-tests to revision a8fb1792cbfab3ed59401775da76fb6c15d9f2e2 2018-11-23 15:48:00 -05:00
importscripts_mime.any.js Update web-platform-tests to revision 4984b190341b535c645729b8f99247aace0022fe 2018-12-17 22:27:33 -05:00
interfaces.worker.js Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326 2017-10-12 12:36:21 -04:00
META.yml Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d 2018-07-18 22:07:44 +00:00
name-property.html Update web-platform-tests to revision cf261625e2d230ab219eec966f4abe26e3401b64 2018-05-29 23:08:06 -04:00
nested_worker.worker.js Update web-platform-tests to revision cf261625e2d230ab219eec966f4abe26e3401b64 2018-05-29 23:08:06 -04:00
nested_worker_close_from_parent_worker.html Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7 2018-06-22 22:44:39 -04:00
nested_worker_close_self.worker.js Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7 2018-06-22 22:44:39 -04:00
nested_worker_importScripts.worker.js Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7 2018-06-22 22:44:39 -04:00
nested_worker_sync_xhr.worker.js Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7 2018-06-22 22:44:39 -04:00
nested_worker_terminate_from_document.html Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7 2018-06-22 22:44:39 -04:00
opaque-origin.html Update web-platform-tests to revision 1829a42c93e435937db68c8a842fa9b56dd39dc2 2018-05-30 22:50:35 -04:00
postMessage_clone_port.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
postMessage_clone_port_error.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
postMessage_DataCloneErr.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
postMessage_event_properties.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
postMessage_ports_readonly_array.htm Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326 2017-10-12 12:36:21 -04:00
postMessage_target_source.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
README.md Update web-platform-tests to revision a589fd30bc64bb4d40e1d6854e07accca69b8472 2019-01-18 22:11:13 -05:00
shared-worker-from-blob-url.window.js Update web-platform-tests to revision a8fb1792cbfab3ed59401775da76fb6c15d9f2e2 2018-11-23 15:48:00 -05:00
shared-worker-name-via-options.html Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d 2017-10-05 00:42:13 +02:00
SharedWorker-constructor.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker-exception-propagation.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker-exception.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker-MessageEvent-source.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker-replace-EventHandler.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker-script-error.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker-simple.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
SharedWorker_blobUrl.html Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534 2017-02-20 13:52:41 +01:00
SharedWorker_dataUrl.html Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317 2018-01-09 12:52:27 -05:00
SharedWorkerPerformanceNow.html Update web-platform-tests to revision c26470dac73f2df9d4822a0d3482f7eb1ebf57d9 2018-01-16 17:18:09 +01:00
Worker-base64.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-call.worker.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-constructor-proto.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-custom-event.any.js Update web-platform-tests to revision b7a8b84debb42268ea95a45bdad8f727d1facdf7 2019-03-21 23:44:37 -04:00
Worker-formdata.any.js Update web-platform-tests to revision b7a8b84debb42268ea95a45bdad8f727d1facdf7 2019-03-21 23:44:37 -04:00
Worker-location.sub.any.js Update web-platform-tests to revision 0f0b7a7e353421b600ee555bf354d3a98bb603ae 2019-02-01 22:58:23 -05:00
Worker-messageport.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker-multi-port.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker-nested-importScripts-error.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
worker-performance.worker.js Update web-platform-tests to revision c26470dac73f2df9d4822a0d3482f7eb1ebf57d9 2018-01-16 17:18:09 +01:00
Worker-replace-event-handler.any.js Update web-platform-tests to revision b7a8b84debb42268ea95a45bdad8f727d1facdf7 2019-03-21 23:44:37 -04:00
Worker-replace-global-constructor.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-replace-self.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-simultaneous-errors.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-structure-message.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker-terminate-forever.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker-termination-with-port-messages.html Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
Worker-timeout-cancel-order.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker-timeout-decreasing-order.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker-timeout-increasing-order.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
Worker_basic.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
Worker_cross_origin_security_err.htm Update web-platform-tests to revision 122a4672fa0dc554a6e7528fa3487fd907c792ee 2019-03-23 23:57:08 -04:00
Worker_dispatchEvent_ErrorEvent.htm Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326 2017-10-12 12:36:21 -04:00
Worker_ErrorEvent_bubbles_cancelable.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
Worker_ErrorEvent_error.htm Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d 2017-10-05 00:42:13 +02:00
Worker_ErrorEvent_filename.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
Worker_ErrorEvent_lineno.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
Worker_ErrorEvent_message.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
Worker_ErrorEvent_type.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
Worker_NosniffErr.htm Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534 2017-02-20 13:52:41 +01:00
Worker_script_mimetype.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
Worker_terminate_event_queue.htm Update web-platform-tests to revision 41a7d8732d8e5c65728c153d29a34fe9d5192b29 2015-05-14 13:03:25 +01:00
WorkerGlobalScope-close.html Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851 2019-03-06 22:39:43 -05:00
WorkerGlobalScope_ErrorEvent_colno.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
WorkerGlobalScope_ErrorEvent_filename.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
WorkerGlobalScope_ErrorEvent_lineno.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
WorkerGlobalScope_ErrorEvent_message.htm Allow uncaught exceptions in worker runtime error tests. 2016-09-09 09:01:56 +02:00
WorkerGlobalScope_importScripts.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerGlobalScope_importScripts_NetworkErr.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerGlobalScope_importScripts_NosniffErr.htm Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534 2017-02-20 13:52:41 +01:00
WorkerGlobalScope_requestAnimationFrame.tentative.worker.js Update web-platform-tests to revision 848ceffad26e92d47ffe790ed8b650906b2c2343 2018-08-10 14:45:43 -04:00
WorkerGlobalScope_setInterval.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerGlobalScope_setTimeout.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation-origin.sub.window.js Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326 2017-10-12 12:36:21 -04:00
WorkerLocation.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_hash.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_hash_encoding.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_hash_nonexist.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_host.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_hostname.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_href.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_pathname.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_port.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_protocol.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_search.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_search_empty.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_search_fragment.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerLocation_search_nonexist.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerNavigator-hardware-concurrency.any.js Update web-platform-tests to revision b7a8b84debb42268ea95a45bdad8f727d1facdf7 2019-03-21 23:44:37 -04:00
WorkerNavigator.any.js Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e 2019-01-30 22:39:55 -05:00
WorkerNavigator_appName.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerNavigator_appVersion.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerNavigator_onLine.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerNavigator_platform.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerNavigator_userAgent.htm Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255 2015-04-03 23:28:54 +01:00
WorkerPerformanceNow.html Update web-platform-tests to revision c26470dac73f2df9d4822a0d3482f7eb1ebf57d9 2018-01-16 17:18:09 +01:00

Worker WPT tests

These are the workers (Worker, SharedWorker) tests for the Web workers chapter of the HTML Standard.

See also testharness.js API > Web Workers.

Writing *.any.js

The easiest and most recommended way to write tests for workers is to create .any.js-style tests.

Official doc: WPT > File Name Flags > Test Features.

  • Standard testharness.js-style can be used (and is enforced).
  • The same test can be run on window and many types of workers.
  • All glue code are automatically generated.
  • No need to care about how to create and communicate with each type of workers, thanks to fetch_tests_from_worker in testharness.js.

Converting existing tests into .any.js-style also has benefits:

  • Multiple tests can be merged into one.
  • Tests written for window can be run on workers with a very low development cost.

How to write tests

If you write testharness.js-based tests in foo.any.js and specify types of workers to be tested, the test can run on any of dedicated, shared and service workers.

See examples/general.any.js for example.

Even for testing specific features in a specific type of workers (e.g. shared worker's onconnect), .any.js-style tests can be used.

See examples/onconnect.any.js for example.

How to debug tests

Whether each individual test passed or failed, and its assertion failures (if any) are all reported in the final results.

console.log() might not appear in the test results and thus might not be useful for printf debugging. For example, in Chromium, this message

  • Appears (in stderr) on a window or a dedicated worker, but
  • Does NOT appear on a shared worker or a service worker.

How it works

.any.js-style tests use fetch_tests_from_worker functionality of testharness.js.

The WPT test server generates necessary glue code (including generated Document HTML and worker top-level scripts). See serve.py for the actual glue code.

Note that .any.js file is not the worker top-level script, and currently we cannot set response headers to the worker top-level script, e.g. to set Referrer Policy of the workers.

Writing *.worker.js

Similar to .any.js, you can also write .worker.js for tests only for dedicated workers. Almost the same as .any.js, except for the things listed below.

Official doc: WPT > File Name Flags > Test Features.

How to write tests

You have to write two things manually (which is generated in .any.js tests):

  • importScripts("/resources/testharness.js"); at the beginning.
  • done(); at the bottom.

Note: Even if you write async_test() or promise_test(), this global done() is always needed (this is different from async_test's done()) for dedicated workers and shared workers. See official doc: testharness.js API > Determining when all tests are complete.

See examples/general.worker.js for example.

How it works

.worker.js-style tests also use fetch_tests_from_worker functionality of testharness.js.

The WPT test server generates glue code in Document HTML-side, but not for worker top-level scripts. This is why you have to manually write importScripts() etc. See serve.py for the actual glue code.

Unlike *.any.js cases, the *.worker.js is the worker top-level script.

Using fetch_tests_from_worker

If you need more flexibility, writing tests using fetch_tests_from_worker is the way to go. For example, when

  • Additional processing is needed on the parent Document.
  • Workers should be created in a specific way.
  • You are writing non-WPT tests using testharness.js.

You have to write the main HTMLs and the worker scripts, but most of the glue code needed for running tests on workers are provided by fetch_tests_from_worker.

How to write tests

See

  • examples/fetch_tests_from_worker.html and examples/fetch_tests_from_worker.js.

Writing the whole tests manually

If fetch_tests_from_worker isn't suitable for your specific case (which should be rare but might be still possible), you have to write the whole tests, including the main Document HTML, worker scripts, and message passing code between them.

TODO: Supply the templates for writing this kind of tests.