Closed
Bug 58491
Opened 25 years ago
Closed 24 years ago
ns4xplugin interface incorrect
Categories
(Core Graveyard :: Plug-ins, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: mkaply, Assigned: mkaply)
References
Details
Attachments
(7 files)
12.32 KB,
patch
|
Details | Diff | Splinter Review | |
6.96 KB,
text/plain
|
Details | |
27.53 KB,
text/plain
|
Details | |
27.72 KB,
text/plain
|
Details | |
7.01 KB,
text/plain
|
Details | |
45.55 KB,
patch
|
Details | Diff | Splinter Review | |
23.44 KB,
patch
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Comment 1•25 years ago
|
||
Assignee | ||
Comment 2•25 years ago
|
||
This is a very urgent problem for getting plugins working on OS/2.
scc has agreed that this interface is incorrect.
Assignee | ||
Comment 3•25 years ago
|
||
av, can I please get a review on this?
I don't fully understand the patch you have attached. There is still a class
declaration in the header file, is this correct?
Assignee | ||
Comment 5•25 years ago
|
||
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?
Assignee | ||
Comment 7•25 years ago
|
||
Assignee | ||
Comment 8•25 years ago
|
||
OK, I applied your patch, and it seems to work on Windows. r=av
You will need a super review to get it in.
Comment 10•25 years ago
|
||
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.
Assignee | ||
Comment 11•25 years ago
|
||
Assignee | ||
Comment 12•25 years ago
|
||
Comment 13•25 years ago
|
||
ouch. Can I have it as a diff -u please? :-)
Assignee | ||
Comment 14•25 years ago
|
||
Assignee | ||
Comment 15•25 years ago
|
||
Comment 16•25 years ago
|
||
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|
Assignee | ||
Comment 17•25 years ago
|
||
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.
Comment 18•24 years ago
|
||
Moving to m0.9.1 and reassigning to scc.
Assignee: av → scc
Target Milestone: --- → mozilla0.9.1
Updated•24 years ago
|
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Updated•24 years ago
|
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Why shouldn't mkaply own this?
Assignee | ||
Comment 20•24 years ago
|
||
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
Comment 21•24 years ago
|
||
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
Comment 22•24 years ago
|
||
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
Comment 23•24 years ago
|
||
0.9.5 is out the door. bumping TM up by one.
Target Milestone: mozilla0.9.5 → mozilla0.9.6
Comment 24•24 years ago
|
||
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 → ---
Comment 25•24 years ago
|
||
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
Assignee | ||
Comment 26•24 years ago
|
||
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.
Comment 28•24 years ago
|
||
If this is FIXED - why do a lot of NS4.x plugins incl. the X.org Broadway plugin
still not work ?
Assignee | ||
Comment 29•24 years ago
|
||
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.
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•