~robcee/ more than just sandwiches

1 October 2012 @ 12pm

devtools, Firefox, Mozilla

Firefox Devtools: hax

Last week, the Firefox Devtools teams got together in London for some together-time. We kicked the show off on Tuesday with some lightning talks, followed by hack sessions over the rest of the week. As always, it’s incredible getting together with everybody — I’m kind of a fan. We’ll be finishing things we worked on this week for the next couple of months and it will be awesome.

My lightning talk was an example of how you can write a Jetpack addon using gozala‘s Scratch-kit. I cooked up a non-working demo the morning before our talks and managed to get the addon prototype to a state where it kind of works. The addon itself is ultimately intended to be a button you can use to share posts on app.net (the I-have-fifty-dollars social network).

The Code looks like this:

The remaining time was spent hacking on bigger targets. I got to sit down with Benoit Girard and work on integrating a JS-only version of the SPS Profiler. In two days, we were able to put up patches for a stripped-down version replacing the addon and integrating the Cleopatra web app. We’re going to be continuing that work over the next little while to get it polished and tested. See bug 795262 to track our progress.

Watch planet.mo and the Devtools blog for more throughout the week!


Posted by
tom jones
1 October 2012 @ 2pm

i found it convenient for simple content scripts to write the code inside a function, and then convert that to string (with appropriate parenthesis) to assign to contentScript.

that way, you get syntax highlight in your editor, and is much easier to manage imho. check the example here:


Posted by
1 October 2012 @ 2pm

hey, that’s a nice tip. Thank you!

Posted by
1 October 2012 @ 6pm

Another way to obtain the same result, is:

contentScript: “new ” + function() {
self.port.on(“update”, function _update () {
// etc

We usually do this trick in jetpack, you need just one concatenation at the beginning.