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

lib: make structuredClone spec compliant #40251

Closed
wants to merge 1 commit into from

Conversation

VoltrexKeyva
Copy link
Member

Fixes: #40246

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Sep 29, 2021
@targos
Copy link
Member

targos commented Sep 29, 2021

It would be nice to have a WPT for this.

@targos
Copy link
Member

targos commented Sep 29, 2021

BTW, I'm not sure we should throw an error, but instead just grab transfer from the passed object and create a new options object with it.

@VoltrexKeyva
Copy link
Member Author

BTW, I'm not sure we should throw an error, but instead just grab transfer from the passed object and create a new options object with it.

We mostly just throw an error if the passed value is not spec complaint in most cases, throwing an error here would be nice for keeping consistency unless there's a special case where we have to avoid throwing an error.

@targos
Copy link
Member

targos commented Sep 29, 2021

What's important here is not consistency, but spec compliance. The spec just asks to pass options["transfer"]. Maybe I'm wrong, but I understand that it should not be an error to do this:

const options = [];
options.transfer = [toTransfer];
structuredClone({}, options);

@targos
Copy link
Member

targos commented Sep 29, 2021

Do we have a WHATWG spec specialist that we could ping to take a look?

@aduh95
Copy link
Contributor

aduh95 commented Sep 29, 2021

Maybe @surma would be available to review this, since they are the one who proposed this API to WHATWG.

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 3, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2021
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 3, 2021
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2021

Landed in 6199441...3d11baf

@github-actions github-actions bot closed this Oct 3, 2021
nodejs-github-bot pushed a commit that referenced this pull request Oct 3, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@VoltrexKeyva VoltrexKeyva deleted the fix-structuredclone branch October 3, 2021 15:25
danielleadams pushed a commit that referenced this pull request Oct 4, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 4, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid globalThis.structuredClone interface
7 participants