Monday, November 27, 2006

Patching Firefox 2.0

bon echo

In office, the standard browser we use is IE 6. Fine. But once in awhile, some of my colleagues and I like to use Firefox to browser the Internet. Mostly because it has the tabbed browsing feature.

Since we don't want the company proxy to track us down for using a non-standard browser, we overrided the User-Agent setting of Firefox so that it appears as IE.

The only problem is, when the user agent is changed, the Java plug-in will start to complain that "Java Plug-in for Netscape Navigator should not be used in Microsoft Internet Explorer". This is a known "bug". But luckily, Firefox is an open source project and someone already provided a solution. Basically, all we need to do is to patch the NS plugin API so that the original User Agent string is returned to all the plug-ins. Simple, huh? Well...

Lesson learned: Read the document carefully!

I used to compile Firefox 1.x on my Windows machine with Cygwin. But this time I want to try Firefox 2.0 with VCC. Mostly because the performance of the executables compiled with gcc is kind of disappointing. However, setting up a new compilation environment for Firefox is more time consuming than I anticipated. All becuase I didn't RTFA!

As I already have VCC 6.0 installed, I thought I was all set. It turns out that VCC 6.0 sp6 cannot be used to compile Firefox! I retried the build process and failed many times before I re-read the Build Prerequisites... yuck! Anyway, after I re-installed the VCC with sp5, the build process finally can be completed happily.

Anyway, I now have the customized Firefox running without the User-Agent problem. Later maybe I will try to re-compile the code to fiddle with more compiler optimization settings.

PS. In case you are interested, here is the .mozconfig that I use:

. $topsrcdir/browser/config/mozconfig

export MOZILLA_OFFICIAL=1
export BUILD_OFFICIAL=1
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
ac_add_options --enable-official-branding

ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --disable-tests
mk_add_options MOZ_CO_PROJECT=browser


yes... i know... i shouldn't be using the official branding options... but then, i don't like the name bon echo :P

No comments: