Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Constructor in NPObject

12 views
Skip to first unread message

L.A

unread,
Oct 18, 2009, 6:37:59 AM10/18/09
to
Hi,

I am new to NPAPI and frankly I am confused. AFAIU, browser creates
plugin instances through NPP_New and gets scriptable objects through
NPP_GetValue. Plugin Instance creates the scriptable object by calling
NPN_CreateObject. And I assume that NPN_CreateObject calls the
allocate function in the NPClass that is passed to it.

The questions is what is the constructor function in the NPClass used
for? Is it different than allocate? Does it create a new plugin?

Thanks
Levent

Benjamin Smedberg

unread,
Oct 19, 2009, 8:53:49 AM10/19/09
to
On 10/18/09 6:37 AM, L.A wrote:

> I am new to NPAPI and frankly I am confused. AFAIU, browser creates
> plugin instances through NPP_New and gets scriptable objects through
> NPP_GetValue.

Yes. There are other ways of gettings scriptable objects as well, for
example calling a method or getting a property of an object the browser
already has.

> Plugin Instance creates the scriptable object by calling
> NPN_CreateObject. And I assume that NPN_CreateObject calls the
> allocate function in the NPClass that is passed to it.

Yes.

> The questions is what is the constructor function in the NPClass used
> for? Is it different than allocate? Does it create a new plugin?

The constructor function is what implements NPN_Construct, which is the
NPAPI equivalent of `new SomeFunction()` in JavaScript. It has nothing to do
with creating the NPObject, or creating a new plugin instance.

--BDS

0 new messages