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

WPT: Add dom/abortsignal tests #3436

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

WPT: Add dom/abortsignal tests #3436

wants to merge 2 commits into from

Conversation

npaun
Copy link
Member

@npaun npaun commented Jan 29, 2025

Enables tests from the dom/abortsignal module from WPT.

The following features were added to the harness to support these tests:

  • The Test class, including step, step_func, step_timeout, step_func_done and done
  • The async_test test type

@npaun npaun requested review from jasnell and anonrig January 29, 2025 23:14
@npaun npaun requested review from a team as code owners January 29, 2025 23:14
},
'event.any.js': {
comment: 'Target should be set to signal',
expectedFailures: ['the abort event should have the right properties'],
Copy link
Member Author

Choose a reason for hiding this comment

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

The event has target = undefined and currentTarget = signal. I'm not sure if I'm doing something wrong in the harness or if we have a bug.

expectedFailures: [
'AbortSignal.any() follows a single signal (using AbortController)',
'AbortSignal.any() follows multiple signals (using AbortController)',
'Abort events for AbortSignal.any() signals fire in the right order (using AbortController)',
Copy link
Member Author

Choose a reason for hiding this comment

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

@npaun
Copy link
Member Author

npaun commented Jan 29, 2025

@anonrig

Bad news: I have a Windows build failure too now.
Good news: It'll be convenient for me to fix it now that it's on my own branch lol.

@jasnell
Copy link
Member

jasnell commented Jan 29, 2025

Great work, will review tomorrow.

build/wpt_modules.bzl Outdated Show resolved Hide resolved

[filegroup(
name = dir,
srcs = glob(["{}/**/*".format(dir)]),
visibility = ["//visibility:public"],
) for dir in directories]
) for dir in wpt_get_directories("dom")]
Copy link
Member

Choose a reason for hiding this comment

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

Why does this only mentions "dom"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to have a hierarchy under dom because having one huge dom-test.ts seems hard to work with. So this creates a dom/ directory so we can have dom/abort-test.ts. dom is the only module that I'm breaking out so far. But we'll see if we need a different hierarchy as we enable more modules.

Copy link
Member

Choose a reason for hiding this comment

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

I mean previously this was checking all directories. Right now it's checking only for dom?

src/workerd/api/wpt/dom/abort-test.ts Show resolved Hide resolved
src/workerd/api/wpt/url-test.ts Outdated Show resolved Hide resolved
src/workerd/api/wpt/dom/abort-test.ts Outdated Show resolved Hide resolved
src/wpt/harness.ts Outdated Show resolved Hide resolved
Comment on lines +449 to +445
if (testCase.error) {
globalThis.errors.push(testCase.error);
}
Copy link
Member

Choose a reason for hiding this comment

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

line 438 and 449 does the same exact thing. doesn't this duplicate the errors?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah this is a bit messy. I'll try to rework this.

Comment on lines +438 to +434
if (testCase.error) {
globalThis.errors.push(testCase.error);
}
Copy link
Member

Choose a reason for hiding this comment

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

How can a test you just created can have an error property?

Copy link
Member Author

Choose a reason for hiding this comment

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

The function passed to promise_test needs to return a Promise but is not required to be an async function, so if some exception is thrown before it returns the Promise that exception would be caught immediately in step.

Copy link
Member

Choose a reason for hiding this comment

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

Can you add this as a comment?

src/wpt/harness.ts Show resolved Hide resolved
src/wpt/harness.ts Outdated Show resolved Hide resolved
@npaun npaun force-pushed the dom/abort-signal branch 2 times, most recently from f8068f9 to c6c1c3b Compare January 30, 2025 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants