Skip to content

[browser] don't set js_handle for js prototypes #115773

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pavelsavara
Copy link
Member

Fixes #110716

@pavelsavara pavelsavara added this to the 10.0.0 milestone May 20, 2025
@pavelsavara pavelsavara self-assigned this May 20, 2025
@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 10:15
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label May 20, 2025
@pavelsavara pavelsavara requested a review from lewing as a code owner May 20, 2025 10:15
@pavelsavara pavelsavara requested a review from maraf May 20, 2025 10:16
Copy link
Contributor

@Copilot 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 addresses the issue of setting js_handle for JavaScript prototypes in the browser runtime by adding a conditional check in the gc-handles module and corresponding test coverage.

  • Introduces a check in gc-handles.ts to bypass setting the js_handle on JS prototype objects.
  • Adds a new unit test to verify distinct behavior for prototypes.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/mono/browser/runtime/gc-handles.ts Adds a condition to avoid setting cs_owned_js_handle_symbol on JS prototype objects.
src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs Adds a new test to validate that prototypes are handled differently.
Comments suppressed due to low confidence (1)

src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs:23

  • Consider extending the test to also verify that the cs_owned_js_handle_symbol property is not set on prototype objects, ensuring complete coverage of the intended functionality.
[Fact]

Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[browser] JSObject.GetPropertyAsJSObject on prototypes is not consistent
1 participant