Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add features and assign more keys for workers (and add a workers group) #2665

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion features/audio-worklet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: AudioWorklet
description: The `AudioWorklet` API runs module code in a separate thread, specifically for non-blocking, low latency audio processing.
spec: https://webaudio.github.io/web-audio-api/#AudioWorklet
group: web-audio
group:
- web-audio
- workers
compat_features:
- api.AudioWorklet
- api.AudioWorkletGlobalScope
Expand All @@ -18,3 +20,6 @@ compat_features:
- api.AudioWorkletProcessor.AudioWorkletProcessor
- api.AudioWorkletProcessor.port
- api.BaseAudioContext.audioWorklet
- api.Worklet
- api.Worklet.addModule
- api.WorkletGlobalScope
15 changes: 15 additions & 0 deletions features/audio-worklet.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ compat_features:
- api.AudioWorkletProcessor.AudioWorkletProcessor
- api.AudioWorkletProcessor.port

# baseline: high
# baseline_low_date: 2021-04-26
# baseline_high_date: 2023-10-26
# support:
# chrome: "65"
# chrome_android: "65"
# edge: "79"
# firefox: "76"
# firefox_android: "79"
# safari: "14.1"
# safari_ios: "14.5"
- api.Worklet
- api.Worklet.addModule
- api.WorkletGlobalScope

# ⬇️ Same status as overall feature ⬇️
# baseline: high
# baseline_low_date: 2021-04-26
Expand Down
39 changes: 39 additions & 0 deletions features/dedicated-workers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Dedicated workers
description: The `Worker()` constructor runs a script in its own thread, which can send and receive messages with the script that created it. Also known as web workers.
spec: https://html.spec.whatwg.org/multipage/workers.html#workers
caniuse: webworkers
group: workers
status:
compute_from: api.WorkerGlobalScope.importScripts
compat_features:
- api.DedicatedWorkerGlobalScope
- api.DedicatedWorkerGlobalScope.close
- api.DedicatedWorkerGlobalScope.name
- api.Worker
- api.Worker.Worker
- api.Worker.Worker.mime_checks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a process/decision-making question: I noticed that only close and name are included for DedicatedWorkerGlobalScope, why only those two? Is there something unique about them that the other properties don't have?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case, it seems to be because the other BCD keys under api.DedicatedWorkerGlobalScope are already assigned to other features.
If you open https://web-platform-dx.github.io/web-features-explorer/ids/, you'll see the entire list of features, together with their BCD keys. On that page, you can do a search for "api.DedicatedWorkerGlobalScope".
You'll see that api.DedicatedWorkerGlobalScope.message_event and api.DedicatedWorkerGlobalScope.postMessage, for example, are already part of the postmessage feature.
Currently, in web-features, a given BCD key can only be part of one feature at most. This is something we might change in the future.

You're asking a good question though. I don't think there's a super clear way to answer whether those BCD keys should be in postmessage, or in dedicated-workers.

- api.Worker.Worker.options_name_parameter
- api.Worker.error_event
- api.Worker.terminate
- api.Worker.worker_support
- api.WorkerGlobalScope
- api.WorkerGlobalScope.error_event
- api.WorkerGlobalScope.importScripts
- api.WorkerGlobalScope.importScripts.mime_checks
- api.WorkerGlobalScope.location
- api.WorkerGlobalScope.navigator
- api.WorkerGlobalScope.rejectionhandled_event
- api.WorkerGlobalScope.self
- api.WorkerGlobalScope.unhandledrejection_event
- api.WorkerLocation
- api.WorkerLocation.hash
- api.WorkerLocation.host
- api.WorkerLocation.hostname
- api.WorkerLocation.href
- api.WorkerLocation.origin
- api.WorkerLocation.pathname
- api.WorkerLocation.port
- api.WorkerLocation.protocol
- api.WorkerLocation.search
- api.WorkerLocation.toString
- api.WorkerNavigator
166 changes: 166 additions & 0 deletions features/dedicated-workers.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Generated from: dedicated-workers.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: high
baseline_low_date: 2015-07-29
baseline_high_date: 2018-01-29
support:
chrome: "4"
chrome_android: "18"
edge: "12"
firefox: "4"
firefox_android: "4"
safari: "4"
safari_ios: "5"
compat_features:
# baseline: high
# baseline_low_date: 2015-07-29
# baseline_high_date: 2018-01-29
# support:
# chrome: "2"
# chrome_android: "18"
# edge: "12"
# firefox: "3.5"
# firefox_android: "4"
# safari: "4"
# safari_ios: "5"
- api.Worker
- api.Worker.terminate

