Closed
Bug 254280
Opened 21 years ago
Closed 20 years ago
NPAPI GetProperty() never gets called
Categories
(Core Graveyard :: Plug-ins, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 257191
People
(Reporter: vlad.alexander, Unassigned)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115
Build Identifier: 2004080309 Mozilla 1.8a3
Developing a plugin using NPAPI. Unable to call a property from script. Suspect
this is a bug.
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1•21 years ago
|
||
Reporter | ||
Comment 2•21 years ago
|
||
The method is SPO_GetProperty(). See attached C++ source files.
Comment 3•21 years ago
|
||
is that the entire plugin source code? because if so, this is missing functions
like NP_Initialize.
it is also missing a RemoveProperty function.
Reporter | ||
Comment 4•21 years ago
|
||
Attached is the entire project. There is a property called Foo that does not
work when you try to call it from script. By the way, the latest nightly build
of Mozilla crashes loading this plugin. Last week's builds were okay.
Reporter | ||
Comment 5•20 years ago
|
||
Hi Guys,
We are in the process of developing the first plugin to use this new API but we
reached a dead end because we are not able to get properties to work. If this is
a bug, please, let's get this fixed. If we are not using properties correctly,
please give us some examples of correct usage. We have a lot of users who are
waiting to use this plugin in Mozilla/Firefox. Thanks.
Vlad, haven't looked at your code, but here's a resource you might find useful:
http://www.mozilla.org/projects/plugins/npruntime.html
Reporter | ||
Comment 7•20 years ago
|
||
Properties do not work if they are called by "document.getElementById". Methods
do work if they are called in this manner.
If the plug-in adds a representation of itself to the "document" object,
properties do work. For example: alert(pluginobj.bar); However, this is not the
preferred method for interacting with scriptable plug-ins. Plug-in IDs need to
be assigned through the "id" attribute on the <object> tag.
Example:
<object id="abc" type="application/mozilla-npruntime-scriptable-plugin"
width="600" height="40" />
<!-- this does not work -->
<input type=button value="Call Property"
onclick="alert(document.getElementById('abc').Bar)" />
<!-- this does work -->
<input type=button value="Call Method"
onclick="alert(document.getElementById('abc').Foo())" />
Also, there appears to be a memory leak when a property returns a value. If the
property is a string, the plug-in alloc some memory for that string and returns
it to script engine. It appears that the script engine does not release it. The
same thing happens to the Invoke function. We were able to identify this by
debugging our plug-in. Every time the browser is closed, the VC++ debug
environment reports that there is a memory leak. For example, the GetProperty
function malloc memory to the return value but it appears that it never gets
released.
bool
ScriptablePluginObjectBase::GetProperty(NPIdentifier name, NPVariant
*result)
{
if (name == sBar_id) {
STRINGZ_TO_NPVARIANT(strdup("Hi, I'm bar"), *result);
return true;
}
VOID_TO_NPVARIANT(*result);
return false;
}
Comment 8•20 years ago
|
||
This will be fixed by the patch in bug 257191. Duping, just to keep my sanity
here...
*** This bug has been marked as a duplicate of 257191 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Updated•2 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•