nspluginwrapper-1.2.0

Taken from Ubuntu orig.tar.gz file.
This commit is contained in:
David Benjamin 2011-03-05 22:28:32 -05:00
parent 1f0ad8eb29
commit 74360b0d71
22 changed files with 548 additions and 75 deletions

185
ChangeLog
View File

@ -1,3 +1,188 @@
2008-12-25 21:29 Gwenole Beauchesne <gb.public@free.fr>
* ChangeLog: Generated by svn2cl.
2008-12-21 21:43 Gwenole Beauchesne <gb.public@free.fr>
* src/debug.h: Fix npw_return_if_fail() definition in !DEBUG mode.
2008-12-21 14:02 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-viewer.c: Destroy the plugin window in NPP_Destroy().
NPAPI docs mention plugin shall not use graphics operations
beyond that call. So, don't bother with broken plugins, we
already have our own bugs to bother with...
2008-12-21 12:14 Gwenole Beauchesne <gb.public@free.fr>
* .: Create nspluginwrapper-1.2-branch from rev 837.
2008-12-20 22:24 Gwenole Beauchesne <gb.public@free.fr>
* gwenole/projects/nspluginwrapper/trunk/ChangeLog: Generated by
svn2cl.
2008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr>
* gwenole/projects/nspluginwrapper/trunk/NEWS,
gwenole/projects/nspluginwrapper/trunk/nspluginwrapper.spec:
1.2.0.
2008-12-20 21:32 Gwenole Beauchesne <gb.public@free.fr>
* gwenole/projects/nspluginwrapper/trunk/src/npw-config.c:
Suppress error messages in non-verbose mode when exec()'ing
npviewer.bin (Stanislav Brabec).
2008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr>
* NEWS, nspluginwrapper.spec: 1.2.0.
2008-12-20 21:32 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-config.c: Suppress error messages in non-verbose mode
when exec()'ing npviewer.bin (Stanislav Brabec).
2008-12-20 21:16 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-config.c: Remove non-strictly conforming usage of
varargs (noticed by Carsten Juttner).
2008-12-16 22:48 Gwenole Beauchesne <gb.public@free.fr>
* configure: Newer Intel compilers deprecated use of -c99. Rather,
they now support the GCC-like option -std=c99.
2008-12-16 22:45 Gwenole Beauchesne <gb.public@free.fr>
* tests/test-rpc-nested-2.c: Fix return values.
2008-12-14 22:08 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-wrapper.c: Drop beta status.
2008-12-14 22:07 Gwenole Beauchesne <gb.public@free.fr>
* NEWS, nspluginwrapper.spec: Updates for 1.2.0.
2008-12-14 21:58 Gwenole Beauchesne <gb.public@free.fr>
* ChangeLog: Generated by svn2cl.
2008-12-14 21:40 Gwenole Beauchesne <gb.public@free.fr>
* src/utils.c: Handle unmasked variants of NPNVariable and
NPPVariable.
2008-12-14 21:39 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-common.h, src/npw-viewer.c: Handle NPNVToolkit variable
regardless of the C++ ABI mask flag if we implement Gtk2. This
fixes Flash Player 10 plugin (built with Sun Studio) execution
with a gcc built npviewer.bin since NPNVToolkit has a different
value in that case.
2008-12-14 21:22 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-viewer.c: Load the SunStudio C++ run-time library on
Solaris. This is necessary for the Flash Player 10 plugin.
2008-12-14 20:42 Gwenole Beauchesne <gb.public@free.fr>
* Makefile, nspluginwrapper.spec: No longer ship with obsolete
mkruntime script. It was never really used anyway.
2008-12-14 18:09 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-player.c: Fix definition of byte array, aka Stun Studio
warning fix.
2008-12-14 18:02 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-common.h: Avoid warning for empty member declaration
(Sun Studio), i.e. avoid double-colon.
2008-12-14 18:01 Gwenole Beauchesne <gb.public@free.fr>
* src/npruntime.c: Fix incomplete assert(), noticed by David
Binderman.
2008-12-14 17:58 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-wrapper.c: Fix variable used in comparison.
2008-12-14 17:56 Gwenole Beauchesne <gb.public@free.fr>
* npapi/npapi.h: Remove extraneous characters.
* npapi/nptypes.h: Fix build on newer Solaris distributions. bool
is defined as a macro by the ISO C standard.
2008-12-14 17:54 Gwenole Beauchesne <gb.public@free.fr>
* npapi/nspr/prcpucfg.h: Add definitions for Solaris builds with
Sun Studio compilers.
2008-12-14 17:53 Gwenole Beauchesne <gb.public@free.fr>
* configure: Recognize Sun Studio compilers.
2008-12-14 17:26 Gwenole Beauchesne <gb.public@free.fr>
* tests/test-rpc-types.c: Fix RPC test with 0 argument.
2008-12-14 10:29 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-viewer.c, src/npw-wrapper.c: Implement
PluginInstance::invalidate() vfunc. Besides, don't free() the
NPP instance in NPP_Destroy() because the plugin may still use
it through an NPObject::Invalidate() vfunc for example.
2008-12-14 10:23 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-common.c, src/npw-common.h, src/npw-rpc.c: Add
NPW_PluginInstance::invalidate() vfunc akin to NPObjects.
2008-12-14 10:21 Gwenole Beauchesne <gb.public@free.fr>
* src/npruntime.c: Reset hashes to NULL after they were destroyed.
2008-12-14 09:39 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-viewer.sh: Allow use of valgrind if NPW_USE_VALGRIND is
set to "yes". Use NPW_VALGRIND_OPTIONS to pass additional
options to valgrind.
2008-12-14 09:15 Gwenole Beauchesne <gb.public@free.fr>
* src/rpc.c: Fix debug message.
2008-12-13 14:06 Gwenole Beauchesne <gb.public@free.fr>
* configure: Allow biarch builds on Linux platforms only.
2008-12-13 14:05 Gwenole Beauchesne <gb.public@free.fr>
* src/utils.c: Fix build on FreeBSD (and others) since
/proc/self/fd is a Linux-only extension.
2008-12-10 21:10 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-viewer.c: Flush the X output buffer while destroying the
plugin window. i.e. make sure we have no pending callback that
would depend on that dead window.
2008-12-10 20:52 Gwenole Beauchesne <gb.public@free.fr>
* nspluginwrapper.spec: Bump version for development.
2008-12-07 22:53 Gwenole Beauchesne <gb.public@free.fr>
* NEWS, nspluginwrapper.spec: Updates for 1.1.10 (1.2.0-RC).
2008-12-07 22:44 Gwenole Beauchesne <gb.public@free.fr>
* ChangeLog: Generated by svn2cl.
2008-12-07 22:35 Gwenole Beauchesne <gb.public@free.fr>
* src/npw-viewer.c: Destroy plugin window only if PluginInstance