# baseline: high
# baseline_low_date: 2015-07-29
# baseline_high_date: 2018-01-29
# support:
# chrome: "4"
# chrome_android: "18"
# edge: "12"
# firefox: "3.5"
# firefox_android: "4"
# safari: "4"
# safari_ios: "5"
- api.DedicatedWorkerGlobalScope
- api.DedicatedWorkerGlobalScope.close
- api.Worker.Worker
- api.Worker.error_event
- api.WorkerGlobalScope
- api.WorkerGlobalScope.error_event
- api.WorkerGlobalScope.location
- api.WorkerLocation
- api.WorkerLocation.hash
- api.WorkerLocation.host
- api.WorkerLocation.hostname
- api.WorkerLocation.href
- api.WorkerLocation.pathname
- api.WorkerLocation.port
- api.WorkerLocation.protocol
- api.WorkerLocation.search
- api.WorkerLocation.toString
- api.WorkerNavigator

# baseline: high
# baseline_low_date: 2015-07-29
# baseline_high_date: 2018-01-29
# support:
# chrome: "4"
# chrome_android: "18"
# edge: "12"
# firefox: "3.5"
# firefox_android: "34"
# safari: "4"
# safari_ios: "5"
- api.WorkerGlobalScope.self

# ⬇️ Same status as overall feature ⬇️
# baseline: high
# baseline_low_date: 2015-07-29
# baseline_high_date: 2018-01-29
# support:
# chrome: "4"
# chrome_android: "18"
# edge: "12"
# firefox: "4"
# firefox_android: "4"
# safari: "4"
# safari_ios: "5"
- api.WorkerGlobalScope.importScripts

# baseline: high
# baseline_low_date: 2016-09-20
# baseline_high_date: 2019-03-20
# support:
# chrome: "38"
# chrome_android: "38"
# edge: "14"
# firefox: "29"
# firefox_android: "29"
# safari: "10"
# safari_ios: "10"
- api.WorkerLocation.origin

# baseline: high
# baseline_low_date: 2018-04-30
# baseline_high_date: 2020-10-30
# support:
# chrome: "4"
# chrome_android: "18"
# edge: "17"
# firefox: "3.5"
# firefox_android: "4"
# safari: "4"
# safari_ios: "5"
- api.WorkerGlobalScope.navigator

# baseline: high
# baseline_low_date: 2019-03-25
# baseline_high_date: 2021-09-25
# support:
# chrome: "70"
# chrome_android: "70"
# edge: "18"
# firefox: "55"
# firefox_android: "55"
# safari: "12.1"
# safari_ios: "12.2"
- api.DedicatedWorkerGlobalScope.name
- api.Worker.Worker.options_name_parameter

# baseline: high
# baseline_low_date: 2020-07-28
# baseline_high_date: 2023-01-28
# support:
# chrome: "49"
# chrome_android: "49"
# edge: "79"
# firefox: "69"
# firefox_android: "79"
# safari: "11"
# safari_ios: "11"
- api.WorkerGlobalScope.rejectionhandled_event
- api.WorkerGlobalScope.unhandledrejection_event

# baseline: low
# baseline_low_date: 2022-09-12
# support:
# chrome: "71"
# chrome_android: "71"
# edge: "79"
# firefox: "67"
# firefox_android: "67"
# safari: "16"
# safari_ios: "16"
- api.WorkerGlobalScope.importScripts.mime_checks

# baseline: false
# support:
# firefox: "81"
# firefox_android: "81"
# safari: "16"
# safari_ios: "16"
- api.Worker.Worker.mime_checks

# baseline: false
# support:
# firefox: "34"
# firefox_android: "34"
- api.Worker.worker_support
4 changes: 3 additions & 1 deletion features/js-modules-service-workers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: JavaScript modules in service workers
description: 'The `navigator.serviceWorker.register()` method accepts `{ type: "module" }` to load scripts that use `import` and `export`. Also known as ECMAScript modules or ESM in service workers.'
spec: https://w3c.github.io/ServiceWorker/#dom-registrationoptions-type
group: js-modules
group:
- js-modules
- workers
4 changes: 3 additions & 1 deletion features/js-modules-shared-workers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: JavaScript modules in shared workers
description: 'The `SharedWorker()` constructor accepts `{ type: "module" }` to load scripts that use `import` and `export`. Also known as ECMAScript modules or ESM in shared workers.'
spec: https://html.spec.whatwg.org/multipage/workers.html#shared-workers-and-the-sharedworker-interface:dom-sharedworker-2
group: js-modules
group:
- js-modules
- workers
4 changes: 3 additions & 1 deletion features/js-modules-workers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: JavaScript modules in workers
description: 'The `Worker()` constructor accepts `{ type: "module" }` to load scripts that use `import` and `export`. Also known as ECMAScript modules or ESM in workers.'
spec: https://html.spec.whatwg.org/multipage/workers.html#dom-worker-dev
group: js-modules
group:
- js-modules
- workers
1 change: 1 addition & 0 deletions features/js-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ status:
- javascript.statements.export
- javascript.statements.import
compat_features:
- api.Worklet.ecmascript_modules
- html.elements.script.nomodule
- html.elements.script.type.module
- javascript.statements.export
Expand Down
12 changes: 12 additions & 0 deletions features/js-modules.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ compat_features:
# safari_ios: "16.4"
- javascript.operators.import_meta.resolve

