---------- Forwarded message ----------
From: Eddy Bruel <
ejpb...@mozilla.com>
Date: Thu, Feb 5, 2015 at 7:52 AM
Subject: Re: Breakpoints, source actors, and multiple concurrent sources
To: James Long <
jl...@mozilla.com>
Take a look at test-breakpoint-20.js. What this test does is the following:
- Eval some test code.
This causes a Debugger.Script instance to be created, with a
corresponding Debugger.Source instance.
- Set a breakpoint.
We do this by finding the SourceActor corresponding to the
Debugger.Source instance we just created.
- Eval the same test code again.
Correct me if I'm wrong, but I believe this causes a new Debugger.Script
instance to be created, with a Debugger.Source instance that is separate
from the one we created earlier. At this point we replace the SourceActor
corresponding to the previous Debugger.Source instance with one
representing the new Debugger.Source instance, but the same actor ID.
- Check if the breakpoint we set earlier is hit in the new source as well.
This currently works because creating a new Debugger.Script causes
_addScript to be called. Since the actorID for the new and the old
SourceActor are the same, we find any BreakpointActors associated with the
old SourceActor, and then reset them as breakpoint handler on the newly
introduced script using the new Debugger.Source instance. So far so good.
The particular test code we are evalling pushes a function on the stack.
Now, what happens if somebody sets a second breakpoint, and then calls the
function pushed when the test code was evalled the first time?
The SourceActor refers to the Debugger.Source instance corresponding to the
second eval. Since the ScriptStore keys scripts by Debugger.Source
instance, won't we only find those scripts that where created with the
second call to eval? I suspect the new breakpoint will end up hitting in
the second function, but not in the first. Conversely, removing the
breakpoint on the second source will not cause it to be removed from the
first function.