View File

@ -253,7 +253,7 @@ clean:
distclean: clean
rm -f config-host.* config.*
uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.mkruntime uninstall.dirs
uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.dirs
uninstall.dirs:
rmdir $(DESTDIR)$(pkglibdir)/noarch
rmdir $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)
@ -281,7 +281,7 @@ uninstall.config:
uninstall.mkruntime:
rm -f $(DESTDIR)$(pkglibdir)/noarch/mkruntime
install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config install.mkruntime
install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config
install.dirs:
mkdir -p $(DESTDIR)$(pkglibdir)/noarch
mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)
@ -367,7 +367,7 @@ localrpm: $(archivedir)$(SRCARCHIVE).bz2
changelog: ../common/authors.xml
svn_prefix=`svn info .|sed -n '/^URL *: .*\/svn\/\(.*\)$$/s//\1\//p'`; \
LC_ALL=C TZ=GMT svn2cl --strip-prefix=$$svn_prefix --authors=../common/authors.xml || :
LC_ALL=C TZ=GMT svn2cl --strip-prefix=$$svn_prefix --authors=../common/authors.xml --accum || :
changelog.commit: changelog
svn commit -m "Generated by svn2cl." ChangeLog

10
NEWS
View File

@ -1,6 +1,14 @@
nspluginwrapper NEWS -- history of user-visible changes. 2008-12-08
nspluginwrapper NEWS -- history of user-visible changes. 2008-12-26
Copyright (C) 2005-2008 Gwenole Beauchesne
Version 1.2.0 - 26.Dec.2008
* Drop obsolete mkruntime scripts
* Use valgrind if NPW_USE_VALGRIND=yes
* Add support for SunStudio compilers
* Add support for Flash Player 10 on OpenSolaris 2008.11
* Fix build on non-Linux platforms
* Fix NPP_Destroy() to keep NPP instances longer, but destroy window immediately
Version 1.1.10 (BETA) - 08.Dec.2008
* Fix NPPVpluginScriptableNPObject::Invalidate()
* Fix condition for delayed NPN_ReleaseObject() call

21
configure vendored
View File