# baseline: low
# baseline_low_date: 2023-06-06
# support:
# chrome: "80"
# chrome_android: "80"
# edge: "80"
# firefox: "114"
# firefox_android: "114"
# safari: "15"
# safari_ios: "15"
- api.Worklet.ecmascript_modules

# baseline: false
# support:
# chrome: "123"
Expand Down
12 changes: 12 additions & 0 deletions features/messageerror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@ spec:
- https://html.spec.whatwg.org/multipage/indices.html#event-messageerror
- https://w3c.github.io/ServiceWorker/#eventdef-serviceworkerglobalscope-messageerror
group: messaging
status:
compute_from:
- api.DedicatedWorkerGlobalScope.messageerror_event
- api.MessagePort.messageerror_event
- api.ServiceWorkerContainer.messageerror_event
- api.Window.messageerror_event
compat_features:
- api.DedicatedWorkerGlobalScope.messageerror_event
- api.MessagePort.messageerror_event
- api.ServiceWorkerContainer.messageerror_event
- api.Window.messageerror_event
- api.Worker.messageerror_event

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are errors separated into their own feature instead of with their parent features?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question too. I don't know how these features came to be. The guiding principle for features should always be: does this feature make sense, individually, to web developers? Is this something they talk about separately from other things? Is this perceived as an incremental addition to the platform?

I'm not super convinced that this feature should exist on its own to be honest, but I don't have the context. Maybe the guiding principle I mentioned before applies here. I just don't know enough to be sure.

One other aspect to keep in mind is that, over time, as features mature and get baseline high, it makes less and less sense for them to live on their own. That's why we're working on a mechanism to merge features. Maybe messageerror makes sense now, but in a few years from now, we might want to merge it into a bigger parent feature. By then, it's likely that developers won't think of messageerror as a separate thing anymore.

8 changes: 8 additions & 0 deletions features/messageerror.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ compat_features:
# safari: "16.4"
# safari_ios: "16.4"
- api.ServiceWorkerContainer.messageerror_event

# baseline: false
# support:
# firefox: "57"
# firefox_android: "57"
# safari: "16.4"
# safari_ios: "16.4"
- api.Worker.messageerror_event
1 change: 1 addition & 0 deletions features/request-animation-frame-workers.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: requestAnimationFrame() in workers
description: The `requestAnimationFrame()` method in workers schedules a function that runs before the next repaint. Together with offscreen canvas, you can animate content from a worker.
spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames
group: workers
2 changes: 1 addition & 1 deletion features/service-workers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Service workers
description: The service worker of a website is a script that runs in its own thread and which acts as local proxy that intercepts network requests from the website. Use a service worker to implement advanced caching strategies, offline support, background tasks, or push notification support on your website.
spec: https://w3c.github.io/ServiceWorker/
caniuse: serviceworkers
# Status computed to match Caniuse.
group: workers
status:
compute_from:
- api.ServiceWorkerContainer.register
Expand Down
18 changes: 18 additions & 0 deletions features/shared-workers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Shared worker
description: The `SharedWorker()` constructor runs a script in its own thread, which can send and receive messages with other scripts running at the same origin.
spec: https://html.spec.whatwg.org/multipage/workers.html#shared-workers-introduction
caniuse: sharedworkers
group: workers
status:
compute_from: api.SharedWorker
compat_features:
- api.SharedWorker
- api.SharedWorker.SharedWorker
- api.SharedWorker.SharedWorker.mime_checks
- api.SharedWorker.SharedWorker.options_name_parameter
- api.SharedWorker.error_event
- api.SharedWorker.port
- api.SharedWorkerGlobalScope
- api.SharedWorkerGlobalScope.close
- api.SharedWorkerGlobalScope.connect_event
- api.SharedWorkerGlobalScope.name
Loading