-
Notifications
You must be signed in to change notification settings - Fork 86
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 shared worker support #3345
Conversation
223ea6f
to
7beccb6
Compare
@kainino0x The file
I believe the error comes from the existing code below as dynamic import is not supported in the context of a service worker (unlike shared and dedicated worker): export class DefaultTestFileLoader extends TestFileLoader {
async listing(suite: string): Promise<TestSuiteListing> {
return ((await import(`../../${suite}/listing.js`)) as ListingFile).listing;
}
import(path: string): Promise<SpecFile> {
return import(`../../${path}`);
}
} Do you know by any chance how to solve this? |
Ugh, that's an unfortunate limitation. CTS is heavily built around dynamic imports - it's the only way we can run a subset of tests without loading every JS file in the entire repository. In order to work around this, proxying to ServiceWorker probably has to look something like, make one ServiceWorker for each
|
Thank you @kainino0x. I have to admit I'm not sure how to apply your suggestions yet. |
Are you thinking of
I believe* we can use https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/unregister in cleanup stages. |
No, I don't think you can I mean create the worker from a blob from a string: https://web.dev/articles/workers-basics#inline_workers |
I wish I could do that but Chrome throws this error when I create a service worker from a blob URL:
|
@kainino0x Can you think of other ways to properly test service worker support in the CTS? |
We could:
|
I don't know how to apply this suggestion sadly. Could you provide detailed instructions? Or a similar example in the CTS? |
Sorry, I haven't had time this week because I'll be out next week. I have opened a draft PR which hopefully does the annoying build configuration stuff for you. #3415 |
5a708a6
to
edd088f
Compare
Got it. I've updated this PR for Shared Worker support only. |
a2041b0
to
d4a925c
Compare
Do we need all the tests to run in a ServiceWorker? I feel like maybe we only need to test that you can create a device and you can do a few basic things (run a render pass, run a compute pass, create a buffer, texture, ....) We have a basic test for regular workers that runs in the main suite when running in the main thread. Maybe we should just add the same for shared and service workers? src/webgpu/web_platform/worker/worker.spec.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Basic tests for shared workers (in this PR) and service workers are available in http://localhost:8080/standalone/?q=webgpu:web_platform,worker,worker:* |
@greggman Please merge if it looks good to you. |
d4a925c
to
4641deb
Compare
This reverts commit cdb6b22. This is an attempt to fix issues we're seeing when rolling the CTS into Dawn.
This reverts commit 55e6eea. Attempting to land this again to see if it causes any infra issues when rolled into Chromium.
Spec PR: gpuweb/gpuweb#4465
Requirements for PR author:
.unimplemented()
./** documented */
and new helper files are found inhelper_index.txt
.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.