Re: [v8-users] ways to prevent scripts from accessing certain built-in features
On Thu, Apr 12, 2018 at 10:29 AM, YJ wrote: > A semi-related question, are the built-ins in global not enumerable for some > reason ? That's per spec. Other JS engines work the same way. -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] ways to prevent scripts from accessing certain built-in features
Well nm...something along the following line works for me. // Local props = g->GetPropertyNames(context, // KeyCollectionMode::kOwnOnly, // PropertyFilter::ALL_PROPERTIES, // IndexFilter::kSkipIndices) // .ToLocalChecked(); The default mode for PropertyFilter must have been the problem. On Thursday, April 12, 2018 at 4:29:30 PM UTC+8, YJ wrote: > > A semi-related question, are the built-ins in global not enumerable for > some reason ? > > Basically the following code does not iterate over things like typed array > constructors. Am I doing something wrong here ? > > auto g = context->Global(); >> > Local props = g->GetPropertyNames(); >> const uint32_t length = props->Length(); // length is always 0 in a clean >> context >> >> > On Wednesday, April 11, 2018 at 7:30:00 PM UTC+8, YJ wrote: >> >> Thanks Ben. Will give that a shot. >> >> I had experimented with interceptors but unfortunately I can't seem to >> return a normal global object from inside an global interceptor as >> accessing a property triggers that interceptor again. >> >> On Wednesday, April 11, 2018 at 5:13:37 PM UTC+8, Ben Noordhuis wrote: >>> >>> On Wed, Apr 11, 2018 at 6:58 AM, YJ wrote: >>> > Hi v8-users, >>> > >>> > In certain situations we want user scripts to run in a context where >>> the >>> > scripts don't get to use some of the newer ECMAScript features, for >>> > instance, Atomics, typed arrays etc. What is the recommended way to >>> achieve >>> > that? >>> > >>> > Any pointers are appreciated. >>> >>> Delete the corresponding globals from the global object >>> (`v8::Context::Global()`) before you start executing JS code. Won't >>> work for everything but will work for most things. >>> >> -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] ways to prevent scripts from accessing certain built-in features
A semi-related question, are the built-ins in global not enumerable for some reason ? Basically the following code does not iterate over things like typed array constructors. Am I doing something wrong here ? auto g = context->Global(); > Local props = g->GetPropertyNames(); > const uint32_t length = props->Length(); // length is always 0 in a clean > context > > On Wednesday, April 11, 2018 at 7:30:00 PM UTC+8, YJ wrote: > > Thanks Ben. Will give that a shot. > > I had experimented with interceptors but unfortunately I can't seem to > return a normal global object from inside an global interceptor as > accessing a property triggers that interceptor again. > > On Wednesday, April 11, 2018 at 5:13:37 PM UTC+8, Ben Noordhuis wrote: >> >> On Wed, Apr 11, 2018 at 6:58 AM, YJ wrote: >> > Hi v8-users, >> > >> > In certain situations we want user scripts to run in a context where >> the >> > scripts don't get to use some of the newer ECMAScript features, for >> > instance, Atomics, typed arrays etc. What is the recommended way to >> achieve >> > that? >> > >> > Any pointers are appreciated. >> >> Delete the corresponding globals from the global object >> (`v8::Context::Global()`) before you start executing JS code. Won't >> work for everything but will work for most things. >> > -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] ways to prevent scripts from accessing certain built-in features
Thanks Ben. Will give that a shot. I had experimented with interceptors but unfortunately I can't seem to return a normal global object from inside an global interceptor as accessing a property triggers that interceptor again. On Wednesday, April 11, 2018 at 5:13:37 PM UTC+8, Ben Noordhuis wrote: > > On Wed, Apr 11, 2018 at 6:58 AM, YJ > > wrote: > > Hi v8-users, > > > > In certain situations we want user scripts to run in a context where the > > scripts don't get to use some of the newer ECMAScript features, for > > instance, Atomics, typed arrays etc. What is the recommended way to > achieve > > that? > > > > Any pointers are appreciated. > > Delete the corresponding globals from the global object > (`v8::Context::Global()`) before you start executing JS code. Won't > work for everything but will work for most things. > -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] ways to prevent scripts from accessing certain built-in features
On Wed, Apr 11, 2018 at 6:58 AM, YJ wrote: > Hi v8-users, > > In certain situations we want user scripts to run in a context where the > scripts don't get to use some of the newer ECMAScript features, for > instance, Atomics, typed arrays etc. What is the recommended way to achieve > that? > > Any pointers are appreciated. Delete the corresponding globals from the global object (`v8::Context::Global()`) before you start executing JS code. Won't work for everything but will work for most things. -- -- 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. For more options, visit https://groups.google.com/d/optout.