Forgive me for what is likely a simple question.
In the browser, you can have a WWW page with an IFrame. If the main
page has a JavaScript function:
function foo(obj) {
console.dir(obj);
}
And the IFrame has JavaScript that calls top.foo(some_object), it
works as expected.
But it seems to me that the main page and IFrame each have their own
context - separate processes, right? And some_object was created in
the IFrame context, yet it can be examined in the page context.
How is this achieved?
To add to my questioning...
If these are two different contexts, isn't it possible that there's
code running in the main page's context at the exact moment the
IFrame calls top.foo() ?
I would like to understand how in two separate processes running
nothing but V8, I can pass one context's variable to the other, and if
it's possible to have both contexts literally share the same object.
For example, what if foo() in the main context looks like this:
function foo(obj) {
setInterval(function() { console.log(obj.bar); }, 1);
}
And the code in the IFrame looks like this:
top.foo(obj);
setInterval(function() { obj.bar++; }, 1);
In fact, how is "top" itself implemented? (A reference to one context
within another)
Thanks in advance
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users