Title: url: href setter converts its value before validating the receiver · Issue #67344 · nodejs/node · GitHub
Open Graph Title: url: href setter converts its value before validating the receiver · Issue #67344 · nodejs/node
X Title: url: href setter converts its value before validating the receiver · Issue #67344 · nodejs/node
Description: This issue was drafted with the help of LLMs (Claude and Codex); I reviewed it and verified the reproductions. Version v26.13.0. Also reproduced on v20.20.2, v22.23.4 and v24.22.2. Platform macOS 26.7, Darwin 25.6.0, arm64 Subsystem url ...
Open Graph Description: This issue was drafted with the help of LLMs (Claude and Codex); I reviewed it and verified the reproductions. Version v26.13.0. Also reproduced on v20.20.2, v22.23.4 and v24.22.2. Platform macOS 2...
X Description: This issue was drafted with the help of LLMs (Claude and Codex); I reviewed it and verified the reproductions. Version v26.13.0. Also reproduced on v20.20.2, v22.23.4 and v24.22.2. Platform macOS 2...
Opengraph URL: https://github.com/nodejs/node/issues/67344
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"url: href setter converts its value before validating the receiver","articleBody":"> This issue was drafted with the help of LLMs (Claude and Codex); I reviewed it and verified the reproductions.\n\n### Version\n\nv26.13.0. Also reproduced on v20.20.2, v22.23.4 and v24.22.2.\n\n### Platform\n\nmacOS 26.7, Darwin 25.6.0, arm64\n\n### Subsystem\n\nurl / WHATWG URL\n\n### What steps will reproduce the bug?\n\nRun this directly with Node.js; no dependencies or polyfills are involved:\n\n```js\nconst setHref = Object.getOwnPropertyDescriptor(URL.prototype, 'href').set;\nlet calls = 0;\n\ntry {\n setHref.call({}, {\n toString() {\n calls++;\n return 'https://example.com/';\n },\n });\n} catch (error) {\n console.log(error.name);\n}\n\nconsole.log(calls);\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways, when calling the `href` setter with an incompatible receiver and a value whose string conversion has an observable side effect.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```text\nTypeError\n0\n```\n\nThe [Web IDL attribute setter algorithm](https://webidl.spec.whatwg.org/#es-attributes) rejects a receiver that does not implement the interface before converting the assigned value to the attribute's IDL type. Therefore, the `toString()` method must not be called here.\n\n### What do you see instead?\n\n```text\nTypeError\n1\n```\n\nThe setter invokes `toString()` and only then rejects the receiver.\n\n### Additional information\n\nTested regression boundary:\n\n| Node.js version | Output |\n|---|---|\n| 17.0.0 | `TypeError`, `0` |\n| 19.9.0 | `TypeError`, `0` |\n| 20.0.0 | `TypeError`, `1` |\n| 20.20.2, 22.23.4, 24.22.2, 26.13.0 | `TypeError`, `1` |\n\nThe conversion was moved before the private-state access in [#47339](https://github.com/nodejs/node/pull/47339). The same order is still present in [this main-branch source snapshot](https://github.com/nodejs/node/blob/82940d6fa5586774b0890574a0ddec7ba5e4fd3f/lib/internal/url.js#L1024): the `href` setter converts the value before accessing `this.#context`, which rejects an incompatible receiver. The runtime results above are from the listed Node.js releases; the main snapshot was inspected separately.\n\nThis regresses the receiver-before-conversion behavior present after [#39752](https://github.com/nodejs/node/pull/39752).\n\nThe same snippet produces the expected output in Chromium 156.0.8078.4, Firefox 157.0 and WebKit 27.2 (Playwright builds), as well as Bun 1.4.4 and Deno 2.9.7.\n","author":{"url":"https://github.com/zloirock","@type":"Person","name":"zloirock"},"datePublished":"2026-11-08T13:20:17Z","url":"https://github.com/nodejs/node/issues/67344"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8bf706cd-31d7-68c6-0ae8-352648a7fa47 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9934:11DCCF:4DD403:660E52:6B061F31 |
| html-safe-nonce | 6e8de820b67ca506a9f60a44a9cdf794f9d6c68cd710bd372f35cfe5fa489ab4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTM0OjExRENDRjo0REQ0MDM6NjYwRTUyOjZCMDYxRjMxIiwidmlzaXRvcl9pZCI6IjIyNDEzMDEwNjg1NzM0NTAwMzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7a924714e8172ebb38c275cb4936368a40702f4c14d14ef7e4692e92e4e7362d |
| hovercard-subject-tag | issue:6271342648 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67344/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9356fe2a912ac5c6237028393f291bba18c9bfe0f87a7b0880759e71661524bc/nodejs/node/issues/67344 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9356fe2a912ac5c6237028393f291bba18c9bfe0f87a7b0880759e71661524bc/nodejs/node/issues/67344 |
| og:image:alt | This issue was drafted with the help of LLMs (Claude and Codex); I reviewed it and verified the reproductions. Version v26.13.0. Also reproduced on v20.20.2, v22.23.4 and v24.22.2. Platform macOS 2... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zloirock |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b25c3080e84402f75431d8dc7a96b2635219cec7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width