/hg/release/icedtea6-1.7: Import from 1.6 tip:
dbhole at icedtea.classpath.org
dbhole at icedtea.classpath.org
Thu Dec 24 11:01:31 PST 2009
changeset a0f8cf8cf432 in /hg/release/icedtea6-1.7
details: http://icedtea.classpath.org/hg/release/icedtea6-1.7?cmd=changeset;node=a0f8cf8cf432
author: Deepak Bhole <dbhole at redhat.com>
date: Thu Dec 24 14:06:38 2009 -0500
Import from 1.6 tip:
- Stability imrovements
- Fix regression introduced with fix for bug# 406
- Fix to build with Gecko 1.9.1.5
- Add proper proxy support
- Update to work with latest chromium builds
diffstat:
13 files changed, 274 insertions(+), 138 deletions(-)
ChangeLog | 23 +
plugin/icedteanp/IcedTeaNPPlugin.cc | 122 +++----
plugin/icedteanp/IcedTeaNPPlugin.h | 11
plugin/icedteanp/IcedTeaPluginRequestProcessor.cc | 153 +++++++---
plugin/icedteanp/IcedTeaPluginRequestProcessor.h | 8
plugin/icedteanp/IcedTeaPluginUtils.cc | 38 ++
plugin/icedteanp/IcedTeaPluginUtils.h | 14
plugin/icedteanp/IcedTeaRunnable.h | 2
plugin/icedteanp/IcedTeaScriptablePluginObject.cc | 8
plugin/icedteanp/IcedTeaScriptablePluginObject.h | 2
plugin/icedteanp/java/sun/applet/PluginAppletViewer.java | 22 -
plugin/icedteanp/java/sun/applet/PluginCallRequestFactory.java | 3
rt/net/sourceforge/jnlp/Launcher.java | 6
diffs (truncated from 1030 to 500 lines):
diff -r 56fe14241120 -r a0f8cf8cf432 ChangeLog
--- a/ChangeLog Thu Dec 24 13:56:30 2009 +0000
+++ b/ChangeLog Thu Dec 24 14:06:38 2009 -0500
@@ -1,3 +1,26 @@ 2009-12-24 Andrew John Hughes <ahughes
+2009-12-24 Deepak Bhole <dbhole at redhat.com>
+
+ * Makefile.am: Define XP_UNIX, without which critical plugin API
+ functions don't get exported from Mozilla API anymore.
+ * plugin/icedteanp/IcedTeaNPPlugin.cc: Update to build with gecko
+ 1.9.1.5.
+ (consume_message): Use calloc instead of malloc.
+ (decode_url): Remove function. Rewritten from scratch (this time without
+ using any Mozilla code) in IcedTeaPluginUtils.
+ (get_scriptable_object): Initialize handle to 0 if not already set.
+ (GCJ_SetWindow): Set proper instance id when manipulating height.
+ * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc: Add temporary
+ workaround for chromium which seems to free on calls to
+ NPN_PluginThreadAsyncCall.
+ * plugin/icedteanp/IcedTeaPluginUtils.cc
+ (decodeURL): New function. Decodes an encoded URL.
+ * plugin/icedteanp/IcedTeaPluginUtils.h: Added helper macros for
+ decodeURL.
+ * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java: Make panel
+ visible only if handle is non-zero.
+ (parse): Fix regression introduced when fix for Bug# 406 was ported over.
+ Normalized default width and height.
+
2009-12-24 Andrew John Hughes <ahughes at redhat.com>
* configure.ac: Bump version to 1.7.
diff -r 56fe14241120 -r a0f8cf8cf432 plugin/icedteanp/IcedTeaNPPlugin.cc
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc Thu Dec 24 13:56:30 2009 +0000
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc Thu Dec 24 14:06:38 2009 -0500
@@ -47,15 +47,17 @@ exception statement from your version. *
#include <sys/types.h>
#include <unistd.h>
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+// Liveconnect extension
+#include "IcedTeaScriptablePluginObject.h"
+#include "IcedTeaNPPlugin.h"
+
+#if MOZILLA_VERSION_COLLAPSED < 1090100
// Documentbase retrieval includes.
#include <nsIPluginInstance.h>
#include <nsIPluginInstancePeer.h>
#include <nsIPluginTagInfo2.h>
-#endif
// API's into Mozilla
-#if MOZILLA_VERSION_COLLAPSED < 1090200
#include <nsCOMPtr.h>
#include <nsICookieService.h>
#include <nsIDNSRecord.h>
@@ -70,10 +72,6 @@ exception statement from your version. *
#include <nsStringAPI.h>
#include <nsServiceManagerUtils.h>
#endif
-
-// Liveconnect extension
-#include "IcedTeaScriptablePluginObject.h"
-#include "IcedTeaNPPlugin.h"
// Error reporting macros.
#define PLUGIN_ERROR(message) \
@@ -136,7 +134,7 @@ exception statement from your version. *
#define FAILURE_MESSAGE "gcjwebplugin error: Failed to run %s." \
" For more detail rerun \"firefox -g\" in a terminal window."
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
// Documentbase retrieval required definition.
static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
#endif
@@ -186,7 +184,7 @@ PluginRequestProcessor* plugin_req_proc;
// Sends messages to Java over the bus
JavaMessageSender* java_req_proc;
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
// Documentbase retrieval type-punning union.
typedef union
{
@@ -211,7 +209,7 @@ static gboolean plugin_out_pipe_callback
GIOCondition condition,
gpointer plugin_data);
static NPError plugin_start_appletviewer (GCJPluginData* data);
-static gchar* plugin_create_applet_tag (int16 argc, char* argn[],
+static gchar* plugin_create_applet_tag (int16_t argc, char* argn[],
char* argv[]);
static void plugin_stop_appletviewer ();
// Uninitialize GCJPluginData structure
@@ -219,7 +217,6 @@ static void plugin_data_destroy (NPP ins
NPError get_cookie_info(const char* siteAddr, char** cookieString, uint32_t* len);
NPError get_proxy_info(const char* siteAddr, char** proxy, uint32_t* len);
-void decode_url(const gchar* url, gchar** decoded_url);
void consume_message(gchar* message);
void start_jvm_if_needed();
static void appletviewer_monitor(GPid pid, gint status, gpointer data);
@@ -261,8 +258,8 @@ pthread_cond_t cond_message_available =
// function will free anything that's been allocated so far, set
// instance->pdata to NULL and return an error code.
NPError
-GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
- int16 argc, char* argn[], char* argv[],
+GCJ_New (NPMIMEType pluginType, NPP instance, uint16_t mode,
+ int16_t argc, char* argn[], char* argv[],
NPSavedData* saved)
{
PLUGIN_DEBUG_0ARG("GCJ_New\n");
@@ -613,8 +610,8 @@ GCJ_GetValue (NPP instance, NPPVariable
case NPPVpluginNeedsXEmbed:
{
PLUGIN_DEBUG_0ARG ("GCJ_GetValue: returning TRUE for NeedsXEmbed.\n");
- PRBool* bool_value = (PRBool*) value;
- *bool_value = PR_TRUE;
+ bool* bool_value = (bool*) value;
+ *bool_value = true;
}
break;
case NPPVpluginScriptableNPObject:
@@ -702,7 +699,6 @@ GCJ_SetWindow (NPP instance, NPWindow* w
if (jvm_up)
{
-
gboolean dim_changed = FALSE;
// The window is the same as it was for the last
@@ -729,8 +725,8 @@ GCJ_SetWindow (NPP instance, NPWindow* w
}
if (dim_changed) {
- gchar* message = g_strdup_printf ("instance 1 width %d height %d",
- window->width, window->height);
+ gchar* message = g_strdup_printf ("instance %d width %d height %d",
+ id, window->width, window->height);
plugin_send_message_to_appletviewer (message);
g_free (message);
message = NULL;
@@ -786,7 +782,7 @@ GCJ_SetWindow (NPP instance, NPWindow* w
NPError
GCJ_NewStream (NPP instance, NPMIMEType type, NPStream* stream,
- NPBool seekable, uint16* stype)
+ NPBool seekable, uint16_t* stype)
{
PLUGIN_DEBUG_0ARG ("GCJ_NewStream\n");
@@ -813,7 +809,7 @@ GCJ_DestroyStream (NPP instance, NPStrea
return NPERR_NO_ERROR;
}
-int32
+int32_t
GCJ_WriteReady (NPP instance, NPStream* stream)
{
PLUGIN_DEBUG_0ARG ("GCJ_WriteReady\n");
@@ -823,8 +819,8 @@ GCJ_WriteReady (NPP instance, NPStream*
return 0;
}
-int32
-GCJ_Write (NPP instance, NPStream* stream, int32 offset, int32 len,
+int32_t
+GCJ_Write (NPP instance, NPStream* stream, int32_t offset, int32_t len,
void* buffer)
{
PLUGIN_DEBUG_0ARG ("GCJ_Write\n");
@@ -842,7 +838,7 @@ GCJ_Print (NPP instance, NPPrint* platfo
PLUGIN_DEBUG_0ARG ("GCJ_Print return\n");
}
-int16
+int16_t
GCJ_HandleEvent (NPP instance, void* event)
{
PLUGIN_DEBUG_0ARG ("GCJ_HandleEvent\n");
@@ -864,7 +860,7 @@ NPError
NPError
get_cookie_info(const char* siteAddr, char** cookieString, uint32_t* len)
{
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
nsresult rv;
nsCOMPtr<nsIScriptSecurityManager> sec_man =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
@@ -949,7 +945,7 @@ plugin_data_new (GCJPluginData** data)
// browser. We could not find a way to retrieve the documentbase
// using the original Netscape plugin API so we use the XPCOM API
// instead.
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
static gchar*
plugin_get_documentbase (NPP instance)
{
@@ -1033,12 +1029,21 @@ plugin_get_documentbase (NPP instance)
browser_functions.getvalue(instance, NPNVWindowNPObject, &window);
script_str += "window.location.href";
+#if MOZILLA_VERSION_COLLAPSED < 1090200
+ script.utf8characters = script_str.c_str();
+ script.utf8length = script_str.size();
+#else
script.UTF8Characters = script_str.c_str();
script.UTF8Length = script_str.size();
+#endif
browser_functions.evaluate(instance, window, &script, location);
// Strip everything after the last "/"
+#if MOZILLA_VERSION_COLLAPSED < 1090200
+ gchar** parts = g_strsplit (NPVARIANT_TO_STRING(*location).utf8characters, "/", -1);
+#else
gchar** parts = g_strsplit (NPVARIANT_TO_STRING(*location).UTF8Characters, "/", -1);
+#endif
guint parts_sz = g_strv_length (parts);
for (int i=0; i < parts_sz - 1; i++)
@@ -1163,8 +1168,8 @@ void consume_message(gchar* message) {
if (g_str_has_prefix (parts[2], "url"))
{
// Open the URL in a new browser window.
- gchar* decoded_url = (gchar*) malloc(strlen(parts[3])*sizeof(gchar) + sizeof(gchar));
- decode_url(parts[3], &decoded_url);
+ gchar* decoded_url = (gchar*) calloc(strlen(parts[3]) + 1, sizeof(gchar));
+ IcedTeaPluginUtilities::decodeURL(parts[3], &decoded_url);
PLUGIN_DEBUG_1ARG ("plugin_in_pipe_callback: opening URL %s\n", decoded_url);
PLUGIN_DEBUG_1ARG ("plugin_in_pipe_callback: URL target %s\n", parts[4]);
@@ -1223,12 +1228,13 @@ void consume_message(gchar* message) {
gchar* proxy;
uint32_t len;
- gchar* decoded_url = (gchar*) malloc(strlen(parts[2])*sizeof(gchar) + sizeof(gchar));
- decode_url(parts[2], &decoded_url);
+ gchar* decoded_url = (gchar*) calloc(strlen(parts[2]) + 1, sizeof(gchar));
+ IcedTeaPluginUtilities::decodeURL(parts[2], &decoded_url);
+ PLUGIN_DEBUG_4ARG("parts[0]=%s, parts[1]=%s, parts[2]=%s -- decoded_url=%s\n", parts[0], parts[1], parts[2], decoded_url);
gchar* proxy_info;
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
proxy = (char*) malloc(sizeof(char)*2048);
#endif
@@ -1246,15 +1252,15 @@ void consume_message(gchar* message) {
g_free(proxy_info);
proxy_info = NULL;
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
g_free(proxy);
proxy = NULL;
#endif
} else if (g_str_has_prefix(parts[1], "PluginCookieInfo"))
{
- gchar* decoded_url = (gchar*) malloc(strlen(parts[2])*sizeof(gchar) + sizeof(gchar));
- decode_url(parts[2], &decoded_url);
+ gchar* decoded_url = (gchar*) calloc(strlen(parts[2])+1, sizeof(gchar));
+ IcedTeaPluginUtilities::decodeURL(parts[2], &decoded_url);
gchar* cookie_info = g_strconcat ("plugin PluginCookieInfo ", parts[2], " ", NULL);
gchar* cookie_string;
@@ -1293,33 +1299,10 @@ int get_id_from_instance(NPP instance)
return id;
}
-void decode_url(const gchar* url, gchar** decoded_url)
-{
-#if MOZILLA_VERSION_COLLAPSED < 1090200
- // There is no GLib function to decode urls, so we fallback to Mozilla's
- // methods
-
- nsresult rv;
- nsCOMPtr<nsINetUtil> net_util = do_GetService(NS_NETUTIL_CONTRACTID, &rv);
-
- if (!net_util)
- printf("Error instantiating NetUtil service.\n");
-
- nsDependentCSubstring unescaped_url;
- net_util->UnescapeString(nsCString(url), 0, unescaped_url);
-
- // no need for strn. decoded_url is malloced to sizeof unescaped_url, which
- // will always be <= decoded size
- strcpy(*decoded_url, nsCString(unescaped_url).get());
-#else
-
-#endif
-}
-
NPError
get_proxy_info(const char* siteAddr, char** proxy, uint32_t* len)
{
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
nsresult rv;
// Initialize service variables
@@ -1353,7 +1336,7 @@ get_proxy_info(const char* siteAddr, cha
// if proxy info is available, extract it
nsCString phost;
- PRInt32 pport;
+ PRint32_t pport;
nsCString ptype;
info->GetHost(phost);
@@ -1535,14 +1518,14 @@ plugin_start_appletviewer (GCJPluginData
// Build up the applet tag string that we'll send to the applet
// viewer.
static gchar*
-plugin_create_applet_tag (int16 argc, char* argn[], char* argv[])
+plugin_create_applet_tag (int16_t argc, char* argn[], char* argv[])
{
PLUGIN_DEBUG_0ARG ("plugin_create_applet_tag\n");
gchar* applet_tag = g_strdup ("<EMBED ");
gchar* parameters = g_strdup ("");
- for (int16 i = 0; i < argc; i++)
+ for (int16_t i = 0; i < argc; i++)
{
if (!g_ascii_strcasecmp (argn[i], "code"))
{
@@ -1909,7 +1892,7 @@ NP_Initialize (NPNetscapeFuncs* browserT
browser_functions.releasevariantvalue = browserTable->releasevariantvalue;
browser_functions.setexception = browserTable->setexception;
browser_functions.pluginthreadasynccall = browserTable->pluginthreadasynccall;
-#if MOZILLA_VERSION_COLLAPSED >= 1090200
+#if MOZILLA_VERSION_COLLAPSED >= 1090100
browser_functions.getvalueforurl = browserTable->getvalueforurl;
browser_functions.setvalueforurl = browserTable->setvalueforurl;
#endif
@@ -1918,7 +1901,7 @@ NP_Initialize (NPNetscapeFuncs* browserT
pluginTable->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
pluginTable->size = sizeof (NPPluginFuncs);
-#if MOZILLA_VERSION_COLLAPSED < 1090200
+#if MOZILLA_VERSION_COLLAPSED < 1090100
pluginTable->newp = NewNPP_NewProc (GCJ_New);
pluginTable->destroy = NewNPP_DestroyProc (GCJ_Destroy);
pluginTable->setwindow = NewNPP_SetWindowProc (GCJ_SetWindow);
@@ -2066,13 +2049,14 @@ NP_Initialize (NPNetscapeFuncs* browserT
data_directory = NULL;
}
+
return np_error;
}
// Returns a string describing the MIME type that this plugin
// handles.
char*
-NP_GetMIMEDescription (void)
+NP_GetMIMEDescription ()
{
PLUGIN_DEBUG_0ARG ("NP_GetMIMEDescription\n");
@@ -2224,6 +2208,18 @@ get_scriptable_object(NPP instance)
int id = get_id_from_instance(instance);
gchar* id_str = g_strdup_printf ("%d", id);
+ // Some browsers.. (e.g. chromium) don't call NPP_SetWindow
+ // for 0x0 plugins and therefore require initialization with
+ // a 0 handle
+ if (!data->window_handle)
+ {
+ data->window_handle = 0;
+ gchar *window_message = g_strdup_printf ("instance %s handle %d",
+ id_str, 0);
+ plugin_send_message_to_appletviewer (window_message);
+ g_free (window_message);
+ }
+
java_result = java_request.getAppletObjectInstance(id_str);
g_free(id_str);
diff -r 56fe14241120 -r a0f8cf8cf432 plugin/icedteanp/IcedTeaNPPlugin.h
--- a/plugin/icedteanp/IcedTeaNPPlugin.h Thu Dec 24 13:56:30 2009 +0000
+++ b/plugin/icedteanp/IcedTeaNPPlugin.h Thu Dec 24 14:06:38 2009 -0500
@@ -39,12 +39,10 @@ exception statement from your version. *
#ifndef __ICEDTEANPPLUGIN_H__
#define __ICEDTEANPPLUGIN_H__
-// Netscape plugin API includes.
-#include <npapi.h>
+#define MOZILLA_VERSION_COLLAPSED 1090105
+
+#if MOZILLA_VERSION_COLLAPSED < 1090100
#include <nsThreadUtils.h>
-
-#if MOZILLA_VERSION_COLLAPSED < 1090200
-#include <npupp.h>
#else
#include <npapi.h>
#include <npruntime.h>
@@ -60,6 +58,9 @@ exception statement from your version. *
#include "IcedTeaPluginUtils.h"
#include "IcedTeaPluginRequestProcessor.h"
+
+// Work around across some chromium issues
+#define CHROMIUM_WORKAROUND
// GCJPluginData stores all the data associated with a single plugin
// instance. A separate plugin instance is created for each <APPLET>
diff -r 56fe14241120 -r a0f8cf8cf432 plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Thu Dec 24 13:56:30 2009 +0000
+++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Thu Dec 24 14:06:38 2009 -0500
@@ -210,7 +210,7 @@ PluginRequestProcessor::eval(std::vector
CHECK_JAVA_RESULT(java_result);
script.append(*(java_result->return_string));
- AyncCallThreadData thread_data = AyncCallThreadData();
+ AsyncCallThreadData thread_data = AsyncCallThreadData();
thread_data.result_ready = false;
thread_data.parameters = std::vector<void*>();
thread_data.result = std::string();
@@ -219,9 +219,20 @@ PluginRequestProcessor::eval(std::vector
thread_data.parameters.push_back(NPVARIANT_TO_OBJECT(*window_ptr));
thread_data.parameters.push_back(&script);
- browser_functions.pluginthreadasynccall(instance, &_eval, &thread_data);
-
- while (!thread_data.result_ready) usleep(2000); // Wait till result is ready
+#ifdef CHROMIUM_WORKAROUND
+ // Workaround for chromium
+ _eval(&thread_data);
+
+ if (!thread_data.call_successful)
+ {
+#endif
+ thread_data.result_ready = false;
+ browser_functions.pluginthreadasynccall(instance, &_eval, &thread_data);
+
+ while (!thread_data.result_ready) usleep(2000); // Wait till result is ready
+#ifdef CHROMIUM_WORKAROUND
+ }
+#endif
NPVariant* result_variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result);
std::string result_variant_jniid = std::string();
@@ -292,7 +303,7 @@ PluginRequestProcessor::call(std::vector
for (int i=0; i < args.size(); i++)
args_array[i] = args[i];
- AyncCallThreadData thread_data = AyncCallThreadData();
+ AsyncCallThreadData thread_data = AsyncCallThreadData();
thread_data.result_ready = false;
thread_data.parameters = std::vector<void*>();
thread_data.result = std::string();
@@ -303,10 +314,20 @@ PluginRequestProcessor::call(std::vector
thread_data.parameters.push_back(&arg_count);
thread_data.parameters.push_back(args_array);
- printf("Packing %p [%p] %p %s@%p %p %p\n", instance, thread_data.parameters.at(0), window_ptr, window_function_name.c_str(), &window_function_name, &arg_count, args_array);
- browser_functions.pluginthreadasynccall(instance, &_call, &thread_data);
-
- while (!thread_data.result_ready) usleep(2000); // wait till ready
+#ifdef CHROMIUM_WORKAROUND
+ // Workaround for chromium
+ _call(&thread_data);
+
+ if (!thread_data.call_successful)
+ {
+#endif
+ thread_data.result_ready = false;
+ browser_functions.pluginthreadasynccall(instance, &_call, &thread_data);
+
+ while (!thread_data.result_ready) usleep(2000); // wait till ready
+#ifdef CHROMIUM_WORKAROUND
+ }
+#endif
NPVariant* result_variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result);
std::string result_variant_jniid = std::string();
@@ -339,7 +360,7 @@ PluginRequestProcessor::sendString(std::
variant_ptr = message_parts->at(3);
variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(variant_ptr);
- AyncCallThreadData thread_data = AyncCallThreadData();
+ AsyncCallThreadData thread_data = AsyncCallThreadData();
thread_data.result_ready = false;
thread_data.parameters = std::vector<void*>();
thread_data.result = std::string();
@@ -348,9 +369,19 @@ PluginRequestProcessor::sendString(std::
thread_data.parameters.push_back(instance);
thread_data.parameters.push_back(variant);
- browser_functions.pluginthreadasynccall(instance, &_getString, &thread_data);
-
- while (!thread_data.result_ready) usleep(2000); // wait till ready
+#ifdef CHROMIUM_WORKAROUND
+ // Workaround for chromium
+ _getString(&thread_data);
+
+ if (!thread_data.call_successful)
More information about the distro-pkg-dev
mailing list