How to add hooks to getProperty and setProperty?

In SpiderMonkey 1.8.5, I can add hooks to “JSClass.getProperty” and “JSClass.setProperty”.

However these callbacks are removed in SpiderMonkey 115.12.

Is is possible to get the same result?

The best way to achieve this is with a JS proxy object

Define a C++ proxy handler class that inherits from js::ForwardingProxyHandler and override the traps you care about (eg get/set/defineProperty). Then use JS::NewProxyObject to create a new object with this handler.