summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2013-03-01 15:37:14 +0000
committerDaniel P. Berrange <berrange@redhat.com>2013-03-13 11:47:42 +0000
commit9d69e5a629ae4213443ff8043db02aa852aa6115 (patch)
treec62f6ade33d874f9482ed83881ef64cef9719eb7
parent9d851a4da3e8ee42d31b8c3c23a835a2aad1e0c9 (diff)
downloadvirt-viewer-9d69e5a629ae4213443ff8043db02aa852aa6115.tar.gz
virt-viewer-9d69e5a629ae4213443ff8043db02aa852aa6115.tar.xz
virt-viewer-9d69e5a629ae4213443ff8043db02aa852aa6115.zip
Delete browser plugin entirely
The browser plugin code has been effectively unmaintained since the day it was merged. There has always been a caveat that the code has not been properly audited to ensure it is secure, and being unmaintained doesn't give a warm secure feeling. These days there are better solutions for the browser which are pure HTML5 code, noVNC and SPICE-HTML5. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--Makefile.am2
-rwxr-xr-xautobuild.sh2
-rw-r--r--cfg.mk4
-rw-r--r--configure.ac24
-rw-r--r--plugin/Makefile.am44
-rw-r--r--plugin/npshell.c394
-rw-r--r--plugin/npunix.c537
-rw-r--r--plugin/npupp.h719
-rw-r--r--plugin/test.html22
-rw-r--r--plugin/virt-viewer-plugin.c143
-rw-r--r--plugin/virt-viewer-plugin.h83
-rw-r--r--virt-viewer.spec.in44
12 files changed, 4 insertions, 2014 deletions
diff --git a/Makefile.am b/Makefile.am
index 0befda2..ab0bcfd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ NULL =
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = icons src man plugin po data
+SUBDIRS = icons src man po data
EXTRA_DIST = \
$(PACKAGE).spec \
diff --git a/autobuild.sh b/autobuild.sh
index ddd39de..2d4a343 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -14,7 +14,6 @@ cd build
../autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT \
--enable-compile-warnings=error \
- --disable-plugin \
--with-gtk=2.0
make
@@ -26,7 +25,6 @@ if test $? = 0 ; then
make distclean
../configure --prefix=$AUTOBUILD_INSTALL_ROOT \
--enable-compile-warnings=error \
- --disable-plugin \
--with-gtk=3.0
make
make install
diff --git a/cfg.mk b/cfg.mk
index eede44f..b359d3a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -113,8 +113,8 @@ prev_version_file = /dev/null
exclude_file_name_regexp--sc_preprocessor_indentation = ^*/*.[ch]
exclude_file_name_regexp--sc_prohibit_strcmp = ^*/*.[ch]
-exclude_file_name_regexp--sc_require_config_h = ^plugin/|src/gbinding\.c|src/windows-cmdline-wrapper.c
-exclude_file_name_regexp--sc_require_config_h_first = ^plugin/|src/gbinding\.c|src/windows-cmdline-wrapper.c
+exclude_file_name_regexp--sc_require_config_h = ^src/gbinding\.c|src/windows-cmdline-wrapper.c
+exclude_file_name_regexp--sc_require_config_h_first = ^src/gbinding\.c|src/windows-cmdline-wrapper.c
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^icons/
exclude_file_name_regexp--sc_trailing_blank = ^icons/
diff --git a/configure.ac b/configure.ac
index ea5adda..b1d532b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,28 +169,6 @@ dnl Decide if this platform can support the SSH tunnel feature.
AC_CHECK_HEADERS([sys/socket.h sys/un.h windows.h])
AC_CHECK_FUNCS([fork socketpair])
-dnl --enable-plugin to enable the browser plugin.
-NSPR_REQUIRED=4.0.0
-FIREFOX_PLUGIN_REQUIRED=1.5.0
-MOZILLA_PLUGIN_REQUIRED=1.8
-AC_ARG_ENABLE(plugin,
- [ --enable-plugin=[no/yes] enable browser plugin [default=no]],,
- enable_plugin=no)
-if test "x$enable_plugin" = "xyes"; then
- dnl Check for Netscape Portable Runtime development package.
- PKG_CHECK_MODULES(NSPR, nspr >= $NSPR_REQUIRED)
- dnl Check for Firefox plugin package (also includes NSPR cflags/libs).
- PKG_CHECK_MODULES(FIREFOX_PLUGIN,
- firefox-plugin >= $FIREFOX_PLUGIN_REQUIRED, ,[
- PKG_CHECK_MODULES(MOZILLA_PLUGIN,
- mozilla-plugin >= $MOZILLA_PLUGIN_REQUIRED)
- FIREFOX_PLUGIN_CFLAGS="$MOZILLA_PLUGIN_CFLAGS"
- FIREFOX_PLUGIN_LIBS="$MOZILLA_PLUGIN_LIBS"
- ])
- AC_SUBST(FIREFOX_PLUGIN_CFLAGS)
- AC_SUBST(FIREFOX_PLUGIN_LIBS)
-fi
-AM_CONDITIONAL(ENABLE_PLUGIN, [test "x$enable_plugin" = "xyes"])
if test "x$have_gtk_vnc" != "xyes" && test "x$have_spice_gtk" != "xyes"; then
AC_MSG_ERROR([At least one of spice or vnc must be used])
@@ -215,7 +193,6 @@ AC_CONFIG_FILES([
icons/256x256/Makefile
man/Makefile
mingw-virt-viewer.spec
- plugin/Makefile
po/Makefile.in
src/Makefile
src/virt-viewer.rc
@@ -229,7 +206,6 @@ AC_MSG_NOTICE([=====================])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Features:])
AC_MSG_NOTICE([])
-AC_MSG_NOTICE([ Plugin: $enable_plugin])
AC_MSG_NOTICE([ Gtk: $with_gtk])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Libraries:])
diff --git a/plugin/Makefile.am b/plugin/Makefile.am
deleted file mode 100644
index 2c1e38c..0000000
--- a/plugin/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-if ENABLE_PLUGIN
-
-plugindir = $(libdir)/mozilla/plugins
-plugin_LTLIBRARIES = virt-viewer-plugin.la
-
-virt_viewer_plugin_la_SOURCES = \
- ../src/virt-viewer-util.c ../src/virt-viewer-util.h \
- ../src/virt-viewer-auth.c ../src/virt-viewer-auth.h \
- ../src/virt-viewer.c ../src/virt-viewer.h \
- ../src/virt-viewer-events.c ../src/virt-viewer-events.h \
- virt-viewer-plugin.c virt-viewer-plugin.h \
- npshell.c npunix.c
-virt_viewer_plugin_la_LIBADD = \
- $(FIREFOX_PLUGIN_LIBS) \
- $(GTK_VNC_LIBS) \
- $(GTK_LIBS) \
- $(LIBXML2_LIBS) \
- $(LIBVIRT_LIBS)
-virt_viewer_plugin_la_LDFLAGS = \
- -module -avoid-version
-virt_viewer_plugin_la_CFLAGS = \
- -DPLUGIN=1 -DENABLE_DEBUG=1 \
- $(FIREFOX_PLUGIN_CFLAGS) \
- $(GTK_VNC_CFLAGS) \
- $(GTK_CFLAGS) \
- $(LIBXML2_CFLAGS) \
- $(LIBVIRT_CFLAGS) \
- -DGLADE_DIR="\"$(gladedir)\"" \
- -I$(top_srcdir)/src
-
-all-local: virt-viewer-plugin.so
-
-virt-viewer-plugin.so: virt-viewer-plugin.la
- cp .libs/virt-viewer-plugin.so $@
-
-# Only leave the .so file in the plugins directory.
-install-data-hook:
- rm -f $(DESTDIR)$(plugindir)/virt-viewer-plugin.a $(DESTDIR)$(plugindir)/virt-viewer-plugin.la
-
-CLEANFILES = virt-viewer-plugin.so
-
-endif
-
--include $(top_srcdir)/git.mk
diff --git a/plugin/npshell.c b/plugin/npshell.c
deleted file mode 100644
index bb43da3..0000000
--- a/plugin/npshell.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Stephen Mak <smak@sun.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * npshell.c
- *
- * Netscape Client Plugin API
- * - Function that need to be implemented by plugin developers
- *
- * This file defines a "shell" plugin that plugin developers can use
- * as the basis for a real plugin. This shell just provides empty
- * implementations of all functions that the plugin can implement
- * that will be called by Netscape (the NPP_xxx methods defined in
- * npapi.h).
- *
- * dp Suresh <dp@netscape.com>
- * updated 5/1998 <pollmann@netscape.com>
- * updated 9/2000 <smak@sun.com>
- *
- */
-
-
-/*
-The contents of this file are subject to the Mozilla Public License
-
-Version 1.1 (the "License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-the specific language governing rights and limitations under the License.
-
-The Original Code is stub code that defines the binary interface to a Mozilla
-plugin.
-
-The Initial Developer of the Original Code is Mozilla.
-
-Portions created by Adobe Systems Incorporated are Copyright (C) 2007. All Rights Reserved.
-
-Contributor(s): Adobe Systems Incorporated.
-*/
-
-//#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-
-#include <npapi.h>
-#include <npupp.h>
-
-#include "virt-viewer-plugin.h"
-
-/***********************************************************************
- *
- * Implementations of plugin API functions
- *
- ***********************************************************************/
-
-char *
-NPP_GetMIMEDescription(void)
-{
- return (char *) MIME_TYPES_HANDLED;
-}
-
-NPError
-NPP_GetValue(NPP instance G_GNUC_UNUSED, NPPVariable variable, void *value)
-{
- NPError err = NPERR_NO_ERROR;
-
- debug ("NPP_GetValue %d", variable);
-
- switch (variable) {
- case NPPVpluginNameString:
- *((const char **)value) = PLUGIN_NAME;
- break;
- case NPPVpluginDescriptionString:
- *((const char **)value) = PLUGIN_DESCRIPTION;
- break;
- case NPPVpluginNeedsXEmbed:
- *((PRBool *)value) = PR_TRUE;
- break;
- default:
- err = NPERR_GENERIC_ERROR;
- }
- return err;
-}
-
-NPError
-NPP_Initialize(void)
-{
- debug ("NPP_Initialize");
-
- gtk_init(0, 0);
-
- return NPERR_NO_ERROR;
-}
-
-#ifdef OJI
-jref
-NPP_GetJavaClass()
-{
- return NULL;
-}
-#endif
-
-void
-NPP_Shutdown(void)
-{
- debug ("NPP_Shutdown");
-}
-
-NPError
-NPP_New(NPMIMEType pluginType G_GNUC_UNUSED,
- NPP instance,
- uint16 mode,
- int16 argc,
- char* argn[],
- char* argv[],
- NPSavedData *saved G_GNUC_UNUSED)
-{
- PluginInstance *This;
- NPError err = NPERR_NO_ERROR;
- PRBool supportsXEmbed = PR_FALSE;
- NPNToolkitType toolkit = 0;
- int i;
-
- debug ("NPP_New");
-
- if (instance == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- /* http://developer.mozilla.org/en/docs/XEmbed_Extension_for_Mozilla_Plugins
- * Check for XEmbed and Gtk toolkit.
- */
- err = NPN_GetValue (instance,
- NPNVSupportsXEmbedBool,
- (void *)&supportsXEmbed);
- if (err != NPERR_NO_ERROR || supportsXEmbed != PR_TRUE)
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
-
-#if 1
- err = NPN_GetValue (instance,
- NPNVToolkit,
- (void *)&toolkit);
- if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2)
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
-#endif
-
- instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
-
- This = (PluginInstance*) instance->pdata;
-
- if (This == NULL) {
- return NPERR_OUT_OF_MEMORY_ERROR;
- }
-
- memset(This, 0, sizeof(PluginInstance));
-
- /* Mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h). */
- This->mode = mode;
- This->instance = instance;
- This->uri = This->name = NULL;
- This->direct = This->waitvm = This->debug = This->reconnect = 0;
-
- /* Read the parameters passed to the plugin. */
- for (i = 0; i < argc; i++)
- {
- if (strcasecmp (argn[i], "uri") == 0)
- This->uri = strdup (argv[i]);
- else if (strcasecmp (argn[i], "name") == 0)
- This->name = strdup (argv[i]);
- else if (strcasecmp (argn[i], "direct") == 0)
- This->direct = strcmp (argv[i], "1") == 0;
- else if (strcasecmp (argn[i], "wait") == 0)
- This->waitvm = strcmp (argv[i], "1") == 0;
- else if (strcasecmp (argn[i], "debug") == 0)
- This->debug = strcmp (argv[i], "1") == 0;
- else if (strcasecmp (argn[i], "reconnect") == 0)
- This->reconnect = strcmp (argv[i], "1") == 0;
- }
-
- return NPERR_NO_ERROR;
-}
-
-NPError
-NPP_Destroy(NPP instance, NPSavedData** save G_GNUC_UNUSED)
-{
- PluginInstance* This;
-
- debug ("NPP_Destroy");
-
- if (instance == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- This = (PluginInstance*) instance->pdata;
-
- if (This != NULL)
- {
- (void) VirtViewerDestroyWindow (instance);
- free (This->uri);
- free (This->name);
- NPN_MemFree(instance->pdata);
- instance->pdata = NULL;
- }
-
- return NPERR_NO_ERROR;
-}
-
-
-NPError
-NPP_SetWindow(NPP instance, NPWindow* window)
-{
- debug ("NPP_SetWindow");
-
- return VirtViewerXSetWindow(instance, window);
-}
-
-int32
-NPP_WriteReady(NPP instance, NPStream *stream)
-{
- /*printf("NPP_WriteReady()\n");*/
- if (instance == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- /* We don't want any data, kill the stream */
- NPN_DestroyStream(instance, stream, NPRES_DONE);
-
- /* Number of bytes ready to accept in NPP_Write() */
- return -1L; /* don't accept any bytes in NPP_Write() */
-}
-
-int32
-NPP_Write(NPP instance, NPStream *stream,
- int32 offset G_GNUC_UNUSED, int32 len G_GNUC_UNUSED,
- void *buffer G_GNUC_UNUSED)
-{
- /*printf("NPP_Write()\n");*/
- if (instance == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- /* We don't want any data, kill the stream */
- NPN_DestroyStream(instance, stream, NPRES_DONE);
-
- return -1L; /* don't accept any bytes in NPP_Write() */
-}
-
-NPError
-NPP_DestroyStream(NPP instance, NPStream *stream G_GNUC_UNUSED,
- NPError reason G_GNUC_UNUSED)
-{
- /*printf("NPP_DestroyStream()\n");*/
- if (instance == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- /***** Insert NPP_DestroyStream code here *****\
- PluginInstance* This;
- This = (PluginInstance*) instance->pdata;
- \**********************************************/
-
- return NPERR_NO_ERROR;
-}
-
-void
-NPP_StreamAsFile(NPP instance G_GNUC_UNUSED, NPStream *stream G_GNUC_UNUSED,
- const char* fname G_GNUC_UNUSED)
-{
- /*printf("NPP_StreamAsFile()\n");*/
- /***** Insert NPP_StreamAsFile code here *****\
- PluginInstance* This;
- if (instance != NULL)
- This = (PluginInstance*) instance->pdata;
- \*********************************************/
-}
-
-void
-NPP_URLNotify(NPP instance G_GNUC_UNUSED, const char* url G_GNUC_UNUSED,
- NPReason reason G_GNUC_UNUSED, void* notifyData G_GNUC_UNUSED)
-{
- /*printf("NPP_URLNotify()\n");*/
- /***** Insert NPP_URLNotify code here *****\
- PluginInstance* This;
- if (instance != NULL)
- This = (PluginInstance*) instance->pdata;
- \*********************************************/
-}
-
-
-void
-NPP_Print(NPP instance, NPPrint* printInfo)
-{
- /*printf("NPP_Print()\n");*/
- if(printInfo == NULL)
- return;
-
- if (instance != NULL) {
- /***** Insert NPP_Print code here *****\
- PluginInstance* This = (PluginInstance*) instance->pdata;
- \**************************************/
-
- if (printInfo->mode == NP_FULL) {
- /*
- * PLUGIN DEVELOPERS:
- * If your plugin would like to take over
- * printing completely when it is in full-screen mode,
- * set printInfo->pluginPrinted to TRUE and print your
- * plugin as you see fit. If your plugin wants Netscape
- * to handle printing in this case, set
- * printInfo->pluginPrinted to FALSE (the default) and
- * do nothing. If you do want to handle printing
- * yourself, printOne is true if the print button
- * (as opposed to the print menu) was clicked.
- * On the Macintosh, platformPrint is a THPrint; on
- * Windows, platformPrint is a structure
- * (defined in npapi.h) containing the printer name, port,
- * etc.
- */
-
- /***** Insert NPP_Print code here *****\
- void* platformPrint =
- printInfo->print.fullPrint.platformPrint;
- NPBool printOne =
- printInfo->print.fullPrint.printOne;
- \**************************************/
-
- /* Do the default*/
- printInfo->print.fullPrint.pluginPrinted = FALSE;
- }
- else { /* If not fullscreen, we must be embedded */
- /*
- * PLUGIN DEVELOPERS:
- * If your plugin is embedded, or is full-screen
- * but you returned false in pluginPrinted above, NPP_Print
- * will be called with mode == NP_EMBED. The NPWindow
- * in the printInfo gives the location and dimensions of
- * the embedded plugin on the printed page. On the
- * Macintosh, platformPrint is the printer port; on
- * Windows, platformPrint is the handle to the printing
- * device context.
- */
-
- /***** Insert NPP_Print code here *****\
- NPWindow* printWindow =
- &(printInfo->print.embedPrint.window);
- void* platformPrint =
- printInfo->print.embedPrint.platformPrint;
- \**************************************/
- }
- }
-}
-
-int16 NPP_HandleEvent(NPP instance, void* event)
-{
- /*printf("NPP_HandleEvent()\n");*/
-
- return VirtViewerXHandleEvent(instance, event);
-}
diff --git a/plugin/npunix.c b/plugin/npunix.c
deleted file mode 100644
index 48948d0..0000000
--- a/plugin/npunix.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Stephen Mak <smak@sun.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * npunix.c
- *
- * Netscape Client Plugin API
- * - Wrapper function to interface with the Netscape Navigator
- *
- * dp Suresh <dp@netscape.com>
- *
- *----------------------------------------------------------------------
- * PLUGIN DEVELOPERS:
- * YOU WILL NOT NEED TO EDIT THIS FILE.
- *----------------------------------------------------------------------
- */
-
-#include <config.h>
-
-#define XP_UNIX 1
-
-#include <stdio.h>
-#include <npapi.h>
-#include <npupp.h>
-
-#include <glib.h> /* just for G_GNUC_UNUSED */
-
-/*
- * Define PLUGIN_TRACE to have the wrapper functions print
- * messages to stderr whenever they are called.
- */
-
-#ifdef PLUGIN_TRACE
-#include <stdio.h>
-#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg)
-#else
-#define PLUGINDEBUGSTR(msg)
-#endif
-
-
-/***********************************************************************
- *
- * Globals
- *
- ***********************************************************************/
-
-static NPNetscapeFuncs gNetscapeFuncs; /* Netscape Function table */
-
-
-/***********************************************************************
- *
- * Wrapper functions : plugin calling Netscape Navigator
- *
- * These functions let the plugin developer just call the APIs
- * as documented and defined in npapi.h, without needing to know
- * about the function table and call macros in npupp.h.
- *
- ***********************************************************************/
-
-void
-NPN_Version(int* plugin_major, int* plugin_minor,
- int* netscape_major, int* netscape_minor)
-{
- *plugin_major = NP_VERSION_MAJOR;
- *plugin_minor = NP_VERSION_MINOR;
-
- /* Major version is in high byte */
- *netscape_major = gNetscapeFuncs.version >> 8;
- /* Minor version is in low byte */
- *netscape_minor = gNetscapeFuncs.version & 0xFF;
-}
-
-NPError
-NPN_GetValue(NPP instance, NPNVariable variable, void *r_value)
-{
- return CallNPN_GetValueProc(gNetscapeFuncs.getvalue,
- instance, variable, r_value);
-}
-
-NPError
-NPN_SetValue(NPP instance, NPPVariable variable, void *value)
-{
- return CallNPN_SetValueProc(gNetscapeFuncs.setvalue,
- instance, variable, value);
-}
-
-NPError
-NPN_GetURL(NPP instance, const char* url, const char* window)
-{
- return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
-}
-
-NPError
-NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
-{
- return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
-}
-
-NPError
-NPN_PostURL(NPP instance, const char* url, const char* window,
- uint32 len, const char* buf, NPBool file)
-{
- return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
- url, window, len, buf, file);
-}
-
-NPError
-NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len,
- const char* buf, NPBool file, void* notifyData)
-{
- return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
- instance, url, window, len, buf, file, notifyData);
-}
-
-NPError
-NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
-{
- return CallNPN_RequestReadProc(gNetscapeFuncs.requestread,
- stream, rangeList);
-}
-
-NPError
-NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
- NPStream** stream_ptr)
-{
- return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance,
- type, window, stream_ptr);
-}
-
-int32
-NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
-{
- return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
- stream, len, buffer);
-}
-
-NPError
-NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream,
- instance, stream, reason);
-}
-
-void
-NPN_Status(NPP instance, const char* message)
-{
- CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
-}
-
-const char*
-NPN_UserAgent(NPP instance)
-{
- return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
-}
-
-void*
-NPN_MemAlloc(uint32 size)
-{
- return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
-}
-
-void NPN_MemFree(void* ptr)
-{
- CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
-}
-
-uint32 NPN_MemFlush(uint32 size)
-{
- return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
-}
-
-void NPN_ReloadPlugins(NPBool reloadPages)
-{
- CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
-}
-
-#ifdef OJI
-JRIEnv* NPN_GetJavaEnv()
-{
- return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv);
-}
-
-jref NPN_GetJavaPeer(NPP instance)
-{
- return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer,
- instance);
-}
-#endif
-
-void
-NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
-{
- CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance,
- invalidRect);
-}
-
-void
-NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
-{
- CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance,
- invalidRegion);
-}
-
-void
-NPN_ForceRedraw(NPP instance)
-{
- CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance);
-}
-
-void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
-{
- CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate,
- instance, enabled);
-}
-
-void NPN_PopPopupsEnabledState(NPP instance)
-{
- CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate,
- instance);
-}
-
-
-
-/***********************************************************************
- *
- * Wrapper functions : Netscape Navigator -> plugin
- *
- * These functions let the plugin developer just create the APIs
- * as documented and defined in npapi.h, without needing to
- * install those functions in the function table or worry about
- * setting up globals for 68K plugins.
- *
- ***********************************************************************/
-
-static NPError
-Private_New(NPMIMEType pluginType, NPP instance, uint16 mode,
- int16 argc, char* argn[], char* argv[], NPSavedData* saved)
-{
- NPError ret;
- PLUGINDEBUGSTR("New");
- ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
- return ret;
-}
-
-static NPError
-Private_Destroy(NPP instance, NPSavedData** save)
-{
- PLUGINDEBUGSTR("Destroy");
- return NPP_Destroy(instance, save);
-}
-
-static NPError
-Private_SetWindow(NPP instance, NPWindow* window)
-{
- NPError err;
- PLUGINDEBUGSTR("SetWindow");
- err = NPP_SetWindow(instance, window);
- return err;
-}
-
-static NPError
-Private_NewStream(NPP instance G_GNUC_UNUSED, NPMIMEType type G_GNUC_UNUSED,
- NPStream* stream G_GNUC_UNUSED,
- NPBool seekable G_GNUC_UNUSED, uint16* stype G_GNUC_UNUSED)
-{
- NPError err = NPERR_NO_ERROR;
- PLUGINDEBUGSTR("NewStream");
-/* err = NPP_NewStream(instance, type, stream, seekable, stype);*/
- return err;
-}
-
-static int32
-Private_WriteReady(NPP instance, NPStream* stream)
-{
- unsigned int result;
- PLUGINDEBUGSTR("WriteReady");
- result = NPP_WriteReady(instance, stream);
- return result;
-}
-
-static int32
-Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
- void* buffer)
-{
- unsigned int result;
- PLUGINDEBUGSTR("Write");
- result = NPP_Write(instance, stream, offset, len, buffer);
- return result;
-}
-
-static void
-Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
-{
- PLUGINDEBUGSTR("StreamAsFile");
- NPP_StreamAsFile(instance, stream, fname);
-}
-
-
-static NPError
-Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- NPError err;
- PLUGINDEBUGSTR("DestroyStream");
- err = NPP_DestroyStream(instance, stream, reason);
- return err;
-}
-
-static void
-Private_URLNotify(NPP instance, const char* url,
- NPReason reason, void* notifyData)
-{
- PLUGINDEBUGSTR("URLNotify");
- NPP_URLNotify(instance, url, reason, notifyData);
-}
-
-static NPError
-Private_GetValue(void *instance, NPPVariable variable, void *result)
-{
- NPError rv = NPP_GetValue(instance, variable, result);
- return rv;
-}
-
-static void
-Private_Print(NPP instance, NPPrint* platformPrint)
-{
- PLUGINDEBUGSTR("Print");
- NPP_Print(instance, platformPrint);
-}
-
-#ifdef OJI
-static JRIGlobalRef
-Private_GetJavaClass(void)
-{
- jref clazz = NPP_GetJavaClass();
- if (clazz) {
- JRIEnv* env = NPN_GetJavaEnv();
- return JRI_NewGlobalRef(env, clazz);
- }
- return NULL;
-}
-#endif
-
-static int16
-Private_HandleEvent(NPP instance, void* event)
-{
- return NPP_HandleEvent(instance, event);
-}
-
-/***********************************************************************
- *
- * These functions are located automagically by netscape.
- *
- ***********************************************************************/
-
-/*
- * NP_GetMIMEDescription
- * - Netscape needs to know about this symbol
- * - Netscape uses the return value to identify when an object instance
- * of this plugin should be created.
- */
-char *
-NP_GetMIMEDescription(void)
-{
- return NPP_GetMIMEDescription();
-}
-
-/*
- * NP_GetValue [optional]
- * - Netscape needs to know about this symbol.
- * - Interfaces with plugin to get values for predefined variables
- * that the navigator needs.
- */
-NPError
-NP_GetValue(void* future, NPPVariable variable, void *value)
-{
- return NPP_GetValue(future, variable, value);
-}
-
-/*
- * NP_Initialize
- * - Netscape needs to know about this symbol.
- * - It calls this function after looking up its symbol before it
- * is about to create the first ever object of this kind.
- *
- * PARAMETERS
- * nsTable - The netscape function table. If developers just use these
- * wrappers, they dont need to worry about all these function
- * tables.
- * RETURN
- * pluginFuncs
- * - This functions needs to fill the plugin function table
- * pluginFuncs and return it. Netscape Navigator plugin
- * library will use this function table to call the plugin.
- *
- */
-NPError
-NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
-{
- NPError err = NPERR_NO_ERROR;
-
- PLUGINDEBUGSTR("NP_Initialize");
-
- /* validate input parameters */
-
- if ((nsTable == NULL) || (pluginFuncs == NULL))
- err = NPERR_INVALID_FUNCTABLE_ERROR;
-
- /*
- * Check the major version passed in Netscape's function table.
- * We won't load if the major version is newer than what we expect.
- * Also check that the function tables passed in are big enough for
- * all the functions we need (they could be bigger, if Netscape added
- * new APIs, but that's OK with us -- we'll just ignore them).
- *
- */
-
- if (err == NPERR_NO_ERROR) {
- if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- if (nsTable->size < sizeof(NPNetscapeFuncs))
- err = NPERR_INVALID_FUNCTABLE_ERROR;
- if (pluginFuncs->size < sizeof(NPPluginFuncs))
- err = NPERR_INVALID_FUNCTABLE_ERROR;
- }
-
- if (err == NPERR_NO_ERROR) {
- /*
- * Copy all the fields of Netscape function table into our
- * copy so we can call back into Netscape later. Note that
- * we need to copy the fields one by one, rather than assigning
- * the whole structure, because the Netscape function table
- * could actually be bigger than what we expect.
- */
- gNetscapeFuncs.version = nsTable->version;
- gNetscapeFuncs.size = nsTable->size;
- gNetscapeFuncs.posturl = nsTable->posturl;
- gNetscapeFuncs.geturl = nsTable->geturl;
- gNetscapeFuncs.geturlnotify = nsTable->geturlnotify;
- gNetscapeFuncs.requestread = nsTable->requestread;
- gNetscapeFuncs.newstream = nsTable->newstream;
- gNetscapeFuncs.write = nsTable->write;
- gNetscapeFuncs.destroystream = nsTable->destroystream;
- gNetscapeFuncs.status = nsTable->status;
- gNetscapeFuncs.uagent = nsTable->uagent;
- gNetscapeFuncs.memalloc = nsTable->memalloc;
- gNetscapeFuncs.memfree = nsTable->memfree;
- gNetscapeFuncs.memflush = nsTable->memflush;
- gNetscapeFuncs.reloadplugins = nsTable->reloadplugins;
-#ifdef OJI
- gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv;
- gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer;
-#endif
- gNetscapeFuncs.getvalue = nsTable->getvalue;
- gNetscapeFuncs.setvalue = nsTable->setvalue;
- gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate;
- gNetscapeFuncs.poppopupsenabledstate = nsTable->poppopupsenabledstate;
-
- /*
- * Set up the plugin function table that Netscape will use to
- * call us. Netscape needs to know about our version and size
- * and have a UniversalProcPointer for every function we
- * implement.
- */
- pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
- pluginFuncs->size = sizeof(NPPluginFuncs);
- pluginFuncs->newp = NewNPP_NewProc(Private_New);
- pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy);
- pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow);
- pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream);
- pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
- pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile);
- pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
- pluginFuncs->write = NewNPP_WriteProc(Private_Write);
- pluginFuncs->print = NewNPP_PrintProc(Private_Print);
- pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);
- pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue);
- pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent);
-#ifdef OJI
- pluginFuncs->javaClass = Private_GetJavaClass();
-#endif
-
- err = NPP_Initialize();
- }
-
- return err;
-}
-
-/*
- * NP_Shutdown [optional]
- * - Netscape needs to know about this symbol.
- * - It calls this function after looking up its symbol after
- * the last object of this kind has been destroyed.
- *
- */
-NPError
-NP_Shutdown(void)
-{
- PLUGINDEBUGSTR("NP_Shutdown");
- NPP_Shutdown();
- return NPERR_NO_ERROR;
-}
diff --git a/plugin/npupp.h b/plugin/npupp.h
deleted file mode 100644
index 0240e31..0000000
--- a/plugin/npupp.h
+++ /dev/null
@@ -1,719 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-/*
- * npupp.h $Revision: 3.26 $
- * function call mecahnics needed by platform specific glue code.
- */
-
-
-#ifndef _NPUPP_H_
-#define _NPUPP_H_
-
-#if defined(__OS2__)
-#pragma pack(1)
-#endif
-
-#ifndef GENERATINGCFM
-#define GENERATINGCFM 0
-#endif
-
-#ifndef _NPAPI_H_
-#include "npapi.h"
-#endif
-
-#include "npruntime.h"
-
-#ifdef OJI
-#include "jri.h"
-#else
-typedef void* JRIGlobalRef;
-#endif
-
-
-/******************************************************************************************
- plug-in function table macros
- for each function in and out of the plugin API we define
- typedef NPP_FooUPP
- #define NewNPP_FooProc
- #define CallNPP_FooProc
- *******************************************************************************************/
-
-
-/* NPP_Initialize */
-typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
-#define NewNPP_InitializeProc(FUNC) \
- ((NPP_InitializeUPP) (FUNC))
-#define CallNPP_InitializeProc(FUNC) \
- (*(FUNC))()
-
-/* NPP_Shutdown */
-typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
-#define NewNPP_ShutdownProc(FUNC) \
- ((NPP_ShutdownUPP) (FUNC))
-#define CallNPP_ShutdownProc(FUNC) \
- (*(FUNC))()
-
-/* NPP_New */
-typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
-#define NewNPP_NewProc(FUNC) \
- ((NPP_NewUPP) (FUNC))
-#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
-
-/* NPP_Destroy */
-typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
-#define NewNPP_DestroyProc(FUNC) \
- ((NPP_DestroyUPP) (FUNC))
-#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPP_SetWindow */
-typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
-#define NewNPP_SetWindowProc(FUNC) \
- ((NPP_SetWindowUPP) (FUNC))
-#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPP_NewStream */
-typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
-#define NewNPP_NewStreamProc(FUNC) \
- ((NPP_NewStreamUPP) (FUNC))
-#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
-
-/* NPP_DestroyStream */
-typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
-#define NewNPP_DestroyStreamProc(FUNC) \
- ((NPP_DestroyStreamUPP) (FUNC))
-#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
- (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
-
-/* NPP_WriteReady */
-typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
-#define NewNPP_WriteReadyProc(FUNC) \
- ((NPP_WriteReadyUPP) (FUNC))
-#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
- (*(FUNC))((NPParg), (NPStreamPtr))
-
-/* NPP_Write */
-typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
-#define NewNPP_WriteProc(FUNC) \
- ((NPP_WriteUPP) (FUNC))
-#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
- (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
-
-/* NPP_StreamAsFile */
-typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
-#define NewNPP_StreamAsFileProc(FUNC) \
- ((NPP_StreamAsFileUPP) (FUNC))
-#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPP_Print */
-typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
-#define NewNPP_PrintProc(FUNC) \
- ((NPP_PrintUPP) (FUNC))
-#define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
- (*(FUNC))((NPParg), (NPPrintArg))
-
-/* NPP_HandleEvent */
-typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
-#define NewNPP_HandleEventProc(FUNC) \
- ((NPP_HandleEventUPP) (FUNC))
-#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
- (*(FUNC))((NPParg), (voidPtr))
-
-/* NPP_URLNotify */
-typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
-#define NewNPP_URLNotifyProc(FUNC) \
- ((NPP_URLNotifyUPP) (FUNC))
-#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
-
-/* NPP_GetValue */
-typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
-#define NewNPP_GetValueProc(FUNC) \
- ((NPP_GetValueUPP) (FUNC))
-#define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPP_SetValue */
-typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
-#define NewNPP_SetValueProc(FUNC) \
- ((NPP_SetValueUPP) (FUNC))
-#define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/*
- * Netscape entry points
- */
-
-
-/* NPN_GetValue */
-typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
-#define NewNPN_GetValueProc(FUNC) \
- ((NPN_GetValueUPP) (FUNC))
-#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_SetValue */
-typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
-#define NewNPN_SetValueProc(FUNC) \
- ((NPN_SetValueUPP) (FUNC))
-#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_GetUrlNotify */
-typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
-#define NewNPN_GetURLNotifyProc(FUNC) \
- ((NPN_GetURLNotifyUPP) (FUNC))
-#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
-
-/* NPN_PostUrlNotify */
-typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
-#define NewNPN_PostURLNotifyProc(FUNC) \
- ((NPN_PostURLNotifyUPP) (FUNC))
-#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
-
-/* NPN_GetUrl */
-typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
-#define NewNPN_GetURLProc(FUNC) \
- ((NPN_GetURLUPP) (FUNC))
-#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_PostUrl */
-typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
-#define NewNPN_PostURLProc(FUNC) \
- ((NPN_PostURLUPP) (FUNC))
-#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
-
-/* NPN_RequestRead */
-typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
-#define NewNPN_RequestReadProc(FUNC) \
- ((NPN_RequestReadUPP) (FUNC))
-#define CallNPN_RequestReadProc(FUNC, stream, range) \
- (*(FUNC))((stream), (range))
-
-/* NPN_NewStream */
-typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
-#define NewNPN_NewStreamProc(FUNC) \
- ((NPN_NewStreamUPP) (FUNC))
-#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
- (*(FUNC))((npp), (type), (window), (stream))
-
-/* NPN_Write */
-typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
-#define NewNPN_WriteProc(FUNC) \
- ((NPN_WriteUPP) (FUNC))
-#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
- (*(FUNC))((npp), (stream), (len), (buffer))
-
-/* NPN_DestroyStream */
-typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
-#define NewNPN_DestroyStreamProc(FUNC) \
- ((NPN_DestroyStreamUPP) (FUNC))
-#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
- (*(FUNC))((npp), (stream), (reason))
-
-/* NPN_Status */
-typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
-#define NewNPN_StatusProc(FUNC) \
- ((NPN_StatusUPP) (FUNC))
-#define CallNPN_StatusProc(FUNC, npp, msg) \
- (*(FUNC))((npp), (msg))
-
-/* NPN_UserAgent */
-typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
-#define NewNPN_UserAgentProc(FUNC) \
- ((NPN_UserAgentUPP) (FUNC))
-#define CallNPN_UserAgentProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_MemAlloc */
-typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
-#define NewNPN_MemAllocProc(FUNC) \
- ((NPN_MemAllocUPP) (FUNC))
-#define CallNPN_MemAllocProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN__MemFree */
-typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
-#define NewNPN_MemFreeProc(FUNC) \
- ((NPN_MemFreeUPP) (FUNC))
-#define CallNPN_MemFreeProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_MemFlush */
-typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
-#define NewNPN_MemFlushProc(FUNC) \
- ((NPN_MemFlushUPP) (FUNC))
-#define CallNPN_MemFlushProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_ReloadPlugins */
-typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
-#define NewNPN_ReloadPluginsProc(FUNC) \
- ((NPN_ReloadPluginsUPP) (FUNC))
-#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_GetJavaEnv */
-typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
-#define NewNPN_GetJavaEnvProc(FUNC) \
- ((NPN_GetJavaEnvUPP) (FUNC))
-#define CallNPN_GetJavaEnvProc(FUNC) \
- (*(FUNC))()
-
-/* NPN_GetJavaPeer */
-typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
-#define NewNPN_GetJavaPeerProc(FUNC) \
- ((NPN_GetJavaPeerUPP) (FUNC))
-#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_InvalidateRect */
-typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
-#define NewNPN_InvalidateRectProc(FUNC) \
- ((NPN_InvalidateRectUPP) (FUNC))
-#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPN_InvalidateRegion */
-typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
-#define NewNPN_InvalidateRegionProc(FUNC) \
- ((NPN_InvalidateRegionUPP) (FUNC))
-#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPN_ForceRedraw */
-typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
-#define NewNPN_ForceRedrawProc(FUNC) \
- ((NPN_ForceRedrawUPP) (FUNC))
-#define CallNPN_ForceRedrawProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_GetStringIdentifier */
-typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierUPP)(const NPUTF8* name);
-#define NewNPN_GetStringIdentifierProc(FUNC) \
- ((NPN_GetStringIdentifierUPP) (FUNC))
-#define CallNPN_GetStringIdentifierProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_GetStringIdentifiers */
-typedef void (* NP_LOADDS NPN_GetStringIdentifiersUPP)(const NPUTF8** names,
- int32_t nameCount,
- NPIdentifier* identifiers);
-#define NewNPN_GetStringIdentifiersProc(FUNC) \
- ((NPN_GetStringIdentifiersUPP) (FUNC))
-#define CallNPN_GetStringIdentifiersProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_GetIntIdentifier */
-typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierUPP)(int32_t intid);
-#define NewNPN_GetIntIdentifierProc(FUNC) \
- ((NPN_GetIntIdentifierUPP) (FUNC))
-#define CallNPN_GetIntIdentifierProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_IdentifierIsString */
-typedef bool (* NP_LOADDS NPN_IdentifierIsStringUPP)(NPIdentifier identifier);
-#define NewNPN_IdentifierIsStringProc(FUNC) \
- ((NPN_IdentifierIsStringUPP) (FUNC))
-#define CallNPN_IdentifierIsStringProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_UTF8FromIdentifier */
-typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierUPP)(NPIdentifier identifier);
-#define NewNPN_UTF8FromIdentifierProc(FUNC) \
- ((NPN_UTF8FromIdentifierUPP) (FUNC))
-#define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_IntFromIdentifier */
-typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierUPP)(NPIdentifier identifier);
-#define NewNPN_IntFromIdentifierProc(FUNC) \
- ((NPN_IntFromIdentifierUPP) (FUNC))
-#define CallNPN_IntFromIdentifierProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_CreateObject */
-typedef NPObject* (* NP_LOADDS NPN_CreateObjectUPP)(NPP npp, NPClass *aClass);
-#define NewNPN_CreateObjectProc(FUNC) \
- ((NPN_CreateObjectUPP) (FUNC))
-#define CallNPN_CreateObjectProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPN_RetainObject */
-typedef NPObject* (* NP_LOADDS NPN_RetainObjectUPP)(NPObject *obj);
-#define NewNPN_RetainObjectProc(FUNC) \
- ((NPN_RetainObjectUPP) (FUNC))
-#define CallNPN_RetainObjectProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_ReleaseObject */
-typedef void (* NP_LOADDS NPN_ReleaseObjectUPP)(NPObject *obj);
-#define NewNPN_ReleaseObjectProc(FUNC) \
- ((NPN_ReleaseObjectUPP) (FUNC))
-#define CallNPN_ReleaseObjectProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_Invoke */
-typedef bool (* NP_LOADDS NPN_InvokeUPP)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
-#define NewNPN_InvokeProc(FUNC) \
- ((NPN_InvokeUPP) (FUNC))
-#define CallNPN_InvokeProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
-
-/* NPN_InvokeDefault */
-typedef bool (* NP_LOADDS NPN_InvokeDefaultUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-#define NewNPN_InvokeDefaultProc(FUNC) \
- ((NPN_InvokeDefaultUPP) (FUNC))
-#define CallNPN_InvokeDefaultProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
-
-/* NPN_Evaluate */
-typedef bool (* NP_LOADDS NPN_EvaluateUPP)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
-#define NewNPN_EvaluateProc(FUNC) \
- ((NPN_EvaluateUPP) (FUNC))
-#define CallNPN_EvaluateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
-
-/* NPN_GetProperty */
-typedef bool (* NP_LOADDS NPN_GetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
-#define NewNPN_GetPropertyProc(FUNC) \
- ((NPN_GetPropertyUPP) (FUNC))
-#define CallNPN_GetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
-
-/* NPN_SetProperty */
-typedef bool (* NP_LOADDS NPN_SetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
-#define NewNPN_SetPropertyProc(FUNC) \
- ((NPN_SetPropertyUPP) (FUNC))
-#define CallNPN_SetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
-
-/* NPN_RemoveProperty */
-typedef bool (* NP_LOADDS NPN_RemovePropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
-#define NewNPN_RemovePropertyProc(FUNC) \
- ((NPN_RemovePropertyUPP) (FUNC))
-#define CallNPN_RemovePropertyProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_HasProperty */
-typedef bool (* NP_LOADDS NPN_HasPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
-#define NewNPN_HasPropertyProc(FUNC) \
- ((NPN_HasPropertyUPP) (FUNC))
-#define CallNPN_HasPropertyProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_HasMethod */
-typedef bool (* NP_LOADDS NPN_HasMethodUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
-#define NewNPN_HasMethodProc(FUNC) \
- ((NPN_HasMethodUPP) (FUNC))
-#define CallNPN_HasMethodProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_ReleaseVariantValue */
-typedef void (* NP_LOADDS NPN_ReleaseVariantValueUPP)(NPVariant *variant);
-#define NewNPN_ReleaseVariantValueProc(FUNC) \
- ((NPN_ReleaseVariantValueUPP) (FUNC))
-#define CallNPN_ReleaseVariantValueProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_SetException */
-typedef void (* NP_LOADDS NPN_SetExceptionUPP)(NPObject *obj, const NPUTF8 *message);
-#define NewNPN_SetExceptionProc(FUNC) \
- ((NPN_SetExceptionUPP) (FUNC))
-#define CallNPN_SetExceptionProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPN_PushPopupsEnabledStateUPP */
-typedef bool (* NP_LOADDS NPN_PushPopupsEnabledStateUPP)(NPP npp, NPBool enabled);
-#define NewNPN_PushPopupsEnabledStateProc(FUNC) \
- ((NPN_PushPopupsEnabledStateUPP) (FUNC))
-#define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
- (*(FUNC))((ARG1), (ARG2))
-
-/* NPN_PopPopupsEnabledState */
-typedef bool (* NP_LOADDS NPN_PopPopupsEnabledStateUPP)(NPP npp);
-#define NewNPN_PopPopupsEnabledStateProc(FUNC) \
- ((NPN_PopPopupsEnabledStateUPP) (FUNC))
-#define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
- (*(FUNC))((ARG1))
-
-/* NPN_Enumerate */
-typedef bool (* NP_LOADDS NPN_EnumerateUPP)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
-#define NewNPN_EnumerateProc(FUNC) \
- ((NPN_EnumerateUPP) (FUNC))
-#define CallNPN_EnumerateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
-
-/* NPN_PluginThreadAsyncCall */
-typedef void (* NP_LOADDS NPN_PluginThreadAsyncCallUPP)(NPP instance, void (*func)(void *), void *userData);
-#define NewNPN_PluginThreadAsyncCallProc(FUNC) \
- ((NPN_PluginThreadAsyncCallUPP) (FUNC))
-#define CallNPN_PluginThreadAsyncCallProc(FUNC, ARG1, ARG2, ARG3) \
- (*(FUNC))((ARG1), (ARG2), (ARG3))
-
-/* NPN_Construct */
-typedef bool (* NP_LOADDS NPN_ConstructUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-#define NewNPN_ConstructProc(FUNC) \
- ((NPN_ConstructUPP) (FUNC))
-#define CallNPN_ConstructProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
- (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
-
-
-
-/******************************************************************************************
- * The actual plugin function table definitions
- *******************************************************************************************/
-
-typedef struct _NPPluginFuncs {
- uint16 size;
- uint16 version;
- NPP_NewUPP newp;
- NPP_DestroyUPP destroy;
- NPP_SetWindowUPP setwindow;
- NPP_NewStreamUPP newstream;
- NPP_DestroyStreamUPP destroystream;
- NPP_StreamAsFileUPP asfile;
- NPP_WriteReadyUPP writeready;
- NPP_WriteUPP write;
- NPP_PrintUPP print;
- NPP_HandleEventUPP event;
- NPP_URLNotifyUPP urlnotify;
- JRIGlobalRef javaClass;
- NPP_GetValueUPP getvalue;
- NPP_SetValueUPP setvalue;
-} NPPluginFuncs;
-
-typedef struct _NPNetscapeFuncs {
- uint16 size;
- uint16 version;
- NPN_GetURLUPP geturl;
- NPN_PostURLUPP posturl;
- NPN_RequestReadUPP requestread;
- NPN_NewStreamUPP newstream;
- NPN_WriteUPP write;
- NPN_DestroyStreamUPP destroystream;
- NPN_StatusUPP status;
- NPN_UserAgentUPP uagent;
- NPN_MemAllocUPP memalloc;
- NPN_MemFreeUPP memfree;
- NPN_MemFlushUPP memflush;
- NPN_ReloadPluginsUPP reloadplugins;
- NPN_GetJavaEnvUPP getJavaEnv;
- NPN_GetJavaPeerUPP getJavaPeer;
- NPN_GetURLNotifyUPP geturlnotify;
- NPN_PostURLNotifyUPP posturlnotify;
- NPN_GetValueUPP getvalue;
- NPN_SetValueUPP setvalue;
- NPN_InvalidateRectUPP invalidaterect;
- NPN_InvalidateRegionUPP invalidateregion;
- NPN_ForceRedrawUPP forceredraw;
- NPN_GetStringIdentifierUPP getstringidentifier;
- NPN_GetStringIdentifiersUPP getstringidentifiers;
- NPN_GetIntIdentifierUPP getintidentifier;
- NPN_IdentifierIsStringUPP identifierisstring;
- NPN_UTF8FromIdentifierUPP utf8fromidentifier;
- NPN_IntFromIdentifierUPP intfromidentifier;
- NPN_CreateObjectUPP createobject;
- NPN_RetainObjectUPP retainobject;
- NPN_ReleaseObjectUPP releaseobject;
- NPN_InvokeUPP invoke;
- NPN_InvokeDefaultUPP invokeDefault;
- NPN_EvaluateUPP evaluate;
- NPN_GetPropertyUPP getproperty;
- NPN_SetPropertyUPP setproperty;
- NPN_RemovePropertyUPP removeproperty;
- NPN_HasPropertyUPP hasproperty;
- NPN_HasMethodUPP hasmethod;
- NPN_ReleaseVariantValueUPP releasevariantvalue;
- NPN_SetExceptionUPP setexception;
- NPN_PushPopupsEnabledStateUPP pushpopupsenabledstate;
- NPN_PopPopupsEnabledStateUPP poppopupsenabledstate;
- NPN_EnumerateUPP enumerate;
- NPN_PluginThreadAsyncCallUPP pluginthreadasynccall;
- NPN_ConstructUPP construct;
-} NPNetscapeFuncs;
-
-
-#ifdef XP_MACOSX
-/******************************************************************************************
- * Mac platform-specific plugin glue stuff
- *******************************************************************************************/
-
-/*
- * Main entry point of the plugin.
- * This routine will be called when the plugin is loaded. The function
- * tables are passed in and the plugin fills in the NPPluginFuncs table
- * and NPPShutdownUPP for Netscape's use.
- */
-typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
-#define NewNPP_MainEntryProc(FUNC) \
- ((NPP_MainEntryUPP) (FUNC))
-#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
- (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
-
-/*
- * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
- * These can be called to retreive MIME information from the plugin dynamically
- *
- * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
- * to get mime info from the plugin only on OSX and may not be supported
- * in furture version -- use NP_GetMIMEDescription instead
- */
-
-enum
-{
- kBPSupportedMIMETypesStructVers_1 = 1
-};
-
-typedef struct _BPSupportedMIMETypes
-{
- SInt32 structVersion; /* struct version */
- Handle typeStrings; /* STR# formated handle, allocated by plug-in */
- Handle infoStrings; /* STR# formated handle, allocated by plug-in */
-} BPSupportedMIMETypes;
-OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
-
- /* NP_GetMIMEDescription */
-#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
-typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
-#define NewNP_GetMIMEDescEntryProc(FUNC) \
- ((NP_GetMIMEDescriptionUPP) (FUNC))
-#define CallNP_GetMIMEDescEntryProc(FUNC) \
- (*(FUNC))()
-
-/* BP_GetSupportedMIMETypes */
-typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
-#define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
- ((BP_GetSupportedMIMETypesUPP) (FUNC))
-#define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
- (*(FUNC))((mimeInfo), (flags))
-
-#endif /* XP_MACOSX */
-
-#if defined(_WINDOWS)
-#define OSCALL WINAPI
-#else
-#if defined(__OS2__)
-#define OSCALL _System
-#else
-#define OSCALL
-#endif
-#endif
-
-#if defined(XP_UNIX)
-/* GCC 3.3 and later support the visibility attribute. */
-#if defined(__GNUC__) && \
- ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
-#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
-#else
-#define NP_VISIBILITY_DEFAULT
-#endif
-
-#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
-#endif
-
-#if defined( _WINDOWS ) || defined (__OS2__)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* plugin meta member functions */
-#if defined(__OS2__)
-
-typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
- char *pMimeTypes;
- char *pFileExtents;
- char *pFileOpenTemplate;
- char *pProductName;
- char *pProductDescription;
- unsigned long dwProductVersionMS;
- unsigned long dwProductVersionLS;
-} NPPluginData;
-
-NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
-
-#endif
-
-NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
-
-NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
-
-NPError OSCALL NP_Shutdown();
-
-char* !NP_GetMIMEDescription();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _WINDOWS || __OS2__ */
-
-#if defined(__OS2__)
-#pragma pack()
-#endif
-
-#ifdef XP_UNIX
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* plugin meta member functions */
-
-NP_EXPORT(char*) NP_GetMIMEDescription(void);
-NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
-NP_EXPORT(NPError) NP_Shutdown(void);
-NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* XP_UNIX */
-
-#endif /* _NPUPP_H_ */
diff --git a/plugin/test.html b/plugin/test.html
deleted file mode 100644
index 735ca2b..0000000
--- a/plugin/test.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<html>
-<body>
-
- <h1>Virt Viewer plugin test</h1>
-
- <p>You will need to edit the source to
- set <code>uri</code>, <code>name</code> etc.</p>
-
- <embed type="application/x-virt-viewer"
- width="800"
- height="600"
- uri="qemu:///system?socket=/var/run/libvirt/libvirt-sock-ro"
- debug="1"
- wait="1"
- reconnect="1"
- name="VirtTest1">
- </embed>
-
- <p>End of page</p>
-
-</body>
-</html>
diff --git a/plugin/virt-viewer-plugin.c b/plugin/virt-viewer-plugin.c
deleted file mode 100644
index 3fd6e84..0000000
--- a/plugin/virt-viewer-plugin.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- VIRT-VIEWER-PLUGIN
-
- By Richard W.M. Jones <rjones@redhat.com>
- Copyright (C) 2008-2012 Red Hat, Inc.
-
- Largely based on DiamondX (http://multimedia.cx/diamondx/), which itself
- is based on Mozilla sources.
-
- DiamondX copyright notice:
-
- Example XEmbed-aware Mozilla browser plugin by Adobe.
-
- Copyright (c) 2007 Adobe Systems Incorporated
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <vncdisplay.h>
-
-#include "virt-viewer-plugin.h"
-
-
-NPError
-VirtViewerXSetWindow (NPP instance, NPWindow *window)
-{
- PluginInstance *This;
- NPSetWindowCallbackStruct *ws_info;
- int r;
-
- if (instance == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- This = (PluginInstance*) instance->pdata;
-
- debug ("ViewViewerXSetWindow, This=%p", This);
-
- if (This == NULL)
- return NPERR_INVALID_INSTANCE_ERROR;
-
- ws_info = (NPSetWindowCallbackStruct *)window->ws_info;
-
- /* Mozilla likes to re-run its greatest hits */
- if (window == This->window &&
- window->x == This->x &&
- window->y == This->y &&
- window->width == This->width &&
- window->height == This->height) {
- debug ("virt-viewer-plugin: window re-run; returning");
- return NPERR_NO_ERROR;
- }
-
- This->window = window;
- This->x = window->x;
- This->y = window->y;
- This->width = window->width;
- This->height = window->height;
-
- /* Create a GtkPlug container and a Gtk-VNC widget inside it. */
- This->container = gtk_plug_new ((GdkNativeWindow)(long)window->window);
-
- /* Make the VNC widget. */
- if (This->uri && This->name) {
- debug ("calling viewer_start uri=%s name=%s direct=%d waitvm=%d reconnect=%d container=%p",
- This->uri, This->name, This->direct, This->waitvm, This->reconnect, This->container);
- r = viewer_start (This->uri, This->name, This->direct, This->waitvm, This->reconnect, 1, This->debug, This->container);
- if (r != 0)
- fprintf (stderr, "viewer_start returned %d != 0\n", r);
- }
-
- gtk_widget_show_all (This->container);
-
- return NPERR_NO_ERROR;
-}
-
-NPError
-VirtViewerDestroyWindow (NPP instance)
-{
- PluginInstance *This = (PluginInstance*) instance->pdata;
-
- debug ("VirtViewerDestroyWindow, This=%p", This);
-
- if (This && This->container) {
- gtk_widget_destroy (This->container);
- This->container = NULL;
- }
-
- return NPERR_NO_ERROR;
-}
-
-static NPWindow windowlessWindow;
-
-int16
-VirtViewerXHandleEvent(NPP instance, void *event)
-{
- XGraphicsExposeEvent exposeEvent;
- XEvent *nsEvent;
-
- debug ("VirtViewerXHandleEvent");
-
- nsEvent = (XEvent *) event;
- exposeEvent = nsEvent->xgraphicsexpose;
-
- /*printf(" event: x, y, w, h = %d, %d, %d, %d; display @ %p, window/drawable = %d\n",
- exposeEvent.x,
- exposeEvent.y,
- exposeEvent.width,
- exposeEvent.height,
- exposeEvent.display,
- exposeEvent.drawable);*/
-
- windowlessWindow.window = exposeEvent.display;
- windowlessWindow.x = exposeEvent.x;
- windowlessWindow.y = exposeEvent.y;
- windowlessWindow.width = exposeEvent.width;
- windowlessWindow.height = exposeEvent.height;
- windowlessWindow.ws_info = (void *)exposeEvent.drawable;
-
- NPP_SetWindow(instance, &windowlessWindow);
-
- return 0;
-}
diff --git a/plugin/virt-viewer-plugin.h b/plugin/virt-viewer-plugin.h
deleted file mode 100644
index add97df..0000000
--- a/plugin/virt-viewer-plugin.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- VIRT_VIEWER-PLUGIN
-
- By Richard W.M. Jones <rjones@redhat.com>
- Copyright (C) 2008-2012 Red Hat, Inc.
-
- Largely based on DiamondX (http://multimedia.cx/diamondx/), which itself
- is based on Mozilla sources.
-
- DiamondX copyright notice:
-
- Example XEmbed-aware Mozilla browser plugin by Adobe.
-
- Copyright (c) 2007 Adobe Systems Incorporated
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef VIRT_VIEWER_PLUGIN_H
-#define VIRT_VIEWER_PLUGIN_H
-
-#include <npapi.h>
-#include <gtk/gtk.h>
-#include <X11/Xlib.h>
-#include "virt-viewer-app.h"
-
-#define PLUGIN_NAME "Virt-viewer browser plugin"
-#define MIME_TYPES_HANDLED "application/x-virt-viewer:virt-viewer:Virt viewer"
-#define PLUGIN_DESCRIPTION "Virtual machine console viewer plugin"
-
-typedef struct {
- uint16 mode;
- NPWindow *window;
- int32 x, y;
- uint32 width, height;
-
- NPP instance;
- NPBool pluginsHidden;
-
- GtkWidget *container;
-
- char *uri, *name;
- gboolean direct, waitvm, debug, reconnect;
-} PluginInstance;
-
-extern NPError VirtViewerXSetWindow (NPP instance, NPWindow* window);
-extern NPError VirtViewerDestroyWindow (NPP instance);
-extern int16 VirtViewerXHandleEvent (NPP instance, void* event);
-
-#ifdef ENABLE_DEBUG
-static void
-debug (const char *msg, ...)
-{
- va_list args;
-
- va_start (args, msg);
- vfprintf (stderr, msg, args);
- va_end (args);
- fprintf (stderr, "\n");
- fflush (stderr);
-}
-#else
-#define debug(msg...)
-#endif
-
-#endif /* VIRT_VIEWER_PLUGIN_H */
diff --git a/virt-viewer.spec.in b/virt-viewer.spec.in
index f5bc5ec..77507eb 100644
--- a/virt-viewer.spec.in
+++ b/virt-viewer.spec.in
@@ -5,10 +5,6 @@
# touch configure.ac or Makefile.am.
%{!?enable_autotools:%define enable_autotools 1}
-# Plugin isn't ready for real world use yet - it needs
-# a security audit at very least
-%define _with_plugin %{?with_plugin:1}%{!?with_plugin:0}
-
%define with_gtk3 0
%if 0%{?fedora} >= 15
%define with_gtk3 1
@@ -73,34 +69,12 @@ BuildRequires: spice-protocol >= 0.10.1
%endif
BuildRequires: /usr/bin/pod2man
BuildRequires: intltool
-%if %{_with_plugin}
-%if 0%{?fedora} > 8
-BuildRequires: xulrunner-devel
-%else
-BuildRequires: firefox-devel
-%endif
-%endif
%description
Virtual Machine Viewer provides a graphical console client for connecting
to virtual machines. It uses the GTK-VNC or SPICE-GTK widgets to provide
the display, and libvirt for looking up VNC/SPICE server details.
-%if %{_with_plugin}
-%package plugin
-Summary: Mozilla plugin for the gtk-vnc library
-Group: Development/Libraries
-Requires: %{name} = %{version}
-
-%description plugin
-Virtual Machine Viewer provides a graphical console client for connecting
-to virtual machines. It uses the GTK-VNC or SPICE-GTK widgets to provide
-the display, and libvirt for looking up VNC/SPICE server details.
-
-This package provides a web browser plugin for Mozilla compatible
-browsers.
-%endif
-
%prep
%setup -q
@@ -110,12 +84,6 @@ browsers.
autoreconf -if
%endif
-%if %{_with_plugin}
-%define plugin_arg --enable-plugin
-%else
-%define plugin_arg --disable-plugin
-%endif
-
%if %{with_spice}
%define spice_arg --with-spice-gtk
%else
@@ -128,7 +96,7 @@ autoreconf -if
%define gtk_arg --with-gtk=2.0
%endif
-%configure %{spice_arg} %{plugin_arg} %{gtk_arg} --with-buildid=-%{release}
+%configure %{spice_arg} %{gtk_arg} --with-buildid=-%{release}
%__make %{?_smp_mflags}
@@ -138,10 +106,6 @@ rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}%{_libexecdir}
touch %{buildroot}%{_libexecdir}/spice-xpi-client
install -m 0755 data/spice-xpi-client-remote-viewer %{buildroot}%{_libexecdir}/
-%if %{_with_plugin}
-rm -f %{buildroot}%{_libdir}/mozilla/plugins/%{name}-plugin.a
-rm -f %{buildroot}%{_libdir}/mozilla/plugins/%{name}-plugin.la
-%endif
%find_lang %{name}
%clean
@@ -182,10 +146,4 @@ update-desktop-database -q %{_datadir}/applications
%{_mandir}/man1/virt-viewer.1*
%{_mandir}/man1/remote-viewer.1*
-%if %{_with_plugin}
-%files plugin
-%defattr(-, root, root)
-%{_libdir}/mozilla/plugins/%{name}-plugin.so
-%endif
-
%changelog