On Fri, Jun 24, 2016 at 7:34 AM, Zac Hansen <[email protected]> wrote: > If I create two contexts both within a single isolate, what types of things > can I share between them and what is only available in the specific context? > > I know this is a broad question, so I'm happy to get broad answers or links > to documentation. > > An example that I find confusing is: v8::Object is created with only a > isolate but to call .set on it requires a context. > http://v8.paulfryzel.com/docs/master/classv8_1_1_object.html > > Is the object somehow shared across contexts, but the attributes aren't? > > Any insight would be great. I've also got an open question on this on > stack overflow and I'll put anything I learn on this thread into that. > http://stackoverflow.com/questions/37981291/what-is-shared-discrete-across-multiple-v8-context-objects-belonging-to-a-single
It depends on the security policy. By default, everything is shared. You can turn on access checks with v8::ObjectTemplate::SetAccessCheckCallback() to block access on a per-property basis or disallow sharing altogether by changing the security token with v8::Context::SetSecurityToken(). Aside: I believe the reason you need to pass a context to v8::Object::Set() is to disambiguate the overloaded function. C++ doesn't allow overloading on just the return type. It's also slightly faster. The non-context version of Set() looks up the current context and calls the contextified Set(). -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