@ -164,14 +164,15 @@ if test "$linux_only" = "guess"; then
fi
fi
# check for biarch build
# check for biarch build (Linux only)
if test "$biarch" = "guess"; then
# XXX: biarch builds require LSB headers for now
biarch="no"
case $host_cpu:$target_cpu in
x86_64:i386 | ppc64:ppc)
biarch="yes"
;;
*)
biarch="no"
if test "$host_os" = "linux"; then
biarch="yes"
fi
;;
esac
fi
@ -308,6 +309,8 @@ cat > $TMPC << EOF
#define COMPILER_NAME "xlc"
#elif defined __sgi
#define COMPILER_NAME "mipspro"
#elif defined __SUNPRO_C || defined __SUNPRO_CC
#define COMPILER_NAME "sunstudio"
#else
#define COMPILER_NAME "unknown"
#endif
@ -340,7 +343,9 @@ if test "$compiler" = "gcc"; then
cc="$cc -std=c99"
fi
elif test "$compiler" = "icc"; then
if check_cc_option -c99; then
if check_cc_option -std=c99; then
cc="$cc -std=c99"
elif check_cc_option -c99; then
cc="$cc -c99"
fi
elif test "$compiler" = "xlc"; then
@ -351,6 +356,10 @@ elif test "$compiler" = "mipspro"; then
if check_cc_option -c99; then
cc="$cc -c99"
fi
elif test "$compiler" = "sunstudio"; then
if check_cc_option -xc99; then
cc="$cc -xc99"
fi
fi
# check for CFLAGS

View File

@ -635,9 +635,9 @@ enum NPEventType {
#define NPVERS_68K_HAS_LIVECONNECT 11
#define NPVERS_HAS_WINDOWLESS 11
#define NPVERS_HAS_XPCONNECT_SCRIPTING 13
#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
#define NPVERS_HAS_FORM_VALUES 15
#define NPVERS_HAS_POPUPS_ENABLED_STATE 16
#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
#define NPVERS_HAS_FORM_VALUES 15
#define NPVERS_HAS_POPUPS_ENABLED_STATE 16
#define NPVERS_HAS_RESPONSE_HEADERS 17
#define NPVERS_HAS_NPOBJECT_ENUM 18
#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19

View File

@ -55,7 +55,7 @@
*/
#include <inttypes.h>
#ifndef __cplusplus
#if !defined(__cplusplus) && !defined(bool)
typedef int bool;
#endif
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)

View File

@ -39,6 +39,123 @@
#define XP_UNIX
#endif
#if defined(__sun)
#ifndef SOLARIS
#define SOLARIS
#endif
#define PR_AF_INET6 26 /* same as AF_INET6 */
#if defined(sparc) || defined(__sparc)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_DOUBLE 8
#if defined(__sparcv9)
#define IS_64
#endif
#elif defined(__x86_64)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_DOUBLE 8
#define IS_64
#elif defined(i386) || defined(__i386)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define PR_ALIGN_OF_INT64 4
#define PR_ALIGN_OF_DOUBLE 4
#else
#error unknown processor
#endif
#ifdef IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_POINTER 8
#else /* IS_64 */
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_POINTER 4
#endif /* IS_64 */
#ifndef HAVE_LONG_LONG
#define HAVE_LONG_LONG
#endif
#define HAVE_ALIGNED_DOUBLES
#define HAVE_ALIGNED_LONGLONGS
#else
#ifndef LINUX
#define LINUX
#endif
@ -659,6 +776,8 @@
#define HAVE_ALIGNED_LONGLONGS
#endif
#endif /* LINUX */
#ifndef NO_NSPR_10_SUPPORT
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE

View File

@ -1,5 +1,5 @@
%define name nspluginwrapper
%define version 1.1.10
%define version 1.2.0
%define release 1
#define svndate DATE
@ -160,7 +160,6 @@ fi
%dir %{pkglibdir}
%dir %{pkglibdir}/noarch
%{pkglibdir}/noarch/npviewer
%{pkglibdir}/noarch/mkruntime
%dir %{pkglibdir}/%{_arch}
%dir %{pkglibdir}/%{_arch}/%{_os}
%{pkglibdir}/%{_arch}/%{_os}/npconfig
@ -192,6 +191,15 @@ fi
%endif
%changelog
* Fri Dec 26 2008 Gwenole Beauchesne <gb.public@free.fr> 1.2.0-1
- drop obsolete mkruntime scripts
- use valgrind if NPW_USE_VALGRIND=yes
- add support for SunStudio compilers
- add support for Flash Player 10 on OpenSolaris 2008.11
- fix build on non-Linux platforms
- fix NPP_Destroy() to keep NPP instances longer
- fix NPP_Destroy() to destroy the plugin window immediately
* Mon Dec 08 2008 Gwenole Beauchesne <gb.public@free.fr> 1.1.10-1
- fix NPPVpluginScriptableNPObject::Invalidate()
- fix condition for delayed NPN_ReleaseObject() call

View File

