Commit Graph

211 Commits

Author SHA1 Message Date
David Benjamin 31df33f292 Don't export rpc_has_pending_sync
The GSources are created in rpc.c, so we don't need to export this
function.
2011-04-15 15:16:05 -04:00
David Benjamin 5db01af5f8 Be consistent with other WARNING messages and don't hide under D()
Although this does mean we spew stuff every time we open a Flash
instance. Hehehe.
2011-04-14 15:34:47 -04:00
David Benjamin ed1ac280ec Handle NP_GetValue variables in NPP_GetValue
Firefox requests them with the wrong function sometimes. Fixes #18.
2011-04-13 17:38:20 -04:00
David Benjamin 7450a0d541 Drop some unnecessary UPP typedefs
Missed some from the NPAPI upgrade. Also make some variable properly
const.
2011-04-13 16:50:25 -04:00
David Benjamin 5cb0607b5d Always enable windowless plugins
They're part of NPAPI and quite useful. There's really no point in
disabling them.
2011-04-13 14:20:49 -04:00
David Benjamin f1a37cc1db Punt remainder of XPCOM stubs
They don't do anything, and I've no intention of implementing them.
2011-04-13 14:19:52 -04:00
David Benjamin 73f9bf6c67 Output the NPRect in NPN_InvalidateRect
May prove useful for debugging redraws.
2011-04-13 14:11:42 -04:00
David Benjamin f445ff709d Merge branch 'master' into rework-sync 2011-04-12 21:23:25 -04:00
David Benjamin bcedfed331 Skip pending sync dispatches on nested event loops
Chromium pumps the glib event loop on nested event loops. We don't
support the wrapper or the viewer recursively handling events on
themselves or each other anyway because of GSources can't recurse by
default (and it's insane). But with two event sources, we need
additional logic.

Bug #14.
2011-04-12 21:22:18 -04:00
David Benjamin 888bcabe8b Free NPString data using NPN_MemFree
The RPC system allocates it with NPN_MemAlloc.
2011-04-09 22:48:17 -04:00
David Benjamin f80103be0e Print out the script being evaluated in NPN_Evaluate
This output is useful when trying to figure out what an NPN_Evalute is
doing. It would be nice not to do the strndup/free when not debugging,
but meh. We're already doing a string_of_NPVariant anyway.
2011-04-09 22:48:17 -04:00
David Benjamin 662820f46b Release pointer grabs before forwarding a ButtonPress to the plugin
Otherwise we still carry an implicit passive grab and the viewer cannot
upgrade to an active grab to show a context menu. This really only fixes
older Firefoxes as browsers which push plugins out-of-process themselves
(as they should) need to also include this fix. In theory this would
also fix Arora, but they have a QtWebKit bug where the event time is
bogus.

See browser bugs
http://code.google.com/p/chromium/issues/detail?id=40157
http://bugzilla.mozilla.org/show_bug.cgi?id=544211

Closes #16.
2011-04-09 22:48:17 -04:00
David Benjamin 045363395a Pass the instance on to toolkit_flush
We may as well not pass NULL when we know what the value is. This
codepath doesn't run in Mozilla, but Mozilla uses a NULL instance to
trigger some backwards-compatibility Xt code.
2011-04-09 22:48:17 -04:00
David Benjamin 29a392b2ed The latest Acrobat Reader plugin seems to work just fine
May as well update the list of plugins.
2011-04-09 22:48:17 -04:00
David Benjamin c270e3f1d2 Split sync source out to a higher priority GSource
We want these to run /immediately/. (Ideally right after the event loop
iteration returns.) So split it off into its own dedicated high-priority
source.
2011-04-08 14:46:41 -04:00
David Benjamin eacf34822c Rework the sync mechanism
We still request a SYNC on new invokes, as before. However, we do not
unblock the SYNC with a SYNC_ACK (and correspondingly the SYNC_ACK with
a SYNC_END) until we return to the event loop. Originally, we unblock
when the current invoke is finished, so conflicts always alternate
method calls. This makes race conditions insane. Instead, we interleave
one event loop iteration's worth of invokes as a unit.

The end result should be that the wrapper never sees inconsistencies
(modulo main loop source priorities but those were already violated).
The viewer still may. However its inconsistencies are limited to the
first RPC'd NPAPI call in a single event loop iteration. We can get rid
of this by driving the viewer event loop ourselves and surrounding every
dispatch with a SYNC/SYNC_END pair (thus binding the two event loops
together), but this may be prohibitively expensive for dispatches that
don't call NPAPI.

Closes #14. The crash was caused by an NPN_Evaluate (triggering an
NPP_SetWindow browser-side) getting in between a
NPP_SetWindow/NPP_HandleEvent pair because windowless plugins on Linux
make no sense.
2011-04-08 14:39:43 -04:00
David Benjamin 45eebbd0b3 Move GSource creation into rpc.c
Save us a bit of code since it's shared in both processes.
2011-04-08 14:34:41 -04:00
David Benjamin a29b84fdec Print out the NPWindowType we receive
Probably not strictly necessary as we can tell by whether window->window
is NULL. Still, useful bit of debug.
2011-04-06 13:30:45 -04:00
David Benjamin c065c28f95 Don't bundle ELF header definitions
There's no point when it's available in elf.h anyway.
2011-04-04 00:27:14 -04:00
David Benjamin 815511a3ba Check for NULL plugin instance values in NPN_GetValue and NPN_SetValue
This is to work-around Chromium not doing the check itself. It's only
somewhat Chromium's fault as they're perfectly okay with segfaults
(separate plugin process) and a plugin shouldn't request
NPNVWindowNPObject on a NULL npp anyway. And, in fact, they don't. This
is a side effect of our RPC system not being able to distinguish a NULL
plugin instance from an invalid plugin instance.

This check should be removed when the fix in Chromium has trickled down
to the stable channel or when our RPC system becomes less awful.
2011-04-03 13:41:47 -04:00
David Benjamin da4fed8cb4 Clean up some error case better 2011-04-03 02:01:02 -04:00
David Benjamin f1c9c19337 Use dlopen instead of g_module_open in npw-player.c
GModule implements additional logic which we do not want. It will call
g_module_init_check and g_module_unload which is not part of the plugin
interface.

Also, we already explicitly look for -ldl whereas using gmodule wants
pkg-config gmodule-2.0 anyway.
2011-04-03 01:59:46 -04:00
David Benjamin 0ff78b2a87 Don't unload plugins from the process
Unfortunately, some libraries are broken and corrupt internal state when
they are unloaded. Closes #8.
2011-04-03 01:49:58 -04:00
David Benjamin 3a30b40846 Mark a function static that should have been
Just in case there's a symbol clash someday.
2011-04-02 22:25:55 -04:00
David Benjamin 151a9d9b5b Remove a finished entry in the TODO file
The file's from earlier, but let's remove what's definitely done.
2011-04-02 21:53:09 -04:00
David Benjamin 10f43d1b9c Make some output if we think the wrapper needn't be modified
It's not clear this logic is what we want, but at least make such things
visible.
2011-04-02 21:47:21 -04:00
David Benjamin 3628084743 Punt the debug statements in NPN_PluginThreadAsyncCall
The debug system is not thread-safe. It probably should be made so at
some point, but for now just don't bother printing stuff here.
2011-04-02 21:44:37 -04:00
David Benjamin 1b259a8119 Decrease the RPC message timeout from 30 seconds to 10
Patch from Fedora. Makes plugin hangs marginally more bearable if your
browser blocks the UI on that.
2011-04-02 00:05:38 -04:00
David Benjamin 12f10dfab2 Uniquify the socket path within a given process
Also move the code a little. This allows two nspluginwrapper plugins
with the same file name to be loaded at once in the same process. This
is not very important, except it appears Arora or QtWebKit call
NP_Initialize when probing plugins (instead of skipping to
NP_GetMIMEDescription and NP_GetValue like everyone else). They also
leave the plugin around evidently.

