deno
cca89e6d - fix(ext/node): improve worker_threads path validation and error handling (#32791)

Commit
195 days ago
fix(ext/node): improve worker_threads path validation and error handling (#32791) ## Summary - Implement `ERR_WORKER_PATH` error class for proper Node.js-compatible path validation in `worker_threads.Worker` - Reject string URL specifiers (`file://`, `data:`, `http://`, `https://`) with `ERR_WORKER_PATH` (must use `new URL()`) - Reject relative paths that don't start with `./` or `../` (or `.\`/`..\` on Windows) - Throw `ERR_INVALID_URL_SCHEME` for URL objects with non-file/data protocols - Validate `eval: true` requires a string specifier, not a URL object - Preserve native error constructor (`SyntaxError`, `TypeError`, etc.) on worker error events so `err.constructor` matches - Fix spec tests to use `new URL()` instead of `import.meta.resolve()` strings ## Newly passing Node.js compat tests - `test-worker-unsupported-path.js` - `test-worker-unsupported-eval-on-url.mjs` - `test-worker-syntax-error.js` - `test-worker-syntax-error-file.js` --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Parents
Loading