@ -73,7 +73,7 @@ extern void npw_vprintf(const char *format, va_list args) attribute_hidden;
} \
} while (0)
#else
# define npw_return_if_fail(expr, val) do {} while (0)
# define npw_return_if_fail(expr) do {} while (0)
# define npw_return_val_if_fail(expr, val) do {} while (0)
#endif

View File

@ -811,7 +811,7 @@ void npobject_destroy(NPObject *npobj)
void npobject_associate(NPObject *npobj, NPObjectInfo *npobj_info)
{
assert(npobj && npobj_info && npobj_info > 0);
assert(npobj && npobj_info && npobj_info->npobj_id > 0);
npobject_hash_table_insert(npobj, npobj_info);
}
@ -835,10 +835,14 @@ bool npobject_bridge_new(void)
void npobject_bridge_destroy(void)
{
if (g_npobject_ids)
if (g_npobject_ids) {
g_hash_table_destroy(g_npobject_ids);
if (g_npobjects)
g_npobject_ids = NULL;
}
if (g_npobjects) {
g_hash_table_destroy(g_npobjects);
g_npobjects = NULL;
}
}
void npobject_hash_table_insert(NPObject *npobj, NPObjectInfo *npobj_info)

View File

@ -42,6 +42,7 @@ npw_plugin_instance_new(NPW_PluginInstanceClass *klass)
{
plugin->klass = klass;
plugin->refcount = 1;
plugin->is_valid = true;
}
return plugin;
}
@ -72,6 +73,18 @@ npw_plugin_instance_unref(void *ptr)
NPW_MemFree (plugin);
}
void
npw_plugin_instance_invalidate(void *ptr)
{
NPW_PluginInstance *plugin = (NPW_PluginInstance *)ptr;
if (plugin == NULL)
return;
NPW_PluginInstanceClass *klass = plugin->klass;
if (klass && klass->invalidate)
klass->invalidate(ptr);
plugin->is_valid = false;
}
/* ====================================================================== */
/* === NPAPI interface === */
/* ====================================================================== */

View File

@ -36,6 +36,7 @@
/* Supported NPAPI interfaces */
#define NPW_NPAPI_VERSION 17
#define NPW_NP_CLASS_STRUCT_VERSION 1
#define NPW_TOOLKIT NPNVGtk2
/* What are we building? */
#if defined BUILD_WRAPPER
@ -58,7 +59,8 @@
NPW_PluginInstanceClass *klass; \
uint32_t refcount; \
NPP instance; \
uint32_t instance_id;
uint32_t instance_id; \
bool is_valid
typedef struct _NPW_PluginInstance NPW_PluginInstance;
typedef struct _NPW_PluginInstanceClass NPW_PluginInstanceClass;
@ -77,11 +79,15 @@ typedef void
typedef void
(*NPW_PluginInstanceFinalizeFunctionPtr) (NPW_PluginInstance *plugin);
typedef void
(*NPW_PluginInstanceInvalidateFunctionPtr) (NPW_PluginInstance *plugin);
struct _NPW_PluginInstanceClass
{
NPW_PluginInstanceAllocateFunctionPtr allocate;
NPW_PluginInstanceDeallocateFunctionPtr deallocate;
NPW_PluginInstanceFinalizeFunctionPtr finalize;
NPW_PluginInstanceInvalidateFunctionPtr invalidate;
};
void *
@ -93,6 +99,16 @@ npw_plugin_instance_ref(void *ptr) attribute_hidden;
void
npw_plugin_instance_unref(void *ptr) attribute_hidden;
void
npw_plugin_instance_invalidate(void *ptr) attribute_hidden;
static inline bool
npw_plugin_instance_is_valid(void *ptr)
{
NPW_PluginInstance *plugin = (NPW_PluginInstance *)ptr;
return plugin && plugin->is_valid;
}
#define NPW_PLUGIN_INSTANCE(instance) npw_get_plugin_instance (instance)
#define NPW_PLUGIN_INSTANCE_NPP(plugin) npw_get_plugin_instance_npp (plugin)
@ -135,7 +151,7 @@ npw_get_plugin_instance_npp (NPW_PluginInstance *plugin)
#define NPW_DECL_STREAM_INSTANCE \
NPStream *stream; \
uint32_t stream_id; \
int is_plugin_stream;
int is_plugin_stream
typedef struct _NPW_StreamInstance NPW_StreamInstance;
struct _NPW_StreamInstance

View File

