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

feat: add all File WPTs #1687

Merged
merged 1 commit into from Oct 7, 2022
Merged

feat: add all File WPTs #1687

merged 1 commit into from Oct 7, 2022

Conversation

KhafraDev
Copy link
Member

  • Fixes bug when using boxed primitives, for example: new File([new String('bits')], 'dummy')
  • Fixes bug where null/undefined values would try to be converted to a webidl dictionary, causing an error.

After this I don't think there's any reason not to make File a global in node?

+95 tests, no failures. All test files are from https://github.com/web-platform-tests/wpt/tree/master/FileAPI/file

p.s. sorry for all the PRs lately

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina
Copy link
Member

mcollina commented Oct 6, 2022

After this I don't think there's any reason not to make File a global in node?

No, let's do it.

@KhafraDev
Copy link
Member Author

if it is made a global, should FileReader also be implemented?

@mcollina
Copy link
Member

mcollina commented Oct 7, 2022

I think we should implement that interface anyway.

@mcollina mcollina merged commit eead2b8 into nodejs:main Oct 7, 2022
@KhafraDev KhafraDev deleted the add-file-wpts branch October 7, 2022 19:43
@jimmywarting
Copy link
Contributor

I don't think the FileReader is necessary. We have read methods on the blob itself

I consider it to be kind of legacy now

@KhafraDev
Copy link
Member Author

I think adding it is good for the same reason that btoa and atob were added: browser (& deno) compatibility. It was insanely easy to implement too.

It also allows us to enable the idlharness for File (the alternative is disabling ~100 tests) which allowed me to find 2 minor bugs in the File implementation. It also prevents regressions in the future, which is great.

metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
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.

None yet

3 participants