Firebug Extensions

26 views
Skip to first unread message

Gabriel Mariani

unread,
Aug 4, 2011, 10:21:57 AM8/4/11
to fir...@googlegroups.com
I'm a bit confused on how I need to update my extension to work with Firebug 1.8. My extension (Flashbug) currently supports 1.6/1.7 but doesn't in 1.8. I understand that some globals have been replaced, but if I replace those they will no longer work in 1.6, 1.7 correct? It would be nice if Firebug versions didn't overlap so I could just target a specific version of Firefox and not worry about checking for specific versions of Firebug. I also had a question about HOW i should update my extension. What i mean is, do I need to do a complete overhaul to match the AMD style you guys decided to go with in order for it to work? I know you are supporting some legacy, but should I start migrating to that style yet or wait til 1.9? And if I should wait til 1.9, how do I access some API that's only in a specific module now? The error console has tons of errors but it's only pertaining to Firebug scripts not my extensions so I don't know what I need to update to get it working.
 
My extension makes extensive use of NetMonitor.Utils and only hunting through Firebug itself did I find it was replaced by NetUtils. But do I have to include that module to get it to work or can I still use NetMonitor.Utils? The wiki isn't very clear on this fact or complete so I'm left pretty confused. Any help would be appreciated on which path I need to take to update my extension moving forward.
 
-gabriel

Sebo

unread,
Aug 5, 2011, 4:25:32 PM8/5/11
to Firebug, odv...@gmail.com
Honza, that's a question for you.

Sebastian

Jan Honza Odvarko

unread,
Aug 8, 2011, 7:59:47 AM8/8/11
to Firebug
On Aug 4, 4:21 pm, Gabriel Mariani <gmariani...@gmail.com> wrote:
> I'm a bit confused on how I need to update my extension to work with Firebug
> 1.8. My extension (Flashbug) currently supports 1.6/1.7 but doesn't in 1.8.
> I understand that some globals have been replaced, but if I replace those
> they will no longer work in 1.6, 1.7 correct? It would be nice if Firebug
> versions didn't overlap so I could just target a specific version of Firefox
> and not worry about checking for specific versions of Firebug.
I think you can do the check simply in your code:

For example:

var currentContext;
if (typeof(FirebugContext) != "undefined")
currentContext = FirebugContext;
else
currentContext = Firebug.currentContext;

Instead of testing Firebug version, you should detect existing
features (just like it's recommended for cross-browser feature
detection).

> I also had a
> question about HOW i should update my extension. What i mean is, do I need
> to do a complete overhaul to match the AMD style you guys decided to go with
> in order for it to work?
Not in Firebug 1.8, Firebug 1.8 still supports extensions based on XUL
overlays.

> I know you are supporting some legacy, but should I
> start migrating to that style yet or wait til 1.9? And if I should wait til
> 1.9, how do I access some API that's only in a specific module now? The
> error console has tons of errors but it's only pertaining to Firebug scripts
> not my extensions so I don't know what I need to update to get it working.
Using the Firebug module loader and AMD style in Firebug extensions is
already supported, but not well documented. Anyway, you can see
HelloWorld example here:
http://code.google.com/p/fbug/source/browse/#svn%2Fexamples%2Ffirebug1.8%2Fhelloworld
(it also includes support for restartless extension, which is not
interesting in this particular case).

We need to improve the AMD related APIs for extensions yet, provide
examples/docs/tutorial which should happen in Firebug 1.9

> My extension makes extensive use of NetMonitor.Utils and only hunting
> through Firebug itself did I find it was replaced by NetUtils. But do I have
> to include that module to get it to work or can I still use
> NetMonitor.Utils? The wiki isn't very clear on this fact or complete so I'm
> left pretty confused. Any help would be appreciated on which path I need to
> take to update my extension moving forward.
You should be able to load any existing Firebug module in your
extension as a dependency. See this file (part of the Hello World
example):
http://code.google.com/p/fbug/source/browse/examples/firebug1.8/helloworld/chrome/content/main.js

In your case it would look like as follows:

define([
"firebug/lib/trace",
"firebug/net/netUtils",
"helloworld/myPanel"
],
function(FBTrace, NetUtils) {
/* ... */
});

In order to make progress on your extension, please create a new bug
report and we can step-by-step solve all problems you are facing when
using AMD in your extension.

I can also create a better HelloWorld example that's focused on how to
use AMD in Firebug extensions.

Honza

Gabriel Mariani

unread,
Aug 8, 2011, 8:07:50 AM8/8/11
to fir...@googlegroups.com
Thanks Honza!

I suppose another point of confusion was that you say not to update to AMD style for 1.8 but I need to load dependency modules. I was thinking if it supported legacy then I wouldn't have to change to that style but I guess I do. I'll post a bug report to work on these issues. Thanks again

Gabriel

Jan Honza Odvarko

unread,
Aug 8, 2011, 8:17:37 AM8/8/11
to Firebug
On Aug 8, 2:07 pm, Gabriel Mariani <gmariani...@gmail.com> wrote:
> Thanks Honza!
>
> I suppose another point of confusion was that you say not to update to AMD
> style for 1.8
Sorry for the confusion, but yes I wouldn't *officially* recommend to
start rewriting all existing extensions to use AMD style now, since
the API on Firebug side are not finalized yet. But if you are ready to
face problems, report bugs and wait for fixes we can together improve
the APIs so, they are ready for others.

> but I need to load dependency modules. I was thinking if it
> supported legacy then I wouldn't have to change to that style but I guess I
> do. I'll post a bug report to work on these issues. Thanks again
Ah, you are right the NetUtils was accessible via Firebug namespace
hierarchy as Firebug.NetMonitor.Utils

OK, I see, I'll make this working again as part of the legacy support.
Please file a bug for this too so, I can track it.

Thanks!
Honza

Gabriel Mariani

unread,
Aug 8, 2011, 8:22:59 AM8/8/11
to fir...@googlegroups.com
One last question before I post the rest to the bug report. If i define modules and encapsulate my extension in 

define([ 
    "firebug/lib/trace", 
    "firebug/net/netUtils", 
    "helloworld/myPanel" 
], 
function(FBTrace, NetUtils) { 
/* ... */ 
}); 


instead of the old style of

FBL.ns(function() { with (FBL) {
/*...*/
}});

Won't that break compatibility with Firebug 1.6,1.7 anyways?

Jan Honza Odvarko

unread,
Aug 8, 2011, 8:30:33 AM8/8/11
to Firebug
No

Following is the same (extensions never had to use with FBL
statement):

with (FBL) {
trimLeft(" hello");
}

or

FBL.trimLeft(" hello");

Honza


Gabriel Mariani

unread,
Aug 8, 2011, 8:39:44 AM8/8/11
to fir...@googlegroups.com
All other questions I've now posted to http://code.google.com/p/fbug/issues/detail?id=4718
Reply all
Reply to author
Forward
0 new messages