Skip to content

feat: add all File WPTs#1687

Merged
mcollina merged 1 commit intonodejs:mainfrom
KhafraDev:add-file-wpts
Oct 7, 2022
Merged

feat: add all File WPTs#1687
mcollina merged 1 commit intonodejs:mainfrom
KhafraDev:add-file-wpts

Conversation

@KhafraDev
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

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

@mcollina
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants