Search code examples
javascriptfirefoxpluginswindows-7npapi

NPAPI plugin problems in Windows 7


I have a NPAPI plugin which I have written and been using for some time with Firefox 3.x with no problems.

The object is defined as follows -

<object class="someClass" id="pluginobj" type="application/x-plugintype"></object>

I then call methods on it using the following format -

if( document.getElementById("pluginobj") != null )
{
    document.getElementById("pluginobj").someMethod(someParams));
}

This is how I understand it should be done and has always worked fine. However, I recently installed this same plugin on a Windows 7 machine (with the same version of Firefox) and it now fails to find the functions defined in the plugin, so I get the following error -

Error: document.getElementById("pluginobj").someMethod is not a function

Nothing has changed at all within the plugin, this errors occurs for any method that is called, not a particular one, and it still works fine on Windows XP machines with no problems.

Very confused! Could anyone help? Thanks.

Note: I've also tried logging inside my plugin and it appears it's not even getting in to the NP_Initialize and NP_GetEntryPoints methods.

I have seen some suggestions around that it could be to with dependencies and libraries being linked to the plugin, but i'm not sure what could be missing on win 7?

Dependency Walker is showing a error saying that the "side-by-side configuration information is incorrect"?


Solution

  • Are you linking to other DLL files from your npapi plugin? Windows 7 works differently in how it finds DLL files, though I don't know the details. The times I've seen this with plugins in the past the problem was that on windows 7 one of the dll files couldn't be found. You could try copying dependency dll files to your system32 directory (not permanently, just to see if that's the issue). I would expect that there it would be able to find it.

    If that's the issue, I unfortunately am not certain how to fix it, but it might help.

    Another possibility based on the side-by-side configuration issue thing is that your visual studio project is creating a manifest that is telling windows that it requires a specific version of one of the DLLs that isn't there on windows 7. See: http://buffered.io/2008/05/17/resolving-side-by-side-configuration-issues/

    I think I've resolved that issue in plugins before by disabling the manifest. I'm not sure; I've never had this issue with the way that FireBreath generates npapi plugin dlls, so I haven't needed to worry about it in the last year. You might consider looking at FireBreath, which works on both IE and Firefox (activex and npapi) and has a very good community for tracking down issues like this.