Saturday, 5 June 2010

GSoC: Zeitgeist weekly report #2


As planned, this week I finished our new Chrome extension together with the NPAPI plugin. In the end the javascript part of the extension didn't turn out to be as straightforward as I expected, but using some not-so-nice hacks  it does what it's supposed to do. After I finished the Chrome extension I tried to make our new totem plugin using libzeitgeist build out of totem's tree, and fortunately this was easier than I thought it would, so it's done now and I also got some time to start to revamp the build system in zeitgeist-dataproviders [1], and even though now it's a strange mix of autotools in the top source directory and our own Makefiles in the plugin dirs, it works and currently provides the ability to detect which plugins can be build and it builds only those (note that it's incomplete, but the framework is there).

Plan for the next week is to move the whole build system to autotools, with the ultimate goal of making it possible to build packages of the dataproviders. Once that is done, I'll start to write another totem plugin, this time one which will pull data from ZG and therefore will add some UI elements to totem. Stay tuned ;)

Note to self: maybe I'm too spoiled by python, but this just doesn't work in JS (at least not when writing Chrome extension), even though there's no warning/error:
if (condition) {
    function callback () {
        console.log("You'll never see this");
    document.addEventListener("event", callback, false);



  1. Depends on which event you want to observe on what element. For example, only window fires the "load" event:

    // works:
    window.addEventListener("load", callback, false);

    // no action:
    document.addEventListener("load", callback, false);

  2. I'm sure the event was correct, maybe it's a bug in Chrome I don't know, but when it was an inner function it didn't get executed.

  3. It also depends on which html file called this javascript function : For eg, if your options.html called this function, the logs will not visible in the developer tools of background.html.

    So I usually have a function in background js which writes to console and call it as chrome.extension.getBackgroundPage().writeToConsole(txt).

    This allows all logs to come in a single console.