Peter,

Please note that there is a V8 context for each tab, and for each frame.
Whether it is possible to access data in one context from another controlled
through the V8 security. Through the API this can be controlled both through
tokens and security callbacks. Chrome implements the web model using the API
which is mostly controlled via the origins of each context, but there are a
lot of details in this area.

A: It is only possible to have one debugger connected to a V8 instance. It
is possible that two tabs use the same V8 instance and is sharing code for
functions in these different contexts. If a breakpoints is set in such a
function it will be hit in either context. This is due to the compilation
cache which reuses already generated code. We try to avoid this by disabling
the compilation cache when a debugger is connected. Through the V8 API each
context can be given ID's by the embedder. These ID's are available through
the debugger protocol. This requires some knowledge of the embedder in the
debugger, which of cause is the case for the Chrome Dev Tools.

B: You cannot constraint the debugger to a particular group of contexts.

C: Evaluation when V8 is idle will still be relative to the current V8 call
stack. If there is none evaluation is not possible as there is no context.
For this a callback to the embedder to provide a context for evaluation
might be considered...

/Søren


On Wed, Jan 6, 2010 at 15:22, Peter Rybin <[email protected]> wrote:

> Thanks a lot Yury,
>
> It was really exhaustive explanation.
>
> Can I rephrase it in the following way:
>
> 1. Debugger protocol is not quite context-aware.
>
> 2. V8 does not provide real context separation (objects are not
> attributed to a particular contexts, one object may well be reachable
> from several contexts).
>
> 3. V8/Debugger does not list existing contexts, there is not regular
> way for reaching all of them from debugger. However debugger always
> see one context, but cannot choose it.
>
> 4. Evaluate command may not specify context. It is only allowed to
> select a frame of current stack.
>
>
> Does it look like a reasonable summary?
>
> However I don't really understand if debugger protocol should be
> scoped to a particular context or not.
>
> From your explanations and my summary it appears that it's not really
> scoped to a context.
>
> On the other hand Chrome debugger is obviously scoped to a particular
> tab ergo scoped to V8 context.
>
> And I don't quite see how V8 handles several tabs inside one instance:
>
> A. What if I open 2 connections to 2 tabs which happened to be in one
> instance of V8. Will V8 handle 2 remote debuggers simultaneously?
> B. When debugging a particular tab I expect to suspend inside context
> of my tab only. What happens when V8 suspend in context of different
> tab?
> C. If we support evaluate command when V8 is idle, can we make sure we
> evaluate our expression inside a proper context?
>
> Peter
>
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
>
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to