diff options
author | Thomas Fitzsimmons <fitzsim@redhat.com> | 2006-06-14 03:38:34 +0000 |
---|---|---|
committer | Thomas Fitzsimmons <fitzsim@gcc.gnu.org> | 2006-06-14 03:38:34 +0000 |
commit | 648e8d6dd39f9bb1a61b7886007088e1064f7dae (patch) | |
tree | 4ead311615cefc89deebca761f0deb7edf23dcb8 /libjava/classpath/native/plugin | |
parent | e3d437c0561389c39a8232327982baba7e9dfe46 (diff) | |
download | gcc-648e8d6dd39f9bb1a61b7886007088e1064f7dae.zip gcc-648e8d6dd39f9bb1a61b7886007088e1064f7dae.tar.gz gcc-648e8d6dd39f9bb1a61b7886007088e1064f7dae.tar.bz2 |
configure: Regenerate.
2006-06-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* configure: Regenerate.
* Makefile.in: Regenerate.
* configure.ac (--enable-plugin): New option.
(ac_configure_args): Add --enable-tool-wrappers.
(ac_configure_args): Add --disable-plugin unless --enable-plugin
was specified.
* gcj/Makefile.in: Regenerate.
* sources.am (gnu_java_net_source_files): Add
classpath/gnu/java/net/IndexListParser.java.
(property_files): Remove
classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties,
classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties.
Add
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties,
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties,
classpath/resource/gnu/classpath/tools/getopt/Messages.properties,
classpath/resource/gnu/classpath/tools/jar/messages.properties,
classpath/resource/gnu/classpath/tools/jarsigner/messages.properties,
classpath/resource/gnu/classpath/tools/keytool/messages.properties,
classpath/resource/gnu/classpath/tools/native2ascii/messages.properties,
classpath/resource/gnu/classpath/tools/serialver/messages.properties.
* classpath/Makefile.in: Regenerate.
* classpath/native/jni/gtk-peer/cairographics2d.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c:
Merge from GNU Classpath.
* classpath/native/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.am: Install libjawt.so in GCJ's
versioned library directory.
* classpath/native/Makefile.am: Add plugin directory if
--enable-plugin was specified.
* classpath/native/plugin/Makefile.in: Regenerate. *
classpath/native/plugin/Makefile.am: Install libgcjwebplugin.so in
GCJ's versioned library directory.
* classpath/resource/gnu/classpath/tools/native2ascii/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/getopt/Messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/keytool/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties:
New file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jar/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/serialver/messages.properties:
Likewise.
* classpath/gnu/java/net/IndexListParser.java:
Likewise.
* classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
classpath/gnu/java/awt/peer/gtk/CairoSurface.java,
classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,
classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,
classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java,
classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java,
classpath/gnu/java/awt/java2d/PolyEdge.java,
classpath/gnu/java/awt/java2d/AbstractGraphics2D.java: Merge from
GNU Classpath.
* classpath/tools/toolwrapper.c: Replace tools.zip reference with
libgcj-tools-4.2.0.jar.
* classpath/tools/Makefile.in: Regenerate.
* classpath/tools/Makefile.am: Rename tools.zip to
libgcj-tools-4.2.0.jar. Install libgcj-tools-4.2.0.jar in
$(datadir)/java.
* classpath/javax/swing/JTabbedPane.java,
classpath/javax/swing/text/DefaultStyledDocument.java,
classpath/javax/swing/text/html/HTMLDocument.java,
classpath/javax/swing/text/GapContent.java,
classpath/javax/swing/JComponent.java,
classpath/javax/swing/RepaintManager.java,
classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java,
classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,
classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,
classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,
classpath/javax/swing/plaf/metal/MetalButtonUI.java,
classpath/java/text/Bidi.java,
classpath/java/awt/image/BufferedImage.java,
classpath/java/awt/datatransfer/DataFlavor.java,
classpath/java/awt/geom/AffineTransform.java,
classpath/java/awt/dnd/DropTargetDropEvent.java,
classpath/java/awt/dnd/DropTargetContext.java,
classpath/java/awt/font/TextLayout.java,
classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,
classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h,
classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h,
classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h: Merge from
GNU Classpath.
* classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,
classpath/native/jni/gtk-peer/gtkcairopeer.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
Remove files.
* classpath/Makefile.am (SUBDIRS, DIST_SUBDIRS): Include tools
directory.
* include/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
From-SVN: r114633
Diffstat (limited to 'libjava/classpath/native/plugin')
-rw-r--r-- | libjava/classpath/native/plugin/Makefile.am | 15 | ||||
-rw-r--r-- | libjava/classpath/native/plugin/Makefile.in | 72 | ||||
-rw-r--r-- | libjava/classpath/native/plugin/gcjwebplugin.cc | 97 |
3 files changed, 108 insertions, 76 deletions
diff --git a/libjava/classpath/native/plugin/Makefile.am b/libjava/classpath/native/plugin/Makefile.am index 19c7618..920cce6 100644 --- a/libjava/classpath/native/plugin/Makefile.am +++ b/libjava/classpath/native/plugin/Makefile.am @@ -1,17 +1,24 @@ -lib_LTLIBRARIES = libgcjwebplugin.la +## GCJ LOCAL: install this library in GCJ's versioned library +## directory +gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER) +gcjversionedlibdir = $(libdir)/gcj-$(gcc_version) +gcjversionedlib_LTLIBRARIES = libgcjwebplugin.la libgcjwebplugin_la_SOURCES = gcjwebplugin.cc libgcjwebplugin_la_CXXFLAGS = \ - -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/appletviewer\"" \ + -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \ -DPLUGIN_DATA_DIRECTORY="\"$(PLUGIN_DIR)/gcjwebplugin-data\"" \ $(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) -libgcjwebplugin_la_LDFLAGS = -avoid-version \ +## GCJ LOCAL: encode the library path and use GCJ's library version +libgcjwebplugin_la_LDFLAGS = -rpath $(gcjversionedlibdir) \ + -version-info `grep -v '^\#' $(top_srcdir)/../libtool-version` \ $(GLIB_LIBS) $(GTK_LIBS) \ -lstdc++ -install-plugin: $(lib_LTLIBRARIES) +## GCJ LOCAL: depend on gcjversionedlib_LTLIBRARIES +install-plugin: $(gcjversionedlib_LTLIBRARIES) $(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR) $(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR) diff --git a/libjava/classpath/native/plugin/Makefile.in b/libjava/classpath/native/plugin/Makefile.in index 22b8d3d..b1fe45a 100644 --- a/libjava/classpath/native/plugin/Makefile.in +++ b/libjava/classpath/native/plugin/Makefile.in @@ -58,9 +58,9 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) +am__installdirs = "$(DESTDIR)$(gcjversionedlibdir)" +gcjversionedlibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(gcjversionedlib_LTLIBRARIES) libgcjwebplugin_la_LIBADD = am_libgcjwebplugin_la_OBJECTS = libgcjwebplugin_la-gcjwebplugin.lo libgcjwebplugin_la_OBJECTS = $(am_libgcjwebplugin_la_OBJECTS) @@ -294,14 +294,17 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ vm_classes = @vm_classes@ -lib_LTLIBRARIES = libgcjwebplugin.la +gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER) +gcjversionedlibdir = $(libdir)/gcj-$(gcc_version) +gcjversionedlib_LTLIBRARIES = libgcjwebplugin.la libgcjwebplugin_la_SOURCES = gcjwebplugin.cc libgcjwebplugin_la_CXXFLAGS = \ - -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/appletviewer\"" \ + -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \ -DPLUGIN_DATA_DIRECTORY="\"$(PLUGIN_DIR)/gcjwebplugin-data\"" \ $(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) -libgcjwebplugin_la_LDFLAGS = -avoid-version \ +libgcjwebplugin_la_LDFLAGS = -rpath $(gcjversionedlibdir) \ + -version-info `grep -v '^\#' $(top_srcdir)/../libtool-version` \ $(GLIB_LIBS) $(GTK_LIBS) \ -lstdc++ @@ -338,35 +341,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-libLTLIBRARIES: $(lib_LTLIBRARIES) +install-gcjversionedlibLTLIBRARIES: $(gcjversionedlib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + test -z "$(gcjversionedlibdir)" || $(mkdir_p) "$(DESTDIR)$(gcjversionedlibdir)" + @list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gcjversionedlibdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gcjversionedlibdir)/$$f"; \ else :; fi; \ done -uninstall-libLTLIBRARIES: +uninstall-gcjversionedlibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gcjversionedlibdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gcjversionedlibdir)/$$p"; \ done -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ +clean-gcjversionedlibLTLIBRARIES: + -test -z "$(gcjversionedlib_LTLIBRARIES)" || rm -f $(gcjversionedlib_LTLIBRARIES) + @list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libgcjwebplugin.la: $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_DEPENDENCIES) - $(CXXLINK) -rpath $(libdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS) + $(CXXLINK) -rpath $(gcjversionedlibdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -493,7 +496,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: - for dir in "$(DESTDIR)$(libdir)"; do \ + for dir in "$(DESTDIR)$(gcjversionedlibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am @@ -522,7 +525,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +clean-am: clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am @@ -541,9 +544,9 @@ info: info-am info-am: -install-data-am: +install-data-am: install-gcjversionedlibLTLIBRARIES -install-exec-am: install-libLTLIBRARIES +install-exec-am: install-info: install-info-am @@ -569,23 +572,24 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES +uninstall-am: uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am \ - install-libLTLIBRARIES install-man install-strip installcheck \ +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am \ + install-gcjversionedlibLTLIBRARIES install-info \ + install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-libLTLIBRARIES + tags uninstall uninstall-am \ + uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am -install-plugin: $(lib_LTLIBRARIES) +install-plugin: $(gcjversionedlib_LTLIBRARIES) $(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR) $(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR) diff --git a/libjava/classpath/native/plugin/gcjwebplugin.cc b/libjava/classpath/native/plugin/gcjwebplugin.cc index deae810..1202c47 100644 --- a/libjava/classpath/native/plugin/gcjwebplugin.cc +++ b/libjava/classpath/native/plugin/gcjwebplugin.cc @@ -79,6 +79,10 @@ exception statement from your version. */ g_printerr ("%s:%d: thread %p: Error: %s: %s\n", __FILE__, __LINE__, \ g_thread_self (), first, second) +#define PLUGIN_ERROR_THREE(first, second, third) \ + g_printerr ("%s:%d: thread %p: Error: %s: %s: %s\n", __FILE__, \ + __LINE__, g_thread_self (), first, second, third) + // Plugin information passed to about:plugins. #define PLUGIN_NAME "GCJ Web Browser Plugin" #define PLUGIN_DESC "The " PLUGIN_NAME " executes Java applets." @@ -120,7 +124,6 @@ exception statement from your version. */ // Security dialog messages. #define RESPONSE_TRUST_APPLET "Trust Applet" #define RESPONSE_TRUST_APPLET_ADD_TO_LIST "Trust Applet and Add to Whitelist" -#define WHITELIST_FILENAME PLUGIN_DATA_DIRECTORY "/whitelist.txt" #define SECURITY_WARNING \ "%s wants to load an applet.\n" \ "GNU Classpath's security implementation is not complete.\n" \ @@ -132,7 +135,7 @@ exception statement from your version. */ " and run this applet from now on, without asking.\n" \ "The whitelist is a list of the URLs from which you trust" \ " applets.\n" \ - "Your whitelist file is \"" WHITELIST_FILENAME "\"." + "Your whitelist file is \" %s \"." #define FAILURE_MESSAGE \ "This page wants to load an applet.\n" \ "The appletviewer is missing or not installed properly in \"" \ @@ -144,9 +147,15 @@ static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); // Browser function table. static NPNetscapeFuncs browserFunctions; +// Data directory for plugin. +static gchar* data_directory; + +// Whitelist filename +static gchar* whitelist_filename; + // Keeps track of initialization. NP_Initialize should only be // called once. -bool initialized = false; +gboolean initialized = false; // GCJPluginData stores all the data associated with a single plugin // instance. A separate plugin instance is created for each <APPLET> @@ -314,21 +323,40 @@ GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode, " Browser not Mozilla-based?"); goto cleanup_appletviewer_mutex; } + + // Open the user's documentbase whitelist. + whitelist_file = g_io_channel_new_file (whitelist_filename, + "a+", &channel_error); + if (!whitelist_file) + { + if (channel_error) + { + PLUGIN_ERROR_THREE ("Failed to open whitelist file", + whitelist_filename, + channel_error->message); + g_error_free (channel_error); + channel_error = NULL; + } + else + PLUGIN_ERROR_TWO ("Failed to open whitelist file", + whitelist_filename); + return NPERR_GENERIC_ERROR; + } + if (!plugin_user_trusts_documentbase (documentbase)) { PLUGIN_ERROR ("User does not trust applet."); np_error = NPERR_GENERIC_ERROR; goto cleanup_appletviewer_mutex; } - + // Create appletviewer-to-plugin pipe which we refer to as the input // pipe. // data->in_pipe_name - data->in_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY - "/gcj-%s-appletviewer-to-plugin", - data->instance_string); + data->in_pipe_name = g_strdup_printf ("%s/gcj-%s-appletviewer-to-plugin", + data_directory, data->instance_string); if (!data->in_pipe_name) { PLUGIN_ERROR ("Failed to create input pipe name."); @@ -349,9 +377,8 @@ GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode, // output pipe. // data->out_pipe_name - data->out_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY - "/gcj-%s-plugin-to-appletviewer", - data->instance_string); + data->out_pipe_name = g_strdup_printf ("%s/gcj-%s-plugin-to-appletviewer", + data_directory, data->instance_string); if (!data->out_pipe_name) { @@ -952,7 +979,7 @@ plugin_user_trusts_documentbase (char* documentbase) channel_error = NULL; } else - PLUGIN_ERROR ("Failed to open whitelist file."); + PLUGIN_ERROR ("Failed to read line from whitelist file."); g_free (whitelist_entry); whitelist_entry = NULL; break; @@ -1061,7 +1088,7 @@ plugin_ask_user_about_documentbase (char* documentbase) SECURITY_WARNING, documentbase); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - SECURITY_DESCRIPTION); + SECURITY_DESCRIPTION, whitelist_filename); cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, @@ -1577,7 +1604,7 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable) return NPERR_INVALID_FUNCTABLE_ERROR; } - + // Ensure that the major version of the plugin API that the browser // expects is not more recent than the major version of the API that // we've implemented. @@ -1606,43 +1633,25 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable) return NPERR_INVALID_FUNCTABLE_ERROR; } + data_directory = g_strconcat(getenv("HOME"), "/.gcjwebplugin", NULL); + whitelist_filename = g_strconcat (data_directory, "/whitelist.txt", NULL); // Make sure the plugin data directory exists, creating it if // necessary. - if (!g_file_test (PLUGIN_DATA_DIRECTORY, + if (!g_file_test (data_directory, (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { int file_error = 0; - file_error = g_mkdir (PLUGIN_DATA_DIRECTORY, 0700); + file_error = g_mkdir (data_directory, 0700); if (file_error != 0) { - PLUGIN_ERROR_TWO ("Failed to create data directory " - PLUGIN_DATA_DIRECTORY " ", - strerror (errno)); + PLUGIN_ERROR_THREE ("Failed to create data directory", + data_directory, + strerror (errno)); return NPERR_GENERIC_ERROR; } } - // Open the user's documentbase whitelist. - whitelist_file = g_io_channel_new_file (WHITELIST_FILENAME, - "a+", &channel_error); - if (!whitelist_file) - { - if (channel_error) - { - PLUGIN_ERROR_TWO ("Failed to open whitelist file " - WHITELIST_FILENAME " ", - channel_error->message); - g_error_free (channel_error); - channel_error = NULL; - } - else - PLUGIN_ERROR ("Failed to open whitelist file " - WHITELIST_FILENAME); - - return NPERR_GENERIC_ERROR; - } - // Store in a local table the browser functions that we may use. browserFunctions.version = browserTable->version; browserFunctions.size = browserTable->size; @@ -1750,6 +1759,18 @@ NP_Shutdown (void) g_io_channel_close (whitelist_file); whitelist_file = NULL; } + + if (data_directory) + { + g_free (data_directory); + data_directory = NULL; + } + + if (whitelist_filename) + { + g_free (whitelist_filename); + whitelist_filename = NULL; + } initialized = false; |