Search code examples
javascriptnpapi

NPAPI : How to read the return NPError value of NPP_New in javascript


We are developing a Netscape plugin for Safari in Mac I have a scenario in which the initialization done in NPP_New function fails and I am returning NPERR_GENERIC_ERROR. How can i read this error code in Javascript.

Any help in this regard would be greatly appreciated. Thanks in advance.


Solution

  • If you need to identify this specific failure scenario i can think of the following options:

    • succeed NPP_New, but set the plugins internal state accordingly (so script can ask the plugin about it later)
    • move the initialization in question out of NPP_New and let it be invoked through a scriptable function (... ret = plugin.initStuff())
    • if you absolutely have to fail in NPP_New (e.g. because there is no supported drawing model on OS X) you could call into the page, informing script about the condition