Re: NPAPI race conditions due to IPC

Benjamin Smedberg <[email protected]> Tue, 03 Mar 2015 12:57:43 -0500
Newsgroups gmane.comp.mozilla.devel.plugins
Message-ID <[email protected]>
Could you file a bug with a minimal testcase, then? With a small plugin 
along with HTML code that exhibits the problem, we'd probably solve your 
problem faster than trying to debug it over a newsgroup. NEEDINFO me 
after you've filed the bug.

I still have a feeling that this is somehow related to the order that 
you insert the plugin element into the document; that we don't 
necessarily instantiate plugins the instant they are inserted, and that 
may be throwing off the rest of the testcase.

--BDS

On 3/3/2015 2:58 AM, [email protected] wrote:
> On Monday, March 2, 2015 at 12:31:34 PM UTC+2, [email protected] wrote:
>> Hi,
>>
>>    I have a plugin which can create two types of scriptable objects and I can add one to another using JavaScript and id association in the plugin. I create one in HTML and the other one in JS. Example:
>>
>> HTML:
>>    <embed id="a" type="application/x-a">
>>
>> JS:
>>    b = document.createElement("embed");
>>    renderer.setAttribute("type", "application/x-b");
>>
>>    a = documenet.getElementById("a");
>>    a.add(b);
>>
>>
>>    The problem which I am having is that NPN_Invoke for object a is called before NPP_New for object b. This is also visible in the invoke function because the _class member of the object which is given in the add function still has the default values.
>>    If I call a function of b than the NPP_New function is called before NPN_Invoke.
>>    The id association is done by trying to call a function of the object with NPN_Invoke:
>>
>> C++:
>>
>>    NPIdentifier identifier = NPN_GetStringIdentifier(GETID);
>>    if (!NPN_Invoke(npp, object, identifier, 0, 0, &variant)) {
>>      return 0;
>>    }
>>    obj = Manager.get(NPVARIANT_TO_INT32(variant);
>>
>>    The problem disappears when dom.ipc.plugins.enabled is set to false.
>>
>>
>>    Could this be a problem caused by IPC? Is there a way to flush all the changes from javascript to the C++ code?
>>
>> Thanks in advance,
>>
>> Cosmin
> Sorry for not making my self clear.
> Yes, I have two plugin instances of different types which are created by the same plugin.
>
> The created <embed> element is added to the document before it is added to the plugin.
>
> I am using Firefox 36, for Fedora 20.
> _______________________________________________
> dev-tech-plugins mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-plugins