Closed Bug 58491 Opened 25 years ago Closed 24 years ago

ns4xplugin interface incorrect

Categories

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

x86
All
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: mkaply, Assigned: mkaply)

References

Details

Attachments

(7 files)

The ns4xplugin interface was written using a C++ class. This incorrectly assumes that the compiler being used uses the same calling convention for C and C++. This would be OK if this were a new interface, but this is a legacy interface so it must work the same way it used to. The calls that the plugin makes back to Mozilla should be genuine C calls, they should NOT be member functions of a class. I already have this fixed and will be attaching a patch in a few moments.
Blocks: 58462
This is a very urgent problem for getting plugins working on OS/2. scc has agreed that this interface is incorrect.
av, can I please get a review on this?
Keywords: patch, review
I don't fully understand the patch you have attached. There is still a class declaration in the header file, is this correct?
Unfortunately, the CVS diff really doesn't give any info about this change. Sorry about that. Basically what I have done is move all the callback functions (_geturl, etc.) out of the plugin class. They are now standalone C functions. This causes them to have C calling convention.
Would you please attach the modified versions of the whole files?
Attached file ns4xPlugin.h
Attached file ns4xPlugin.cpp
OK, I applied your patch, and it seems to work on Windows. r=av You will need a super review to get it in.
prefer the idiom for pointer tests, e.g., if ( gServiceMgr ) return NPERR_GENERIC_ERROR; as opposed to an explicit comparision against my personal enemy, |nsnull|. In your assertions as well. Don't use old-style casts (yeah, I know that's what was already there, but if you're touching the code...). I see |(nsISupports**)&pm| et al. Use |NS_STATIC_CAST|, it should be a habit --- it catches errors. It looks like the code started out with some questionable practices, so I won't bug you to fix them all. I don't see any real problems with this code ... just minor language technicalities. I'd appreciate it if you fixed the casts, and the comparisons. Other than that, sr=scc.
ouch. Can I have it as a diff -u please? :-)
Reviewed with mkaply on IRC. For the benefit of other readers, here were my comments: first thing is, if you have to touch |QueryInterface|, you might as well replace it with the macro |NS_IMPL_QUERY_INTERFACE3| or whatever is appropriate and you got one of your tests backwards should be |if (aServiceMgr && !gMalloc) ...| not |!aServiceMgr| in |_destroystream|, since you have to QI anyway, you should use an |nsCOMPtr| which will make the code shorter and safer but since you have to call |GetService| anyway [in |reloadplugins|, et al], you should use an |nsCOMPtr| in this situation, and use |do_GetService| most of these routines would benefit from appropriate use of |nsCOMPtr|
Could you be more specific on the _destroystream thing? here's the code: nsISupports* stream = NS_STATIC_CAST(nsISupports*, pstream->ndata); nsIPluginStreamListener* listener; if(stream->QueryInterface(kIPluginStreamListenerIID, NS_STATIC_CAST(void**, &listener)) == NS_OK) { // XXX we should try to kill this listener here somehow NS_RELEASE(listener); return NPERR_NO_ERROR; } Would it look like this? nsISupports* stream = NS_STATIC_CAST(nsISupports*, pstream->ndata); nsComPtr<nsIPluginStreamListener> listener = do_QueryInterface(stream); if(listener) { // XXX we should try to kill this listener here somehow NS_RELEASE(listener); return NPERR_NO_ERROR; } That doesn't make a lot of sense to me. Maybe I'm missing something.
Keywords: 4xp
Blocks: 55959
Moving to m0.9.1 and reassigning to scc.
Assignee: av → scc
Target Milestone: --- → mozilla0.9.1
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Blocks: 76771
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Actually, I think someone in plugin land should own this. What is left is a cleanup of ns4xplugin.cpp because it does stuff "the old way" per scc. I could certainly take a look at it, but I am way backlogged right now
Doesn't look like this is getting fixed before the freeze tonight. Pushing out a milestone. Please correct if I'm mistaken.
Target Milestone: mozilla0.9.3 → mozilla0.9.4
looks like we could live without these for 0.9.4. let me know if this is a mistake. moving out...
Target Milestone: mozilla0.9.4 → mozilla0.9.5
0.9.5 is out the door. bumping TM up by one.
Target Milestone: mozilla0.9.5 → mozilla0.9.6
unsetting the target milestone... doesn't seem like this is too critical. is anybody really waiting on this? peter, is this something that you could pick up?
Target Milestone: mozilla0.9.6 → ---
wow, this is an old bug. Looking at ns4xPlugin today, it looks like most of them have already been converted to C functions. -->over to mkaply to see if he wants to do anything else with this bug...
Assignee: scc → mkaply
The only thing left on here is the scc comment: prefer the idiom for pointer tests, e.g., if ( gServiceMgr ) return NPERR_GENERIC_ERROR; as opposed to an explicit comparision against my personal enemy, |nsnull|. In your assertions as well. Don't use old-style casts (yeah, I know that's what was already there, but if you're touching the code...). I see |(nsISupports**)&pm| et al. Use |NS_STATIC_CAST|, it should be a habit --- it catches errors. It looks like the code started out with some questionable practices, so I won't bug you to fix them all. I don't see any real problems with this code ... just minor language technicalities. I'd appreciate it if you fixed the casts, and the comparisons. Other than that, sr=scc. This file uses old style. The actual bug has been fixed.
-->FIXED
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
If this is FIXED - why do a lot of NS4.x plugins incl. the X.org Broadway plugin still not work ?
This defect was about a specific issue that the 4.x plugin interface was written in C++ rather than C so there were calling convention issues. This issue is fixed.
v
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: