Firefox [npapi] plugin development - freeze firefox when calling a method

I am trying to learn how to write a Firefox plugin. I downloaded the npruntime example from Mozilla, compiled it, and ran it. Getting properties from the plugin worked well, but when I tried to call the method, Firefox freezes. I thought maybe something was wrong with this example, so I wrote my own main script plugin with one property and one method that returns a string. The property worked well, but calling the method caused Firefox to freeze again.

Am I missing something? I tried to debug the plugin and everything seems to be fine. All rights of the function are called, and the value is returned correctly. If I try to stop the process while Firefox hangs, I stop in the Windows DLL, not in the code, but not in the Firefox code.

If someone can point me in the right direction ...

Thanks.

+3
source share
2 answers

I hope you solve it. If this is not the case, I just discovered that the example (I assume this is a damn "npruntime pattern") was corrupted.

strdup , NP_something. , NPAPI , , , strdup malloc, NPN_MemAlloc.

, malloc , NPAPI. npruntime 452:

STRINGZ_TO_NPVARIANT(strdup("foo return val"), *result);

466:

STRINGZ_TO_NPVARIANT(strdup("default method return val"), *result);

:

char* src = "foo return val";
char* out = (char *)NPN_MemAlloc(strlen(src) + 1);
strcpy(out, src);
STRINGZ_TO_NPVARIANT(out, *result);

. , mozilla SDK.

+6

npruntime . , firefox Windows 7.

firefox config "dom.ipc.plugins.enabled" false. , , , .

0

Source: https://habr.com/ru/post/1717806/


All Articles