Thursday, November 26, 2009

Building and Customizing ff-activex-host Browser Plugin

I need to use ff-activex-host, "An NPAPI based plugin for Firefox that enables the use of ActiveX controls", to enable me to build firefox's browser plugin using activex (for simplicity reason). It's a very helpful bridge without which we need to write different code for different browser.

We need to customize and build the plugin ourselves to be able to use it in a secure way i.e: avoiding any arbitrary activex can be run. Here's the main documentation on building. I find it still too general and requires us to build firefox source which takes a long time. After collecting some infos on the project site, forums and after some "fun" trial and error (including building the firefox source which is a bit painful and still not work in the end :) ) I finally able to build it in a less painful way. So, here's the summary of the steps that got me to it :

  • Checkout ff-activex-host source
  • Get the latest firefox source from here. Follow the instruction there to get the path to the latest source, in my case it's :
  • Get xulrunner-sdk from here. I downloaded the one titled "Gecko 1.9.1 (Firefox 3.5)"
  • I used Visual Studio 2005, so I need to update the .sln and .vcproj file of the original source of ff-activex-host which is a Visual Studio 2008 ones. Here's the article on how to convert vs2008 solution and projec file to vs2005. In my case, I only changed "Version="9,00"" entry to "Version="8,00"" in the .vcproj file, make a new blank .sln file and mount the updated .vcproj file and it works straight away
  • Change the additional include directories in ffactivex project as follow : change any "c:\src\mozilla\objdir\dist" to your xulrunner-sdk path, change the rest of "c:\src\mozilla" to firefox's source path. Here's the discussion that mention it somewhere in the middle, if you're interested.
  • Build the solution
To make an installer for the plugin, here's the summary :
  • Install Inno Setup (isetup-5.3.6.exe as of this writing) and it's QuickStart Pack (ispack-5.3.6.exe as of this writing). You can download them here
  • Use ISTool to open "install\ffactivex.iss" and update the line
    #define xbasepath "c:\src\ff-activex-host\ff-activex-host\"
    to the directory where your solution file reside
  • Compile and run the installer script
You should now see the "Activex hosting plugin for Firefox" on your browser's plugin list.

This path is basically just replace the step of compiling the firefox's source in the formal documentation with using xulrunner-sdk, adding some technical details and stuff specific to my situation.

No comments: