Re: NPAPI race conditions due to IPC
[email protected] Mon, 2 Mar 2015 23:58:20 -0800 (PST)
| Newsgroups | gmane.comp.mozilla.devel.plugins |
|---|---|
| Message-ID | <[email protected]> |
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.