firefoxselenium-webdriverfirefox-addonxpitor-browser-bundle

Add-on compatibility in TorBrowser


I have a FireFox add-on which installs successfully with latest Firefox ESR (currently 24.6.0), but returns this error when attempting to install on the latest Tor Browser Bundle.

My Test WebDriver could not be installed because it is not compatible with TorBrowser 24.6.0.

Tor Browser Version

Why does Tor Browser say this is not compatible, but Firefox 24.6.0 does? And how can my .xpi be modified to make it work?

Here is my install.rdf:

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">

    <Description about="urn:mozilla:install-manifest">
        <em:id>test@example.com</em:id>
        <em:version>2.42.0</em:version>
        <em:name>My Test WebDriver</em:name>
        <em:description>WebDriver implementation for Firefox</em:description>
        <em:creator>Simon Stewart</em:creator>
        <em:unpack>true</em:unpack>

        <!-- Firefox -->
        <em:targetApplication>
            <Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>17.0</em:minVersion>
                <em:maxVersion>10000.0</em:maxVersion>
            </Description>
        </em:targetApplication>

        <!-- Platforms where we're not compiling the native events -->
        <em:targetPlatform>Darwin</em:targetPlatform>
        <em:targetPlatform>SunOS</em:targetPlatform>
        <em:targetPlatform>FreeBSD</em:targetPlatform>

        <!-- Platforms where we are -->
        <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform>
        <em:targetPlatform>Linux</em:targetPlatform>
    </Description>

</RDF>

I'm attempting to get Selenium WebDriver to work with the Tor Browser Bundle using a manual .xpi.


Solution

  • The problem here is actually your targetPlatforms. The TorBrowser is compiled differently to enable allow them to do deterministic builds. In particular the Tor Browser is compiled by some mingw-gcc while the official Firefox is compiled by a MSVC compiler.

    Remember that targetPlatform is:

    A string specifying a platform that the add-on supports. It contains either the value of OS_TARGET alone or combined with TARGET_XPCOM_ABI, separated by an underscore (_).

    In the TorBrowser, OS_TARGET still is WINNT, but XPCOMABI is x86-gcc3 apparantly. So your targetPlatform of WINNT_x86-msvc does not match the expected WINNT_x86-gcc3.

    BTW: You can get OS_TARGET and XPCOMABI from a running browser instance, e.g. by opening a web console on an about:newtab tab and executing: 

    Services.appinfo.OS
    // and
    Services.appinfo.XPCOMABI
    

    So the first order of business would be trying to add WINNT_x86-gcc3 to your targetPlatforms.

    As you apparently have binary components this may or may not work... not sure if MSVC compiled "glue" is compatible to a gcc compiled one, so your binary components may still fail to load. You might then have to recompile your component for the different target using the appropriate compiler (mingw-gcc something; see the TOR deterministic build docs about this), or, and this might be better in the long run anyway, switch over to js-ctypes and regular C API/ABI libraries if possible.