@ -544,6 +544,11 @@ static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin
if (pid < 0)
continue;
else if (pid == 0) {
if (!g_verbose) {
// don't spit out errors in non-verbose mode, we only need
// to know whether there is a valid viewer or not
freopen("/dev/null", "w", stderr);
}
execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL);
exit(1);
}
@ -858,7 +863,7 @@ static int auto_install_plugins(void)
return 0;
}
static int remove_plugin(const char *plugin_path, ...)
static int remove_plugin(const char *plugin_path)
{
if (g_verbose)
printf("Remove plugin %s\n", plugin_path);
@ -869,6 +874,11 @@ static int remove_plugin(const char *plugin_path, ...)
return 0;
}
static int remove_plugin_cb(const char *plugin_path, void *unused)
{
return remove_plugin(plugin_path);
}
static int auto_remove_plugins(void)
{
const char **plugin_dirs = get_mozilla_plugin_dirs();
@ -878,14 +888,14 @@ static int auto_remove_plugins(void)
const char *plugin_dir = plugin_dirs[i];
if (g_verbose)
printf("Auto-remove plugins from %s\n", plugin_dir);
process_plugin_dir(plugin_dir, (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)remove_plugin);
process_plugin_dir(plugin_dir, (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)remove_plugin_cb);
}
}
free(plugin_dirs);
return 0;
}
static int update_plugin(const char *plugin_path, ...)
static int update_plugin(const char *plugin_path)
{
if (g_verbose)
printf("Update plugin %s\n", plugin_path);
@ -934,6 +944,11 @@ static int update_plugin(const char *plugin_path, ...)
return ret;
}
static int update_plugin_cb(const char *plugin_path, void *unused)
{
return update_plugin(plugin_path);
}
static int auto_update_plugins(void)
{
const char **plugin_dirs = get_mozilla_plugin_dirs();
@ -943,14 +958,14 @@ static int auto_update_plugins(void)
const char *plugin_dir = plugin_dirs[i];
if (g_verbose)
printf("Auto-update plugins from %s\n", plugin_dir);
process_plugin_dir(plugin_dir, (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)update_plugin);
process_plugin_dir(plugin_dir, (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)update_plugin_cb);
}
}
free(plugin_dirs);
return 0;
}
static int list_plugin(const char *plugin_path, ...)
static int list_plugin(const char *plugin_path)
{
NPW_PluginInfo plugin_info;
is_wrapper_plugin(plugin_path, &plugin_info);
@ -972,6 +987,11 @@ static int list_plugin(const char *plugin_path, ...)
return 0;
}
static int list_plugin_cb(const char *plugin_path, void *unused)
{
return list_plugin(plugin_path);
}
static void print_usage(void)
{
printf("%s, configuration tool. Version %s\n", NPW_CONFIG, NPW_VERSION);
@ -1022,7 +1042,7 @@ static int process_list(int argvc, char *argv[])
const char *plugin_dir = plugin_dirs[i];
if (g_verbose)
printf("List plugins in %s\n", plugin_dir);
process_plugin_dir(plugin_dir, (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)list_plugin);
process_plugin_dir(plugin_dir, (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)list_plugin_cb);
}
}
free(plugin_dirs);

View File

