servo/tests/wpt/web-platform-tests/workers
2023-05-14 01:39:34 +00:00
..
baseurl Update web-platform-tests to revision 4af6af604800559d2c58cf3561621ae43e28aaa8 2020-06-16 10:58:22 +00:00
constructors Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
examples Update web-platform-tests to revision b'51407aaa3d17aa440f6807caef5e390dc779087a' 2021-02-25 09:47:00 +00:00
interfaces Update web-platform-tests to revision b'1d9b01e2fad6af3a057d571b1e088e15fa9bc8e6' 2023-04-07 01:30:49 +00:00
modules Update web-platform-tests to revision b'c9946198c9ee19db3b4974a388fae45da844a94a' 2023-05-14 01:39:34 +00:00
multi-globals Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440' 2022-01-17 16:30:29 +09:00
non-automated Update web-platform-tests to revision b'ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4' 2022-01-20 20:57:54 +09:00
semantics Update web-platform-tests to revision b'5656a2f4653b5894c500b724778009ca9a26e48c' 2022-12-23 01:34:56 +00:00
support Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
abrupt-completion.html Update web-platform-tests to revision 993a932dca2b378a44dc55f4ee80812f65d8fb4e 2020-02-20 13:37:42 +00: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 90e1ee27eede63cf117f19c1e55553cc1881aef0 2019-09-27 13:51:36 +00:00
dedicated-worker-in-data-url-context.window.js Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
dedicated-worker-parse-error-failure.html Update web-platform-tests to revision 84f93271efe15a4e37fed477a2ad364f8659a0f8 2020-04-23 11:17:32 +00:00
importscripts_mime.any.js Update web-platform-tests to revision b'b6f6bf16fe6069aed53d28af86a79b8ff4963844' 2023-02-15 01:39:03 +00:00
importscripts_mime_local.any.js Update web-platform-tests to revision b'b6f6bf16fe6069aed53d28af86a79b8ff4963844' 2023-02-15 01:39:03 +00: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_block.https.html Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
postMessage_block.https.html.headers Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
postMessage_clone_port.htm
postMessage_clone_port_error.htm Update web-platform-tests to revision e1edaa3dd1bea4415ee88e042affee32028d7f1d 2020-01-26 11:15:02 +00:00
postMessage_DataCloneErr.htm
postMessage_event_properties.htm
postMessage_ports_readonly_array.htm Update web-platform-tests to revision e1edaa3dd1bea4415ee88e042affee32028d7f1d 2020-01-26 11:15:02 +00:00
postMessage_target_source.htm
README.md Update web-platform-tests to revision d75cd4df6722acef7224eb6edcdc52b125680dad 2019-08-28 15:09:15 +00:00
same-origin-check.sub.html Update web-platform-tests to revision b'7af9d6ec48ab04043a2bea85a3599904a1a19efa' 2021-02-21 11:31:07 -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-in-data-url-context.window.js Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
shared-worker-name-via-options.html Update web-platform-tests to revision cbd8c8ca929bc1aea71087be3b826cf1ee189a52 2019-10-28 14:07:02 +00:00
shared-worker-options-mismatch.html Update web-platform-tests to revision ac16628eb7eb601957382053011363d2bcf8ce44 2020-02-17 11:33:33 +00:00
shared-worker-parse-error-failure.html Update web-platform-tests to revision 10adbd6b133f1ccf77a27ed51ffd3e7a00a499ee 2020-03-24 11:01:51 +00:00
shared-worker-partitioned.tentative.html Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
SharedWorker-constructor.html Update web-platform-tests to revision 55351d32dd26ea3ad42a8f5973e943ba0342c812 2020-01-28 11:11:32 +00:00
SharedWorker-detach-frame-in-error-event.html Update web-platform-tests to revision e426a6933a05bf144eba06a1d4c47ba876a4e2d1 2019-05-22 14:00:10 +00: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 289272c280086dda4bce0d31f2ce0fc1e7a08fa8 2021-02-03 11:17:49 +00:00
SharedWorker-replace-EventHandler.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00: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 281f62f2d8ffe72128d848851ac1e8d823f608f6 2020-09-23 10:40:47 +00:00
Worker-base64.any.js Update web-platform-tests to revision 281f62f2d8ffe72128d848851ac1e8d823f608f6 2020-09-23 10:40:47 +00: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 289272c280086dda4bce0d31f2ce0fc1e7a08fa8 2021-02-03 11:17:49 +00:00
Worker-custom-event.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
Worker-formdata.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
Worker-location.sub.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00: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 55351d32dd26ea3ad42a8f5973e943ba0342c812 2020-01-28 11:11:32 +00:00
Worker-nested-importScripts-error.html Prevent the error from triggering a page error in Worker-nested-importScripts-error 2019-06-12 10:15:52 +02: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 d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
Worker-replace-global-constructor.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
Worker-replace-self.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
worker-request-animation-frame.html Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00: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-during-evaluation.html Update web-platform-tests to revision 9a1a27e665e531a65b28f4f589ae3cb66381da5f 2020-12-22 10:55:56 +00: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
Worker_cross_origin_security_err.htm Update web-platform-tests to revision e1edaa3dd1bea4415ee88e042affee32028d7f1d 2020-01-26 11:15:02 +00:00
Worker_dispatchEvent_ErrorEvent.htm Update web-platform-tests to revision b'a3cb53d786edfd9106825e312866624150382075' 2023-04-23 01:36:19 +00: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 b'3ee7ccc2abbbc8d8f6efbb45f80bffdb3c0c76ba' 2023-03-11 01:46:58 +00:00
Worker_terminate_event_queue.htm Update web-platform-tests to revision c12517985bca8a3fafd1d3f4f78df75ea4ea79cf 2020-11-19 10:59:58 +00:00
WorkerGlobalScope-close.html Update web-platform-tests to revision fa41b43ac93bc2fdc2427a4378dc3754d483cdda 2019-12-10 11:06:32 +00: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
WorkerGlobalScope_importScripts_NetworkErr.htm
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
WorkerGlobalScope_setTimeout.htm
WorkerLocation-origin.sub.window.js Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326 2017-10-12 12:36:21 -04:00
WorkerLocation.htm
WorkerLocation_hash.htm
WorkerLocation_hash_encoding.htm
WorkerLocation_hash_nonexist.htm
WorkerLocation_host.htm
WorkerLocation_hostname.htm
WorkerLocation_href.htm
WorkerLocation_pathname.htm
WorkerLocation_port.htm
WorkerLocation_protocol.htm
WorkerLocation_search.htm
WorkerLocation_search_empty.htm
WorkerLocation_search_fragment.htm
WorkerLocation_search_nonexist.htm
WorkerNavigator-hardware-concurrency.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
WorkerNavigator.any.js Update web-platform-tests to revision d9ff48a8babff036c1f9d5285ec0dc55609bebb8 2020-04-29 11:14:24 +00:00
WorkerNavigator_appName.htm
WorkerNavigator_appVersion.htm
WorkerNavigator_onLine.htm
WorkerNavigator_platform.htm
WorkerNavigator_userAgent.htm
WorkerNavigator_userAgentData.http.html Update web-platform-tests to revision 78eae724c61bb01d858a01a324363e997ac66851 2020-04-25 11:14:57 +00:00
WorkerNavigator_userAgentData.https.html Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
WorkerPerformanceNow.html Update web-platform-tests to revision 281f62f2d8ffe72128d848851ac1e8d823f608f6 2020-09-23 10:40:47 +00: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.

Note that because workers are defined in the HTML Standard, the idlharness.js tests are in /html/dom instead of here.

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.