If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

UNIX plugin SDK samples don't correctly use NP_GetValue

RESOLVED FIXED in mozilla1.4alpha

Status

()

Core
Plug-ins
P3
normal
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: Raffe, Assigned: Peter Lubczynski)

Tracking

Trunk
mozilla1.4alpha
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (compatible; Konqueror/2.2.1; Linux)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021204


I have developed a plug-in for Mozilla using, as base, examples found under:

<...>/modules/plugin/tools/sdk/samples/basic/unix

I find problems while displaying plug-in name and description via, for example,
browser's "Help/About plug-ins":
- the plug-in name I get is the "filename" of the plug-in shared library
(pluginame.so)
- no plug-in description is displayed.

I compiled the plug-in found under:
<mozilla-path>/modules/plugin/tools/sdk/samples/basic/unix

and I detected the same thing. I copied the binary under the "plugins" folder 
and I did run the
browser. When I choose "About Mozilla" to see if the plug-in has been
recognized, then I actually see it but no description is displayed. Then
name is also wrong as the displayed string is the name of the plug-in file
and not the one in the source code.


It seems like Mozilla never call the function NPP_GetValue in my plug-in 
with the parameter "NPPVariable variable" having the value 
"NPPpluginDescriptionString". Neither is the function called with the same 
parameter having the value "NPPpluginName".

I have tried to touch the plugin under recomendations of Peter Lubczynski (bug 
125469), but it didnt work.


I provide the part of the code where GetValue is:

#define MIME_TYPES_HANDLED "application/something:.something:something"
#define PLUGIN_NAME "A-Plug-in"
#define PLUGIN_DESCRIPTION "Description for A-Plug-in"

char* NPP_GetMIMEDescription(void)
{
    return(MIME_TYPES_HANDLED);
}


NPError nsPluginInstance::GetValue(NPPVariable aVariable, void *aValue)
{
  NPError rv = NPERR_NO_ERROR;

  switch (aVariable) {
    case NPPpluginScriptableInstance ...

    case NPPpluginScriptableIID ...

    case NPPpluginNameString:
      *((char **)aValue) = PLUGIN_NAME;
      break;

    case NPPpluginDescriptionString:
      *((char **)aValue) = PLUGIN_DESCRIPTION;
      break;

     default:
        break;
  }
  return rv;

}



Reproducible: Always

Steps to Reproduce:
1. compile plug-in found under 
<mozilla-path>/modules/plugin/tools/sdk/samples/basic/unix
2. install it (plugins folder of mozilla installation)
3. run browser
4. display About Plugins (Help menu)

Actual Results:  
neither plug-in name nor description for the example plug-in provided by 
Mozilla is shown.
the same happens for own developed plug-in


Expected Results:

Comment 1

15 years ago
reassign
Assignee: beppe → peterl

Comment 2

15 years ago
See how the default plugin is doing this in:
http://lxr.mozilla.org/mozilla/source/modules/plugin/samples/default/unix/npunix.c

Make sure you have np_entry.c compiled:
http://lxr.mozilla.org/mozilla/source/modules/plugin/tools/sdk/samples/common/np_entry.cpp

..specifically, be sure you have exported "NP_GetMIMEDescription" and
"NP_GetValue". Be sure you are using the right npupp.h:
http://lxr.mozilla.org/mozilla/source/modules/plugin/base/public/npupp.h#1276

Comment 3

15 years ago
this is the valid unix plugins sdk bug
first of all |NP_GetValue| is declared & implemented only in one place
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/modules/plugin/tools/sdk/samples/common/np_entry.cpp&rev=1.3&root=/cvsroot#188
which means cpp compiler by default will mangle this name and
|PR_FindSymbol(fLibrary, "NP_GetValue")|
will return null here:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/modules/plugin/base/src/ns4xPlugin.cpp&rev=1.95&root=/cvsroot#823

well, even if we declare |extern  "C"  NP_GetValue| we'll fail in
|npp_gate.cpp:NPP_GetValue|
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/modules/plugin/tools/sdk/samples/common/npp_gate.cpp&rev=1.4&root=/cvsroot#223
because we do not have plugins instance at that point yet:(

I'll try to figure out what we can do to fix it.

Comment 4

15 years ago
ah yes, Serge is right, our unix sdk samples are broken! :(

Take a look at how the UNIX default plugin does NP_GetValue:
http://lxr.mozilla.org/mozilla/source/modules/plugin/samples/default/unix/npshell.c#62
http://lxr.mozilla.org/mozilla/source/modules/plugin/samples/default/unix/npunix.c#363
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: neither plug-in name nor description is shown for developed plug-in via Help/About Mozilla → UNIX plugin SDK samples don't correctly use NP_GetValue

Comment 5

15 years ago
Created attachment 109685 [details] [diff] [review]
patch v1

Comment 6

15 years ago
Comment on attachment 109685 [details] [diff] [review]
patch v1 

this is not part of the build yet, so it doesn't need sr=
Attachment #109685 - Flags: review?(peterl)

Updated

15 years ago
Attachment #109685 - Flags: review?(peterl) → review+

Comment 7

15 years ago
-->serge has the fix
Assignee: peterl → serge
Keywords: patch
Target Milestone: --- → mozilla1.3beta

Comment 8

15 years ago
*** Bug 185549 has been marked as a duplicate of this bug. ***
(Reporter)

Comment 9

15 years ago
I have built mozilla 1.3 from source and I still experiment the same problems.
And not only for our plug-in, but also for the "simple" example
(".../sdk/samples/simple"): no plug-in name and no plug-in description is shown
via "Help/About plug-ins".

/R

Comment 10

15 years ago
-->peterl
Assignee: serge → peterl
Priority: -- → P3
Target Milestone: mozilla1.3beta → mozilla1.4alpha

Comment 11

15 years ago
this patch was checked into the trunk, please update to the tip
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.