@ -251,12 +251,12 @@ get_mime_type_from_content (guchar *bytes, guint size)
gchar *mime_type = NULL;
/* XXX: poor man's MIME type characterisation */
static const gchar gif_sig[] = {0x47, 0x49, 0x46, 0x38};
static const gchar png_sig[] = {0x89, 0x50, 0x4e, 0x47};
static const gchar jpg_sig[] = {0xff, 0xd8, 0xff};
static const gchar bmp_sig[] = {0x42, 0x4d};
static const gchar flv_sig[] = {0x46, 0x4c, 0x56};
static const gchar xml_sig[] = {0x3c, 0x3f, 0x78, 0x6d, 0x6c};
static const guchar gif_sig[] = {0x47, 0x49, 0x46, 0x38};
static const guchar png_sig[] = {0x89, 0x50, 0x4e, 0x47};
static const guchar jpg_sig[] = {0xff, 0xd8, 0xff};
static const guchar bmp_sig[] = {0x42, 0x4d};
static const guchar flv_sig[] = {0x46, 0x4c, 0x56};
static const guchar xml_sig[] = {0x3c, 0x3f, 0x78, 0x6d, 0x6c};
#define MATCH(TYPE) \
(size >= sizeof (TYPE##_sig) && \

View File

@ -115,6 +115,8 @@ static int do_recv_NPW_PluginInstance(rpc_message_t *message, void *p_value)
npw_printf("ERROR: no valid NPP -> PluginInstance mapping found\n");
else if (plugin && plugin->instance == NULL)
npw_printf("ERROR: no valid PluginInstance -> NPP mapping found\n");
else if (plugin && !npw_plugin_instance_is_valid(plugin))
npw_printf("ERROR: received PluginInstance was invalidated earlier\n");
*((NPW_PluginInstance **)p_value) = plugin;
return RPC_ERROR_NO_ERROR;
}

View File

@ -111,11 +111,13 @@ static void destroy_window(PluginInstance *plugin);
static void *plugin_instance_allocate(void);
static void plugin_instance_deallocate(PluginInstance *plugin);
static void plugin_instance_finalize(PluginInstance *plugin);
static void plugin_instance_invalidate(PluginInstance *plugin);
static NPW_PluginInstanceClass PluginInstanceClass = {
(NPW_PluginInstanceAllocateFunctionPtr)plugin_instance_allocate,
(NPW_PluginInstanceDeallocateFunctionPtr)plugin_instance_deallocate,
(NPW_PluginInstanceFinalizeFunctionPtr)plugin_instance_finalize
(NPW_PluginInstanceFinalizeFunctionPtr)plugin_instance_finalize,
(NPW_PluginInstanceInvalidateFunctionPtr)plugin_instance_invalidate
};
static void *plugin_instance_allocate(void)
@ -134,7 +136,30 @@ static void plugin_instance_finalize(PluginInstance *plugin)
g_object_unref(plugin->browser_toplevel);
plugin->browser_toplevel = NULL;
}
if (plugin->instance) {
free(plugin->instance);
plugin->instance = NULL;
}
}
static void plugin_instance_invalidate(PluginInstance *plugin)
{
destroy_window(plugin);
/* NPP instance is no longer valid beyond this point. Drop the link
to the PluginInstance now so that future RPC with this
PluginInstance will actually emit a NULL instance, which the
other side will deal as a no-op for all functions but
NPN_GetValue().
However, don't free() the NPP instance yet as it could be used
later, e.g. in some NPObject::Invalidate()... Note: this also
means we forbid that function to call into the browser in an NPP
instance. */
if (plugin->instance_id) {
id_remove(plugin->instance_id);
plugin->instance_id = 0;
}
}
// Pid support routines
@ -671,7 +696,9 @@ static void destroy_window(PluginInstance *plugin)
if (plugin->use_xembed) {
GtkData *toolkit = (GtkData *)plugin->toolkit_data;
if (toolkit->container) {
gdk_flush();
gtk_widget_destroy(toolkit->container);
gdk_flush();
toolkit->container = NULL;
}
}
@ -682,6 +709,7 @@ static void destroy_window(PluginInstance *plugin)
XtUnrealizeWidget(toolkit->top_widget);
XtDestroyWidget(toolkit->top_widget);
XSync(x_display, False);
toolkit->top_widget = None;
}
}
free(plugin->toolkit_data);
@ -919,7 +947,7 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value)
*(void **)value = XtDisplayToApplicationContext(x_display);
break;
case NPNVToolkit:
*(NPNToolkitType *)value = NPNVGtk2;
*(NPNToolkitType *)value = NPW_TOOLKIT;
break;
#if USE_XPCOM
case NPNVserviceManager: {
@ -963,6 +991,15 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value)
case NPNVPluginElementNPObject:
return g_NPN_GetValue_real(instance, variable, value);
default:
switch (variable & 0xff) {
case 13: /* NPNVToolkit */
if (NPW_TOOLKIT == NPNVGtk2) {
// Gtk2 does not need to depend on a specific C++ ABI
*(NPNToolkitType *)value = NPW_TOOLKIT;
return NPERR_NO_ERROR;
}
break;
}
npw_printf("WARNING: unhandled variable %d (%s) in NPN_GetValue()\n", variable, string_of_NPNVariable(variable));
return NPERR_INVALID_PARAM;
}
@ -3035,17 +3072,7 @@ static NPError g_NPP_Destroy(NPP instance, NPSavedData **sdata)
NPError ret = plugin_funcs.destroy(instance, sdata);
D(bugiD("NPP_Destroy return: %d [%s]\n", ret, string_of_NPError(ret)));
/* NPP instance is no longer valid beyond this point. So, let's also
drop the link to the PluginInstance now */
plugin->instance = NULL;
instance->ndata = NULL;
id_remove(plugin->instance_id);
plugin->instance_id = 0;
/* ... reset instance_id so that future RPC with this PluginInstance
will actually emit a NULL instance, which the other side will
deal as a no-op for all functions but NPN_GetValue() */
free(instance);
npw_plugin_instance_invalidate(plugin);
npw_plugin_instance_unref(plugin);
return ret;
}
@ -4008,16 +4035,30 @@ int main(int argc, char **argv)
}
// Open plug-in and get exported lib functions
void *handle = NULL;
void *handles[10] = { NULL, };
int n_handles = 0;
if (plugin_path == NULL)
cmd = CMD_HELP;
else {
void *handle;
const char *error;
#if defined(__sun)
/* XXX: check for Flash Player only? */
const char SunStudio_libCrun[] = "libCrun.so.1";
D(bug(" trying to open SunStudio C++ runtime '%s'\n", SunStudio_libCrun));
if ((handle = dlopen(SunStudio_libCrun, RTLD_LAZY|RTLD_GLOBAL)) == NULL) {
npw_printf("ERROR: %s\n", dlerror());
return 1;
}
handles[n_handles++] = handle;
dlerror();
#endif
D(bug(" %s\n", plugin_path));
if ((handle = dlopen(plugin_path, RTLD_LAZY)) == NULL) {
npw_printf("ERROR: %s\n", dlerror());
return 1;
}
handles[n_handles++] = handle;
dlerror();
g_plugin_NP_GetMIMEDescription = (NP_GetMIMEDescriptionUPP)dlsym(handle, "NP_GetMIMEDescription");
if ((error = dlerror()) != NULL) {
@ -4053,7 +4094,10 @@ int main(int argc, char **argv)
break;
}
if (handle)
dlclose(handle);
while (--n_handles >= 0) {
void * const handle = handles[n_handles];
if (handle)
dlclose(handle);
}
return ret;
}

