winter
winter

Reputation: 81

How to deploy a Firefox extension in XULRunner/GeckoFX?

I have a developed a binary extension that works fine under Firefox, but cannot manage to deploy it in XULRunner/GeckoFX. The extension doesn't have a UI and just provides an API to our main application (in .NET).

All tutorials I could find explain how to install them into a XULRunner application. But by using GeckoFX, XULRunner is running embedded in my project, so I don't have a XULRunner application.

I've already tried copying the installed extension's directory from Firefox's profile directory to XULRunner's profile, and also to use the FF profile directory for GeckoFX, both to no avail.

My current suspicion is that the extension's targetApplication in install.rdf needs to be adjusted for GeckoFX, but what's the correct id?

Since we are deploying GeckoFX/XULRunner embedded in our project, I don't need the extension manager, a static deployment would be enough.

Upvotes: 4

Views: 1556

Answers (1)

winter
winter

Reputation: 81

I finally managed to get it to work. Here's what I did:

First, add the location where the extension is deployed using Xpcom.ComponentRegistrar.AutoRegister():

void RegisterExtensionDir(string dir)
{
    Console.WriteLine("Registering binary extension directory:  " + dir);
    var chromeDir = (nsIFile)Xpcom.NewNativeLocalFile(dir);
    var chromeFile = chromeDir.Clone();
    chromeFile.Append(new nsAString("chrome.manifest"));
    Xpcom.ComponentRegistrar.AutoRegister(chromeFile);
}

Second, do not use the ABI flag in the extension's chrome.manifest. So instead of

binary-component components/GeckoScraper.dll  ABI=WINNT_x86-msvc

I used

binary-component components/GeckoScraper.dll

I consider this a bug of GeckoFX 29 and have created an issue for that.

Upvotes: 4

Related Questions