Parts of Firefox…coded in JavaScript? News to me…

So, maybe I’m about to state the obvious here, but believe it or not, parts of Mozilla Firefox are coded in JavaScript.

JavaScript?  Powering Firefox?  Holy smokes, I had absolutely no idea.

Let me back up for a minute.

There’s a very small possibility that I’m going to be working with Mozilla for Google Summer of Code this year, so I downloaded the Firefox code base to take a look at what their code looks like.

And it looks good.  Really good.  Clearly, the guys at Mozilla are pros.

So I was digging around in the source code, and in the folder mozilla/browser/base/content/browser.js, there is a JavaScript file that essentially details how Firefox behaves.

Look – here’s the function that handles when a new tab is opened in Firefox:

function BrowserOpenTab()
{
  if (!gBrowser) {
    // If there are no open browser windows, open a new one
    window.openDialog("chrome://browser/content/", "_blank",
                      "chrome,all,dialog=no", "about:blank");
    return;
  }
  gBrowser.loadOneTab("about:blank", null, null, null, false, false);
  if (gURLBar)
    gURLBar.focus();
}

JavaScript.  My mind is starting to get blown here, and I’m getting excited by the possibilities – seeing as how I’ve grown quite comfortable with JavaScript over the years.

And it’s all thanks to the Mozilla framework, apparently.  I’m only scratching the surface here, but I’m really interested in this, and I’ll post more as I learn it.

4 thoughts on “Parts of Firefox…coded in JavaScript? News to me…

  1. Christopher Blizzard

    Hi, Mike! Glad to see you’re so excited. You should join the people at Mozilla on irc.mozilla.org using IRC on #extdev – lots of people doing extension and XUL development there. Development can be both exciting and frustrating so just remember to roll with the punches and enjoy yourself.

    Take care!

  2. Mike

    Christopher:

    Thanks for posting, and for the tip about @extdev! Time to crack out the ol’ IRC client…

    Greg:

    The paper-work is done, and the application is in. Time for the waiting game.

    David:

    Seems that way. 🙂

Comments are closed.