On Aug 4, 3:24 am, Olivier Cornu <[email protected]> wrote:
> On Sat, Aug 1, 2009 at 18:34, johnjbarton<[email protected]> wrote:
...
> > SourceFiles are then used to map jsdIScripts to source that is shown
> > to the user. (SourceFiles are defined in lib.js)
>
> Alright. I'm still unsure as to how i am going to deal with the fact
> that a single GM script may be composed of several JS source files
> (glued and run in the same sandbox), which i'd like to show separately
> in Firebug's script tab. But this can be dealt with later...
Oh, I did not know this part.
>
> > Since GM is also an extension it could easily help by providing a
> > method that returns the source so Firebug can copy it into its cache
> > and point from the SourceFile into the cache.
Ok you need to take the list of innerScripts from the GM compile and
create a new
>
> Yes. And the file name seems to be needed as well, at least for the
> GUI: so far it shows webmonkey.js, which is the JS code creating the
> sandbox, not the script code running inside it.
Yes, that is all the compiler knows, because that is what GM told it.
> I guess this GM method should return the needed script's details,
> whatever they end up being. As far as i can see, the only reference to
> the running script we share between GM and FB is the Sandbox object
> it's running in -- that should be the method parameter.
You will need the line numbers for points of concatenation, eg. a.js
1-150, b.js 151-213, c.js 213-end.
>
> Overall, here is how i'm proceeding: i patch
> firebug-service.js:getFrameScopeWindowAncestor() to allow finding the
> right debugger for a GM script sandbox. It then flows as usual up to
> debugger.js:onTopLevelScriptCreated(), patched in order to delegate
> the work to onSandboxScriptCreated() in case of a Sandbox scope.
> Finally, this last method returns a lib.js:SandboxSourceFile object.
> Does it look ok so far?
You might return a sourcefile representing the webmonkey.js with a
single script, the outer script representing the body of the function
that run the sandbox global method (called outerScript in Firebug).
>
> >> Just to make it clearer though, i meant: as i understand it, it
> >> usually is about linking "spawned" jsdIScripts to a SourceFile, while
> >> in the GM-script discovery step it is about creating several
> >> SourceFiles objects in the context of one on(JsdI)Script handler.
>
> > The GM script is compiled in a sandbox, so the entire compile will be
> > one SourceFile.
Now that I realize you want to decompose, this it not true.
>
> It's fine as long as we show all the JS source files composing a GM
> script as one big source file. I guess that, if we wanted to show them
> separately, Firebug.Debugger#onSandboxScriptCreated() should return an
> array of SourceFiles...
Or just jam the other ones on the context and return one representing
the outerScript.
To create the others you need to walk the list of innerScripts and
compare the source ranges (baseLineNumber, lineExtent) to the
webmonkey.js and your list of actual sources with their line ranges.
Divvy them up.
jjb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---