Skip to content

Conversation

@littledivy
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings November 6, 2025 13:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the DOMException implementation from JavaScript to Rust using the cppgc (C++ garbage collection) API. The goal is to improve performance by moving the core implementation to native code while maintaining compatibility with the existing JavaScript API.

  • Moved DOMException struct and implementation to Rust using deno_core::cppgc
  • Implemented native constructor and getters for message, name, and code properties
  • Removed JavaScript class implementation in favor of prototype extensions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
ext/web/lib.rs Added DOMException struct with cppgc implementation, constructor, and getters; registered as extension object
ext/web/01_dom_exception.js Removed JavaScript class implementation; imported native DOMException and added custom inspect method to prototype
Comments suppressed due to low confidence (1)

ext/web/01_dom_exception.js:28

  • These symbol constants are no longer used after migrating to the Rust implementation. They should be removed to avoid dead code.
const _name = Symbol("name");
const _message = Symbol("message");
const _code = Symbol("code");

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ext/web/lib.rs Outdated
#[constructor]
fn new<'s>(
scope: &'s mut v8::PinScope<'_, '_>,
#[varargs] args: Option<&v8::FunctionCallbackArguments>,
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The args parameter is declared but never used in the constructor function. If this parameter is not needed for the implementation, it should be removed. If it's intended for future use or required by the macro, consider adding a comment explaining its purpose.

Suggested change
#[varargs] args: Option<&v8::FunctionCallbackArguments>,

Copilot uses AI. Check for mistakes.

// Defined in WebIDL 4.3.
// https://webidl.spec.whatwg.org/#idl-DOMException
const INDEX_SIZE_ERR: u32 = 1;
Copy link

Copilot AI Nov 6, 2025

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 = 2 is 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.

Suggested change
const INDEX_SIZE_ERR: u32 = 1;
const INDEX_SIZE_ERR: u32 = 1;
const DOMSTRING_SIZE_ERR: u32 = 2;

Copilot uses AI. Check for mistakes.
const INDEX_SIZE_ERR: u32 = 1;
const HIERARCHY_REQUEST_ERR: u32 = 3;
const WRONG_DOCUMENT_ERR: u32 = 4;
const INVALID_CHARACTER_ERR: u32 = 5;
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The constant NO_DATA_ALLOWED_ERR = 6 is missing from the Rust implementation but is present in the JavaScript constants (line 37 of 01_dom_exception.js). This inconsistency could lead to issues if this error code is needed.

Suggested change
const INVALID_CHARACTER_ERR: u32 = 5;
const INVALID_CHARACTER_ERR: u32 = 5;
const NO_DATA_ALLOWED_ERR: u32 = 6;

Copilot uses AI. Check for mistakes.
Copy link
Member Author

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

Comment on lines +489 to +490
const INVALID_ACCESS_ERR: u32 = 15;
const TYPE_MISMATCH_ERR: u32 = 17;
Copy link

Copilot AI Nov 6, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant