[Opera-Linux] plugins in Opera

Eirik Byrkjeflot Anonsen eirik at opera.com
Fri Feb 16 08:49:39 UTC 2007


Kevin DeKorte <kdekorte at gmail.com> writes:

> Hi,
>
> I'm developing a plugin for Gecko and was hoping to make the same plugin
> work in Opera. So far the problem I have is this. I want the plugin to
> be able to use dbus and be able to send signals to another out of
> process app. Under firefox I have this working quite well. But when I
> run the same plugin under Opera it looks like it just goes dead. I think
> the problem is that my plugin is using glib and Opera does not have a
> glib main loop or thread running. I tried creating a g_main_loop and
> putting that in my plugin but that didn't work and caused breakage in
> firefox. So any one have any hints as to what I can do to be able to use
> my glib based plugin in Opera.
>
> I'm using Opera 9.1 that I downloaded today from the main site and I am
> running on Fedora Core 6.
>
> Thanks,
>
> Kevin

I don't think it is a good idea to start a second main loop inside
another main loop.  The plug-in specification is quite clear that the
plug-in is running in a process that runs the Xt main loop.  These
days you can not be sure the Xt main loop is the only main loop
running, so even if the secondary main loop you try to start claims
that it is safe to run as a slave of Xt, it may not be safe to run it
slaved to the actual main loop of the process.  As you can see when
trying to run a slave glib main loop in firefox.

Hmm, I hope that wasn't too confusing :)

Anyway, from a portability viewpoint I think it is a very bad idea to
make any significant assumptions about how the "browser" is
constructed.  You're allowed to assume that there is an Xt main loop
running and that the window you get is an Xt window (The spec says the
window should be a motif drawing area, but this is not true these
days).

You can not assume that the browser runs a glib/gtk main loop or a qt
main loop.  And conversely, you can not assume that it does not run a
glib or qt main loop.

You could, in principle do run-time checks to see what sort of main
loops are running, but that is highly error prone.  In particular, you
will only be able to handle the things you know about.

My opinion is that the netscape plug-in specification is very bad from
a compatibility and future-proofing point of view.  And it is
extremely bad from a security point of view.  I would really like to
discard that specification and have a new one that deals correctly
with these issues.  Unfortunately, I doubt that will happen in the
foreseeable future.

(Due to the way the plug-in specification is made, it isn't even safe
to call new and delete in a plug-in.  That is, in fact, documented in
the specification.)


Sorry, I don't know what the solution to your problem is.  If you
can't do dbus calls without hooking into a main loop, and you can't
use the Xt main loop, then I can't see a "correct" way of doing this.


By the way, note that if a browser somehow is loading libdbus, it may
load a dbus library that is incompatible with the one your plug-in
wants.  There's a pretty good chance that this will cause
instabilities with both the browser and the plug-in.  See what I mean
when I say that the plug-in specification is really bad?

eirik



More information about the Opera-Linux mailing list