Skip to content

Fixes and improvements for proxy and reflect#19

Open
duonglaiquang wants to merge 4 commits intoHtmlUnit:masterfrom
duonglaiquang:duong_reflect_and_proxy
Open

Fixes and improvements for proxy and reflect#19
duonglaiquang wants to merge 4 commits intoHtmlUnit:masterfrom
duonglaiquang:duong_reflect_and_proxy

Conversation

@duonglaiquang
Copy link

@duonglaiquang duonglaiquang commented Mar 17, 2026

This PR does the following

Fix multiple issues in NativeProxy and NativeReflect.

1. NativeProxy: fix set trap not passing receiver object

put(String, ...), put(int, ...), put(Symbol, ...) now pass this (the proxy) as the 4th argument to the set trap.

2. NativeReflect: fix Reflect.construct() with LambdaConstructor

Reflect.construct used ctorBaseFunction.call() to invoke the target, but LambdaConstructor targets can be non-callable as they only support .construct() which would result in a TypeError when called.

Now we check if it's callable or constructable to decide what to do.

3. NativeReflect: re-implement Reflect.get() and Reflect.set() following official spec

The old implementation of Reflect.get and Reflect.set ignored the optional receiver parameter entirely.

@duonglaiquang duonglaiquang changed the title Fix and improvement for proxy and reflect Fixes and improvements for proxy and reflect Mar 17, 2026
@duonglaiquang duonglaiquang force-pushed the duong_reflect_and_proxy branch from 26c8bb5 to da44309 Compare March 17, 2026 05:07
@rbri
Copy link
Member

rbri commented Mar 18, 2026

Thanks a lot, but this requires some time, something for the weekend ;-)

@rbri
Copy link
Member

rbri commented Mar 22, 2026

first pr is on the way mozilla#2347

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.

2 participants