You indeed need to be careful. Context->Global() changes semantics after
Context->DetachGlobal(). Until navigation it returns the global proxy,
afterwards it returns the internal global object for technical reasons...
(See
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Split_object
for the diff between global proxy and global object).

If you want a stable identity hash across iframe navigation, you have to
make sure you fetch it from the "global proxy" (correct for the iframe),
not the "global object" (correct for a specific page loaded in the iframe;
you don't have access to this until you navigate the context away).

If you know the global proxy that was used for a specific context, or if
you know that you never detach the global (hence Global() always returns
the proxy), you can use that hash. That will obviously == the hash of other
pages loaded in the same iframe.

HTH somewhat,
Toon

On Mon, May 11, 2015 at 11:44 AM Ben Noordhuis <[email protected]> wrote:

> On Sun, May 10, 2015 at 8:08 PM, Francisco Tolmasky <[email protected]>
> wrote:
> > Contextsdon't appear to have a GetIdentityHash like Objects do. Is it
> safe
> > to do Context->Global()->GetIdentityHash(). By that I suppose I mean,
> does
> > Global ever change for a Context?
>
> You can detach the global object from the context with
> v8::Context::DetachGlobal().  I'm not sure if that matters for the
> identity hash but it might.
>
> --
> --
> 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.
>

-- 
-- 
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.

Reply via email to