LO as an NPAPI browser plugin host?
sbergman at redhat.com
Fri Nov 16 07:08:45 PST 2012
There is a little-known(?) feature in LO that allows to plug browser
plugins based on the NPAPI standard to display (multimedia) content
inside LO documents. In Writer at least, it is available via "Insert -
Object - Plug-in...".
The implementation is in extensions/source/plugin/ (which has
platform-specific branches for aqua, unx, and win) and np_sdk/. And it
appears to be horribly broken, see below for details.
Given that "standard" multimedia content is already covered via "Insert
- Movie and Sound..." (whose implementation is completely unrelated),
the only relevant remaining use-case might be Flash content. But given
that I at least was unable to get even that working (see below), I
wonder whether this feature is actually used/missed by anybody, or
whether we should just drop it completely from our codebase? (I vaguely
remember that in the distant past it even worked to display Java applets
via this plugin interface, by plugging a JRE's browser plugin. Given my
findings below, I don't now it would even be worth to try to test that
* I tried all this on Fedora 17 x86-64.
* Running soffice with SAL_LOG=+WARN+INFO.extensions.plugin gives some
useful output now, at least on Linux.
* With totem-mozplugin-3.4.3-1.fc17.x86_64 installed, Firefox is able to
open e.g., .ogg audio files or .flv videos.
** Trying the same with LO Writer's "Insert - Object - Plug-in..." fails
(just specifying the .ogg/.flv file pathname, leaving "Options" blank).
The SAL_INFO output indicates that libtotem-clone-plugin.so is loaded,
but calling its NP_Initialize returns 3 (NPERR_INVALID_FUNCTABLE_ERROR)
because the NPNetscapeFuncs struct created in
extensions/source/plugin/unx/npnapi.cxx (based on an outdated definition
of NPNetscapeFuncs in np_sdk/mozsrc/npupp.h) is too short (i.e., misses
functions added by later NPAPI revisions and expected by the given
** In principle, it should work to update LO's NPAPI host interface to a
recent NPAPI revision. I tried to make extensions/source/plugin/unx/
use contemporary xulrunner-devel-16.0.2-1.fc17.x86_64 NPAPI headers from
--with-system-npapi-headers instead of the hack that is
np_sdk/mozsrc/npupp.h, but quickly gave up: For one, that npupp.h hack
is a wild mix of platform-specifics, OJI (Open JVM Integration) support,
etc., so replacing it with a plain npapi.h include seems far from
trivial. For another, this would require implementations of those
additional functions in the NPNetscapeFuncs struct (for some it might do
to add dummy implementations, in the hope that the relevant plugins do
not call them anyway).
* With the above rationale ("Insert - Movie and Sound..."), the totem
plugin is likely not that relevant, anyway, so next I tried to get
<http://linuxdownload.adobe.com/linux/x86_64/>) working. In Firefox, it
is able to open .swf files (e.g., garth.swf from
** Trying the same with LO fails again. This time, the SAL_INFO output
indicates that libflashplayer.so is loaded and that calling its
NP_Initialize returns 0 (i.e., the plugin is apparently satisfied with
our dated NPAPI implementation, hurrah). However, libflashplayer.so
(offloaded into a pluginapp.bin process of its own) crashes shortly
after in a call to aPluginFuncs.newstream from
extensions/source/plugin/unx/npnapi.cxx, for undebuggable reasons (as
the plugin comes without source code).
More information about the LibreOffice