The result is that, if you have two versions of a wrapper Flash, the
second's will fail to bind the socket and then hang later on.
2011-04-01 14:56:19 -04:00
David Benjamin ff0aa5ef4e Don't hard-code buffer sizes for socket paths
Glib has g_strdup_printf which works just fine here.
2011-04-01 14:56:19 -04:00
David Benjamin e350dae27e Punt dead component name
libxpcom.so has been removed and never did anything.
2011-04-01 14:56:19 -04:00
David Benjamin 91056ae3be Short-circuit the Konqueror heuristic earlier
Two of those checks are local and one requires querying the browser.
Also, the latter will request NPNVxDisplay which triggers Xt
compatibility code in Mozilla. So lets try to make sure it never happens
on browsers newer than 2004 (i.e. that support npruntime).
2011-04-01 14:55:39 -04:00
David Benjamin b5070d4802 Just delete the method and property cache code altogether
No amount of massaging will make them correct. Unless we know we're on
V8 and can get at the hidden classes or something absurd like that.
2011-04-01 01:56:40 -04:00
David Benjamin 449b874338 Use the NPIdentifier cache in NPN_IdentifierIsString
Unlike the HasMethod and HasProperty caches, this one isn't bogus. And I
think they just called the wrong function.
2011-04-01 01:46:45 -04:00
David Benjamin c4b521a9c6 Disable the NPClass::HasMethod and NPClass::HasProperty caches
Unfortunately they are incorrect. A Javascript object's properties may
change over time. In particular, code surrounding the video linked in
this unrelated bug report relied on this.

http://code.google.com/p/chromium/issues/detail?id=29907
2011-04-01 01:42:56 -04:00
David Benjamin 7d86737022 Pull in the newest gtk2xtbin.c from Mozilla
The changes look sane. Mostly updating for GObject being moved out from
GtkObject.
2011-03-31 11:46:50 -04:00
David Benjamin db3be68a41 Silence some unused variable warnings in test-rpc-common.c 2011-03-31 11:46:50 -04:00
David Benjamin 8931b7b618 Move biarch/LSB CFLAGS and LDFLAGS computing to the top
Instead we set *_32 versions of all the variables to get the plugin
target build environment. When not building biarch, they are the same as
the wrapper build environment. (They should be renamed to _TARGET or
something or something.)
2011-03-31 11:28:21 -04:00
David Benjamin 5ca113ac12 Fix initialization of array of structs
gcc 4.5 was unhappy about the missing set of curly braces.
2011-03-30 23:22:48 -04:00
David Benjamin ff54c64f0c Punt libxpcom.so
It is a stub library defining no functions, is currently unused, and
likely never will be used.
2011-03-30 22:28:59 -04:00
David Benjamin cddf8a2914 Enable printf warnings on npw_printf and friends
Also fix two errors they catch.
2011-03-30 22:28:59 -04:00
David Benjamin 04cdf540b8 Use g_file_open_tmp instead of tmpnam
Avoid the race conditions with tmpnam, also handle a ton of error
conditions so we stop getting compiler warnings.
2011-03-30 22:28:59 -04:00
David Benjamin 06e0a2fc61 Silence compiler warning about pointer to char *
Apparently pulling CURLINFO_PRIVATE out of curl actually gets you a char
* "for internal reasons" even though it's actually a void *. What?
2011-03-30 22:28:59 -04:00
David Benjamin b827ee0fed Stub __recv_chk
Fixes build on (I presume) newer libcs when using the lsb stub files.
Patch from OpenSUSE.
2011-03-30 20:27:27 -04:00
David Benjamin 072df8ad81 Use __builtin_offsetof instead of the macro thing
Otherwise the expression is not constant and we fail to build on some
compilers. Patch from OpenSUSE.

We've got to get rid of this lsb-build thing.
2011-03-30 20:26:42 -04:00
David Benjamin 673b42b9f2 Sanitize LDFLAGS vs LIBS
This should make the package fine with --as-needed. Inspired by Gentoo
patch.
2011-03-30 20:25:35 -04:00
David Benjamin 872837d2c8 Honor LDFLAGS
Import it from the environment and also stick it into LDFLAGS_32
2011-03-30 20:25:35 -04:00
David Benjamin 1f2722a8e3 Inherit CFLAGS_32 from CFLAGS 2011-03-30 20:25:35 -04:00
David Benjamin 2118ac47d5 Fix a typo $(biarch) -> $(build_biarch)
Caught by a Gentoo patch.
2011-03-30 20:25:35 -04:00
David Benjamin 1b7e7e0feb Check the return value of freopen
We don't actually care, but gcc is complaining.
2011-03-30 20:25:35 -04:00