s***@gmail.com
2015-03-02 10:31:33 UTC
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
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