From 7c143418b6fd3065baa332d95b74fd68e70f70d2 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Fri, 8 Mar 2002 20:03:12 +0000 Subject: [PATCH] [not part of build] fix bustage caused by checkins for bug #124042. git-svn-id: svn://10.0.0.236/trunk@116164 18797224-902f-48f8-a5cc-f745e15eee43 --- .../Source/LiveConnectNativeMethods.cpp | 46 ++++++++----------- .../plugin/Source/MRJSecurityContext.h | 3 +- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/mozilla/plugin/oji/MRJCarbon/plugin/Source/LiveConnectNativeMethods.cpp b/mozilla/plugin/oji/MRJCarbon/plugin/Source/LiveConnectNativeMethods.cpp index ff4009da275..eb5202fa6ef 100644 --- a/mozilla/plugin/oji/MRJCarbon/plugin/Source/LiveConnectNativeMethods.cpp +++ b/mozilla/plugin/oji/MRJCarbon/plugin/Source/LiveConnectNativeMethods.cpp @@ -42,14 +42,11 @@ #include "LiveConnectNativeMethods.h" -#include "nsIComponentManager.h" +#include "nsIComponentManagerObsolete.h" #include "nsIPluginManager.h" #include "nsIJVMManager.h" #include "nsILiveconnect.h" #include "nsIPluginInstancePeer2.h" -#include "nsIIOService.h" -#include "nsIURI.h" -#include "nsNetCID.h" #include "MRJPlugin.h" #include "MRJContext.h" @@ -68,7 +65,7 @@ extern nsIPluginManager* thePluginManager; static MRJPlugin* theJVMPlugin = NULL; static nsILiveconnect* theLiveConnectManager = NULL; -static nsIComponentManager* theComponentManager = NULL; +static nsIComponentManagerObsolete* theComponentManager = NULL; static jclass netscape_javascript_JSObject = NULL; static jmethodID netscape_javascript_JSObject_JSObject; @@ -83,9 +80,9 @@ static jmethodID netscape_oji_JNIUtils_GetObjectClassLoader = NULL; static NS_DEFINE_IID(kLiveConnectCID, NS_CLIVECONNECT_CID); static NS_DEFINE_IID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); -static nsresult getGlobalComponentManager(nsIComponentManager* *result) +static nsresult getGlobalComponentManager(nsIComponentManagerObsolete* *result) { - return MRJPlugin::GetService(kComponentManagerCID, NS_GET_IID(nsIComponentManager), (void**)result); + return MRJPlugin::GetService(kComponentManagerCID, NS_GET_IID(nsIComponentManagerObsolete), (void**)result); } nsresult InitLiveConnectSupport(MRJPlugin* jvmPlugin) @@ -150,7 +147,6 @@ nsresult InitLiveConnectSupport(MRJPlugin* jvmPlugin) nsresult ShutdownLiveConnectSupport() { NS_IF_RELEASE(theLiveConnectManager); - NS_IF_RELEASE(theComponentManager); if (theJVMPlugin != NULL) { @@ -199,26 +195,22 @@ static jobject GetCurrentThread(JNIEnv* env) * Security Considerations. */ -static nsresult -NS_NewURI(nsIURI* *result, - const char* spec, - nsIURI* baseURI = nsnull) // pass in nsIIOService to optimize callers -{ - nsIIOService* ioService; - static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); - nsresult rv = MRJPlugin::GetService(kIOServiceCID, NS_GET_IID(nsIIOService), (void**)&ioService); - if (rv == NS_OK) - rv = ioService->NewURI(spec, baseURI, result); - NS_RELEASE(ioService); - return rv; -} - MRJSecurityContext::MRJSecurityContext(const char* location) : mLocation(nsnull), mConnection(nsnull) { NS_INIT_REFCNT(); - NS_NewURI(&mLocation, location, nsnull); + mLocation = ::strdup(location); + if (mLocation) { + // find the 3rd slash of the URL, hopefully it's in canonical form. + char* colon = ::strchr(mLocation, ':'); + if (colon) { + if (colon[1] == '/' && colon[2] == '/') { + char* slash = ::strchr(colon + 3, '/'); + if (slash) *slash = '\0'; + } + } + } if (theComponentManager) { theComponentManager->CreateInstance(kLiveConnectCID, nsnull, NS_GET_IID(nsILiveconnect), @@ -231,7 +223,7 @@ MRJSecurityContext::MRJSecurityContext(const char* location) MRJSecurityContext::~MRJSecurityContext() { - NS_IF_RELEASE(mLocation); + delete[] mLocation; NS_IF_RELEASE(mConnection); } @@ -248,9 +240,8 @@ NS_METHOD MRJSecurityContext::GetOrigin(char* buf, int len) { char* origin = nsnull; - if (mLocation && NS_SUCCEEDED(mLocation->GetPrePath(&origin))) { - ::strncpy(buf, origin, len); - delete[] origin; + if (mLocation) { + ::strncpy(buf, mLocation, len); return NS_OK; } return NS_ERROR_FAILURE; @@ -260,7 +251,6 @@ NS_METHOD MRJSecurityContext::GetCertificateID(char* buf, int len) { // ACTION: Implement me. - return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJSecurityContext.h b/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJSecurityContext.h index 37ffa86a52a..34a993e0a70 100644 --- a/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJSecurityContext.h +++ b/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJSecurityContext.h @@ -38,7 +38,6 @@ #include "nsISecurityContext.h" -class nsIURI; class nsILiveconnect; class MRJSecurityContext : public nsISecurityContext { @@ -55,6 +54,6 @@ public: nsILiveconnect* getConnection() { return mConnection; } private: - nsIURI* mLocation; + char* mLocation; nsILiveconnect* mConnection; };