3
votes

I have gone through the questions in this forum regarding this issues, but I have not found any query related to the kind of issue that I am facing. I have written a NPAPI plugin which works fine with GtkLauncher (comes with webkit) and firefox, but with google-chrome (18.0.1025.151), the plugin is not even showing up in about:plugins. I am running on Ubuntu 10.10.

When I am loading the plugin in google-chrome, in the browser I am getting failed to load plugin error but nothing is shown on the console. I doubt whether my NP_Initialize function is getting called.

Here is the NP_Initialize code:

-------------------------------
NPError OSCALL
NP_Initialize(NPNetscapeFuncs *npnf
#if !defined(_WINDOWS) && !defined(WEBKIT_DARWIN_SDK) 
    , NPPluginFuncs *nppfuncs)
#else
)
#endif

{
MEDIA_DEBUG_PRINT("\nwcf Media plugin: NP_Initialize");
    if(npnf == NULL)
        return NPERR_INVALID_FUNCTABLE_ERROR;
    if(HIBYTE(npnf->version) > NP_VERSION_MAJOR)
        return NPERR_INCOMPATIBLE_VERSION_ERROR;

    npnfuncs = npnf;

    #if !defined(_WINDOWS) && !defined(WEBKIT_DARWIN_SDK)
        NP_GetEntryPoints(nppfuncs);                            
    #endif

    return NPERR_NO_ERROR;

}

NPError OSCALL
NP_GetEntryPoints(NPPluginFuncs *nppfuncs) 
{

    MEDIA_DEBUG_PRINT("\nwcf Media plugin: NP_GetEntryPoints"); 
    nppfuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; 
    nppfuncs->newp = nevv; 
    nppfuncs->destroy = destroy; 
    nppfuncs->getvalue = getValue; 
    nppfuncs->event = handleEvent; 
    nppfuncs->setwindow = setWindow; 

    return NPERR_NO_ERROR;
}

I know there is a Firebreath framework for cross browser development which I have plan to use but at present I need to get my plugin running on chrome.

Can some one please help me to solve my issue?

Thanks and Regards, Souvik

2

2 Answers

3
votes

Chrome tends to be a bit pickier about how things start up. I don't see anything here that would be likely to cause your issue, but Chrome is notorious for rejecting plugins that don't behave as it expects. Most likely your issue is later on; you say you doubt that your NP_Initialize is getting called, if I were you I'd verify that. Have it write to a file in /tmp/ or something to make sure.

Also you haven't provided any of your other entrypoints such as NP_GetPluginVersion or NP_GetMimeDescription. Those are needed as well for a linux plugin and could very possibly be responsible for an issue like this. For reference, take a look at FireBreath's X11 entrypoint file.

Finally, it's possible that the way you installed the plugin it is found by mozilla and not by chrome; how did you install it?

2
votes

If your plugin isn't showing in chrome://plugins, then it's failing during the initial plugin scan. Try running with the --debug-plugin-loading flag, which should give you a log statement at the point where registering your plugin is failing.