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

Don't attempt to structure clone unsupported types with workers disabled #13658

Merged
merged 1 commit into from
Jul 3, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

Please refer to https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm

Based on that information, and manually testing our code, the implementation in cloneValue has the following shortcomings:

  • Attempting to clone functions is only prevented when they're part of an Object, but is currently allowed when they occur standalone.
  • Cloning of Symbols is currently not prevented, which it should be since the native structured clone algorithm throws.
  • Any disallowed types should be checked first, to reduce the risk of future changes accidentally allowing something that shouldn't be supported.

Please refer to https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm

Based on that information, and manually testing our code, the implementation in `cloneValue` has the following shortcomings:
 - Attempting to clone `function`s is only prevented when they're part of an Object, but is currently allowed when they occur standalone.
 - Cloning of `Symbol`s is currently not prevented, which it should be since the native structured clone algorithm throws.
 - Any disallowed types should be checked first, to reduce the risk of future changes accidentally allowing something that shouldn't be supported.
@Snuffleupagus
Copy link
Collaborator Author

Given that only the Node.js tests, as run by e.g. GitHub Actions, actually trigger these code-paths running the full test-suite seem mostly like a waste of time.

/botio unittest

@pdfjsbot
Copy link

pdfjsbot commented Jul 3, 2021

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 1

Live output at: http://3.101.106.178:8877/b51ce2ae3362df7/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 3, 2021

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 1

Live output at: http://54.67.70.0:8877/b68cb40d28e6fb3/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 3, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/b68cb40d28e6fb3/output.txt

Total script time: 3.95 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Jul 3, 2021

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/b51ce2ae3362df7/output.txt

Total script time: 5.42 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit f9d506c into mozilla:master Jul 3, 2021
@timvandermeij
Copy link
Contributor

Looks good!

@Snuffleupagus Snuffleupagus deleted the cloneValue branch July 3, 2021 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants