Title: Example snippet does not behave like it should · Issue #60504 · nodejs/node · GitHub
Open Graph Title: Example snippet does not behave like it should · Issue #60504 · nodejs/node
X Title: Example snippet does not behave like it should · Issue #60504 · nodejs/node
Description: Affected URL(s) https://nodejs.org/api/worker_threads.html#considerations-when-cloning-objects-with-prototypes-classes-and-accessors Description of the problem The following code is supposed to print {}: const { port1, port2 } = new Mess...
Open Graph Description: Affected URL(s) https://nodejs.org/api/worker_threads.html#considerations-when-cloning-objects-with-prototypes-classes-and-accessors Description of the problem The following code is supposed to pri...
X Description: Affected URL(s) https://nodejs.org/api/worker_threads.html#considerations-when-cloning-objects-with-prototypes-classes-and-accessors Description of the problem The following code is supposed to pri...
Opengraph URL: https://github.com/nodejs/node/issues/60504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Example snippet does not behave like it should","articleBody":"### Affected URL(s)\n\nhttps://nodejs.org/api/worker_threads.html#considerations-when-cloning-objects-with-prototypes-classes-and-accessors\n\n### Description of the problem\n\nThe following code is supposed to print `{}`:\n```js\nconst { port1, port2 } = new MessageChannel();\n\nport1.onmessage = ({ data }) =\u003e console.log(data);\n\nport2.postMessage(new URL('https://example.org'));\n\n// Prints: { } \n```\nHowever, when running it, it gives the following:\n```\nnode:internal/per_context/domexception:76\n const self = new Error();\n ^\n\nDOMException [DataCloneError]: Cannot clone object of unsupported type.\n at new DOMException (node:internal/per_context/domexception:76:18)\n at file:///my-folder-structure/test.mjs:6:7\n at ModuleJob.run (node:internal/modules/esm/module_job:377:25)\n at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:691:26)\n at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)\n```","author":{"url":"https://github.com/davidebombelli","@type":"Person","name":"davidebombelli"},"datePublished":"2025-10-31T00:49:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/60504/node/issues/60504"}
| 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:5fd3eb21-4fd6-b8f2-5f47-6844979af809 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 91E8:37D99:12E4046:1A385FA:6A4CAD6C |
| html-safe-nonce | 574cded05d62854e8e87d0535c79cc36332d5d24567d414aa96f4606643f2912 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUU4OjM3RDk5OjEyRTQwNDY6MUEzODVGQTo2QTRDQUQ2QyIsInZpc2l0b3JfaWQiOiIxNTkxOTEwMzE5ODcyODQ3MjEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9a59c6edb24e81e17a5f08c57ba8eedd549b13a6b10181bb274e0cdb62b2e76b |
| hovercard-subject-tag | issue:3572985347 |
| 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/60504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc57968c8571fe72bbd7be200b6d7b7a6c46dcccecc3c364ddbc1db8a83a133a/nodejs/node/issues/60504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc57968c8571fe72bbd7be200b6d7b7a6c46dcccecc3c364ddbc1db8a83a133a/nodejs/node/issues/60504 |
| og:image:alt | Affected URL(s) https://nodejs.org/api/worker_threads.html#considerations-when-cloning-objects-with-prototypes-classes-and-accessors Description of the problem The following code is supposed to pri... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidebombelli |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| 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 | ae90d426644ca15e89bacceb72e51f4e9dbf85f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width