-
Notifications
You must be signed in to change notification settings - Fork 5.8k
refactor: define DOMException in Rust #31197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c15ec87
a9ceb01
426a522
8558d1d
7bbff3e
8a64b5a
35b782b
d7cd4f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ use std::sync::Arc; | |||||||
| pub use blob::BlobError; | ||||||||
| pub use compression::CompressionError; | ||||||||
| use deno_core::ByteString; | ||||||||
| use deno_core::GarbageCollected; | ||||||||
| use deno_core::ToJsBuffer; | ||||||||
| use deno_core::U16String; | ||||||||
| use deno_core::op2; | ||||||||
|
|
@@ -112,6 +113,9 @@ deno_core::extension!(deno_web, | |||||||
| urlpattern::op_urlpattern_process_match_input, | ||||||||
| console::op_preview_entries, | ||||||||
| ], | ||||||||
| objects = [ | ||||||||
| DOMException | ||||||||
| ], | ||||||||
| esm = [ | ||||||||
| "00_infra.js", | ||||||||
| "01_dom_exception.js", | ||||||||
|
|
@@ -452,3 +456,116 @@ fn op_encoding_encode_into_fast( | |||||||
| } | ||||||||
|
|
||||||||
| pub struct Location(pub Url); | ||||||||
|
|
||||||||
| pub struct DOMException { | ||||||||
| message: String, | ||||||||
| name: String, | ||||||||
| code: u32, | ||||||||
| } | ||||||||
|
|
||||||||
| // SAFETY: we're sure this can be GCed | ||||||||
| unsafe impl GarbageCollected for DOMException { | ||||||||
| fn trace(&self, _visitor: &mut deno_core::v8::cppgc::Visitor) {} | ||||||||
|
|
||||||||
| fn get_name(&self) -> &'static std::ffi::CStr { | ||||||||
| c"DOMException" | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| // Defined in WebIDL 4.3. | ||||||||
| // https://webidl.spec.whatwg.org/#idl-DOMException | ||||||||
| const INDEX_SIZE_ERR: u32 = 1; | ||||||||
| const HIERARCHY_REQUEST_ERR: u32 = 3; | ||||||||
| const WRONG_DOCUMENT_ERR: u32 = 4; | ||||||||
| const INVALID_CHARACTER_ERR: u32 = 5; | ||||||||
|
||||||||
| const INVALID_CHARACTER_ERR: u32 = 5; | |
| const INVALID_CHARACTER_ERR: u32 = 5; | |
| const NO_DATA_ALLOWED_ERR: u32 = 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brocacho its unused in rust
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant VALIDATION_ERR = 16 is missing from the Rust implementation but is present in the JavaScript constants (line 47 of 01_dom_exception.js). This inconsistency could lead to issues if this error code is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant
DOMSTRING_SIZE_ERR = 2is missing from the Rust implementation but is present in the JavaScript constants (line 33 of 01_dom_exception.js). This inconsistency could lead to issues if this error code is needed.