View File

@ -26,6 +26,11 @@ export LD_LIBRARY_PATH=$NPW_VIEWER_DIR
# XXX: BTW, anything other than "yes" is interpreted as "no"
NPW_USE_XSHM=${NPW_USE_XSHM:-yes}
# Enable use of valgrind?
# Define NPW_VALGRIND_OPTIONS if you want to pass additional options to valgrind
NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no}
can_use_valgrind="no"
case $ARCH in
i?86|i86pc)
ARCH=i386
@ -55,7 +60,7 @@ if test "$ARCH" != "$TARGET_ARCH"; then
else
LOADER=`which qemu-i386`
# Don't allow Xshm with qemu
NPW_USE_XSHM=no
NPW_USE_XSHM="no"
fi
;;
ppc)
@ -68,7 +73,7 @@ if test "$ARCH" != "$TARGET_ARCH"; then
else
LOADER=`which qemu-ppc`
# Don't allow Xshm with qemu
NPW_USE_XSHM=no
NPW_USE_XSHM="no"
fi
;;
esac
@ -103,7 +108,7 @@ fi
# Use sound wrappers wherever possible (Flash 9 plugin)
case " $@ " in
*" --test "*|*" -t "*)
# do nothing
# do nothing, don't even allow valgrind'ing here
;;
*)
# XXX: detect QEMU target soundwrapper differently
@ -120,9 +125,22 @@ case " $@ " in
fi
fi
fi
can_use_valgrind="yes"
;;
"")
can_use_valgrind="yes"
;;
esac
;;
esac
if test "$NPW_USE_VALGRIND:$can_use_valgrind" = "yes:yes"; then
valgrind=`which valgrind 2>/dev/null`
if test -x "$valgrind"; then
LOADER="$LOADER $valgrind --log-fd=1 $NPW_VALGRIND_OPTIONS"
export G_SLICE=always-malloc
export NPW_INIT_TIMEOUT=30
fi
fi
exec $LOADER $NPW_VIEWER_DIR/npviewer.bin ${1+"$@"}

View File

@ -173,11 +173,13 @@ static void toolkit_flush(void)
static void *plugin_instance_allocate(void);
static void plugin_instance_deallocate(PluginInstance *plugin);
static void plugin_instance_finalize(PluginInstance *plugin);
static void plugin_instance_invalidate(PluginInstance *plugin);
static NPW_PluginInstanceClass PluginInstanceClass = {
(NPW_PluginInstanceAllocateFunctionPtr)plugin_instance_allocate,
(NPW_PluginInstanceDeallocateFunctionPtr)plugin_instance_deallocate,
(NPW_PluginInstanceFinalizeFunctionPtr)plugin_instance_finalize
(NPW_PluginInstanceFinalizeFunctionPtr)plugin_instance_finalize,
(NPW_PluginInstanceInvalidateFunctionPtr)plugin_instance_invalidate
};
static void *plugin_instance_allocate(void)
@ -196,6 +198,19 @@ static void plugin_instance_finalize(PluginInstance *plugin)
rpc_connection_unref(plugin->connection);
}
static void plugin_instance_invalidate(PluginInstance *plugin)
{
/* Browser's NPP instance is no longer valid beyond this point. So,
let's just break the link to nspluginwrapper's PluginInstance now. */
if (plugin->instance) {
plugin->instance->pdata = NULL;
plugin->instance = NULL;
}
/* We don't reset instance_id here because we still need the NPP ->
PluginInstance mapping for incoming RPC. However, the important
thing is plugin->instance to be NULL. */
}
/* ====================================================================== */
/* === Plug-in side data === */
@ -1892,14 +1907,7 @@ g_NPP_Destroy(NPP instance, NPSavedData **save)
}
}
/* Browser's NPP instance is no longer valid beyond this point. So,
let's just break the link to nspluginwrapper's PluginInstance now */
plugin->instance = NULL;
instance->pdata = NULL;
/* We don't reset instance_id here because we still need the NPP ->
PluginInstance mapping for incoming RPC. However, the important
thing is plugin->instance to be NULL */
npw_plugin_instance_invalidate(plugin);
npw_plugin_instance_unref(plugin);
return ret;
}
@ -2599,7 +2607,7 @@ g_NP_GetValue(void *future, NPPVariable variable, void *value)
str =
"<a href=\"http://gwenole.beauchesne.info/projects/nspluginwrapper/\">nspluginwrapper</a> "
" is a cross-platform NPAPI plugin viewer, in particular for linux/i386 plugins.<br>"
"This is <b>beta</b> software available under the terms of the GNU General Public License.<br>"
"This software is available under the terms of the GNU General Public License.<br>"
;
ret = NPERR_NO_ERROR;
}
@ -3363,7 +3371,7 @@ static void plugin_init(int is_NP_Initialize)
// Consume the whole line, we can't see our tags here
while (fgets(line, sizeof(line), viewer_fp)) {
len = strlen(line);
if (line > 0 && line[len - 1] == '\n')
if (len > 0 && line[len - 1] == '\n')
break;
}
continue;

View File

@ -201,7 +201,7 @@ static int _rpc_init_timeout(void)
timeout = atoi(timeout_str);
if (timeout <= 0)
timeout = RPC_INIT_TIMEOUT;
D(bug("RPC message timeout set to %d sec\n", timeout));
D(bug("RPC init timeout set to %d sec\n", timeout));
return timeout;
}

View File

@ -249,7 +249,14 @@ const char *string_of_NPPVariable(int variable)
_(NPPVformValue);
#undef _
default:
str = "<unknown variable>";
switch (variable & 0xff) {
#define _(VAL, VAR) case VAL: str = #VAR; break
_(10, NPPVpluginScriptableInstance);
#undef _
default:
str = "<unknown variable>";
break;
}
break;
}
@ -278,7 +285,17 @@ const char *string_of_NPNVariable(int variable)
_(NPNVSupportsWindowless);
#undef _
default:
str = "<unknown variable>";
switch (variable & 0xff) {
#define _(VAL, VAR) case VAL: str = #VAR; break
_(10, NPNVserviceManager);
_(11, NPNVDOMElement);
_(12, NPNVDOMWindow);
_(13, NPNVToolkit);
#undef _
default:
str = "<unknown variable>";
break;
}
break;
}
@ -360,6 +377,7 @@ void npw_close_all_open_files(void)
{
const int min_fd = 3;
#if defined(__linux__)
DIR *dir = opendir("/proc/self/fd");
if (dir) {
const int dfd = dirfd(dir);
@ -374,12 +392,13 @@ void npw_close_all_open_files(void)
}
}
closedir(dir);
return;
}
else {
const int open_max = get_open_max();
for (int fd = min_fd; fd < open_max; fd++)
close(fd);
}
#endif
const int open_max = get_open_max();
for (int fd = min_fd; fd < open_max; fd++)
close(fd);
}

View File

@ -146,13 +146,13 @@ handle_f3 (rpc_connection_t *connection)
static int
handle_f4 (rpc_connection_t *connection)
{
handle_fN (connection, RPC_TEST_METHOD_F4);
return handle_fN (connection, RPC_TEST_METHOD_F4);
}
static int
handle_f5 (rpc_connection_t *connection)
{
handle_fN (connection, RPC_TEST_METHOD_F5);
return handle_fN (connection, RPC_TEST_METHOD_F5);
}
int

View File

@ -709,7 +709,7 @@ rpc_test_execute (gpointer user_data)
RPC_TYPE_INVALID);
rpc_test_invoke (RPC_TEST_METHOD_VOID__UINT64x10,
RPC_TYPE_UINT64, 0,
RPC_TYPE_UINT64, G_GINT64_CONSTANT (0),
RPC_TYPE_UINT64, G_GINT64_CONSTANT (0x00000000000000ffU),
RPC_TYPE_UINT64, G_GINT64_CONSTANT (0x000000000000ff00U),
RPC_TYPE_UINT64, G_GINT64_CONSTANT (0x0000000000ff0000U),