fix(ext/node): improve worker_threads path validation and error handling#32791
Merged
bartlomieju merged 3 commits intodenoland:mainfrom Mar 18, 2026
Merged
Conversation
- Allow .\ and ..\ (Windows backslash) in worker path validation - Use correct native error constructor (SyntaxError, TypeError, etc.) for worker error events so err.constructor matches - Fix spec tests to use new URL() instead of import.meta.resolve() string for Worker specifiers - Enable test-worker-syntax-error.js and test-worker-syntax-error-file.js Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ERR_WORKER_PATHerror class for proper Node.js-compatible path validation inworker_threads.Workerfile://,data:,http://,https://) withERR_WORKER_PATH(must usenew URL())./or../(or.\/..\on Windows)ERR_INVALID_URL_SCHEMEfor URL objects with non-file/data protocolseval: truerequires a string specifier, not a URL objectSyntaxError,TypeError, etc.) on worker error events soerr.constructormatchesnew URL()instead ofimport.meta.resolve()stringsNewly passing Node.js compat tests
test-worker-unsupported-path.jstest-worker-unsupported-eval-on-url.mjstest-worker-syntax-error.jstest-worker-syntax-error-file.jsTest plan
message_portandmessage_port_transferspec tests pass🤖 Generated with Claude Code