Commit Graph

164 Commits

Author SHA1 Message Date
lif b98eea51e8 enable arm build 2020-03-23 00:36:03 -07:00
David Benjamin de08bfb186 Don't include gthread.h directly
Only glib.h (and glib/gstdio.h) are supposed to be included directly.
Fixes bug #43.

Reported-by: Anssi Hannula <anssi.hannula@iki.fi>
2011-12-29 08:44:30 -05:00
David Benjamin 65ef09da15 Hard-code NPNVsupportsAdvancedKeyHandling to FALSE
In case a plugin attempts to check this (unlikely as no browser
implements it yet) and avoid NULL checks on all the entry points, we
shouldn't crash. Also, for correctness, even if the browser supports it,
a browser + nspluginwrapper combination doesn't.
2011-09-14 10:55:56 -04:00
David Benjamin 62a50c7197 Implement NPNVdocumentOrigin
No one implements it yet, but it's a very simple variable, and very very
important to support when it does get used.
2011-09-14 10:52:50 -04:00
David Benjamin 2090fbafdc Add missing NULL check 2011-09-14 09:21:43 -04:00
David Benjamin f3c2b2d1f5 Leak library handles in is_wrapper_plugin
Many libraries crash on unload. Better to just keep them all loaded in
the process like everything else does.
2011-09-06 19:48:36 -04:00
David Benjamin f40a1f6089 Replace the plugin atomically instead of writing in-place
To say nothing of atomicity, lots of Bad Things happen when you replace
libraries in-place. gdb apparently gets upset at you, and you get random
crashes in programs which have the library loaded. Evidently libdl.so
can't even handle it. It's unspecified whether changes to a file mmapped
as MAP_PRIVATE are visible to the process.

Fixes #35.
2011-08-16 10:22:25 -07:00
David Benjamin b8a6af3f13 Set GDK_NATIVE_WINDOWS unconditionally
Browsers are supposed to set it all the time, if we take what Firefox
and Chrome do as the spec (which is as reasonable as anything). May as
well apply the workaround everywhere instead of assuming only Flash
needs it.

Reported-By: Stanislav Brabec <sbrabec@suse.cz>
2011-08-13 11:23:27 -07:00
Stanislav Brabec 8f3be9a1f8 Tell curl that we are a multi-threaded program - i. e. it can not use signals.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2011-07-13 21:16:04 -07:00
David Benjamin 9b1c7f0ff5 Use g_main_context_add_poll for the RPC source
There is not much point in playing silly games with the FD list when we
could just as well add a FD and check it out-of-band.
2011-06-29 09:39:11 -07:00
David Benjamin f6ec3f4c24 Rename a variable to be less confusing 2011-06-29 08:35:11 -07:00
David Benjamin e80bd44a50 Use g_renew instead of freeing and reusing the memory 2011-06-29 08:35:08 -07:00
David Benjamin 173fc6a221 Fix crash when the number of file descriptors grows and then shrinks
This is a bit of an embarrassing bug. The allocated size of the array
and the number of elements are not always the same.

Reported by Fridtjof Busse.
2011-06-28 20:57:35 -07:00
David Benjamin cea4f99888 Use %.*s instead of strndup to print the script in NPN_Evaluate 2011-05-25 23:17:44 -04:00
David Benjamin f136c8bae3 Move variable declaration down a bit
Just to refactor a little.
2011-05-18 00:49:01 -04:00
David Benjamin c7c9aa3fc0 Refactor the GDK_NATIVE_WINDOWS patch
Follow the Fedora patch and put it into npw-viewer.sh. It's a little
cleaner than in the Makefile.
2011-05-17 19:36:31 -04:00
David Benjamin 66570b9b0c Make the plugin capabitilities check somewhat more robust 2011-05-17 16:12:32 -04:00
David Benjamin e87d49bdd6 Half-initialize the plug-in in NP_Initialize
Otherwise the check for attempting to load the wrapper template plug-in
fails in GTK WebKit (which tries to call NP_Initialize on every
plug-in).

Reported by Arch Linux users.
2011-05-17 12:25:00 -04:00
David Benjamin b19fd2707a Send a version in npw-player
Likely doesn't matter, but probably worth initializing the plug-in
correctly.
2011-05-15 19:29:46 -04:00
David Benjamin 2cd26d4902 Detect Konqueror and use glib event loop instead of Xt one
Unfortunately, while Konqueror pretends to have an Xt event loop, it is
completely non-functional. Block hooks will not run, because it is a Qt
event loop polling Xt. Work procs also do not work because Xt does not
report them in XtAppPending. A timeout should, in theory, work, but
Konqueror doesn't even enable its Xt bridge most of the time! If the
plug-in requests XEmbed (as Flash does), a PluginHostXt is never created
and XtEvents::enable is never called. Instead of fighting all this, just
use the glib event loop. They have a bridge and Qt uses the glib event
loop these days anyway.

The only reason it used to work is because, not supporting windowless
plug-ins, most of communication was from browser to plug-in. Requests
would just get queued up and (with luck) not time out. With the new
delayed sync mechanism, we are unable to register the delayed sync and
instead the plug-in hangs.
2011-05-15 15:32:19 -04:00
David Benjamin a3630244c1 Replace mkdir_p with g_mkdir_with_parents 2011-05-13 22:15:59 -04:00
David Benjamin 7afea93464 Replace strstart with g_str_has_prefix 2011-05-13 21:59:09 -04:00
David Benjamin abe9cae68b Use g_build_filename in process_plugin_dir 2011-05-13 21:55:06 -04:00
David Benjamin 3740fd1c38 Don't use a static buffer for ~/.mozilla/plugins
Better avoid the potential buffer overflow.
2011-05-13 21:55:06 -04:00
David Benjamin 5e7569fd2b Use glib's code to get the home directory
No need to reinvent the wheel.
2011-05-13 21:53:15 -04:00
David Benjamin 5d64df2acc Implement NPAPI ClearSiteData hooks
Now that recent stable versions of Firefox, Chrome, and Flash all
implement it, we should wrap it.

