How to retrieve Firebug module (Fireunit) from external extension?

27 views
Skip to first unread message

lucy

unread,
Aug 26, 2009, 4:19:28 PM8/26/09
to Firebug
Hi,

I'm stumped on how to retrieve another Firebug module for an external
extension. (Or perhaps what I need to do is ensure that Firebug loads
before my extension?)

I've looked at the source code for Firebug and the extension I'm
interested in loading (Fireunit), as well as the docs online here
http://getfirebug.com/docs.html

My first thought was to access fireunit through the global namespace:
fireunit.ok(true,"it worked!!");
fireunit.testDone();

This fails because "fireunit" is not defined (if I'm confusing
concepts or leaving something else let me know; happy to get better at
both the technical and communication aspects)

"Firebug" and "FBL" are defined.

I see in fireunit.js that Fireunit registers the FireUnitModule with
Firebug, and I see the global modules variable in firebug.js

I've played with different objects, to no avail. How do I access the
"ok" and "testDone" functions of fireunit?

I even tried doing the following, though it appears not to get
executed.

FBL.ns(function() { with (FBL) {

firebug.ok(true, "it worked!");
firebug.testDone();

}});

Thanks for your help,
Lucy.

Possibly relevant from fireunit.js

Firebug.FireUnitModule = extend(Firebug.Module, {
...
});

Firebug.FireUnitModule.Fireunit = function(context, win) {
var fireunit = {
ok: ...,
...
}
fireunit.__defineGetter__("browser", function() {
return canChrome(win) ? window : null;
});
this.__proto__ = fireunit;
};

johnjbarton

unread,
Aug 26, 2009, 5:55:14 PM8/26/09
to Firebug


On Aug 26, 1:19 pm, lucy <a.downy.h...@gmail.com> wrote:
> Hi,
>
> I'm stumped on how to retrieve another Firebug module for an external
> extension. (Or perhaps what I need to do is ensure that Firebug loads
> before my extension?)
>
> I've looked at the source code for Firebug and the extension I'm
> interested in loading (Fireunit), as well as the docs online herehttp://getfirebug.com/docs.html
I'm just guessing, since this is really as question about fireunit,
not firebug, but it looks like you first need to call the function:
var myUnit = Firebug.FireUnitModule.Fireunit(context,win);
myUnit.ok(...);

You can ponder the magic of __proto__ here:
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Property_Inheritance_Revisited/Determining_Instance_Relationships

jjb

lucy

unread,
Aug 27, 2009, 9:44:01 PM8/27/09
to Firebug

> I'm just guessing, since this is really as question about fireunit,
> not firebug, but it looks like you first need to call the function:
>   var myUnit = Firebug.FireUnitModule.Fireunit(context,win);
>   myUnit.ok(...);
>
> You can ponder the magic of __proto__ here:https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Property_I...
>
> jjb

John,

Thanks for the helpful tips. I appreciate the reference link.

I tried what you suggested. Firebug.FireUnitModule.Fireunit
(context,win)--with the appropriate context and win variables
substituted---is undefined. I'll continue tinkering with it. I've
asked FireUnit folks this question, too. I asked here because I
thought perhaps there was a general way to retrieve registered
modules. The only API documents I found were for console.

In the meantime, I am using a refactoring of QUnit. The refactoring
separates test execution, test result data and test result displaying,
which makes it easy to display results in the console.

http://procrasdonate.wordpress.com/2009/08/27/unittests-pass/

Thanks again for your kind suggestions.

Lucy.
Reply all
Reply to author
Forward
0 new messages