src: support (de)serialization of `DOMException` by jazelly · Pull Request #57372 · nodejs/node · GitHub
Skip to content

src: support (de)serialization of DOMException#57372

Closed
jazelly wants to merge 1 commit into
nodejs:mainfrom
jazelly:serialize-dom-exception
Closed

src: support (de)serialization of DOMException#57372
jazelly wants to merge 1 commit into
nodejs:mainfrom
jazelly:serialize-dom-exception

Conversation

@jazelly

@jazelly jazelly commented Mar 8, 2025

Copy link
Copy Markdown
Member

Added serialization and deserialization support for DOMException. Ideally we shouldn't do this in native, but since it's compiled before an Environment exists, we cannot mark it as kCloneable and provide associated serialization methods in JS land.

Fixes: #49181

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Mar 8, 2025
@jazelly jazelly force-pushed the serialize-dom-exception branch 2 times, most recently from c73bc7f to b039fee Compare March 8, 2025 03:12
@codecov

codecov Bot commented Mar 8, 2025

Copy link
Copy Markdown

@jazelly jazelly force-pushed the serialize-dom-exception branch 2 times, most recently from 0aec3cf to 96f824c Compare March 8, 2025 08:42
@jazelly jazelly requested review from addaleax and legendecas March 9, 2025 07:34
@jazelly jazelly added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 9, 2025
@jazelly jazelly requested a review from joyeecheung March 9, 2025 21:21
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 9, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@legendecas legendecas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Private symbols are per-isolate data and initialized before an Environment is created (in IsolateData). It does not depend on an Environment. Yet, it needs a bit of refactor on the NewContext and GetPerContextExports so that InitializePrimordials can access the private symbols.

Comment thread src/node_messaging.cc Outdated
Comment thread src/node_messaging.cc Outdated
Comment thread src/node_messaging.cc Outdated
Comment thread src/node_messaging.cc Outdated
@jazelly jazelly force-pushed the serialize-dom-exception branch from 947742c to ee1dacf Compare March 10, 2025 13:12
@jazelly jazelly marked this pull request as draft March 10, 2025 13:20
@jazelly

jazelly commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

Yet, it needs a bit of refactor on the NewContext and GetPerContextExports so that InitializePrimordials can access the private symbols

IIUC, we need to pass isolate_data into these so that we can get private symbols and other symbols without env

@jazelly jazelly force-pushed the serialize-dom-exception branch from 440dcd7 to cded81b Compare March 14, 2025 12:08
constructor(message = '', options = 'Error') {
ErrorCaptureStackTrace(this);

this[is_dom_exception] = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use class property syntax to set this using [[Define]] semantics?

class DOMException {
	[is_dom_exception] = true;

	constructor(message = '', options = 'Error') {
		...
	}
}

@jazelly jazelly force-pushed the serialize-dom-exception branch from cded81b to 2ec57d7 Compare March 15, 2025 06:02
@jazelly

jazelly commented Mar 15, 2025

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stucturedClone defective for DataCloneError

5 participants