Tested in Flash 10.3 with Chrome's 'Clear Browsing Data', Firefox's
'Clear Recent History', and Firefox's 'Forget About This Site'. It
appears Flash ignores maxAge and, when asked to clear all data ever,
sometimes gives NPERR_GENERIC_ERROR. But those aren't problems on our
end, and it seems to otherwise work.

See bug #6.
2011-05-13 19:17:37 -04:00
David Benjamin ff68174da4 Refactor some code a little bit 2011-05-13 19:17:37 -04:00
David Benjamin 3050d01ac0 Don't check capabilities in PLUGIN_DIRECT_EXEC 2011-05-13 19:17:37 -04:00
David Benjamin 25ea7083d6 Pass the version to NP_Initialize in NPPluginFuncs
Flash 10.3 expects to find a version in there.
2011-05-13 18:30:24 -04:00
David Benjamin 272e74cbf9 Kill npw_asprintf
It's not used anywhere and glib provides g_strdup_printf anyway.
2011-05-13 16:49:52 -04:00
David Benjamin c9a15440ef Always provide the event loop functions
It doesn't matter whether or not the browser handles them, we always do.
2011-04-28 19:25:38 -04:00
David Benjamin 0209a6814c Report browser and plugin hooks as NULL when not provided
Fixes bug #7.
2011-04-27 10:58:08 -04:00
David Benjamin a8017830ef Add header file to iteration over browser and plugin functions
Saves a bit of effort, and simplifies capability passing. We lose the
npruntime logic, but we may as well unconditionally initialize the
bridge. It's cheap and every browser should have it by now.
2011-04-27 10:06:42 -04:00
David Benjamin eab4684a2f Fix comment typo 2011-04-26 14:26:09 -04:00
David Benjamin 857234e5f1 Revert "Decrease the RPC message timeout from 30 seconds to 10"
This reverts commit 1b259a8119. If you
call a function from Flash that ends up opening an alert, the call
blocks until the user closes the alert, and the call eventually times
out. A 30 second timeout isn't much better, but is harder to trigger
accidentally, whereas it's not difficult to trigger a 10 second timeout
on accident.

See bug #24.
2011-04-23 14:28:00 -04:00
David Benjamin 189a5244a3 Add an explicit npobject_is_proxy check
For obnoxious reasons, NPN_CreateObject needs to know if an object is a
proxy before its proxy fields have been initialized. We can't assume
proxy_id == 0 means not a proxy. Valgrind gets upset.
2011-04-23 13:57:45 -04:00
David Benjamin 30021085d3 Release received NPObjects in npruntime handler functions
Missed a few spots there.
2011-04-22 22:57:06 -04:00
David Benjamin 0bdca9b126 Add more debug statements in npobject_destroy_stub
In case it fails in the middle or something.
2011-04-22 22:55:01 -04:00
David Benjamin cc47a00292 Don't check gtk_plug_new and gtk_socket_new for NULL
Neither can actually return NULL.
2011-04-21 19:21:47 -04:00
David Benjamin 31dcc57f69 Use NPN_ReallocData to reallocate NPPVformValue and Enumerate output
Saves a little bit of code. Also some of the enumerate code was bogus.
Also actually reallocate NPClass::Enumerate array. Oops, must have
missed that one.
2011-04-21 16:37:16 -04:00
David Benjamin e9aeade7cd Don't leak the NPN_SetException string
What's this about? Both Firefox and Chrome make a copy of it. (In fact,
Firefox apparently doesn't implement it for their out-of-process plugin
code. But their old codepath handles it fine.
2011-04-21 16:06:27 -04:00
David Benjamin 63f8937736 Incorporate the release number into NPW_PLUGIN_IDENT
As long as distributions actually remember to increment this value, they
won't keep missing updates.
2011-04-21 14:23:54 -04:00
David Benjamin 698e8d0c12 Hide some accidentally exposed symbols
Now we're back to exporting the bare minimum.
2011-04-20 22:59:30 -04:00
David Benjamin fd133c39a1 Allow NPN_CreateObject to run with a NULL instance
It's probably not a bad idea, and you'll crash Firefox, but let's not
crash it on our end.
2011-04-20 22:56:39 -04:00
David Benjamin 82851c108b Don't reserve the topmost bit in NPObject ids
We explicitly advertise the type, so client and server each get distinct
id spaces.
2011-04-20 21:01:48 -04:00
David Benjamin 6947ea103e Remove some spurious debug statements 2011-04-20 20:57:48 -04:00
David Benjamin cfd90e9ce4 When a NPObjectProxy is forcible invalidated, release the stub
It is of no use anymore, and later code will refuse to communicate with
the stub. It's easier to just free it now directly.
2011-04-20 20:52:37 -04:00
David Benjamin b8aa5a06fb Another massive commit
Maintain and send the owning NPP for every viewer-owned NPObject. Use
this as the NPP when creating proxy objects. Also send an explicit
NPObject type so we don't infer which side owns it from our
dictionaries.

This fixes the Firefox thing properly.
2011-04-20 20:52:37 -04:00
David Benjamin 8bd6c24884 Only compile npruntime_deactivate in the browser 2011-04-20 20:52:37 -04:00
David Benjamin 5f01909fec Go back to calling NPN_CreateObject
We'll later properly fix this under Firefox so that we pass the real NPP
to NPN_CreateObject.
2011-04-20 20:52:14 -04:00