-
Notifications
You must be signed in to change notification settings - Fork 5k
[browser] JSObject.GetPropertyAsJSObject on prototypes is not consistent #110716
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
Comments
Tagging subscribers to 'arch-wasm': @lewing |
cc @pavelsavara |
This is because Try EventTarget["test"]=1
console.log(Window["test"]) We are setting js_handle into marshaled objects in order to keep the identity. runtime/src/mono/browser/runtime/gc-handles.ts Lines 83 to 85 in b6a8764
|
Maybe we should not cache the @maraf thoughts ? |
@miroljub1995 why are you marshaling those prototypes ? What's the use-case ? |
I started to build some library that holds reference of constructors and noticed this issue after 24 hours of debugging the problem 😅 |
Description
In
dotnet new wasmbrowser
template I have really weird situation withJSObject.GetPropertyAsJSObject
where the order of calls makes different output.When I execute
JSHost.GlobalThis.GetPropertyAsJSObject("Window")
alone, it works great, but if I execute it after I executeJSHost.GlobalThis.GetPropertyAsJSObject("EventTarget")
, looks like it returns theEventTarget
instead ofWindow
.Reproduction Steps
Here is a minimal change to template. Just replace
Program.cs
with the following:With this output it prints
...got True
, but if we flip the variablestemp1
andtemp2
, like the following, it prints...got False
:Expected behavior
It should write
...got False
in both cases.Actual behavior
When
JSHost.GlobalThis.GetPropertyAsJSObject("EventTarget")
is executed beforeJSHost.GlobalThis.GetPropertyAsJSObject("Window")
,JSHost.GlobalThis.GetPropertyAsJSObject("Window")
returnsEventTarget
instead ofWindow
constructor.Regression?
No response
Known Workarounds
No response
Configuration
dotnet --info
output:Browser
Chrome Version 131.0.6778.140 (Official Build) (arm64)
Other information
No response
The text was updated successfully, but these errors were encountered: