Closed Bug 254280 Opened 21 years ago Closed 20 years ago

NPAPI GetProperty() never gets called

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 257191

People

(Reporter: vlad.alexander, Unassigned)

Details

Attachments

(2 files)

4.69 KB, application/octet-stream
Details
118.99 KB, application/octet-stream
Details
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.
Attached file C++ source files
The method is SPO_GetProperty(). See attached C++ source files.
is that the entire plugin source code? because if so, this is missing functions like NP_Initialize. it is also missing a RemoveProperty function.
Attached file Sample VC++ project
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.
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
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; }
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
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: