I was able to achieve this by exposing some internal functionality. 
Normally there's already a SetHandler method on a FunctionTemplate but it 
is not available in the public API: 
https://source.chromium.org/chromium/chromium/src/+/master:v8/src/objects/templates-inl.h;l=72;drc=b892cf58e162a8f66cd76d7472f129fe0fb6a7d1;bpv=1;bpt=1

After exposing it, I was able to intercept the setting of any property on 
my function.
 

On Tuesday, March 3, 2020 at 11:39:34 PM UTC+2, Darin Dimitrov wrote:
>
> Ben, yes, unfortunately the SetAccessor method doesn't allow intercepting 
> the setting of any arbitrary member (property or function) on the function.
>
>
> On Tuesday, March 3, 2020 at 11:21:00 PM UTC+2, Ben Noordhuis wrote:
>>
>> On Tue, Mar 3, 2020 at 1:20 PM Darin Dimitrov <darin....@gmail.com> 
>> wrote: 
>> > 
>> > I tried every possible method but cannot intercept setting members on a 
>> Local<Function> instance. Also couldn't find any example in the 
>> https://chromium.googlesource.com/v8/v8/+/refs/heads/lkgr/test/cctest/test-api-interceptors.cc
>>  
>> > 
>> > Is this simply not possible? 
>>
>> I think for Function objects, you can't do better than SetAccessor(), 
>> but that only lets you intercept a single predetermined named property 
>> and I infer you want to intercept them all. 
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/4baf297e-cc8e-4071-83f8-18ee0a58d3da%40googlegroups.com.

Reply via email to