Closed
Bug 182117
Opened 22 years ago
Closed 22 years ago
NPAPI variables that pass COM objects need an ABI bit
Categories
(Core Graveyard :: Plug-ins, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.3final
People
(Reporter: peterlubczynski-bugs, Assigned: peterl-bugs)
References
()
Details
(Keywords: topembed+, Whiteboard: [fixed1.3])
Attachments
(1 file, 5 obsolete files)
6.27 KB,
patch
|
peterlubczynski-bugs
:
review+
sfraser_bugs
:
superreview+
asa
:
approval1.3+
|
Details | Diff | Splinter Review |
This bug is basically a re-do of bug 167178 in that we need a more generic way
of ensuring that the COM objects passed back from the plugin (scriptable peer)
and the ones the browser gives the plugin (service manager and DOM) are of the
same ABI as the reciever. Rather than defining new variables for each object and
platform, how about encoding a bit value in each variable.
Reporter | ||
Comment 1•22 years ago
|
||
Here's a patch implementing the idea.
Reporter | ||
Updated•22 years ago
|
Attachment #107531 -
Flags: superreview?(sfraser)
Attachment #107531 -
Flags: review?(beard)
Comment 2•22 years ago
|
||
Comment on attachment 107531 [details] [diff] [review]
patch v.1
r=beard
Attachment #107531 -
Flags: review?(beard) → review+
Comment 3•22 years ago
|
||
Comment on attachment 107531 [details] [diff] [review]
patch v.1
+ * Flag for indicating compatible ABI formats
+ * for COM object returned from NPAPI variables.
+ */
+#ifdef TARGET_RT_MAC_MACHO
+#define NP_ABI_BASE_FLAG 1024
+#else
+#define NP_ABI_BASE_FLAG 0
+#endif
+
Should this be generalized a bit so that it can be extended to deal with binary
incompatibilities on other platforms, and between different compilers on the
same platform?
Attachment #107531 -
Flags: superreview?(sfraser)
Reporter | ||
Comment 4•22 years ago
|
||
so we need another bit for compiler version, like for the gcc 2.x ----> 3.x switch
Comment 5•22 years ago
|
||
I think we need more. I would expect to see a series of #ifdefs that set
NP_ABI_BASE_FLAG for each ABI-compatible compiler version on each platform.
Reporter | ||
Comment 6•22 years ago
|
||
Here's a patch which encodes each compiler defined ABI version into any
variable that deals with C++ objects.
Attachment #107531 -
Attachment is obsolete: true
I think __GXX_ABI_VERSION is only defined by gcc 3.0 and above, so this won't
distinguish egcs 1.1.2 from gcc 2.95 from gcc RH-2.96.
Comment 8•22 years ago
|
||
Whilst I'm not really qualified to comment on the patch, this looks good.
One thing to keep in mind is that in theory the g++ABI is corss vendor, so an
x86 linux plugin can run on x86 solaris, for example. theres a different define
to handle that, although theres notmuch point in testing for it until we know
that the implementation bugs have been fixed in gcc.
Reporter | ||
Comment 9•22 years ago
|
||
so cls says gcc 2.95 has the same ABI as egcs 1.1.2 so it doesn't need this. It
does link against a different stdlib so if there a problem, we'd crash earlier
on loading the library. RH-2.96 does produce a different ABI so I've given it a
bit in this patch. On the trunk, Mach-O builds have __GXX_ABI_VERSION as 100.
Attachment #108969 -
Attachment is obsolete: true
Reporter | ||
Updated•22 years ago
|
Attachment #109678 -
Flags: superreview?(sfraser)
Attachment #109678 -
Flags: review?(beard)
Comment 10•22 years ago
|
||
Comment on attachment 109678 [details] [diff] [review]
patch v.3
r=beard (I prefer the | operator to the + operator when doing bit twiddling).
Attachment #109678 -
Flags: review?(beard) → review+
Comment 11•22 years ago
|
||
Comment on attachment 109678 [details] [diff] [review]
patch v.3
Do we care about non-gcc compilers and platforms? Should we make the CFM/MachO
difference explicit?
Comment 12•22 years ago
|
||
I don't know if we care about them but Irix builds have the same ABI issue. The
4.x builds & plugins were built using the -o32 ABI. xptcall for irix has only
been ported to the -n32 ABI so the old plugins won't work. I'm not sure if we
see any extremely bad behavior (ie, crashes) because of the old plugins though.
CFM/Mach-o probably does need to be more explicit. CFM builds & 10.1 mach-o
builds will both have a base offset of zero. And it doesn't look like CW8
defines __GXX_ABI_VERSION even though it's supposedly supposed to be compatible.
Comment 13•22 years ago
|
||
Comment on attachment 109678 [details] [diff] [review]
patch v.3
Need to address issues that cls brings up.
Attachment #109678 -
Flags: superreview?(sfraser) → superreview-
Reporter | ||
Comment 14•22 years ago
|
||
Is the vtable layout generated by CW8 compatible with any version of gcc?
Are we going to need to evangelize the specific compiler used in various
embedding products or standardize on one so scripting can be made to work in Mach-O?
Comment 15•22 years ago
|
||
Um, guys, this is getting a little scary. We really don't want to switch our
whole project to Mach-O, but that's something that we could at least consider.
Switching to gcc? Not going to happen.
Our issues aside, how is any plugin developer supposed to install a scriptable
plugin in the best of circumstances? There's no way to figure out automatically
at install time what browser a user prefers. Can you imagine a dialog asking
users to provide that information? "Please indicate if your preferred browser is
a CFM application, was compiled with gcc X.x, gcc Y.y, or CodeWarrior." And a
decision *is* necessary since you cannot install more than one plugin for a
given MIME type. And heaven help the user who regularly uses more than one
browser!
I really fear that we need to find a solution that allows a single scriptable
plugin to work with any browser, irrespective of ABI. Anything else is going to
be a nightmare for developers and for users.
Clearly it's possible for Mach-O browsers to talk to CFM plugins in general,
with the exception of scriptability. Would it be worth considering a very
minimal scriptability interface that didn't depend on COM objects? I agree that
COM objects are an excellent technical solution, but I'd much rather have one
that worked. FWIW, our entire interface consists exclusively of methods and
accessors:
NS_IMETHOD Method(void)
NS_IMETHOD Accessor(const char *type, char **_retval)
Would it be possible to have some sort of callback into the browser that simply
registered function pointers of this type?
NPP_RegisterMethod("MethodName1", (NPPMethodPtr)Method1);
NPP_RegisterMethod("MethodName2", (NPPMethodPtr)Method2);
NPP_RegisterAccessor("AccessorName1", (NPPAccessorPtr)Accessor1);
NPP_RegisterAccessor("AccessorName2", (NPPAccessorPtr)Accessor2);
NPP_RegisterAccessor("AccessorName3", (NPPAccessorPtr)Accessor3);
Something like that would get us up and running nice and smoothly. I don't know
if other developers need more, but this would probably be pretty good for a lot
of them.
Well, it's a thought, anyway. Regardless, I hope you'll keep in mind that not
every plugin is bundled with the browser, and that whatever ends up happening in
terms of scriptability, it has to be something that external developer can
support and that external users can use...
Reporter | ||
Comment 16•22 years ago
|
||
per topembed+ triage: topembed+ for 1.4
Note that scriptability is not the only time COM objects are passed between the
browser and the plugin. The plugin could request a pointer to nsIServiceManager
and have access to almost anything. Also starting with 1.2, the plugin also has
direct access to the nsIDOMNode for the tag and document.
Comment 17•22 years ago
|
||
Well, then maybe this bug should be split up into the general parts
(scriptability) and the Mozilla/Netscape-specific parts (everything else)? Does
any other browser allow access to nsIServiceManager and nsIDOMNode? We don't
need access to those, but we're stymied in providing a scriptable plugin because
some browsers require CFM for access to scriptability, and some require Mach-O,
and it's not impossible to satisfy both at the same time.
Reporter | ||
Comment 18•22 years ago
|
||
Here's a new patch that adds two masks to the NPAPI, one for gcc3 and one for
Mach-O. The idea is that these masks can be used for backwards compatibility to
determine the ABI format the browser expects. This lumps both 10.1 builds and
CW-Mach together into the same effective mask but that should be fine as there
are no shipping browsers off these and that'll work good enough to stop crashes
if there ever are.
There are different ideas for how to hand back a properly formated object and
not have duplicate plugins. One idea calls for having the C++ scripting shim
live in seperate libraries (in the bundle) and the plugin is responsible for
dynamically loading and instantiating the right object based on what the
browser asks. Another idea is to possibly take a look at the sample C
implemented XPCOM component in bug 72083 and perhaps to construct compatible
vtables by hand for nsISupports and nsIClassInfo.
Attachment #109678 -
Attachment is obsolete: true
Reporter | ||
Comment 19•22 years ago
|
||
This fix is needed if Mozilla 1.3 wants scriptable plugins in gcc3 or Mach-O builds.
Status: NEW → ASSIGNED
Flags: blocking1.3?
Target Milestone: mozilla1.4alpha → mozilla1.3final
Reporter | ||
Updated•22 years ago
|
Attachment #115197 -
Flags: superreview?(sfraser)
Attachment #115197 -
Flags: review?(seawood)
Comment 20•22 years ago
|
||
+#define NP_ABI_GCC3_MASK 0x10000000
+#define NP_ABI_MACHO_MASK 0x01000000
+
+#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
+#define _NP_ABI_GCC3_MASK NP_ABI_GCC3_MASK
+#else
+#define _NP_ABI_GCC3_MASK 0
+#endif
+
+#if (defined(TARGET_RT_MAC_MACHO))
+#define _NP_ABI_MACHO_MASK NP_ABI_MACHO_MASK
+#else
+#define _NP_ABI_MACHO_MASK 0
+#endif
I had to stare at this for a few minutes before I noticed that
_NP_ABI_MACHO_MASK and NP_ABI_MACHO are not the same thing. Please make them
more different. I guess the approach is fine, but I'd still like to see some
comments to to say why this is only being done for Unix/Macho, just to keep the
Windows developers in the loop.
Updated•22 years ago
|
Attachment #115197 -
Flags: review?(seawood) → review+
Reporter | ||
Comment 21•22 years ago
|
||
patch with better comments
Attachment #115197 -
Attachment is obsolete: true
Reporter | ||
Updated•22 years ago
|
Attachment #115560 -
Flags: superreview?(sfraser)
Updated•22 years ago
|
Attachment #115560 -
Flags: superreview?(sfraser) → superreview+
Reporter | ||
Comment 22•22 years ago
|
||
I found that if I include npapi.h in nsplugindefs.h, I'm going to have to
change any REQUIRES line that includes plugins to also include java because of
the dependancy on jri.h. nsplugindefs.h is really for deprecated XPCOM plugins
and not plugin vendors and should only be used internally. So this new patch
does not make any changes to nsplugindefs.h but instead removes the ussage of
nsPluginInstanceVariable in calling GetValue.
Attachment #115560 -
Attachment is obsolete: true
Reporter | ||
Updated•22 years ago
|
Attachment #115649 -
Flags: superreview?(sfraser)
Attachment #115649 -
Flags: review+
Updated•22 years ago
|
Attachment #115649 -
Flags: superreview?(sfraser) → superreview+
Reporter | ||
Comment 23•22 years ago
|
||
patch checked in last night so this is in today's trunk builds, marking FIXED
Simon, can you check this into the Chimera branch as well?
QA: This fix can be verified by attempting to script a plugin, like Flash, and
not crashing. Mach-O and gcc3 (like w/RH8) builds should not crash but scripting
will not work until plugin vendors update their code.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
QA Contact: shrir → bmartin
Resolution: --- → FIXED
Comment 24•22 years ago
|
||
Speaking of "until plugin vendors update their code", it would be really really
helpful if there was sample code that showed how to pull that off. We are not
able to abandon all of the people currently using CFM browsers (read: all of the
people currently using our plugin), so we need a solution that lets a single
plugin provide the proper connections to both CFM and Mach-O browsers.
I've split this issue into a separate bug 195264.
Updated•22 years ago
|
Flags: blocking1.3? → blocking1.3+
Reporter | ||
Comment 25•22 years ago
|
||
Comment on attachment 115649 [details] [diff] [review]
patch v.5
Requesting approval for Mozilla 1.3 final:
This fix is needed for 1.3 final because the Mach-O/CFM switch on OSX. The
branch currently has plugin scripting with the NPAPI completely disabled so it
is not possible for a plugin vendor to write a scriptable plugin for Mach-O
without this fix. Users will see this as a regression from CFM and it won't be
possible for plugin vendors to release a compatible plugin without this fix. In
addition, the branch currently crashes when a plugin like Flash is accessed
from Javascript in builds made with gcc3. This fix changes the values of enums
in the NPAPI for Mach-O and gcc3 builds only, therefore preventing crashes and
providing a unique selectors for plugins to hand back their scripting
interfaces in the correct ABI.
Attachment #115649 -
Flags: approval1.3?
Comment 26•22 years ago
|
||
Comment on attachment 115649 [details] [diff] [review]
patch v.5
a=asa (in behalf of drivers) for checkin to 1.3 branch.
Attachment #115649 -
Flags: approval1.3? → approval1.3+
Reporter | ||
Updated•22 years ago
|
Whiteboard: [fixed1.3]
Updated•21 years ago
|
Attachment #115197 -
Flags: superreview?(sfraser)
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
•