Line
Link Here
|
0 |
-- a/ChangeLog Wed Aug 26 01:14:21 2009 -0400 |
0 |
++ b/ChangeLog Wed Aug 26 15:06:47 2009 -0400 |
Lines 1-3
2009-08-26 Deepak Bhole <dbhole@redhat.
Link Here
|
1 |
-- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Wed Aug 26 |
1 |
2009-08-26 Deepak Bhole <dbhole@redhat.com> |
|
|
2 |
|
3 |
* plugin/icedteanp/IcedTeaJavaRequestProcessor.cc |
4 |
(createJavaObjectFromVariant): Add conditional compilation blocks to |
5 |
handle new API along with old. Call renamed newObjectWithConstructor |
6 |
function. |
7 |
(newObject): New function. Creates an object based on the most optimum |
8 |
cost with arbitrary arguments. |
9 |
(newObjectWithConstructor): Renamed from newObject(). Also, take |
10 |
an argument to provide to Java. |
11 |
* plugin/icedteanp/IcedTeaJavaRequestProcessor.h: Change as per above |
12 |
file changes. |
13 |
* plugin/icedteanp/IcedTeaNPPlugin.cc: Include XPCOM specific headers |
14 |
if xulrunner version is < 1.9.2. Instantiate internal Mozilla objects |
15 |
if xulrunner < 1.9.2. |
16 |
(GCJ_New): Correctly account for documentbase length when allocating |
17 |
memory to prevent corruption. |
18 |
(GCJ_Destroy): Remove old instance mappings when destroyed. |
19 |
(GCJ_GetJavaClass): Remove unused method. |
20 |
(get_cookie_info): Change object signature to include length result. |
21 |
on xulrunner version, either use internal Mozilla API for fetching |
22 |
info, or use NPN_GetValueForURL. |
23 |
(plugin_get_documentbase): Define for when xulrunner is >= 1.9.2. |
24 |
(consume_message): Deal with single proxy URL rather than components. |
25 |
Update to handle when xulrunner is >= 1.9.2 |
26 |
(get_proxy_info): Change signature to deal with single url rather than |
27 |
components. Use NPN_GetValueForURL if xulrunner is >= 1.9.2. |
28 |
(NP_Initialize): Add pointers for getvalueforurl and setvalueforurl in |
29 |
NPPluginFuncs table. Also, handle case for when browser provides the |
30 |
plugin .so name as the link location rather than target location. |
31 |
* plugin/icedteanp/IcedTeaNPPlugin.h: Include XPCOM specific headers |
32 |
if xulrunner version is < 1.9.2. |
33 |
* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc |
34 |
(eval): Use the new NPN_PluginThreadAsynCcall function to dispatch |
35 |
to main thread asynchronously. |
36 |
(call): Same. |
37 |
(setMember): Same. |
38 |
(getMember): Same. |
39 |
(storeVariantInJava): Handle changed API when xulrunner >= 1.9.2 |
40 |
(_setMember): Account for changes in the way that the callerpacks |
41 |
arguments. |
42 |
(_getMember): Same. |
43 |
(_call): Same. |
44 |
(_eval): Same. |
45 |
* plugin/icedteanp/IcedTeaPluginRequestProcessor.h: Include Mozilla |
46 |
specific headers only if xulrunner is < 1.9.2. Remove old ThreadData |
47 |
struct and add new AyncCallThreadData struct that contains results and |
48 |
arguments. |
49 |
* plugin/icedteanp/IcedTeaPluginUtils.cc |
50 |
(getSourceFromInstance): Provide null source location due to lack of a |
51 |
secure way to get documentbase. |
52 |
(printNPVariant): Account for change API in xulrunner 1.9.2. |
53 |
(NPVariantToString): Same. |
54 |
* plugin/icedteanp/IcedTeaPluginUtils.h: Include Mozilla specific |
55 |
only if xulrunner is < 1.9.2. |
56 |
* plugin/icedteanp/IcedTeaScriptablePluginObject.cc |
57 |
(invoke): Pass exception over to JS engine. |
58 |
(construct): Implement object construction. |
59 |
* plugin/icedteanp/IcedTeaScriptablePluginObject.h: Include Mozilla |
60 |
specific headers only if xulrunner is < 1.9.2. |
61 |
* plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java |
62 |
(getMatchingConstructor): New method, returns a matching constructor |
63 |
on arguments. |
64 |
(getMatchingConstructors): New helper method for |
65 |
* plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java |
66 |
(handleMessage): Handle new type of call, "NewObjectWithConstructor". |
67 |
(checkPermission): Disable checks for the time being, as NPRuntime |
68 |
not allow cross-site calling anyway. |
69 |
* plugin/icedteanp/java/sun/applet/PluginAppletViewer.java |
70 |
(setStatus): Remove newlines from status messages. |
71 |
* plugin/icedteanp/sun/applet/PluginCookieInfoRequest.java |
72 |
(parseReturn): Store cookie info as a string rather than a list of |
73 |
HttpCookie objects. |
74 |
(getObject): Return the new cookie string. |
75 |
* plugin/icedteanp/sun/applet/PluginCookieManager.java: New file, |
76 |
CookieManager as is set as the default cookie manager for the plugin. |
77 |
* plugin/icedteanp/sun/applet/PluginCookieStore.java : Deleted. New |
78 |
uses a custom cookiemanager rather than just a custom store. |
79 |
* plugin/icedteanp/sun/applet/PluginMain.java |
80 |
(init): Wire in the new cookie manager. |
81 |
|
|
|
82 |
++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Wed Aug 26 |
Lines 122-128
JavaRequestProcessor::newMessageOnBus(co
Link Here
|
122 |
|
|
|
Lines 656-663
JavaRequestProcessor::createJavaObjectFr
Link Here
|
656 |
|
655 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
|
|
656 |
#else |
657 |
stringArg += NPVARIANT_TO_STRING(variant).UTF8Characters; |
658 |
#endif |
Lines 703-709
JavaRequestProcessor::createJavaObjectFr
Link Here
|
703 |
java_result = java_request.newObject("[System]", jsObjectClassID, |
705 |
java_result = java_request.newObjectWithConstructor("[System]", |
Lines 808-814
JavaRequestProcessor::getObjectClass(std
Link Here
|
808 |
JavaRequestProcessor::newObject(std::string source, std::string |
810 |
JavaRequestProcessor::newObject(std::string source, std::string |
|
|
811 |
const NPVariant* args, int argCount) |
812 |
{ |
813 |
JavaRequestProcessor* java_request; |
814 |
std::string message = std::string(); |
815 |
|
816 |
this->instance = 0; // context is always 0 (needed for java-side |
817 |
this->reference = IcedTeaPluginUtilities::getReference(); |
818 |
|
819 |
IcedTeaPluginUtilities::constructMessagePrefix(0, reference, source, |
820 |
message += " NewObject "; |
821 |
message += classID; |
822 |
message += " "; |
823 |
|
824 |
// First, we need to load the arguments into the java-side table |
825 |
for (int i=0; i < argCount; i++) { |
826 |
int objectID = createJavaObjectFromVariant(args[i]); |
827 |
if (objectID == 0) |
828 |
{ |
829 |
result->error_occurred = true; |
830 |
result->error_msg->append("Unable to create arguments"); |
831 |
return result; |
832 |
} |
833 |
|
834 |
char* id = (char*) malloc(sizeof(char)*32); |
835 |
sprintf(id, "%d", objectID); |
836 |
message += id; |
837 |
message += " "; |
838 |
free(id); |
839 |
} |
840 |
|
841 |
postAndWaitForResponse(message); |
842 |
|
843 |
IcedTeaPluginUtilities::releaseReference(); |
844 |
|
845 |
return result; |
846 |
} |
847 |
|
848 |
JavaResultData* |
849 |
JavaRequestProcessor::newObjectWithConstructor(std::string source, |
Lines 819-826
JavaRequestProcessor::newObject(std::str
Link Here
|
819 |
message += " NewObject "; |
860 |
message += " NewObjectWithConstructor "; |
820 |
message += objectID; |
861 |
message += classID; |
Lines 980-982
JavaRequestProcessor::getAppletObjectIns
Link Here
|
980 |
-- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.h Wed Aug 26 01:14:21 |
1021 |
|
|
|
1022 |
++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.h Wed Aug 26 15:06:47 |
Lines 171-179
class JavaRequestProcessor : BusSubscrib
Link Here
|
171 |
/* Creates a new object */ |
171 |
/* Creates a new object with choosable constructor */ |
172 |
std::string objectID, std::string methodID, |
172 |
std::string classID, |
|
|
173 |
const NPVariant* args, int numArgs); |
174 |
|
175 |
/* Creates a new object when constructor is undetermined */ |
176 |
JavaResultData* newObjectWithConstructor(std::string source, |
177 |
std::string methodID, |
173 |
-- a/plugin/icedteanp/IcedTeaNPPlugin.cc Wed Aug 26 01:14:21 2009 -0400 |
178 |
++ b/plugin/icedteanp/IcedTeaNPPlugin.cc Wed Aug 26 15:06:47 2009 -0400 |
Lines 47-58
exception statement from your version. *
Link Here
|
|
|
47 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
48 |
#endif |
49 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
Lines 66-74
exception statement from your version. *
Link Here
|
66 |
#include "IcedTeaScriptablePluginObject.h" |
69 |
#endif |
|
|
70 |
#include "IcedTeaScriptablePluginObject.h" |
Lines 132-139
exception statement from your version. *
Link Here
|
|
|
136 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
137 |
#endif |
Lines 180-193
PluginRequestProcessor* plugin_req_proc;
Link Here
|
180 |
GQuark ITNP_PLUGIN_ERROR = g_quark_from_string("IcedTeaNPPlugin"); |
186 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
181 |
|
187 |
#endif |
Lines 211-218
static void plugin_stop_appletviewer ();
Link Here
|
211 |
NS_IMETHODIMP get_cookie_info(const char* siteAddr, char** |
217 |
NPError get_cookie_info(const char* siteAddr, char** cookieString, |
212 |
void get_proxy_info(const char* siteAddr, char** proxy_scheme, char** |
218 |
NPError get_proxy_info(const char* siteAddr, char** proxy, uint32_t* |
Lines 336-342
GCJ_New (NPMIMEType pluginType, NPP inst
Link Here
|
336 |
tag_message = (gchar*) malloc(strlen(applet_tag)*sizeof(gchar) + |
342 |
tag_message = (gchar*) malloc(strlen(applet_tag)*sizeof(gchar) + |
Lines 636-641
GCJ_Destroy (NPP instance, NPSavedData**
Link Here
|
|
|
642 |
int id = get_id_from_instance(instance); |
643 |
|
644 |
g_hash_table_remove(instance_to_id_map, instance); |
645 |
g_hash_table_remove(id_to_instance_map, GINT_TO_POINTER(id)); |
646 |
|
Lines 844-874
GCJ_URLNotify (NPP instance, const char*
Link Here
|
844 |
jref |
855 |
NPError |
845 |
GCJ_GetJavaClass (void) |
856 |
get_cookie_info(const char* siteAddr, char** cookieString, uint32_t* |
846 |
{ |
857 |
{ |
847 |
PLUGIN_DEBUG_0ARG ("GCJ_GetJavaClass\n"); |
858 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
848 |
|
|
|
849 |
PLUGIN_DEBUG_0ARG ("GCJ_GetJavaClass return\n"); |
850 |
|
851 |
return 0; |
852 |
} |
853 |
|
854 |
NS_IMETHODIMP |
855 |
get_cookie_info(const char* siteAddr, char** cookieString) |
856 |
{ |
857 |
return NS_ERROR_FAILURE; |
859 |
return NPERR_GENERIC_ERROR; |
858 |
return NS_ERROR_FAILURE; |
860 |
return NPERR_GENERIC_ERROR; |
Lines 877-894
get_cookie_info(const char* siteAddr, ch
Link Here
|
877 |
return NS_ERROR_FAILURE; |
879 |
return NPERR_GENERIC_ERROR; |
878 |
return NS_ERROR_FAILURE; |
880 |
return NPERR_GENERIC_ERROR; |
879 |
return NS_OK; |
881 |
#else |
880 |
} |
882 |
|
881 |
|
883 |
// getvalueforurl needs an NPP instance. Quite frankly, there is no |
|
|
884 |
// to know which instance needs the information, as applets on Java |
885 |
// be multi-threaded and the thread making a proxy.cookie request |
886 |
// easily tracked. |
887 |
|
888 |
// Fortunately, XULRunner does not care about the instance as long as |
889 |
// valid. So we just pick the first valid one and use it. Proxy/Cookie |
890 |
// information is not instance specific anyway, it is URL specific. |
891 |
|
892 |
if (browser_functions.getvalueforurl) |
893 |
{ |
894 |
GHashTableIter iter; |
895 |
gpointer id, instance; |
896 |
|
897 |
g_hash_table_iter_init (&iter, instance_to_id_map); |
898 |
g_hash_table_iter_next (&iter, &instance, &id); |
899 |
|
900 |
return browser_functions.getvalueforurl((NPP) instance, NPNURLVCookie, |
901 |
} else |
902 |
{ |
903 |
return NPERR_GENERIC_ERROR; |
904 |
} |
905 |
|
906 |
#endif |
907 |
|
908 |
return NPERR_NO_ERROR; |
909 |
} |
Lines 906-911
plugin_data_new (GCJPluginData** data)
Link Here
|
|
|
934 |
|
935 |
|
Lines 913-918
plugin_data_new (GCJPluginData** data)
Link Here
|
|
|
943 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
Lines 970-977
plugin_get_documentbase (NPP instance)
Link Here
|
|
|
1001 |
PLUGIN_DEBUG_1ARG("plugin_get_documentbase returning: %s\n", |
1002 |
#else |
1003 |
static gchar* |
1004 |
plugin_get_documentbase (NPP instance) |
1005 |
{ |
1006 |
PLUGIN_DEBUG_0ARG ("plugin_get_documentbase\n"); |
1007 |
|
1008 |
char const* documentbase = NULL; |
1009 |
gchar* documentbase_copy = NULL; |
1010 |
|
1011 |
// FIXME: This method is not ideal, but there are no known NPAPI call |
1012 |
// for this. See thread for more information: |
1013 |
// |
1014 |
|
1015 |
// Additionally, since it is insecure, we cannot use it for making |
1016 |
// security decisions. |
1017 |
NPObject* window; |
1018 |
NPString script = NPString(); |
1019 |
std::string script_str = std::string(); |
1020 |
NPVariant* location = new NPVariant(); |
1021 |
std::string location_str = std::string(); |
1022 |
|
1023 |
browser_functions.getvalue(instance, NPNVWindowNPObject, &window); |
1024 |
script_str += "window.location.href"; |
1025 |
script.UTF8Characters = script_str.c_str(); |
1026 |
script.UTF8Length = script_str.size(); |
1027 |
browser_functions.evaluate(instance, window, &script, location); |
1028 |
|
1029 |
// Strip everything after the last "/" |
1030 |
gchar** parts = g_strsplit |
1031 |
guint parts_sz = g_strv_length (parts); |
1032 |
|
1033 |
for (int i=0; i < parts_sz - 1; i++) |
1034 |
{ |
1035 |
location_str += parts[i]; |
1036 |
location_str += "/"; |
1037 |
} |
1038 |
|
1039 |
documentbase_copy = g_strdup (location_str.c_str()); |
1040 |
|
1041 |
// Release references. |
1042 |
cleanup_done: |
1043 |
PLUGIN_DEBUG_0ARG ("plugin_get_documentbase return\n"); |
1044 |
PLUGIN_DEBUG_1ARG("plugin_get_documentbase returning: %s\n", |
1045 |
|
1046 |
return documentbase_copy; |
1047 |
} |
1048 |
#endif |
Lines 1135-1155
void consume_message(gchar* message) {
Link Here
|
1135 |
gchar* proxy_scheme = (gchar*) malloc(sizeof(gchar)*32); |
1214 |
gchar* proxy; |
1136 |
gchar* proxy_host = (gchar*) malloc(sizeof(gchar)*64); |
1215 |
uint32_t len; |
1137 |
gchar* proxy_port = (gchar*) malloc(sizeof(gchar)*8); |
|
|
1138 |
|
1139 |
GError *error = g_error_new(ITNP_PLUGIN_ERROR, 0, ""); |
1140 |
get_proxy_info(decoded_url, &proxy_scheme, &proxy_host, &proxy_port, |
1216 |
|
|
|
1217 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
1218 |
proxy = (char*) malloc(sizeof(char)*2048); |
1219 |
#endif |
1220 |
|
1141 |
if (error->code == 0) |
1221 |
if (get_proxy_info(decoded_url, &proxy, &len) == NPERR_NO_ERROR) |
1142 |
proxy_info = g_strconcat (proxy_info, proxy_scheme, " ", proxy_host, " |
1222 |
proxy_info = g_strconcat (proxy_info, proxy, NULL); |
Lines 1159-1180
void consume_message(gchar* message) {
Link Here
|
1159 |
g_free(proxy_scheme); |
1239 |
|
1160 |
proxy_scheme = NULL; |
1240 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
1161 |
g_free(proxy_host); |
1241 |
g_free(proxy); |
1162 |
proxy_host = NULL; |
1242 |
proxy = NULL; |
1163 |
g_free(proxy_port); |
1243 |
#endif |
1164 |
proxy_port = NULL; |
1244 |
|
1165 |
GError *error = g_error_new(ITNP_PLUGIN_ERROR, 0, ""); |
1245 |
uint32_t len; |
1166 |
|
1246 |
if (get_cookie_info(decoded_url, &cookie_string, &len) == |
1167 |
if (get_cookie_info(decoded_url, &cookie_string) == NS_OK) |
|
|
Lines 1184-1191
void consume_message(gchar* message) {
Link Here
|
1184 |
g_free(cookie_string); |
|
|
1185 |
cookie_string = NULL; |
Lines 1210-1215
int get_id_from_instance(NPP instance)
Link Here
|
|
|
1287 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
Lines 1225-1234
void decode_url(const gchar* url, gchar*
Link Here
|
1225 |
} |
1303 |
#else |
1226 |
|
1304 |
|
1227 |
void get_proxy_info(const char* siteAddr, char** proxy_scheme, char** |
1305 |
#endif |
1228 |
{ |
1306 |
} |
|
|
1307 |
|
1308 |
NPError |
1309 |
get_proxy_info(const char* siteAddr, char** proxy, uint32_t* len) |
1310 |
{ |
1311 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
Lines 1236-1251
void get_proxy_info(const char* siteAddr
Link Here
|
1236 |
error->code = 1; |
1319 |
return NPERR_GENERIC_ERROR; |
1237 |
return; |
|
|
1238 |
error->code = 1; |
1320 |
return NPERR_GENERIC_ERROR; |
1239 |
return; |
|
|
Lines 1259-1266
void get_proxy_info(const char* siteAddr
Link Here
|
1259 |
error->code = 1; |
1340 |
return NPERR_GENERIC_ERROR; |
1260 |
return; |
|
|
Lines 1277-1284
void get_proxy_info(const char* siteAddr
Link Here
|
1277 |
error->code = 1; |
1357 |
return NPERR_GENERIC_ERROR; |
1278 |
return; |
|
|
Lines 1288-1299
void get_proxy_info(const char* siteAddr
Link Here
|
1288 |
// pack information in return variables |
1367 |
snprintf(*proxy, sizeof(char)*1024, "%s://%s:%d", ptype.get(), |
1289 |
snprintf(*proxy_scheme, sizeof(char)*32, "%s", ptype.get()); |
1368 |
*len = strlen(*proxy); |
1290 |
snprintf(*proxy_host, sizeof(char)*64, "%s", ipAddr.get()); |
1369 |
|
1291 |
snprintf(*proxy_port, sizeof(char)*8, "%d", pport); |
1370 |
PLUGIN_DEBUG_2ARG("Proxy info for %s: %s\n", siteAddr, *proxy); |
1292 |
|
1371 |
|
1293 |
PLUGIN_DEBUG_4ARG("Proxy info for %s: %s %s %s\n", siteAddr, |
1372 |
#else |
|
|
1373 |
|
1374 |
if (browser_functions.getvalueforurl) |
1375 |
{ |
1376 |
|
1377 |
// As in get_cookie_info, we use the first active instance |
1378 |
GHashTableIter iter; |
1379 |
gpointer id, instance; |
1380 |
|
1381 |
g_hash_table_iter_init (&iter, instance_to_id_map); |
1382 |
g_hash_table_iter_next (&iter, &instance, &id); |
1383 |
|
1384 |
browser_functions.getvalueforurl((NPP) instance, NPNURLVProxy, |
1385 |
} else |
1386 |
{ |
1387 |
return NPERR_GENERIC_ERROR; |
1388 |
} |
1389 |
#endif |
1390 |
|
1391 |
return NPERR_NO_ERROR; |
Lines 1319-1325
static NPError
Link Here
|
1319 |
PLUGIN_DEBUG_0ARG ("plugin_test_appletviewer\n"); |
1417 |
PLUGIN_DEBUG_1ARG ("plugin_test_appletviewer: %s\n", |
Lines 1756-1764
NP_Initialize (NPNetscapeFuncs* browserT
Link Here
|
1756 |
PLUGIN_ERROR ("Invalid browser function table."); |
1854 |
fprintf (stderr, "ERROR: Invalid browser function table. Some |
1757 |
|
|
|
1758 |
return NPERR_INVALID_FUNCTABLE_ERROR; |
Lines 1804-1813
NP_Initialize (NPNetscapeFuncs* browserT
Link Here
|
|
|
1900 |
browser_functions.pluginthreadasynccall = |
1901 |
#if MOZILLA_VERSION_COLLAPSED >= 1090200 |
1902 |
browser_functions.getvalueforurl = browserTable->getvalueforurl; |
1903 |
browser_functions.setvalueforurl = browserTable->setvalueforurl; |
1904 |
#endif |
1905 |
|
1906 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
Lines 1819-1824
NP_Initialize (NPNetscapeFuncs* browserT
Link Here
|
|
|
1922 |
#else |
1923 |
pluginTable->newp = NPP_NewProcPtr (GCJ_New); |
1924 |
pluginTable->destroy = NPP_DestroyProcPtr (GCJ_Destroy); |
1925 |
pluginTable->setwindow = NPP_SetWindowProcPtr (GCJ_SetWindow); |
1926 |
pluginTable->newstream = NPP_NewStreamProcPtr (GCJ_NewStream); |
1927 |
pluginTable->destroystream = NPP_DestroyStreamProcPtr |
1928 |
pluginTable->asfile = NPP_StreamAsFileProcPtr (GCJ_StreamAsFile); |
1929 |
pluginTable->writeready = NPP_WriteReadyProcPtr (GCJ_WriteReady); |
1930 |
pluginTable->write = NPP_WriteProcPtr (GCJ_Write); |
1931 |
pluginTable->print = NPP_PrintProcPtr (GCJ_Print); |
1932 |
pluginTable->urlnotify = NPP_URLNotifyProcPtr (GCJ_URLNotify); |
1933 |
pluginTable->getvalue = NPP_GetValueProcPtr (GCJ_GetValue); |
1934 |
#endif |
Lines 1848-1853
NP_Initialize (NPNetscapeFuncs* browserT
Link Here
|
|
|
1964 |
int filename_size; |
Lines 1855-1869
NP_Initialize (NPNetscapeFuncs* browserT
Link Here
|
1855 |
filename = g_strdup (info.dli_fname); |
1972 |
filename = (gchar*) malloc(sizeof(gchar)*1024); |
|
|
1973 |
filename_size = readlink(info.dli_fname, filename, 1023); |
1974 |
if (filename_size >= 0) |
1975 |
{ |
1976 |
filename[filename_size] = '\0'; |
1977 |
} |
1978 |
|
1979 |
printf("FILENAME=%s\n", filename); |
1980 |
|
1981 |
|
1982 |
if (filename_size <= 0) |
1983 |
{ |
1984 |
free(filename); |
1985 |
filename = g_strdup(info.dli_fname); |
1986 |
} |
1987 |
|
1988 |
PLUGIN_DEBUG_4ARG(".so is located at: %s and the link points to: %s. |
1856 |
-- a/plugin/icedteanp/IcedTeaNPPlugin.h Wed Aug 26 01:14:21 2009 -0400 |
1989 |
++ b/plugin/icedteanp/IcedTeaNPPlugin.h Wed Aug 26 15:06:47 2009 -0400 |
Lines 41-48
exception statement from your version. *
Link Here
|
41 |
#include <nsThreadUtils.h> |
41 |
#include <nsThreadUtils.h> |
|
|
42 |
|
43 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
|
|
44 |
#else |
45 |
#include <npapi.h> |
46 |
#include <npruntime.h> |
47 |
#include <npfunctions.h> |
48 |
#endif |
Lines 112-118
void get_instance_from_id(int id, NPP& i
Link Here
|
112 |
int get_id_from_instance(NPP* instance); |
119 |
int get_id_from_instance(NPP instance); |
113 |
-- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Wed Aug 26 |
120 |
++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Wed Aug 26 |
Lines 206-226
PluginRequestProcessor::eval(std::vector
Link Here
|
206 |
std::vector<void*> internal_request_params = std::vector<void*>(); |
206 |
AyncCallThreadData thread_data = AyncCallThreadData(); |
207 |
ResultData rdata = ResultData(); |
207 |
thread_data.result_ready = false; |
208 |
nsCOMPtr<nsIRunnable> event; |
208 |
thread_data.parameters = std::vector<void*>(); |
209 |
|
209 |
thread_data.result = std::string(); |
210 |
internal_request_params.push_back(instance); |
210 |
|
211 |
internal_request_params.push_back(window_ptr); |
211 |
thread_data.parameters.push_back(instance); |
212 |
internal_request_params.push_back(&script); |
212 |
thread_data.parameters.push_back(window_ptr); |
213 |
|
213 |
thread_data.parameters.push_back(&script); |
214 |
rdata.result_ready = false; |
214 |
|
215 |
event = new IcedTeaRunnableMethod(&_eval, (void*) |
215 |
browser_functions.pluginthreadasynccall(instance, &_eval, |
216 |
NS_DispatchToMainThread(event, 0); |
216 |
|
217 |
|
217 |
while (!thread_data.result_ready) usleep(2000); // Wait till result is |
218 |
while (!rdata.result_ready) usleep(2000); // Wait till result is ready |
218 |
|
219 |
|
219 |
NPVariant* result_variant = (NPVariant*) |
220 |
NPVariant* result_variant = (NPVariant*) |
|
|
Lines 438-462
PluginRequestProcessor::call(std::vector
Link Here
|
438 |
std::vector<void*> internal_request_params = std::vector<void*>(); |
437 |
AyncCallThreadData thread_data = AyncCallThreadData(); |
439 |
ResultData rdata = ResultData(); |
438 |
thread_data.result_ready = false; |
440 |
nsCOMPtr<nsIRunnable> event; |
439 |
thread_data.parameters = std::vector<void*>(); |
441 |
|
440 |
thread_data.result = std::string(); |
442 |
internal_request_params.push_back(instance); |
441 |
|
443 |
internal_request_params.push_back(window_ptr); |
442 |
thread_data.parameters.push_back(instance); |
444 |
internal_request_params.push_back(&window_function_name); |
443 |
thread_data.parameters.push_back(window_ptr); |
445 |
internal_request_params.push_back(&arg_count); |
444 |
thread_data.parameters.push_back(&window_function_name); |
446 |
internal_request_params.push_back(args_array); |
445 |
thread_data.parameters.push_back(&arg_count); |
447 |
|
446 |
thread_data.parameters.push_back(args_array); |
448 |
printf("Packing %p [%p] %p %s@%p %p %p\n", instance, |
447 |
|
449 |
|
448 |
printf("Packing %p [%p] %p %s@%p %p %p\n", instance, |
450 |
rdata.result_ready = false; |
449 |
browser_functions.pluginthreadasynccall(instance, &_call, |
451 |
event = new IcedTeaRunnableMethod(&_call, (void*) |
450 |
|
452 |
NS_DispatchToMainThread(event, 0); |
451 |
while (!thread_data.result_ready) usleep(2000); // wait till ready |
453 |
|
452 |
|
454 |
while (!rdata.result_ready) usleep(2000); // wait till ready |
453 |
NPVariant* result_variant = (NPVariant*) |
455 |
|
|
|
456 |
NPVariant* result_variant = (NPVariant*) |
Lines 467-473
PluginRequestProcessor::call(std::vector
Link Here
|
467 |
delete rdata.return_string; |
|
|
Lines 535-546
PluginRequestProcessor::setMember(std::v
Link Here
|
535 |
std::string member_ptr_str = std::string(); |
531 |
|
536 |
std::vector<std::string*>* internal_request_params = new |
532 |
NPP instance; |
537 |
|
|
|
538 |
nsCOMPtr<nsIRunnable> event; |
|
|
539 |
ResultData* rdata = new ResultData(); |
Lines 550-555
PluginRequestProcessor::setMember(std::v
Link Here
|
|
|
543 |
instance = IcedTeaPluginUtilities::getInstanceFromMemberPtr(member); |
Lines 558-564
PluginRequestProcessor::setMember(std::v
Link Here
|
558 |
goto cleanup; |
552 |
//goto cleanup; |
Lines 575-581
PluginRequestProcessor::setMember(std::v
Link Here
|
575 |
goto cleanup; |
569 |
//goto cleanup; |
Lines 589-614
PluginRequestProcessor::setMember(std::v
Link Here
|
589 |
goto cleanup; |
583 |
//goto cleanup; |
590 |
IcedTeaPluginUtilities::JSIDToString(member, &member_ptr_str); |
584 |
AyncCallThreadData thread_data = AyncCallThreadData(); |
591 |
internal_request_params->push_back(&member_ptr_str); |
585 |
thread_data.result_ready = false; |
592 |
internal_request_params->push_back(&property_name); |
586 |
thread_data.parameters = std::vector<void*>(); |
593 |
internal_request_params->push_back(&type); |
587 |
thread_data.result = std::string(); |
594 |
internal_request_params->push_back(&value); |
588 |
|
595 |
|
589 |
thread_data.parameters.push_back(instance); |
596 |
rdata->result_ready = false; |
590 |
thread_data.parameters.push_back(member); |
597 |
event = new IcedTeaRunnableMethod(&_setMember, (void*) |
591 |
thread_data.parameters.push_back(&property_name); |
598 |
NS_DispatchToMainThread(event, 0); |
592 |
thread_data.parameters.push_back(&type); |
599 |
|
593 |
thread_data.parameters.push_back(&value); |
600 |
while (!rdata->result_ready) usleep(2000); // wait till ready |
594 |
|
|
|
595 |
browser_functions.pluginthreadasynccall(instance, &_setMember, |
596 |
|
597 |
while (!thread_data.result_ready) usleep(2000); // wait till ready |
601 |
delete rdata; |
|
|
602 |
delete rdata->return_string; |
Lines 664-688
PluginRequestProcessor::sendMember(std::
Link Here
|
664 |
ResultData member_data; |
659 |
NPObject* parent_ptr; |
|
|
660 |
|
665 |
std::string parent_id = std::string(); |
661 |
|
666 |
nsCOMPtr<nsIRunnable> event; |
|
|
667 |
|
668 |
std::vector<std::string*> internal_request_params = |
669 |
int instance; |
662 |
int instance_id; |
670 |
instance = atoi(message_parts->at(1).c_str()); |
663 |
instance_id = atoi(message_parts->at(1).c_str()); |
671 |
parent_id += message_parts->at(3); |
664 |
parent_ptr = reinterpret_cast <NPObject*> |
Lines 701-718
PluginRequestProcessor::sendMember(std::
Link Here
|
701 |
internal_request_params.push_back(&parent_id); |
694 |
AyncCallThreadData thread_data = AyncCallThreadData(); |
702 |
internal_request_params.push_back(java_result->return_string); |
695 |
thread_data.result_ready = false; |
703 |
|
696 |
thread_data.parameters = std::vector<void*>(); |
704 |
member_data = ResultData(); |
697 |
thread_data.result = std::string(); |
705 |
member_data.result_ready = false; |
698 |
|
706 |
|
699 |
NPP instance = |
707 |
event = new IcedTeaRunnableMethod(&_getMember, (void*) |
700 |
thread_data.parameters.push_back(instance); |
708 |
NS_DispatchToMainThread(event, 0); |
701 |
thread_data.parameters.push_back(parent_ptr); |
709 |
|
702 |
thread_data.parameters.push_back(java_result->return_string); |
710 |
while (!member_data.result_ready) usleep(2000); // wait till ready |
703 |
|
711 |
|
704 |
browser_functions.pluginthreadasynccall(instance, &_getMember, |
712 |
PLUGIN_DEBUG_1ARG("Member PTR after internal request: %s\n", |
705 |
|
|
|
706 |
while (!thread_data.result_ready) usleep(2000); // wait till ready |
707 |
|
708 |
PLUGIN_DEBUG_1ARG("Member PTR after internal request: %s\n", |
Lines 747-754
PluginRequestProcessor::sendMember(std::
Link Here
|
747 |
args.push_back(*(member_data.return_string)); |
743 |
args.push_back(thread_data.result); |
748 |
java_result = java_request.newObject("", |
744 |
java_result = java_request.newObjectWithConstructor("", |
Lines 770-776
PluginRequestProcessor::sendMember(std::
Link Here
|
770 |
delete member_data.return_string; |
|
|
Lines 890-896
PluginRequestProcessor::storeVariantInJa
Link Here
|
890 |
java_result = java_request.newObject("", |
885 |
java_result = java_request.newObjectWithConstructor("", |
Lines 919-925
PluginRequestProcessor::storeVariantInJa
Link Here
|
919 |
java_result = java_request.newObject("", |
914 |
java_result = java_request.newObjectWithConstructor("", |
Lines 948-954
PluginRequestProcessor::storeVariantInJa
Link Here
|
948 |
java_result = java_request.newObject("", |
943 |
java_result = java_request.newObjectWithConstructor("", |
Lines 959-965
PluginRequestProcessor::storeVariantInJa
Link Here
|
|
|
954 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
955 |
#else |
956 |
java_result = java_request.newString(str.UTF8Characters); |
957 |
#endif |
Lines 993-999
PluginRequestProcessor::storeVariantInJa
Link Here
|
993 |
java_result = java_request.newObject("", |
992 |
java_result = java_request.newObjectWithConstructor("", |
Lines 1010-1037
PluginRequestProcessor::storeVariantInJa
Link Here
|
1010 |
void* |
1009 |
void |
1011 |
_setMember(void* data, void* result) |
1010 |
_setMember(void* data) |
1012 |
std::vector<std::string*>* message_parts = |
1011 |
std::vector<void*> parameters = ((AyncCallThreadData*) |
1013 |
|
1012 |
instance = (NPP) parameters.at(0); |
1014 |
", message_parts); |
1013 |
member = (NPObject*) parameters.at(1); |
1015 |
|
1014 |
property_name = (std::string*) parameters.at(2); |
1016 |
member = reinterpret_cast <NPObject*> |
1015 |
type = (std::string*) parameters.at(3); |
1017 |
property_name = message_parts->at(1); |
1016 |
value = (std::string*) parameters.at(4); |
1018 |
type = message_parts->at(2); |
1017 |
|
1019 |
value = message_parts->at(3); |
|
|
1020 |
|
1021 |
instance = IcedTeaPluginUtilities::getInstanceFromMemberPtr(member); |
Lines 1043-1059
_setMember(void* data, void* result)
Link Here
|
1043 |
|
1040 |
((AyncCallThreadData*) data)->result_ready = true; |
1044 |
((ResultData*) result)->result_ready = true; |
1041 |
|
1045 |
|
|
|
1046 |
} |
1047 |
|
1048 |
void* |
1049 |
_getMember(void* data, void* result) |
1050 |
{ |
1051 |
std::string* parent_ptr_str; |
|
|
1042 |
} |
1043 |
|
1044 |
void |
1045 |
_getMember(void* data) |
1046 |
{ |
Lines 1062-1082
_getMember(void* data, void* result)
Link Here
|
1062 |
std::vector<std::string*>* message_parts = |
1057 |
std::vector<void*> parameters = ((AyncCallThreadData*) |
1063 |
|
1058 |
|
1064 |
|
1059 |
instance = (NPP) parameters.at(0); |
1065 |
", message_parts); |
1060 |
parent_ptr = (NPObject*) parameters.at(1); |
1066 |
|
1061 |
member_name = (std::string*) parameters.at(2); |
1067 |
parent_ptr_str = message_parts->at(0); |
|
|
1068 |
member_name = message_parts->at(1); |
1069 |
|
|
|
1070 |
// Get the window pointer |
1071 |
parent_ptr = reinterpret_cast <NPObject*> |
1072 |
|
1073 |
// Get the associated instance |
1074 |
instance = |
Lines 1091-1099
_getMember(void* data, void* result)
Link Here
|
1091 |
((ResultData*) result)->return_string = new std::string(); |
1079 |
((AyncCallThreadData*) data)->result.append(member_ptr_str); |
1092 |
((ResultData*) result)->return_string->append(member_ptr_str); |
1080 |
((AyncCallThreadData*) data)->result_ready = true; |
1093 |
((ResultData*) result)->result_ready = true; |
|
|
Lines 1101-1108
_getMember(void* data, void* result)
Link Here
|
1101 |
void* |
1088 |
void |
1102 |
_eval(void* data, void* result) |
1089 |
_eval(void* data) |
Lines 1120-1143
_eval(void* data, void* result)
Link Here
|
1120 |
((ResultData*) result)->return_string = new std::string(); |
1107 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
1121 |
((ResultData*) result)->return_string->append(eval_result_ptr_str); |
1108 |
#else |
1122 |
((ResultData*) result)->result_ready = true; |
1109 |
script.UTF8Characters = script_str->c_str(); |
|
|
1110 |
script.UTF8Length = script_str->size(); |
1111 |
|
1112 |
PLUGIN_DEBUG_1ARG("Evaluating: %s\n", script.UTF8Characters); |
1113 |
#endif |
1114 |
|
1123 |
void* |
1115 |
((AyncCallThreadData*) data)->result.append(eval_result_ptr_str); |
1124 |
_call(void* data, void* result) |
1116 |
((AyncCallThreadData*) data)->result_ready = true; |
|
|
1117 |
void |
1118 |
_call(void* data) |
Lines 1155-1160
_call(void* data, void* result)
Link Here
|
|
|
1149 |
|
Lines 1164-1172
_call(void* data, void* result)
Link Here
|
1164 |
((ResultData*) result)->return_string = new std::string(); |
1159 |
((AyncCallThreadData*) data)->result.append(call_result_ptr_str); |
1165 |
((ResultData*) result)->return_string->append(call_result_ptr_str); |
1160 |
((AyncCallThreadData*) data)->result_ready = true; |
1166 |
((ResultData*) result)->result_ready = true; |
|
|
1167 |
-- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.h Wed Aug 26 |
1161 |
++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.h Wed Aug 26 |
Lines 46-52
exception statement from your version. *
Link Here
|
|
|
46 |
|
47 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
48 |
#else |
49 |
#include <npapi.h> |
50 |
#include <npruntime.h> |
51 |
#endif |
Lines 56-66
exception statement from your version. *
Link Here
|
56 |
typedef struct struct_thread_data |
62 |
typedef struct aync_call_thread_data |
57 |
std::vector<std::string>* message_parts; |
63 |
std::vector<void*> parameters; |
58 |
std::string* source; |
64 |
std::string result; |
59 |
} ThreadData; |
65 |
bool result_ready; |
|
|
66 |
} AyncCallThreadData; |
Lines 79-88
static void convertToNPVariant(std::stri
Link Here
|
79 |
void* _getMember(void* message_parts, void* result); |
86 |
void _getMember(void* data); |
80 |
void* _setMember(void* message_parts, void* result); |
87 |
void _setMember(void* data); |
81 |
void* _call(void* data, void* result); |
88 |
void _call(void* data); |
82 |
void* _eval(void* data, void* result); |
89 |
void _eval(void* data); |
83 |
-- a/plugin/icedteanp/IcedTeaPluginUtils.cc Wed Aug 26 01:14:21 2009 |
90 |
++ b/plugin/icedteanp/IcedTeaPluginUtils.cc Wed Aug 26 15:06:47 2009 |
84 |
0400 |
|
|
85 |
0400 |
|
|
Lines 418-430
IcedTeaPluginUtilities::printStringVecto
Link Here
|
418 |
gchar* |
418 |
const gchar* |
419 |
GCJPluginData* data = (GCJPluginData*) instance->pdata; |
419 |
// At the moment, src cannot be securely fetched via NPAPI |
420 |
return data->source; |
420 |
// See: |
421 |
} |
421 |
// |
422 |
|
422 |
|
|
|
423 |
// Since we use the insecure window.location.href attribute to compute |
424 |
// source, we cannot use it to make security decisions. Therefore, |
425 |
// instance associated source will always return empty |
426 |
|
427 |
//GCJPluginData* data = (GCJPluginData*) instance->pdata; |
428 |
//return (data->source) ? data->source : ""; |
429 |
|
430 |
return "http://null.null"; |
431 |
} |
Lines 518-524
IcedTeaPluginUtilities::printNPVariant(N
Link Here
|
|
|
527 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
528 |
#else |
529 |
PLUGIN_DEBUG_1ARG("STRING: %s\n", |
530 |
#endif |
Lines 557-564
IcedTeaPluginUtilities::NPVariantToStrin
Link Here
|
557 |
-- a/plugin/icedteanp/IcedTeaPluginUtils.h Wed Aug 26 01:14:21 2009 |
570 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
558 |
0400 |
571 |
#else |
|
|
572 |
str = (char*) |
573 |
sprintf(str, "%s", NPVARIANT_TO_STRING(variant).UTF8Characters); |
574 |
#endif |
559 |
0400 |
575 |
++ b/plugin/icedteanp/IcedTeaPluginUtils.h Wed Aug 26 15:06:47 2009 |
Lines 56-62
exception statement from your version. *
Link Here
|
|
|
56 |
|
57 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
58 |
#else |
59 |
#include <npapi.h> |
60 |
#include <npruntime.h> |
61 |
#endif |
Lines 201-207
class IcedTeaPluginUtilities
Link Here
|
201 |
static gchar* getSourceFromInstance(NPP instance); |
207 |
static const gchar* getSourceFromInstance(NPP instance); |
202 |
-- a/plugin/icedteanp/IcedTeaScriptablePluginObject.cc Wed Aug 26 |
208 |
++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.cc Wed Aug 26 |
Lines 471-476
IcedTeaScriptableJavaObject::invoke(NPOb
Link Here
|
|
|
471 |
// error message must be allocated on heap |
472 |
char* error_msg = (char*) |
473 |
browser_functions.setexception(npobj, error_msg); |
Lines 541-547
IcedTeaScriptableJavaObject::invoke(NPOb
Link Here
|
541 |
printf("%p -- %p\n", return_str, |
|
|
Lines 663-668
IcedTeaScriptableJavaObject::construct(N
Link Here
|
663 |
printf ("** Unimplemented: IcedTeaScriptableJavaObject::construct |
665 |
NPUTF8* method_name = ""; |
664 |
return false; |
666 |
|
665 |
} |
667 |
// Extract arg type array |
|
|
668 |
PLUGIN_DEBUG_1ARG("IcedTeaScriptableJavaObject::construct %s. Args |
669 |
for (int i=0; i < argCount; i++) |
670 |
{ |
671 |
IcedTeaPluginUtilities::printNPVariant(args[i]); |
672 |
} |
673 |
|
674 |
JavaResultData* java_result; |
675 |
JavaRequestProcessor java_request = JavaRequestProcessor(); |
676 |
|
677 |
NPObject* obj; |
678 |
std::string class_id = ((IcedTeaScriptableJavaObject*) |
679 |
NPP instance = |
680 |
|
681 |
java_result = java_request.newObject( |
682 |
IcedTeaPluginUtilities::getSourceFromInstance(instance), |
683 |
class_id, |
684 |
args, |
685 |
argCount); |
686 |
|
687 |
if (java_result->error_occurred) |
688 |
{ |
689 |
// error message must be allocated on heap |
690 |
int length = java_result->error_msg->length(); |
691 |
char* error_msg = (char*) malloc((length+1)*sizeof(char)); |
692 |
strcpy(error_msg, java_result->error_msg->c_str()); |
693 |
|
694 |
browser_functions.setexception(npobj, error_msg); |
695 |
return false; |
696 |
} |
697 |
|
698 |
std::string return_obj_instance_id = std::string(); |
699 |
std::string return_obj_class_id = class_id; |
700 |
return_obj_instance_id.append(*(java_result->return_string)); |
701 |
|
702 |
obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_object( |
703 |
IcedTeaPluginUtilities::getInstanceFromMemberPtr(npobj), |
704 |
return_obj_class_id, return_obj_instance_id); |
705 |
|
706 |
OBJECT_TO_NPVARIANT(obj, *result); |
707 |
|
708 |
PLUGIN_DEBUG_0ARG("IcedTeaScriptableJavaObject::construct |
709 |
return true; |
710 |
} |
666 |
-- a/plugin/icedteanp/IcedTeaScriptablePluginObject.h Wed Aug 26 |
711 |
++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.h Wed Aug 26 |
Lines 39-45
exception statement from your version. *
Link Here
|
39 |
-- a/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java Wed |
39 |
#if MOZILLA_VERSION_COLLAPSED < 1090200 |
|
|
40 |
#else |
41 |
#include <npapi.h> |
42 |
#include <npruntime.h> |
43 |
#endif |
|
|
44 |
++ b/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java Wed |
Lines 37-42
exception statement from your version. *
Link Here
|
|
|
37 |
import java.lang.reflect.Constructor; |
Lines 152-157
public class MethodOverloadResolver {
Link Here
|
|
|
153 |
|
Lines 217-222
public class MethodOverloadResolver {
Link Here
|
|
|
219 |
} |
220 |
|
221 |
return ret; |
222 |
} |
223 |
|
224 |
public static Object[] getMatchingConstructor(Object[] callList) { |
225 |
Object[] ret = null; |
226 |
Class c = (Class) callList[0]; |
227 |
|
228 |
Constructor[] matchingConstructors = getMatchingConstructors(c, |
229 |
|
230 |
if (debugging) |
231 |
System.out.println("getMatchingConstructor called with: " + |
232 |
|
233 |
int lowestCost = Integer.MAX_VALUE; |
234 |
|
235 |
ArrayList<Object> paramList = new ArrayList<Object>(); |
236 |
|
237 |
for (Constructor matchingConstructor : matchingConstructors) { |
238 |
|
239 |
int constructorCost = 0; |
240 |
Class[] paramTypes = matchingConstructor.getParameterTypes(); |
241 |
Object[] constructorAndArgs = new Object[paramTypes.length + 1]; |
242 |
constructorAndArgs[0] = matchingConstructor; |
243 |
|
244 |
// Figure out which of the matched methods best represents what we |
245 |
// want |
246 |
for (int i = 0; i < paramTypes.length; i++) { |
247 |
Class paramTypeClass = paramTypes[i]; |
248 |
Object suppliedParam = callList[i + 1]; |
249 |
Class suppliedParamClass = suppliedParam != null ? suppliedParam |
250 |
.getClass() |
251 |
: null; |
252 |
|
253 |
Object[] costAndCastedObj = getCostAndCastedObject( |
254 |
suppliedParam, paramTypeClass); |
255 |
constructorCost += (Integer) costAndCastedObj[0]; |
256 |
Object castedObj = paramTypeClass.isPrimitive() ? costAndCastedObj[1] |
257 |
: paramTypeClass.cast(costAndCastedObj[1]); |
258 |
constructorAndArgs[i + 1] = castedObj; |
259 |
|
260 |
Class castedObjClass = castedObj == null ? null : castedObj |
261 |
.getClass(); |
262 |
Boolean castedObjIsPrim = castedObj == null ? null : castedObj |
263 |
.getClass().isPrimitive(); |
264 |
|
265 |
if (debugging) |
266 |
System.out.println("Param " + i + " of constructor " |
267 |
+ matchingConstructor + " has cost " |
268 |
+ (Integer) costAndCastedObj[0] |
269 |
+ " original param type " + suppliedParamClass |
270 |
+ " casted to " + castedObjClass + " isPrimitive=" |
271 |
+ castedObjIsPrim + " value " + castedObj); |
272 |
} |
273 |
|
274 |
if ((constructorCost > 0 && constructorCost < lowestCost) || |
275 |
paramTypes.length == 0) { |
276 |
ret = constructorAndArgs; |
277 |
lowestCost = constructorCost; |
278 |
} |
Lines 300-305
public class MethodOverloadResolver {
Link Here
|
|
|
362 |
|
363 |
private static Constructor[] getMatchingConstructors(Class c, int |
364 |
Constructor[] allConstructors = c.getConstructors(); |
365 |
ArrayList<Constructor> matchingConstructors = new |
366 |
|
367 |
for (Constructor cs: allConstructors) { |
368 |
if (cs.getParameterTypes().length == paramCount) |
369 |
matchingConstructors.add(cs); |
370 |
} |
371 |
|
372 |
return matchingConstructors.toArray(new Constructor[0]); |
373 |
} |
Lines 415-434
public class MethodOverloadResolver {
Link Here
|
415 |
// First type full match, second Class -> Primitive |
489 |
public FooClass() {} |
416 |
public void foo(Boolean b, int i) { |
490 |
|
417 |
|
491 |
public FooClass(Boolean b, int i) {} |
418 |
} |
492 |
|
419 |
|
493 |
public FooClass(Boolean b, Integer i) {} |
420 |
// Full match |
494 |
|
421 |
public void foo(Boolean b, Integer i) { |
495 |
public FooClass(Boolean b, short s) {} |
422 |
|
496 |
|
423 |
} |
497 |
public FooClass(String s, int i) {} |
424 |
|
498 |
|
425 |
// First type full match, second Class -> Primitive ambiguity |
499 |
public FooClass(String s, Integer i) {} |
426 |
public void foo(Boolean b, short s) { |
500 |
|
427 |
|
501 |
public FooClass(java.lang.Number num) {} |
428 |
} |
502 |
|
|
|
503 |
public FooClass(java.lang.Integer integer) {} |
504 |
|
505 |
public FooClass(long l) {} |
506 |
|
507 |
public FooClass(double d) {} |
508 |
|
509 |
public FooClass(float f) {} |
510 |
|
511 |
public FooClass(JSObject j) {} |
512 |
|
513 |
public FooClass(BarClass1 b) {} |
514 |
|
515 |
public FooClass(BarClass2 b) {} |
516 |
|
517 |
public FooClass(String s) {} |
518 |
|
519 |
public FooClass(byte b) {} |
520 |
|
521 |
public FooClass(String s, Float f) {} |
522 |
|
523 |
public FooClass (int i) {} |
524 |
|
525 |
public void FooClass() {} |
526 |
|
527 |
public void FooClass(boolean b) {} |
528 |
|
529 |
|
530 |
public void foo(Boolean b, int i) {} |
531 |
|
532 |
public void foo(Boolean b, Integer i) {} |
533 |
|
534 |
public void foo(Boolean b, short s) {} |
429 |
-- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java |
535 |
++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java |
Lines 202-208
class Signature {
Link Here
|
202 |
|
202 |
|
Lines 912-943
public class PluginAppletSecurityContext
Link Here
|
912 |
} else if (message.startsWith("NewObject")) { |
912 |
store.getIdentifier(newArray)); |
913 |
Integer methodID = parseCall(args[2], null, Integer.class); |
913 |
} else if (message.startsWith("NewObjectWithConstructor")) { |
914 |
|
914 |
|
915 |
final Constructor m = (Constructor) store.getObject(methodID); |
915 |
String[] args = message.split(" "); |
916 |
Class[] argTypes = m.getParameterTypes(); |
916 |
Integer classID = parseCall(args[1], null, Integer.class); |
917 |
|
917 |
Integer methodID = parseCall(args[2], null, Integer.class); |
918 |
// System.out.println ("NEWOBJ: HERE1"); |
918 |
|
919 |
Object[] arguments = new Object[argTypes.length]; |
919 |
final Constructor m = (Constructor) store.getObject(methodID); |
920 |
// System.out.println ("NEWOBJ: HERE2"); |
920 |
Class[] argTypes = m.getParameterTypes(); |
921 |
for (int i = 0; i < argTypes.length; i++) { |
921 |
|
922 |
arguments[i] = parseArgs(args[3 + i], argTypes[i]); |
922 |
// System.out.println ("NEWOBJ: HERE1"); |
923 |
// System.out.println ("NEWOBJ: GOT ARG: " + arguments[i]); |
923 |
Object[] arguments = new Object[argTypes.length]; |
924 |
} |
924 |
// System.out.println ("NEWOBJ: HERE2"); |
925 |
|
925 |
for (int i = 0; i < argTypes.length; i++) { |
926 |
final Object[] fArguments = arguments; |
926 |
arguments[i] = parseArgs(args[3 + i], argTypes[i]); |
927 |
AccessControlContext acc = callContext != null ? callContext : |
927 |
// System.out.println ("NEWOBJ: GOT ARG: " + arguments[i]); |
928 |
|
928 |
} |
|
|
929 |
|
930 |
final Object[] fArguments = arguments; |
931 |
AccessControlContext acc = callContext != null ? callContext : |
932 |
|
933 |
Class c = (Class) store.getObject(classID); |
934 |
checkPermission(src, c, acc); |
935 |
|
936 |
Object ret = AccessController.doPrivileged(new |
937 |
public Object run() { |
938 |
try { |
939 |
return m.newInstance(fArguments); |
940 |
} catch (Throwable t) { |
941 |
return t; |
942 |
} |
943 |
} |
944 |
}, acc); |
945 |
|
946 |
if (ret instanceof Throwable) |
947 |
throw (Throwable) ret; |
948 |
|
949 |
store.reference(ret); |
950 |
|
951 |
write(reference, "NewObject " + store.getIdentifier(ret)); |
952 |
|
953 |
} else if (message.startsWith("NewObject")) { |
929 |
return m.newInstance(fArguments); |
954 |
final Constructor cons; |
|
|
955 |
final Object[] fArguments; |
956 |
|
957 |
Object[] arguments = new Object[args.length - 1]; |
958 |
arguments[0] = c; |
959 |
for (int i = 0; i < args.length - 2; i++) { |
960 |
arguments[i + 1] = store.getObject(parseCall(args[2 + i], |
961 |
null, Integer.class)); |
962 |
PluginDebug.debug("GOT ARG: " + arguments[i + 1]); |
963 |
} |
964 |
|
965 |
Object[] matchingConstructorAndArgs = MethodOverloadResolver |
966 |
.getMatchingConstructor(arguments); |
967 |
|
968 |
if (matchingConstructorAndArgs == null) { |
969 |
write(reference, |
970 |
"Error: No suitable constructor with matching args found"); |
971 |
return; |
972 |
} |
973 |
|
974 |
Object[] castedArgs = new Object[matchingConstructorAndArgs.length - |
975 |
for (int i = 0; i < castedArgs.length; i++) { |
976 |
castedArgs[i] = matchingConstructorAndArgs[i + 1]; |
977 |
} |
978 |
|
979 |
cons = (Constructor) matchingConstructorAndArgs[0]; |
980 |
fArguments = castedArgs; |
981 |
|
982 |
String collapsedArgs = ""; |
983 |
for (Object arg : fArguments) { |
984 |
collapsedArgs += " " + arg.toString(); |
985 |
} |
986 |
|
987 |
PluginDebug.debug("Calling constructor on class " + c + |
988 |
" with " + collapsedArgs); |
989 |
|
990 |
AccessControlContext acc = callContext != null ? callContext : |
|
|
991 |
return cons.newInstance(fArguments); |
Lines 1084-1093
public class PluginAppletSecurityContext
Link Here
|
1084 |
if (!jsSrc.equals("file://") && !jsSrc.equals("[System]") && |
1145 |
// NPRuntime does not allow cross-site calling. The code below is kept |
1085 |
acc.checkPermission(new BrowserReadPermission()); |
1146 |
// in case that changes in the future.. |
1086 |
} |
1147 |
|
1087 |
-- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Wed Aug |
1148 |
//if (!jsSrc.equals("file://") && !jsSrc.equals("[System]") && |
|
|
1149 |
// acc.checkPermission(new BrowserReadPermission()); |
1150 |
//} |
|
|
1151 |
++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Wed Aug |
Lines 581-587
import com.sun.jndi.toolkit.url.UrlUtil;
Link Here
|
581 |
System.err.println("PANEL = " + panel); |
|
|
Lines 869-874
import com.sun.jndi.toolkit.url.UrlUtil;
Link Here
|
869 |
-- a/plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java Wed |
868 |
// For statuses, we cannot have a newline |
|
|
869 |
status = status.replace("\n", " "); |
|
|
870 |
++ b/plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java Wed |
Lines 37-48
exception statement from your version. *
Link Here
|
37 |
import java.net.HttpCookie; |
|
|
38 |
import java.net.URI; |
39 |
import java.util.ArrayList; |
40 |
import java.util.List; |
41 |
|
42 |
import com.sun.jndi.toolkit.url.UrlUtil; |
Lines 50-56
import com.sun.jndi.toolkit.url.UrlUtil;
Link Here
|
50 |
List<HttpCookie> cookieObjects = new ArrayList<HttpCookie>(); |
44 |
String cookieString = new String(); |
Lines 63-112
public class PluginCookieInfoRequest ext
Link Here
|
63 |
String encodedURI = cookieInfo.split(" ")[2]; |
57 |
cookieString = cookieInfo.substring(cookieInfo.indexOf(' ')+1); |
64 |
|
|
|
65 |
cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ')+1); |
66 |
|
67 |
URI siteURI; |
68 |
try |
69 |
{ |
70 |
siteURI = new URI(UrlUtil.decode(encodedURI, "UTF-8")); |
71 |
} catch (Exception e) |
72 |
{ |
73 |
e.printStackTrace(); |
74 |
return; |
75 |
} |
76 |
|
77 |
if (cookieInfo != null && cookieInfo.length() > 0) |
78 |
{ |
79 |
String[] cookies = cookieInfo.split(";"); |
80 |
|
81 |
for (int i = 0; i < cookies.length; i++) |
82 |
{ |
83 |
ArrayList l = new ArrayList(); |
84 |
|
85 |
String cookie = cookies[i]; |
86 |
cookie = cookie.trim(); |
87 |
String cookieName; |
88 |
String cookieValue; |
89 |
|
90 |
if (cookie.indexOf("=") > 0) { |
91 |
cookieName = cookie.substring(0, cookie.indexOf("=")); |
92 |
cookieValue = cookie.substring(cookie.indexOf("=")+1); |
93 |
|
94 |
HttpCookie httpCookieObj = new HttpCookie(cookieName, cookieValue); |
95 |
httpCookieObj.setPath(siteURI.getPath()); |
96 |
httpCookieObj.setVersion(0); // force v0 |
97 |
|
98 |
PluginDebug.debug("Adding cookie info COOKIEN=" + cookieName + " and |
99 |
cookieObjects.add(httpCookieObj); |
100 |
} |
101 |
} |
102 |
} |
Lines 121-127
public class PluginCookieInfoRequest ext
Link Here
|
121 |
public List<HttpCookie> getObject() { |
76 |
public String getObject() { |
122 |
return this.cookieObjects; |
77 |
return this.cookieString; |
123 |
-- a/plugin/icedteanp/java/sun/applet/PluginMain.java Wed Aug 26 |
78 |
++ b/plugin/icedteanp/java/sun/applet/PluginMain.java Wed Aug 26 |
Lines 215-226
public class PluginMain
Link Here
|
215 |
|
215 |
|
216 |
CookieManager ckManager = new CookieManager(new PluginCookieStore(), |
216 |
CookieManager ckManager = new PluginCookieManager(); |
217 |
-- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
217 |
++ b/plugin/icedteanp/java/sun/applet/PluginCookieManager.java Wed Aug |
Line 0
Link Here
|
0 |
-- a/plugin/icedteanp/java/sun/applet/PluginCookieStore.java Wed Aug 26 |
1 |
/* PluginCookieManager -- Cookie manager for the plugin |
|
|
2 |
Copyright (C) 2009 Red Hat |
3 |
|
4 |
This file is part of IcedTea. |
5 |
|
6 |
IcedTea is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
10 |
|
11 |
IcedTea is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
General Public License for more details. |
15 |
|
16 |
You should have received a copy of the GNU General Public License |
17 |
along with IcedTea; see the file COPYING. If not, write to the |
18 |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 |
02110-1301 USA. |
20 |
|
21 |
Linking this library statically or dynamically with other modules is |
22 |
making a combined work based on this library. Thus, the terms and |
23 |
conditions of the GNU General Public License cover the whole |
24 |
combination. |
25 |
|
26 |
As a special exception, the copyright holders of this library give you |
27 |
permission to link this library with independent modules to produce an |
28 |
executable, regardless of the license terms of these independent |
29 |
modules, and to copy and distribute the resulting executable under |
30 |
terms of your choice, provided that you also meet, for each linked |
31 |
independent module, the terms and conditions of the license of that |
32 |
module. An independent module is a module which is not derived from |
33 |
or based on this library. If you modify this library, you may extend |
34 |
this exception to your version of the library, but you are not |
35 |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
37 |
|
38 |
package sun.applet; |
39 |
|
40 |
import java.io.IOException; |
41 |
import java.net.CookieManager; |
42 |
import java.net.HttpCookie; |
43 |
import java.net.URI; |
44 |
import java.util.Collections; |
45 |
import java.util.List; |
46 |
import java.util.Map; |
47 |
|
48 |
public class PluginCookieManager extends CookieManager |
49 |
{ |
50 |
public Map<String, List<String>> get(URI uri, |
51 |
Map<String, List<String>> requestHeaders) throws IOException { |
52 |
// pre-condition check |
53 |
if (uri == null || requestHeaders == null) { |
54 |
throw new IllegalArgumentException("Argument is null"); |
55 |
} |
56 |
|
57 |
Map<String, List<String>> cookieMap = new java.util.HashMap<String, |
58 |
|
59 |
String cookies = (String) PluginAppletViewer |
60 |
.requestPluginCookieInfo(uri); |
61 |
List<String> cookieHeader = new java.util.ArrayList<String>(); |
62 |
|
63 |
if (cookies != null && cookies.length() > 0) |
64 |
cookieHeader.add(cookies); |
65 |
|
66 |
// Add anything else that mozilla didn't add |
67 |
for (HttpCookie cookie : getCookieStore().get(uri)) { |
68 |
// apply path-matches rule (RFC 2965 sec. 3.3.4) |
69 |
if (pathMatches(uri.getPath(), cookie.getPath())) { |
70 |
cookieHeader.add(cookie.toString()); |
71 |
} |
72 |
} |
73 |
|
74 |
cookieMap.put("Cookie", cookieHeader); |
75 |
return Collections.unmodifiableMap(cookieMap); |
76 |
} |
77 |
|
78 |
private boolean pathMatches(String path, String pathToMatchWith) { |
79 |
if (path == pathToMatchWith) |
80 |
return true; |
81 |
if (path == null || pathToMatchWith == null) |
82 |
return false; |
83 |
if (path.startsWith(pathToMatchWith)) |
84 |
return true; |
85 |
|
86 |
return false; |
87 |
} |
88 |
} |
|
|
89 |
++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
Lines 1-73
Link Here
|
1 |
/* PluginCookieStore -- Storage for cookie information |
|
|
2 |
Copyright (C) 2009 Red Hat |
3 |
|
4 |
This file is part of IcedTea. |
5 |
|
6 |
IcedTea is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
10 |
|
11 |
IcedTea is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
General Public License for more details. |
15 |
|
16 |
You should have received a copy of the GNU General Public License |
17 |
along with IcedTea; see the file COPYING. If not, write to the |
18 |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 |
02110-1301 USA. |
20 |
|
21 |
Linking this library statically or dynamically with other modules is |
22 |
making a combined work based on this library. Thus, the terms and |
23 |
conditions of the GNU General Public License cover the whole |
24 |
combination. |
25 |
|
26 |
As a special exception, the copyright holders of this library give you |
27 |
permission to link this library with independent modules to produce an |
28 |
executable, regardless of the license terms of these independent |
29 |
modules, and to copy and distribute the resulting executable under |
30 |
terms of your choice, provided that you also meet, for each linked |
31 |
independent module, the terms and conditions of the license of that |
32 |
module. An independent module is a module which is not derived from |
33 |
or based on this library. If you modify this library, you may extend |
34 |
this exception to your version of the library, but you are not |
35 |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
37 |
|
38 |
package sun.applet; |
39 |
|
40 |
import java.net.HttpCookie; |
41 |
import java.net.URI; |
42 |
import java.util.List; |
43 |
|
44 |
import sun.net.www.protocol.http.InMemoryCookieStore; |
45 |
|
46 |
public class PluginCookieStore extends InMemoryCookieStore |
47 |
{ |
48 |
public List<HttpCookie> get(URI uri) |
49 |
{ |
50 |
List<HttpCookie> cookies; |
51 |
|
52 |
// Try to fetch it from the plugin, but if something goes |
53 |
// wrong, fall back. Don't crash! |
54 |
try |
55 |
{ |
56 |
cookies = (List<HttpCookie>) |
57 |
|
58 |
// If cookies is null, something went wrong. Fall back. |
59 |
if (cookies == null) throw new NullPointerException("Null cookie"); |
60 |
|
61 |
} catch (Exception e) |
62 |
{ |
63 |
PluginDebug.debug("Unable to fetch cookie information from plugin. " + |
64 |
"Falling back to default."); |
65 |
e.printStackTrace(); |
66 |
cookies = super.get(uri); |
67 |
} |
68 |
|
69 |
PluginDebug.debug("Returning cookies " + cookies + " for site: " + |
70 |
|
71 |
return cookies; |
72 |
} |
73 |
} |