Friday, December 14, 2007

0.3 Released (Finally)

So me and Brandon had finally finished our 0.3 release today. It's been quiet the journey as we have had to deal with so many different issues... most of which really had nothing to do with our code or even the hairy Mozilla code surrounding it. Our largest obstacles were indeed related to the tools we were using and the build system which seemed to dislike code edited by the Visual Studio text editor while working just fine when the code was edited in a different app. Its amazing how depressed you can become when nothing seems to be working for you. Luckily though we did not give up and despite the many struggles, both I and Brandon feel like we have prevailed and actually came up with some pretty interesting code.

From a technical point, one of our biggest challenges was to find a way to communicate with the UI from deep within the plugin related C++ code. One of the problems we encountered with the C++ code itself was that it was in the form of a macro and that made it very difficult to manipulate. That meant that keeping track of anything across the different runs of the macro was basically impossible (since it involved referencing an external object in a macro that was getting called in numerous locations in other files). The need to communicate with the UI was initially for the purpose of notifying the user when a plugin was using too much runtime, however, once we figured out how to communicate with external JS code using Mozilla's observer services (many thanks go to mfinkle for that one) we realized that we can do everything we need directly from inside the JS code itself. So we simply made the C++ code report a plugin's runtime to the JS class, where the different statistics are tracked and the user gets notified under the right conditions. At the moment the user gets notified when a plugin has runtime x or above, y or more times in z amount of seconds.

In addition we also dump a line to the console every time a plugin has a runtime of one millisecond or longer.


The picture above shows console output and a notification bar advising the user about a plugin with a high runtime.

The picture above shows the console output when an interactive flash game is loaded.

So now that you know what our 0.3 does you can try it for yourself by going to our wiki project page.

And now for some final words about OSD. This course has not been easy, it was hard and confusing and very frequently frustrating, for both myself and Brandon. That being said I am glad I took it and I would do it again without hesitating because I got to meet some great people, got to see how people come together to form a community that in turn produces some really great stuff and got a chance to participate in solving a real world problem. The experience has been really invaluable and I thank Dave and Chris for pushing for this sort of education. Many thanks also go to all the people who helped us on our way here like Mark (mfinkle) who was always available for help on any topic, Robert (roc) who made Mozilla's code a little less hairy, Armen (armenzg) who helped us test our 0.1 release and of course Chris (ctyler) and Dave (dave) who were always super supportive and very flexible!

5 comments:

Wladimir Palant said...

Thanks for the nice work! I certainly hope that some of it will be adopted by Mozilla. But for now, can we get a unified diff? You can create one using |cvs diff -pu8|, that will put enough context in the diff to make sure that it is readable and still meaningful even after the file you are patching changes.

pd said...

Released?

Where?

Presumably you are referring to code on the wiki? However I don't see it there. Are you referring to an XPI? Something I can try now?

Crazy Maths Man said...

pd you have to download the C++ code as the link given under "Version 0.3" and you also have to have a full version of the Firefox source code, place it in to the Firefox source code and run a compiler to compile the version of Firefox.

This includes C++ code that requires deep browser behavior to change, even if it was possible to just make an XPI to do this it would likely be either very hard to code or very inefficient.

Anders said...
This comment has been removed by the author.
Fima said...

Wladimir: Thanks for the feedback! I have made a new more reliable patch and it is now available on the wiki. Of course you can also download it directly here if you wish.