Closed Bug 185776 Opened 22 years ago Closed 21 years ago

UNIX plugin SDK samples don't correctly use NP_GetValue

Categories

(Core Graveyard :: Plug-ins, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.4alpha

People

(Reporter: raffe_g, Assigned: peterl-bugs)

References

Details

Attachments

(1 file)

6.24 KB, patch
peterlubczynski-bugs
: review+
Details | Diff | Splinter Review
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:
reassign
Assignee: beppe → peterl
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
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.
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
Attached patch patch v1 Splinter Review
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)
Attachment #109685 - Flags: review?(peterl) → review+
-->serge has the fix
Assignee: peterl → serge
Keywords: patch
Target Milestone: --- → mozilla1.3beta
*** Bug 185549 has been marked as a duplicate of this bug. ***
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
-->peterl
Assignee: serge → peterl
Priority: -- → P3
Target Milestone: mozilla1.3beta → mozilla1.4alpha
this patch was checked into the trunk, please update to the tip
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
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: