Hi, all.

I'm working on a Firebug extension meant to "beautify" JavaScript code
as shown in the Script and Net panels (the beautifying work is done by
the JS Beautifier library).
The Net Panel stuff is finished (just one glitch left to be sorted
out). I'm not sure which is the best way to go with the script panel,
and that's why I'm here.
I'm sorry if some of what I'll write may sound confused - it probably
is, given that I'm still trying to understand Firebug's internals.

I added a button in the Script toolbar, just to the right of the
"fbLocationList" combo (the one showing available JS files).
Clicking the button, I'm able to get the currently displayed JS text,
like this:

context.sourceCache.loadText(context.panelMap.script.location.href)

...and beautify it. Now I have to replace the currently displayed file
with the beautified version. Questions arise...

1. I understand that there's a sourceCache object storing, I believe,
all loaded source files (HTML, JS, and so on). Should I leave the
cache alone, or update it with the beautified text (in case it's an
external JS file, of course)?

2. I saw that there's a sourceFileMap, used to access different types
of SourceFile objects, created by parsing <script> tags, included JS
files, and probably other things I'm not quite sure about. Should I
create a new SourceFile object, and use it to replace the one with the
same href in the sourceFileMap? If so, how can I know which kind of
SourceFile object to create?

3. Moreover, I see that, after choosing another file from the
fbLocationList combo, the script panel contents are refreshed by
calling the navigate(object) method of the panel, passing as "object"
the value of "locationList.repObject" (happens in chrome.js). How is
this related to the SourceFile currently displayed? (I tried to get at
it, but ChromeBug crashed on me after trying to access it while at a
breakpoint)

That is, more or less, where I am poking at now. Any help would be
greatly appreciated.

A.

--

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