On Tue, Aug 11, 2009 at 17:38, johnjbarton<[email protected]> wrote:
>
> We would be happy to help you create a GM extension for Firebug.

Considering the amount of FB code patching that seems necessary so far
(firebug-service, debugger, lib...), will this be doable using a FB
extension only?
That would be excellent...


On Tue, Aug 4, 2009 at 16:49, johnjbarton<[email protected]> wrote:
>> >  You will need the line numbers for points of concatenation, eg. a.js
>> > 1-150, b.js 151-213, c.js 213-end.
>>
>> Yes. From what i see, i guess line numbers should be taken care of in
>> SandboxSourceFile...
>
> Yes, it has to translate the line number the user wants to see back
> and forth to the ones the compiler assigns.

Alright. Frankly, i'm still quite puzzled at how the line mangling
between jsdIScript and SourceFile work...
That is, even when sticking to the simple case: one GM script file run
in its Sandbox (i'm temporarily putting aside the complex case: many
files concatenated and run into a single GM script sandbox).
I've been able to make GM scripts proper name and source code appear
in FB's "Scripts" tab. It is possible to set a breakpoint and the
debugger will properly stop on it on page reload. Restarting execution
also works (i haven't really tested stepping). But there are a few
problems (for example, the breakpoint's red dot in the script margin
does not change state when the debugger stops on it).
The only line mangling i've done though is:
SandboxSourceFile.prototype.getBaseLineOffset
this.SandboxSourceFile.prototype.getBaseLineOffset = function()
{
    return 304;  // TODO depends on number of script tags
https://bugzilla.mozilla.org/show_bug.cgi?id=396568
}

So far i've been able to set a breakpoint in


I'm trying to solve the simple case first, that is:
I suppose the line-nb related methods inherited from SourceFile are
enough in this case.


As a reminder, this is what i do:
>> 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.

onSandboxScriptCreated() calls a GM method to get details on the
script running in this sandbox. It can thus create a SandboxSourceFile
object with the proper file URL.
As a consequence, the GM script name and source now appear correctly
in FB's Scripts tab; i can set breakpoints in the GM script... :-)

...However breakpoints do not work: on page reload, script execution
is not halted, breakpoints seem disabled (light-red UI dot, unchecked
UI box).
I haven't found out why yet.


-- 
Olivier

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

Reply via email to