diff options
author | Adam Domurad <[email protected]> | 2013-04-11 15:37:32 -0400 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2013-04-11 15:37:32 -0400 |
commit | d72aa240b794c81d4ec9aea24158564e696173a9 (patch) | |
tree | a814a39f675b81dfa3997d565d96f2a19abfa8c3 /plugin | |
parent | 038866be9293d5194b04af3c98c71e5e66712cf2 (diff) |
Remove legacy support for the old version of NPAPI
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/icedteanp/IcedTeaNPPlugin.cc | 234 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaNPPlugin.h | 4 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaPluginRequestProcessor.cc | 7 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaPluginRequestProcessor.h | 6 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaPluginUtils.cc | 10 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaPluginUtils.h | 6 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaRunnable.h | 5 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaScriptablePluginObject.h | 4 |
8 files changed, 3 insertions, 273 deletions
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc index bf37b4e..1484982 100644 --- a/plugin/icedteanp/IcedTeaNPPlugin.cc +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc @@ -55,28 +55,6 @@ exception statement from your version. */ #include "IcedTeaScriptablePluginObject.h" #include "IcedTeaNPPlugin.h" -#if MOZILLA_VERSION_COLLAPSED < 1090100 -// Documentbase retrieval includes. -#include <nsIPluginInstance.h> -#include <nsIPluginInstancePeer.h> -#include <nsIPluginTagInfo2.h> - -// API's into Mozilla -#include <nsCOMPtr.h> -#include <nsICookieService.h> -#include <nsIDNSRecord.h> -#include <nsIDNSService.h> -#include <nsINetUtil.h> -#include <nsIProxyInfo.h> -#include <nsIProtocolProxyService.h> -#include <nsIScriptSecurityManager.h> -#include <nsIIOService.h> -#include <nsIURI.h> -#include <nsNetCID.h> -#include <nsStringAPI.h> -#include <nsServiceManagerUtils.h> -#endif - // Error reporting macros. #define PLUGIN_ERROR(message) \ @@ -153,11 +131,6 @@ exception statement from your version. */ #define FAILURE_MESSAGE "icedteanp plugin error: Failed to run %s." \ " For more detail rerun \"firefox -g\" in a terminal window." -#if MOZILLA_VERSION_COLLAPSED < 1090100 -// Documentbase retrieval required definition. -static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); -#endif - // Data directory for plugin. static std::string data_directory; @@ -210,14 +183,6 @@ PluginRequestProcessor* plugin_req_proc; // Sends messages to Java over the bus JavaMessageSender* java_req_proc; -#if MOZILLA_VERSION_COLLAPSED < 1090100 -// Documentbase retrieval type-punning union. -typedef union -{ - void** void_field; - nsIPluginTagInfo2** info_field; -} info_union; -#endif // Static instance helper functions. // Have the browser allocate a new ITNPPluginData structure. @@ -933,38 +898,6 @@ get_cookie_info(const char* siteAddr, char** cookieString, uint32_t* len) { return NPERR_GENERIC_ERROR; } -#if MOZILLA_VERSION_COLLAPSED < 1090100 - nsresult rv; - nsCOMPtr<nsIScriptSecurityManager> sec_man = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); - - if (!sec_man) { - return NPERR_GENERIC_ERROR; - } - - nsCOMPtr<nsIIOService> io_svc = do_GetService("@mozilla.org/network/io-service;1", &rv); - - if (NS_FAILED(rv) || !io_svc) { - return NPERR_GENERIC_ERROR; - } - - nsCOMPtr<nsIURI> uri; - io_svc->NewURI(nsCString(siteAddr), NULL, NULL, getter_AddRefs(uri)); - - nsCOMPtr<nsICookieService> cookie_svc = do_GetService("@mozilla.org/cookieService;1", &rv); - - if (NS_FAILED(rv) || !cookie_svc) { - return NPERR_GENERIC_ERROR; - } - - rv = cookie_svc->GetCookieString(uri, NULL, cookieString); - - if (NS_FAILED(rv) || !*cookieString) { - return NPERR_GENERIC_ERROR; - } - -#else - // getvalueforurl needs an NPP instance. Quite frankly, there is no easy way // to know which instance needs the information, as applets on Java side can // be multi-threaded and the thread making a proxy.cookie request cannot be @@ -983,8 +916,6 @@ get_cookie_info(const char* siteAddr, char** cookieString, uint32_t* len) return NPERR_GENERIC_ERROR; } -#endif - return NPERR_NO_ERROR; } @@ -1025,71 +956,7 @@ plugin_data_new (ITNPPluginData** data) // Documentbase retrieval. This function gets the current document's // documentbase. This function relies on browser-private data so it // will only work when the plugin is loaded in a Mozilla-based -// 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 < 1090100 -static gchar* -plugin_get_documentbase (NPP instance) -{ - PLUGIN_DEBUG ("plugin_get_documentbase\n"); - - nsIPluginInstance* xpcom_instance = NULL; - nsIPluginInstancePeer* peer = NULL; - nsresult result = 0; - nsIPluginTagInfo2* pluginTagInfo2 = NULL; - info_union u = { NULL }; - char const* documentbase = NULL; - gchar* documentbase_copy = NULL; - - xpcom_instance = (nsIPluginInstance*) (instance->ndata); - if (!xpcom_instance) - { - PLUGIN_ERROR ("xpcom_instance is NULL."); - goto cleanup_done; - } - - xpcom_instance->GetPeer (&peer); - if (!peer) - { - PLUGIN_ERROR ("peer is NULL."); - goto cleanup_done; - } - - u.info_field = &pluginTagInfo2; - - result = peer->QueryInterface (kIPluginTagInfo2IID, - u.void_field); - if (result || !pluginTagInfo2) - { - PLUGIN_ERROR ("pluginTagInfo2 retrieval failed."); - goto cleanup_peer; - } - - pluginTagInfo2->GetDocumentBase (&documentbase); - - if (!documentbase) - { - // NULL => dummy instantiation for LiveConnect - goto cleanup_plugintaginfo2; - } - - documentbase_copy = g_strdup (documentbase); - - // Release references. - cleanup_plugintaginfo2: - NS_RELEASE (pluginTagInfo2); - - cleanup_peer: - NS_RELEASE (peer); - - cleanup_done: - PLUGIN_DEBUG ("plugin_get_documentbase return\n"); - - PLUGIN_DEBUG("plugin_get_documentbase returning: %s\n", documentbase_copy); - return documentbase_copy; -} -#else +// browser. static gchar* plugin_get_documentbase (NPP instance) { @@ -1128,7 +995,6 @@ plugin_get_documentbase (NPP instance) return documentbase_copy; } -#endif // plugin_in_pipe_callback is called when data is available on the // input pipe, or when the appletviewer crashes or is killed. It may @@ -1198,10 +1064,6 @@ void consume_plugin_message(gchar* message) { gchar* proxy_info; -#if MOZILLA_VERSION_COLLAPSED < 1090100 - proxy = (gchar*) g_malloc(sizeof(char)*2048); -#endif - proxy_info = g_strconcat ("plugin PluginProxyInfo reference ", parts[3], " ", NULL); if (get_proxy_info(decoded_url, &proxy, &len) == NPERR_NO_ERROR) { @@ -1216,8 +1078,8 @@ void consume_plugin_message(gchar* message) { g_free(proxy_info); proxy_info = NULL; - g_free(proxy); - proxy = NULL; + g_free(proxy); + proxy = NULL; } else if (g_str_has_prefix(parts[1], "PluginCookieInfo")) { @@ -1369,76 +1231,6 @@ get_proxy_info(const char* siteAddr, char** proxy, uint32_t* len) { return NPERR_GENERIC_ERROR; } -#if MOZILLA_VERSION_COLLAPSED < 1090100 - nsresult rv; - - // Initialize service variables - nsCOMPtr<nsIProtocolProxyService> proxy_svc = do_GetService("@mozilla.org/network/protocol-proxy-service;1", &rv); - - if (!proxy_svc) { - printf("Cannot initialize proxy service\n"); - return NPERR_GENERIC_ERROR; - } - - nsCOMPtr<nsIIOService> io_svc = do_GetService("@mozilla.org/network/io-service;1", &rv); - - if (NS_FAILED(rv) || !io_svc) { - printf("Cannot initialize io service\n"); - return NPERR_GENERIC_ERROR; - } - - // uri which needs to be accessed - nsCOMPtr<nsIURI> uri; - io_svc->NewURI(nsCString(siteAddr), NULL, NULL, getter_AddRefs(uri)); - - // find the proxy address if any - nsCOMPtr<nsIProxyInfo> info; - proxy_svc->Resolve(uri, 0, getter_AddRefs(info)); - - // if there is no proxy found, return immediately - if (!info) { - PLUGIN_DEBUG("%s does not need a proxy\n", siteAddr); - return NPERR_GENERIC_ERROR; - } - - // if proxy info is available, extract it - nsCString phost; - PRInt32 pport; - nsCString ptype; - - info->GetHost(phost); - info->GetPort(&pport); - info->GetType(ptype); - - // resolve the proxy address to an IP - nsCOMPtr<nsIDNSService> dns_svc = do_GetService("@mozilla.org/network/dns-service;1", &rv); - - if (!dns_svc) { - printf("Cannot initialize DNS service\n"); - return NPERR_GENERIC_ERROR; - } - - nsCOMPtr<nsIDNSRecord> record; - dns_svc->Resolve(phost, 0U, getter_AddRefs(record)); - - // TODO: Add support for multiple ips - nsDependentCString ipAddr; - record->GetNextAddrAsString(ipAddr); - - if (!strcmp(ptype.get(), "http")) - { - snprintf(*proxy, sizeof(char)*1024, "%s %s:%d", "PROXY", ipAddr.get(), pport); - } else - { - snprintf(*proxy, sizeof(char)*1024, "%s %s:%d", "SOCKS", ipAddr.get(), pport); - } - - *len = strlen(*proxy); - - PLUGIN_DEBUG("Proxy info for %s: %s\n", siteAddr, *proxy); - -#else - if (browser_functions.getvalueforurl) { @@ -1449,7 +1241,6 @@ get_proxy_info(const char* siteAddr, char** proxy, uint32_t* len) { return NPERR_GENERIC_ERROR; } -#endif return NPERR_NO_ERROR; } @@ -2012,11 +1803,7 @@ plugin_data_destroy (NPP instance) static bool initialize_browser_functions(const NPNetscapeFuncs* browserTable) { -#if MOZILLA_VERSION_COLLAPSED < 1090100 -#define NPNETSCAPEFUNCS_LAST_FIELD_USED (browserTable->pluginthreadasynccall) -#else #define NPNETSCAPEFUNCS_LAST_FIELD_USED (browserTable->setvalueforurl) -#endif //Determine the size in bytes, as a difference of the address past the last used field //And the browser table address @@ -2058,20 +1845,6 @@ initialize_plugin_table(NPPluginFuncs* pluginTable) pluginTable->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; pluginTable->size = sizeof (NPPluginFuncs); - -#if MOZILLA_VERSION_COLLAPSED < 1090100 - pluginTable->newp = NewNPP_NewProc (ITNP_New); - pluginTable->destroy = NewNPP_DestroyProc (ITNP_Destroy); - pluginTable->setwindow = NewNPP_SetWindowProc (ITNP_SetWindow); - pluginTable->newstream = NewNPP_NewStreamProc (ITNP_NewStream); - pluginTable->destroystream = NewNPP_DestroyStreamProc (ITNP_DestroyStream); - pluginTable->asfile = NewNPP_StreamAsFileProc (ITNP_StreamAsFile); - pluginTable->writeready = NewNPP_WriteReadyProc (ITNP_WriteReady); - pluginTable->write = NewNPP_WriteProc (ITNP_Write); - pluginTable->print = NewNPP_PrintProc (ITNP_Print); - pluginTable->urlnotify = NewNPP_URLNotifyProc (ITNP_URLNotify); - pluginTable->getvalue = NewNPP_GetValueProc (ITNP_GetValue); -#else pluginTable->newp = NPP_NewProcPtr (ITNP_New); pluginTable->destroy = NPP_DestroyProcPtr (ITNP_Destroy); pluginTable->setwindow = NPP_SetWindowProcPtr (ITNP_SetWindow); @@ -2083,7 +1856,6 @@ initialize_plugin_table(NPPluginFuncs* pluginTable) pluginTable->print = NPP_PrintProcPtr (ITNP_Print); pluginTable->urlnotify = NPP_URLNotifyProcPtr (ITNP_URLNotify); pluginTable->getvalue = NPP_GetValueProcPtr (ITNP_GetValue); -#endif return true; } diff --git a/plugin/icedteanp/IcedTeaNPPlugin.h b/plugin/icedteanp/IcedTeaNPPlugin.h index 6ebb416..2d97d8a 100644 --- a/plugin/icedteanp/IcedTeaNPPlugin.h +++ b/plugin/icedteanp/IcedTeaNPPlugin.h @@ -39,13 +39,9 @@ exception statement from your version. */ #ifndef __ICEDTEANPPLUGIN_H__ #define __ICEDTEANPPLUGIN_H__ -#if MOZILLA_VERSION_COLLAPSED < 1090100 -#include <nsThreadUtils.h> -#else #include <npapi.h> #include <npruntime.h> #include <npfunctions.h> -#endif // GLib includes. #include <glib.h> diff --git a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc index dc611c6..8d48fa0 100644 --- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc +++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc @@ -838,17 +838,10 @@ _eval(void* data) window_ptr = (NPObject*) call_data->at(1); script_str = (std::string*) call_data->at(2); -#if MOZILLA_VERSION_COLLAPSED < 1090200 - script.utf8characters = script_str->c_str(); - script.utf8length = script_str->size(); - - PLUGIN_DEBUG("Evaluating: %s\n", script_str->c_str()); -#else script.UTF8Characters = script_str->c_str(); script.UTF8Length = script_str->size(); PLUGIN_DEBUG("Evaluating: %s\n", script_str->c_str()); -#endif ((AsyncCallThreadData*) data)->call_successful = browser_functions.evaluate(instance, window_ptr, &script, eval_variant); IcedTeaPluginUtilities::printNPVariant(*eval_variant); diff --git a/plugin/icedteanp/IcedTeaPluginRequestProcessor.h b/plugin/icedteanp/IcedTeaPluginRequestProcessor.h index e9c1f5d..97daf8c 100644 --- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.h +++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.h @@ -46,13 +46,7 @@ exception statement from your version. */ #include <time.h> #include <npapi.h> - -#if MOZILLA_VERSION_COLLAPSED < 1090100 -#include <npupp.h> -#else -#include <npapi.h> #include <npruntime.h> -#endif #include "IcedTeaPluginUtils.h" #include "IcedTeaJavaRequestProcessor.h" diff --git a/plugin/icedteanp/IcedTeaPluginUtils.cc b/plugin/icedteanp/IcedTeaPluginUtils.cc index d365b05..6ed17bb 100644 --- a/plugin/icedteanp/IcedTeaPluginUtils.cc +++ b/plugin/icedteanp/IcedTeaPluginUtils.cc @@ -920,15 +920,9 @@ IcedTeaPluginUtilities::decodeURL(const gchar* url, gchar** decoded_url) std::string IcedTeaPluginUtilities::NPVariantAsString(NPVariant variant) { -#if MOZILLA_VERSION_COLLAPSED < 1090200 - return std::string( - NPVARIANT_TO_STRING(variant).utf8characters, - NPVARIANT_TO_STRING(variant).utf8length); -#else return std::string( NPVARIANT_TO_STRING(variant).UTF8Characters, NPVARIANT_TO_STRING(variant).UTF8Length); -#endif } /** @@ -949,11 +943,7 @@ NPString IcedTeaPluginUtilities::NPStringCopy(const std::string& result) { NPVariant IcedTeaPluginUtilities::NPVariantStringCopy(const std::string& result) { NPString npstr = NPStringCopy(result); NPVariant npvar; -#if MOZILLA_VERSION_COLLAPSED < 1090200 - STRINGN_TO_NPVARIANT(npstr.utf8characters, npstr.utf8length, npvar); -#else STRINGN_TO_NPVARIANT(npstr.UTF8Characters, npstr.UTF8Length, npvar); -#endif return npvar; } diff --git a/plugin/icedteanp/IcedTeaPluginUtils.h b/plugin/icedteanp/IcedTeaPluginUtils.h index 2887f46..b55355b 100644 --- a/plugin/icedteanp/IcedTeaPluginUtils.h +++ b/plugin/icedteanp/IcedTeaPluginUtils.h @@ -57,13 +57,7 @@ exception statement from your version. */ #include <npapi.h> #include <glib.h> - -#if MOZILLA_VERSION_COLLAPSED < 1090100 -#include <npupp.h> -#else -#include <npapi.h> #include <npruntime.h> -#endif #define PLUGIN_DEBUG(...) \ do \ diff --git a/plugin/icedteanp/IcedTeaRunnable.h b/plugin/icedteanp/IcedTeaRunnable.h index 7134ab5..9aa490f 100644 --- a/plugin/icedteanp/IcedTeaRunnable.h +++ b/plugin/icedteanp/IcedTeaRunnable.h @@ -45,11 +45,6 @@ exception statement from your version. */ #include <string> #include <npapi.h> -#if MOZILLA_VERSION_COLLAPSED < 1090100 -#include <nsIRunnable.h> -#include <string> -#endif - /* * This struct holds the result from the main-thread dispatched method */ diff --git a/plugin/icedteanp/IcedTeaScriptablePluginObject.h b/plugin/icedteanp/IcedTeaScriptablePluginObject.h index a4933ed..ad8a2eb 100644 --- a/plugin/icedteanp/IcedTeaScriptablePluginObject.h +++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.h @@ -39,12 +39,8 @@ exception statement from your version. */ #ifndef __ICEDTEASCRIPTABLEPLUGINOBJECT_H_ #define __ICEDTEASCRIPTABLEPLUGINOBJECT_H_ -#if MOZILLA_VERSION_COLLAPSED < 1090100 -#include "npupp.h" -#else #include <npapi.h> #include <npruntime.h> -#endif #include "IcedTeaJavaRequestProcessor.h" #include "IcedTeaNPPlugin.h" |