diff --git a/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.cpp b/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.cpp index e6823dc688e..a69ccab0112 100644 --- a/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.cpp +++ b/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.cpp @@ -35,11 +35,11 @@ * ----- END LICENSE BLOCK ----- */ /* - MRJPlugin.cpp - - XP COM Plugin Implementation. - - by Patrick C. Beard. + MRJPlugin.cpp + + XP COM Plugin Implementation. + + by Patrick C. Beard. */ #include "MRJPlugin.h" @@ -62,6 +62,8 @@ #include "CSecureEnv.h" #include +#include +#include nsIPluginManager* thePluginManager = NULL; nsIPluginManager2* thePluginManager2 = NULL; @@ -107,26 +109,26 @@ nsresult MRJPlugin::GetService(const char* aContractID, const nsIID& aIID, void* nsresult NSGetFactory(nsISupports* serviceManager, const nsCID &aClass, const char *aClassName, const char *aContractID, nsIFactory **aFactory) { - nsresult result = NS_OK; + nsresult result = NS_OK; - if (theServiceManager == NULL && theServiceManagerObsolete == NULL) { - if (NS_FAILED(serviceManager->QueryInterface(NS_GET_IID(nsIServiceManager), (void**)&theServiceManager))) - if (NS_FAILED(serviceManager->QueryInterface(NS_GET_IID(nsIServiceManagerObsolete), (void**)&theServiceManagerObsolete))) - return NS_ERROR_FAILURE; + if (theServiceManager == NULL && theServiceManagerObsolete == NULL) { + if (NS_FAILED(serviceManager->QueryInterface(NS_GET_IID(nsIServiceManager), (void**)&theServiceManager))) + if (NS_FAILED(serviceManager->QueryInterface(NS_GET_IID(nsIServiceManagerObsolete), (void**)&theServiceManagerObsolete))) + return NS_ERROR_FAILURE; - // Our global operator new wants to use nsIMalloc to do all of its allocation. - // This should be available from the Service Manager. - if (MRJPlugin::GetService(NS_MEMORY_CONTRACTID, NS_GET_IID(nsIMemory), (void **)&theMemoryAllocator) != NS_OK) - return NS_ERROR_FAILURE; - } + // Our global operator new wants to use nsIMalloc to do all of its allocation. + // This should be available from the Service Manager. + if (MRJPlugin::GetService(NS_MEMORY_CONTRACTID, NS_GET_IID(nsIMemory), (void **)&theMemoryAllocator) != NS_OK) + return NS_ERROR_FAILURE; + } - if (aClass.Equals(kPluginCID)) { - MRJPlugin* pluginFactory = new MRJPlugin(); - pluginFactory->AddRef(); - *aFactory = pluginFactory; - return NS_OK; - } - return NS_NOINTERFACE; + if (aClass.Equals(kPluginCID)) { + MRJPlugin* pluginFactory = new MRJPlugin(); + pluginFactory->AddRef(); + *aFactory = pluginFactory; + return NS_OK; + } + return NS_NOINTERFACE; } #pragma export off @@ -150,17 +152,17 @@ pascal void MRJPlugin__terminate(void); pascal OSErr MRJPlugin__initialize(const CFragInitBlock *initBlock) { - OSErr err = __initialize(initBlock); - if (err != noErr) return err; + OSErr err = __initialize(initBlock); + if (err != noErr) return err; - if (initBlock->fragLocator.where == kDataForkCFragLocator) { - thePluginSpec = *initBlock->fragLocator.u.onDisk.fileSpec; - - // Open plugin's resource fork for read-only access. - thePluginRefnum = ::FSpOpenResFile(&thePluginSpec, fsRdPerm); - } - - return noErr; + if (initBlock->fragLocator.where == kDataForkCFragLocator) { + thePluginSpec = *initBlock->fragLocator.u.onDisk.fileSpec; + + // Open plugin's resource fork for read-only access. + thePluginRefnum = ::FSpOpenResFile(&thePluginSpec, fsRdPerm); + } + + return noErr; } pascal void MRJPlugin__terminate() @@ -180,7 +182,7 @@ pascal void MRJPlugin__terminate() thePluginRefnum = -1; } - __terminate(); + __terminate(); } // @@ -190,44 +192,38 @@ pascal void MRJPlugin__terminate() #pragma mark *** MRJPlugin *** const InterfaceInfo MRJPlugin::sInterfaces[] = { - { NS_IPLUGIN_IID, INTERFACE_OFFSET(MRJPlugin, nsIPlugin) }, - { NS_IJVMPLUGIN_IID, INTERFACE_OFFSET(MRJPlugin, nsIJVMPlugin) }, - { NS_IRUNNABLE_IID, INTERFACE_OFFSET(MRJPlugin, nsIRunnable) }, + { NS_IPLUGIN_IID, INTERFACE_OFFSET(MRJPlugin, nsIPlugin) }, + { NS_IJVMPLUGIN_IID, INTERFACE_OFFSET(MRJPlugin, nsIJVMPlugin) }, +#if USE_SYSTEM_CONSOLE + { NS_IJVMCONSOLE_IID, INTERFACE_OFFSET(MRJPlugin, nsIJVMConsole) }, +#endif + { NS_IRUNNABLE_IID, INTERFACE_OFFSET(MRJPlugin, nsIRunnable) }, }; const UInt32 MRJPlugin::kInterfaceCount = sizeof(sInterfaces) / sizeof(InterfaceInfo); MRJPlugin::MRJPlugin() - : SupportsMixin(this, sInterfaces, kInterfaceCount), - mManager(NULL), mThreadManager(NULL), mSession(NULL), mConsole(NULL), mIsEnabled(false), mPluginThreadID(NULL) + : SupportsMixin(this, sInterfaces, kInterfaceCount), + mManager(NULL), mThreadManager(NULL), mSession(NULL), mConsole(NULL), mIsEnabled(false), mPluginThreadID(NULL) { } MRJPlugin::~MRJPlugin() { - // Release the console. - if (mConsole != NULL) { - mConsole->Release(); - mConsole = NULL; - } + // Release the console. + NS_IF_RELEASE(mConsole); - // tear down the MRJ session, if it exists. - if (mSession != NULL) { - delete mSession; - mSession = NULL; - } + // tear down the MRJ session, if it exists. + if (mSession != NULL) { + delete mSession; + mSession = NULL; + } - // Release the manager? - if (mManager != NULL) { - mManager->Release(); - mManager = NULL; - } - - if (mThreadManager != NULL) { - mThreadManager->Release(); - mThreadManager = NULL; - } + // Release the managers. + NS_IF_RELEASE(mManager); + NS_IF_RELEASE(mThreadManager); } +#if !USE_SYSTEM_CONSOLE /** * MRJPlugin aggregates MRJConsole, so that it can be QI'd to be an nsIJVMConsole. * To save code size, we use the SupportsMixin class instead of the macros in @@ -237,85 +233,88 @@ MRJPlugin::~MRJPlugin() */ NS_METHOD MRJPlugin::QueryInterface(const nsIID& aIID, void** instancePtr) { - nsresult result = queryInterface(aIID, instancePtr); - if (result == NS_NOINTERFACE) { - result = mConsole->queryInterface(aIID, instancePtr); - } - return result; + nsresult result = queryInterface(aIID, instancePtr); + if (result == NS_NOINTERFACE) { + result = mConsole->queryInterface(aIID, instancePtr); + } + return result; } +#endif NS_METHOD MRJPlugin::CreateInstance(nsISupports *aOuter, const nsIID& aIID, void **aResult) { - nsresult result = StartupJVM(); - if (result == NS_OK) { - MRJPluginInstance* instance = new MRJPluginInstance(this); - if (instance == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - result = instance->QueryInterface(aIID, aResult); - if (result != NS_OK) - delete instance; - } - return result; + nsresult result = StartupJVM(); + if (result == NS_OK) { + MRJPluginInstance* instance = new MRJPluginInstance(this); + if (instance == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + result = instance->QueryInterface(aIID, aResult); + if (result != NS_OK) + delete instance; + } + return result; } #define NS_APPLET_MIME_TYPE "application/x-java-applet" NS_METHOD MRJPlugin::CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType, void **aResult) { - nsresult result = NS_NOINTERFACE; + nsresult result = NS_NOINTERFACE; - if (::strcmp(aPluginMIMEType, "application/x-java-frame") == 0) { + if (::strcmp(aPluginMIMEType, "application/x-java-frame") == 0) { #if !TARGET_CARBON - // create a special plugin instance that manages an embedded frame. - EmbeddedFramePluginInstance* instance = new EmbeddedFramePluginInstance(); - nsresult result = instance->QueryInterface(aIID, aResult); - if (result != NS_OK) - delete instance; + // create a special plugin instance that manages an embedded frame. + EmbeddedFramePluginInstance* instance = new EmbeddedFramePluginInstance(); + nsresult result = instance->QueryInterface(aIID, aResult); + if (result != NS_OK) + delete instance; #endif - } else { - // assume it's some kind of an applet. - result = CreateInstance(aOuter, aIID, aResult); - } - return result; + } else { + // assume it's some kind of an applet. + result = CreateInstance(aOuter, aIID, aResult); + } + return result; } NS_METHOD MRJPlugin::Initialize() { - nsresult result = NS_OK; + nsresult result = NS_OK; - // try to get a plugin manager. - if (thePluginManager == NULL) { - result = MRJPlugin::GetService(kPluginManagerCID, NS_GET_IID(nsIPluginManager), (void**)&thePluginManager); - if (result != NS_OK || thePluginManager == NULL) - return NS_ERROR_FAILURE; - } + // try to get a plugin manager. + if (thePluginManager == NULL) { + result = MRJPlugin::GetService(kPluginManagerCID, NS_GET_IID(nsIPluginManager), (void**)&thePluginManager); + if (result != NS_OK || thePluginManager == NULL) + return NS_ERROR_FAILURE; + } - // see if the enhanced plugin manager exists. - if (thePluginManager2 == NULL) { - if (thePluginManager->QueryInterface(NS_GET_IID(nsIPluginManager2), (void**)&thePluginManager2) != NS_OK) - thePluginManager2 = NULL; - } + // see if the enhanced plugin manager exists. + if (thePluginManager2 == NULL) { + if (thePluginManager->QueryInterface(NS_GET_IID(nsIPluginManager2), (void**)&thePluginManager2) != NS_OK) + thePluginManager2 = NULL; + } - // try to get a JVM manager. we have to be able to run without one. - if (MRJPlugin::GetService(kJVMManagerCID, NS_GET_IID(nsIJVMManager), (void**)&mManager) != NS_OK) - mManager = NULL; - - // try to get a Thread manager. - if (mManager != NULL) { - if (mManager->QueryInterface(NS_GET_IID(nsIThreadManager), (void**)&mThreadManager) != NS_OK) - mThreadManager = NULL; + // try to get a JVM manager. we have to be able to run without one. + if (MRJPlugin::GetService(kJVMManagerCID, NS_GET_IID(nsIJVMManager), (void**)&mManager) != NS_OK) + mManager = NULL; + + // try to get a Thread manager. + if (mManager != NULL) { + if (mManager->QueryInterface(NS_GET_IID(nsIThreadManager), (void**)&mThreadManager) != NS_OK) + mThreadManager = NULL; - if (mThreadManager != NULL) - mThreadManager->GetCurrentThread(&mPluginThreadID); - } + if (mThreadManager != NULL) + mThreadManager->GetCurrentThread(&mPluginThreadID); + } - // create a console, only if there's user interface for it. - if (thePluginManager2 != NULL) { - mConsole = new MRJConsole(this); - mConsole->AddRef(); - } +#if !USE_SYSTEM_CONSOLE + // create a console, only if there's user interface for it. + if (thePluginManager2 != NULL) { + mConsole = new MRJConsole(this); + mConsole->AddRef(); + } +#endif - return result; + return result; } NS_METHOD MRJPlugin::Shutdown() @@ -336,238 +335,300 @@ NS_METHOD MRJPlugin::Shutdown() NS_METHOD MRJPlugin::GetMIMEDescription(const char* *result) { - *result = NS_JVM_MIME_TYPE; - return NS_OK; + *result = NS_JVM_MIME_TYPE; + return NS_OK; } NS_METHOD MRJPlugin::GetValue(nsPluginVariable variable, void *value) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_ERROR_NOT_IMPLEMENTED; } MRJSession* MRJPlugin::getSession() { - StartupJVM(); - return mSession; + StartupJVM(); + return mSession; } nsIJVMManager* MRJPlugin::getManager() { - return mManager; + return mManager; } nsIThreadManager* MRJPlugin::getThreadManager() { - return mThreadManager; + return mThreadManager; } -NS_METHOD MRJPlugin::StartupJVM() +static char* getJavaConsolePath(char* path, UInt32 maxPathSize) { - if (mSession == NULL) { - // start a session with MRJ. - mSession = new MRJSession(); + path[0] = '\0'; + FSRef ref; + OSErr err = FSFindFolder(kUserDomain, kDomainLibraryFolderType, true, &ref); + if (err == noErr) { + err = FSRefMakePath(&ref, (UInt8*) path, maxPathSize); + const char kJavaConsoleLog[] = { "/Logs/JavaConsole.log" }; + int len = strlen(path); + if (err == noErr && (len + sizeof(kJavaConsoleLog)) <= maxPathSize) { + strcat(path + len, kJavaConsoleLog); + } + } + return path; +} - // Add "MRJPlugin.jar" to the class path. - FSSpec jarFileSpec = { thePluginSpec.vRefNum, thePluginSpec.parID, "\pMRJPlugin.jar" }; - mSession->addToClassPath(jarFileSpec); - mSession->open(); +nsresult MRJPlugin::StartupJVM() +{ + if (mSession == NULL) { + // start a session with MRJ. + mSession = new MRJSession(); - if (mSession->getStatus() != noErr) { - // how can we signal an error? - delete mSession; - mSession = NULL; - return NS_ERROR_FAILURE; - } + // Add "MRJPlugin.jar" to the class path. + FSSpec jarFileSpec = { thePluginSpec.vRefNum, thePluginSpec.parID, "\pMRJPlugin.jar" }; + mSession->addToClassPath(jarFileSpec); + + // Compute location of ~/Library/Logs/JavaConsole.log + char consolePath[512]; + mSession->open(getJavaConsolePath(consolePath, sizeof(consolePath))); - InitLiveConnectSupport(this); + if (mSession->getStatus() != noErr) { + // how can we signal an error? + delete mSession; + mSession = NULL; + return NS_ERROR_FAILURE; + } + + InitLiveConnectSupport(this); #if 0 - // start our idle thread. - if (mThreadManager != NULL) { - PRUint32 threadID; - mThreadManager->CreateThread(&threadID, this); - } + // start our idle thread. + if (mThreadManager != NULL) { + PRUint32 threadID; + mThreadManager->CreateThread(&threadID, this); + } #endif - mIsEnabled = true; - } - return NS_OK; + mIsEnabled = true; + } + return NS_OK; } NS_METHOD MRJPlugin::AddToClassPath(const char* dirPath) { - if (mSession != NULL) { - mSession->addToClassPath(dirPath); - return NS_OK; - } - return NS_ERROR_FAILURE; + if (mSession != NULL) { + mSession->addToClassPath(dirPath); + return NS_OK; + } + return NS_ERROR_FAILURE; } NS_METHOD MRJPlugin::GetClassPath(const char* *result) { - char* classPath = mSession->getProperty("java.class.path"); - *result = classPath; - return (classPath != NULL ? NS_OK : NS_ERROR_FAILURE); + char* classPath = mSession->getProperty("java.class.path"); + *result = classPath; + return (classPath != NULL ? NS_OK : NS_ERROR_FAILURE); } NS_METHOD MRJPlugin::GetJavaWrapper(JNIEnv* env, jint jsobj, jobject *jobj) { - // use jsobj as key into a table. - // if not in the table, then create a new netscape.javascript.JSObject that references this. - *jobj = Wrap_JSObject(env, jsobj); - return NS_OK; + // use jsobj as key into a table. + // if not in the table, then create a new netscape.javascript.JSObject that references this. + *jobj = Wrap_JSObject(env, jsobj); + return NS_OK; } NS_METHOD MRJPlugin::CreateSecureEnv(JNIEnv* proxyEnv, nsISecureEnv* *outSecureEnv) { - *outSecureEnv = NULL; - nsresult rv = StartupJVM(); - if (rv == NS_OK) { - // Need to spawn a new JVM communication thread here. - NS_DEFINE_IID(kISecureEnvIID, NS_ISECUREENV_IID); - rv = CSecureEnv::Create(this, proxyEnv, kISecureEnvIID, (void**)outSecureEnv); - } - return rv; -} - -NS_METHOD MRJPlugin::UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj) -{ - return NS_ERROR_NOT_IMPLEMENTED; + *outSecureEnv = NULL; + nsresult rv = StartupJVM(); + if (rv == NS_OK) { + // Need to spawn a new JVM communication thread here. + NS_DEFINE_IID(kISecureEnvIID, NS_ISECUREENV_IID); + rv = CSecureEnv::Create(this, proxyEnv, kISecureEnvIID, (void**)outSecureEnv); + } + return rv; } NS_METHOD MRJPlugin::SpendTime(PRUint32 timeMillis) { - nsresult result = NS_OK; - // Only do this if there aren't any plugin instances. - if (MRJPluginInstance::getInstances() == NULL) { - if (mSession == NULL) - result = StartupJVM(); - if (mSession != NULL) - mSession->idle(timeMillis); - } - return result; + nsresult result = NS_OK; + // Only do this if there aren't any plugin instances. + if (MRJPluginInstance::getInstances() == NULL) { + if (mSession == NULL) + result = StartupJVM(); + if (mSession != NULL) + mSession->idle(timeMillis); + } + return result; +} + +NS_METHOD MRJPlugin::UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/** + * Poor Man's Mac OS X Java Console implementation. MRJSession::open() + * opens ~/Library/Logs/JavaConsole.log, and redirects all output + * from System.out and System.err to this file. Rather than + * implementing a Java based console, just take advantage of + * Mac OS X's /Applications/Utilities/Console.app capability + * of showing log files. The following simply uses Launch Services + * to open whatever application normally opens ".log" files. + * A more sophisticated implementation would launch Console.app + * with the log file, but this works just fine for now. + */ +NS_METHOD MRJPlugin::Show() +{ + // Launch the system console application. + char consolePath[512]; + getJavaConsolePath(consolePath, sizeof(consolePath)); + CFURLRef consoleURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (UInt8*)consolePath, strlen(consolePath), false); + if (consoleURL) { + LSOpenCFURLRef(consoleURL, NULL); + CFRelease(consoleURL); + } + return NS_OK; +} + +NS_METHOD MRJPlugin::Hide() +{ + // Hide system console? + return NS_OK; +} + +NS_METHOD MRJPlugin::IsVisible(PRBool *result) +{ + // *result = IsConsoleRunning(); + *result = PR_FALSE; + return NS_OK; +} + +NS_METHOD MRJPlugin::Print(const char* msg, const char* /* encodingName */) +{ + // printf onto the console. + return NS_OK; } NS_METHOD MRJPlugin::Run() { - while (mSession != NULL) { - mSession->idle(); - mThreadManager->Sleep(); - } - return NS_OK; + while (mSession != NULL) { + mSession->idle(); + mThreadManager->Sleep(); + } + return NS_OK; } MRJPluginInstance* MRJPlugin::getPluginInstance(jobject applet) { - JNIEnv* env = mSession->getCurrentEnv(); - MRJPluginInstance* instance = MRJPluginInstance::getInstances(); - while (instance != NULL) { - jobject object = NULL; - if (instance->GetJavaObject(&object) == NS_OK && env->IsSameObject(applet, object)) { - instance->AddRef(); - return instance; - } - instance = instance->getNextInstance(); - } - return NULL; + JNIEnv* env = mSession->getCurrentEnv(); + MRJPluginInstance* instance = MRJPluginInstance::getInstances(); + while (instance != NULL) { + jobject object = NULL; + if (instance->GetJavaObject(&object) == NS_OK && env->IsSameObject(applet, object)) { + instance->AddRef(); + return instance; + } + instance = instance->getNextInstance(); + } + return NULL; } MRJPluginInstance* MRJPlugin::getPluginInstance(JNIEnv* jenv) { #if !TARGET_CARBON - // Apple will provide an API that maps a JNIEnv to an JMAWTContextRef. We can map this to the MRJContext/Applet/Instance. - MRJPluginInstance* instance = MRJPluginInstance::getInstances(); - if (&::JMJNIToAWTContext != NULL) { - JMAWTContextRef contextRef = ::JMJNIToAWTContext(mSession->getSessionRef(), jenv); - if (contextRef != NULL) { - while (instance != NULL) { - if (instance->getContext()->getContextRef() == contextRef) { - instance->AddRef(); - return instance; - } - instance = instance->getNextInstance(); - } - } - } else { - if (instance != NULL) { - instance->AddRef(); - return instance; - } - } + // Apple will provide an API that maps a JNIEnv to an JMAWTContextRef. We can map this to the MRJContext/Applet/Instance. + MRJPluginInstance* instance = MRJPluginInstance::getInstances(); + if (&::JMJNIToAWTContext != NULL) { + JMAWTContextRef contextRef = ::JMJNIToAWTContext(mSession->getSessionRef(), jenv); + if (contextRef != NULL) { + while (instance != NULL) { + if (instance->getContext()->getContextRef() == contextRef) { + instance->AddRef(); + return instance; + } + instance = instance->getNextInstance(); + } + } + } else { + if (instance != NULL) { + instance->AddRef(); + return instance; + } + } #endif - return NULL; + return NULL; } Boolean MRJPlugin::inPluginThread() { - Boolean result = false; - nsPluginThread *currentThreadID = NULL; - - if (mThreadManager != NULL) - mThreadManager->GetCurrentThread(¤tThreadID); - if ((NULL != currentThreadID) && (NULL != mPluginThreadID)) { - if (currentThreadID == mPluginThreadID) { - result = true; - } - } - - return result; + Boolean result = false; + nsPluginThread *currentThreadID = NULL; + + if (mThreadManager != NULL) + mThreadManager->GetCurrentThread(¤tThreadID); + if ((NULL != currentThreadID) && (NULL != mPluginThreadID)) { + if (currentThreadID == mPluginThreadID) { + result = true; + } + } + + return result; } #pragma mark *** MRJPluginInstance *** const InterfaceInfo MRJPluginInstance::sInterfaces[] = { - { NS_IPLUGININSTANCE_IID, INTERFACE_OFFSET(MRJPluginInstance, nsIPluginInstance) }, - { NS_IJVMPLUGININSTANCE_IID, INTERFACE_OFFSET(MRJPluginInstance, nsIJVMPluginInstance) }, - { NS_IEVENTHANDLER_IID, INTERFACE_OFFSET(MRJPluginInstance, nsIEventHandler) }, + { NS_IPLUGININSTANCE_IID, INTERFACE_OFFSET(MRJPluginInstance, nsIPluginInstance) }, + { NS_IJVMPLUGININSTANCE_IID, INTERFACE_OFFSET(MRJPluginInstance, nsIJVMPluginInstance) }, + { NS_IEVENTHANDLER_IID, INTERFACE_OFFSET(MRJPluginInstance, nsIEventHandler) }, }; const UInt32 MRJPluginInstance::kInterfaceCount = sizeof(sInterfaces) / sizeof(InterfaceInfo); MRJPluginInstance::MRJPluginInstance(MRJPlugin* plugin) - : SupportsMixin(this, sInterfaces, kInterfaceCount), - mPeer(NULL), mWindowlessPeer(NULL), - mPlugin(plugin), mSession(plugin->getSession()), - mContext(NULL), mApplet(NULL), mPluginWindow(NULL), - mNext(NULL) + : SupportsMixin(this, sInterfaces, kInterfaceCount), + mPeer(NULL), mWindowlessPeer(NULL), + mPlugin(plugin), mSession(plugin->getSession()), + mContext(NULL), mApplet(NULL), mPluginWindow(NULL), + mNext(NULL) { - // add this instance to the instance list. - pushInstance(); + // add this instance to the instance list. + pushInstance(); - // Tell the plugin we are retaining a reference. - mPlugin->AddRef(); + // Tell the plugin we are retaining a reference. + mPlugin->AddRef(); } MRJPluginInstance::~MRJPluginInstance() { - // Remove this instance from the global list. - popInstance(); + // Remove this instance from the global list. + popInstance(); #if 0 - if (mContext != NULL) { - delete mContext; - mContext = NULL; - } + if (mContext != NULL) { + delete mContext; + mContext = NULL; + } - if (mPlugin != NULL) { - mPlugin->Release(); - mPlugin = NULL; - } + if (mPlugin != NULL) { + mPlugin->Release(); + mPlugin = NULL; + } - if (mWindowlessPeer != NULL) { - mWindowlessPeer->Release(); - mWindowlessPeer = NULL; - } + if (mWindowlessPeer != NULL) { + mWindowlessPeer->Release(); + mWindowlessPeer = NULL; + } - if (mPeer != NULL) { - mPeer->Release(); - mPeer = NULL; - } + if (mPeer != NULL) { + mPeer->Release(); + mPeer = NULL; + } - if (mApplet != NULL) { - JNIEnv* env = mSession->getCurrentEnv(); - env->DeleteGlobalRef(mApplet); - mApplet = NULL; - } + if (mApplet != NULL) { + JNIEnv* env = mSession->getCurrentEnv(); + env->DeleteGlobalRef(mApplet); + mApplet = NULL; + } #endif } @@ -576,224 +637,224 @@ static const char* kGetDocumentBaseScriptURL = "javascript:window.location"; static bool hasTagInfo(nsISupports* supports) { - nsIJVMPluginTagInfo* tagInfo; - if (supports->QueryInterface(NS_GET_IID(nsIJVMPluginTagInfo), (void**)&tagInfo) == NS_OK) { - NS_RELEASE(tagInfo); - return true; - } - return false; + nsIJVMPluginTagInfo* tagInfo; + if (supports->QueryInterface(NS_GET_IID(nsIJVMPluginTagInfo), (void**)&tagInfo) == NS_OK) { + NS_RELEASE(tagInfo); + return true; + } + return false; } NS_METHOD MRJPluginInstance::Initialize(nsIPluginInstancePeer* peer) { - // Tell the peer we are retaining a reference. - mPeer = peer; - mPeer->AddRef(); + // Tell the peer we are retaining a reference. + mPeer = peer; + mPeer->AddRef(); - // See if we have a windowless peer. - nsresult result = mPeer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void**)&mWindowlessPeer); - if (result != NS_OK) mWindowlessPeer = NULL; + // See if we have a windowless peer. + nsresult result = mPeer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void**)&mWindowlessPeer); + if (result != NS_OK) mWindowlessPeer = NULL; - // create a context for the applet we will run. - mContext = new MRJContext(mSession, this); + // create a context for the applet we will run. + mContext = new MRJContext(mSession, this); - if (hasTagInfo(mPeer)) { - mContext->processAppletTag(); - mContext->createContext(); - } else { - // we'll be using JavaScript to create windows. - // fire up a JavaScript URL to get the current document's location. - nsIPluginInstance* pluginInstance = this; - nsIPluginStreamListener* listener = this; - result = thePluginManager->GetURL(pluginInstance, kGetDocumentBaseScriptURL, NULL, listener); - } + if (hasTagInfo(mPeer)) { + mContext->processAppletTag(); + mContext->createContext(); + } else { + // we'll be using JavaScript to create windows. + // fire up a JavaScript URL to get the current document's location. + nsIPluginInstance* pluginInstance = this; + nsIPluginStreamListener* listener = this; + result = thePluginManager->GetURL(pluginInstance, kGetDocumentBaseScriptURL, NULL, listener); + } - return NS_OK; + return NS_OK; } NS_METHOD MRJPluginInstance::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, nsIInputStream* input, PRUint32 length) { - // hopefully all our data is available. - char* documentBase = new char[length + 1]; - if (documentBase != NULL) { - if (input->Read(documentBase, length, &length) == NS_OK) { - // We've delayed processing the applet tag, because we - // don't know the location of the current document yet. - documentBase[length] = '\0'; - - // set up the default document location, which can be used to compute relative CODEBASE, etc. - mContext->setDocumentBase(documentBase); - delete[] documentBase; - - mContext->processAppletTag(); - mContext->createContext(); - - // SetWindow may be called at an inopportune time. - if (mPluginWindow != NULL) - mContext->setWindow(mPluginWindow); - } - } - return NS_OK; + // hopefully all our data is available. + char* documentBase = new char[length + 1]; + if (documentBase != NULL) { + if (input->Read(documentBase, length, &length) == NS_OK) { + // We've delayed processing the applet tag, because we + // don't know the location of the current document yet. + documentBase[length] = '\0'; + + // set up the default document location, which can be used to compute relative CODEBASE, etc. + mContext->setDocumentBase(documentBase); + delete[] documentBase; + + mContext->processAppletTag(); + mContext->createContext(); + + // SetWindow may be called at an inopportune time. + if (mPluginWindow != NULL) + mContext->setWindow(mPluginWindow); + } + } + return NS_OK; } NS_METHOD MRJPluginInstance::GetPeer(nsIPluginInstancePeer* *result) { - mPeer->AddRef(); - *result = mPeer; - return NS_OK; + mPeer->AddRef(); + *result = mPeer; + return NS_OK; } NS_METHOD MRJPluginInstance::Start() { - // Take this moment to show the applet's frames (if any). - mContext->showFrames(); - - mContext->resumeApplet(); - - return NS_OK; + // Take this moment to show the applet's frames (if any). + mContext->showFrames(); + + mContext->resumeApplet(); + + return NS_OK; } NS_METHOD MRJPluginInstance::Stop() { - // Take this moment to hide the applet's frames. - mContext->hideFrames(); + // Take this moment to hide the applet's frames. + mContext->hideFrames(); - mContext->suspendApplet(); + mContext->suspendApplet(); - return NS_OK; + return NS_OK; } NS_METHOD MRJPluginInstance::Destroy() { - // Use this opportunity to break any cycles that might exist, and reduce - // reference counts to their minimum values. - if (mContext != NULL) { - delete mContext; - mContext = NULL; - } + // Use this opportunity to break any cycles that might exist, and reduce + // reference counts to their minimum values. + if (mContext != NULL) { + delete mContext; + mContext = NULL; + } - if (mPlugin != NULL) { - mPlugin->Release(); - mPlugin = NULL; - } + if (mPlugin != NULL) { + mPlugin->Release(); + mPlugin = NULL; + } - if (mWindowlessPeer != NULL) { - mWindowlessPeer->Release(); - mWindowlessPeer = NULL; - } + if (mWindowlessPeer != NULL) { + mWindowlessPeer->Release(); + mWindowlessPeer = NULL; + } - if (mPeer != NULL) { - mPeer->Release(); - mPeer = NULL; - } + if (mPeer != NULL) { + mPeer->Release(); + mPeer = NULL; + } - if (mApplet != NULL) { - JNIEnv* env = mSession->getCurrentEnv(); - env->DeleteGlobalRef(mApplet); - mApplet = NULL; - } + if (mApplet != NULL) { + JNIEnv* env = mSession->getCurrentEnv(); + env->DeleteGlobalRef(mApplet); + mApplet = NULL; + } - return NS_OK; + return NS_OK; } /** FIXME: Need an intelligent way to track changes to the NPPluginWindow. */ NS_METHOD MRJPluginInstance::SetWindow(nsPluginWindow* pluginWindow) { - mPluginWindow = pluginWindow; + mPluginWindow = pluginWindow; - mContext->setWindow(pluginWindow); + mContext->setWindow(pluginWindow); - return NS_OK; + return NS_OK; } NS_METHOD MRJPluginInstance::HandleEvent(nsPluginEvent* pluginEvent, PRBool* eventHandled) { - *eventHandled = PR_TRUE; + *eventHandled = PR_TRUE; - if (pluginEvent != NULL) { - EventRecord* event = pluginEvent->event; + if (pluginEvent != NULL) { + EventRecord* event = pluginEvent->event; - // Check for coordinate/clipping changes. - // Too bad nsPluginEventType_ClippingChangedEvent events aren't implemented. - inspectInstance(); - - if (event->what == nullEvent) { - // Give MRJ another quantum of time. - mSession->idle(kDefaultJMTime); // now SpendTime does this. - } else { + // Check for coordinate/clipping changes. + // Too bad nsPluginEventType_ClippingChangedEvent events aren't implemented. + inspectInstance(); + + if (event->what == nullEvent) { + // Give MRJ another quantum of time. + mSession->idle(kDefaultJMTime); // now SpendTime does this. + } else { #if TARGET_CARBON - *eventHandled = mContext->handleEvent(event); + *eventHandled = mContext->handleEvent(event); #else - MRJFrame* frame = mContext->findFrame(pluginEvent->window); - if (frame != NULL) { - switch (event->what) { - case nsPluginEventType_GetFocusEvent: - frame->focusEvent(true); - break; - - case nsPluginEventType_LoseFocusEvent: - frame->focusEvent(false); - break; + MRJFrame* frame = mContext->findFrame(pluginEvent->window); + if (frame != NULL) { + switch (event->what) { + case nsPluginEventType_GetFocusEvent: + frame->focusEvent(true); + break; + + case nsPluginEventType_LoseFocusEvent: + frame->focusEvent(false); + break; - case nsPluginEventType_AdjustCursorEvent: - frame->idle(event->modifiers); - break; - - case nsPluginEventType_MenuCommandEvent: - frame->menuSelected(event->message, event->modifiers); - break; - - default: - *eventHandled = frame->handleEvent(event); - break; - } - } else { - if (event->what == updateEvt) { - mContext->drawApplet(); - } - } + case nsPluginEventType_AdjustCursorEvent: + frame->idle(event->modifiers); + break; + + case nsPluginEventType_MenuCommandEvent: + frame->menuSelected(event->message, event->modifiers); + break; + + default: + *eventHandled = frame->handleEvent(event); + break; + } + } else { + if (event->what == updateEvt) { + mContext->drawApplet(); + } + } #endif - } - } - - return NS_OK; + } + } + + return NS_OK; } NS_METHOD MRJPluginInstance::Print(nsPluginPrint* platformPrint) { - if (platformPrint->mode == nsPluginMode_Embedded) { - mContext->printApplet(&platformPrint->print.embedPrint.window); - return NS_OK; - } - return NS_ERROR_NOT_IMPLEMENTED; + if (platformPrint->mode == nsPluginMode_Embedded) { + mContext->printApplet(&platformPrint->print.embedPrint.window); + return NS_OK; + } + return NS_ERROR_NOT_IMPLEMENTED; } NS_METHOD MRJPluginInstance::GetValue(nsPluginInstanceVariable variable, void *value) { - switch (variable) { - case nsPluginInstanceVariable_WindowlessBool: - *(PRBool*)value = PR_FALSE; - break; - case nsPluginInstanceVariable_TransparentBool: - *(PRBool*)value = PR_FALSE; - break; - case nsPluginInstanceVariable_DoCacheBool: - *(PRBool*)value = PR_FALSE; - break; - } - return NS_OK; + switch (variable) { + case nsPluginInstanceVariable_WindowlessBool: + *(PRBool*)value = PR_FALSE; + break; + case nsPluginInstanceVariable_TransparentBool: + *(PRBool*)value = PR_FALSE; + break; + case nsPluginInstanceVariable_DoCacheBool: + *(PRBool*)value = PR_FALSE; + break; + } + return NS_OK; } NS_METHOD MRJPluginInstance::GetJavaObject(jobject *result) { - if (mApplet == NULL) { - jobject applet = mContext->getApplet(); - JNIEnv* env = mSession->getCurrentEnv(); - mApplet = env->NewGlobalRef(applet); - } - *result = mApplet; - return NS_OK; + if (mApplet == NULL) { + jobject applet = mContext->getApplet(); + JNIEnv* env = mSession->getCurrentEnv(); + mApplet = env->NewGlobalRef(applet); + } + *result = mApplet; + return NS_OK; } // Accessing the list of instances. @@ -802,43 +863,43 @@ static MRJPluginInstance* theInstances = NULL; void MRJPluginInstance::pushInstance() { - mNext = theInstances; - theInstances = this; + mNext = theInstances; + theInstances = this; } void MRJPluginInstance::popInstance() { - MRJPluginInstance** link = &theInstances; - MRJPluginInstance* instance = *link; - while (instance != NULL) { - if (instance == this) { - *link = mNext; - mNext = NULL; - break; - } - link = &instance->mNext; - instance = *link; - } + MRJPluginInstance** link = &theInstances; + MRJPluginInstance* instance = *link; + while (instance != NULL) { + if (instance == this) { + *link = mNext; + mNext = NULL; + break; + } + link = &instance->mNext; + instance = *link; + } } MRJPluginInstance* MRJPluginInstance::getInstances() { - return theInstances; + return theInstances; } MRJPluginInstance* MRJPluginInstance::getNextInstance() { - return mNext; + return mNext; } MRJContext* MRJPluginInstance::getContext() { - return mContext; + return mContext; } MRJSession* MRJPluginInstance::getSession() { - return mSession; + return mSession; } void MRJPluginInstance::inspectInstance() diff --git a/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.h b/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.h index 6415179720a..0969bd48ad9 100644 --- a/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.h +++ b/mozilla/plugin/oji/MRJCarbon/plugin/Source/MRJPlugin.h @@ -35,21 +35,22 @@ * ----- END LICENSE BLOCK ----- */ /* - MRJPlugin.h - - MRJPlugin encapsulates the global state of the MRJ plugin as a single COM object. - MRJPluginInstance represents an instance of the MRJ plugin. - - by Patrick C. Beard. + MRJPlugin.h + + MRJPlugin encapsulates the global state of the MRJ plugin as a single COM object. + MRJPluginInstance represents an instance of the MRJ plugin. + + by Patrick C. Beard. */ #pragma once #include "nsIPlugin.h" -#include "nsIJVMPlugin.h" -#include "nsIThreadManager.h" #include "nsIPluginInstance.h" +#include "nsIJVMPlugin.h" +#include "nsIJVMConsole.h" #include "nsIJVMPluginInstance.h" +#include "nsIThreadManager.h" #include "nsIEventHandler.h" #include "nsIPluginStreamListener.h" #include "SupportsMixin.h" @@ -62,45 +63,50 @@ class MRJConsole; class nsIJVMManager; -class MRJPlugin : public nsIPlugin, public nsIJVMPlugin, - public nsIRunnable, public SupportsMixin { +class MRJPlugin : public nsIPlugin, public nsIJVMPlugin, + public nsIJVMConsole, public nsIRunnable, + public SupportsMixin { public: - MRJPlugin(); - virtual ~MRJPlugin(); + MRJPlugin(); + virtual ~MRJPlugin(); static nsresult GetService(const nsCID &aCID, const nsIID& aIID, void* *aService); static nsresult GetService(const char* aContractID, const nsIID& aIID, void* *aService); - - // NS_DECL_ISUPPORTS - NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD_(nsrefcnt) AddRef(void) { return addRef(); } - NS_IMETHOD_(nsrefcnt) Release(void) { return release(); } - - // The Release method on NPIPlugin corresponds to NPP_Shutdown. + + // NS_DECL_ISUPPORTS +#if USE_SYSTEM_CONSOLE + DECL_SUPPORTS_MIXIN +#else + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); + NS_IMETHOD_(nsrefcnt) AddRef(void) { return addRef(); } + NS_IMETHOD_(nsrefcnt) Release(void) { return release(); } +#endif - // The old NPP_New call has been factored into two plugin instance methods: - // - // NewInstance -- called once, after the plugin instance is created. This - // method is used to initialize the new plugin instance (although the actual - // plugin instance object will be created by the plugin manager). - // - // NPIPluginInstance::Start -- called when the plugin instance is to be - // started. This happens in two circumstances: (1) after the plugin instance - // is first initialized, and (2) after a plugin instance is returned to - // (e.g. by going back in the window history) after previously being stopped - // by the Stop method. + // The Release method on NPIPlugin corresponds to NPP_Shutdown. - // nsIFactory Methods. - - NS_IMETHOD - CreateInstance(nsISupports *aOuter, const nsIID& aIID, void **aResult); + // The old NPP_New call has been factored into two plugin instance methods: + // + // NewInstance -- called once, after the plugin instance is created. This + // method is used to initialize the new plugin instance (although the actual + // plugin instance object will be created by the plugin manager). + // + // NPIPluginInstance::Start -- called when the plugin instance is to be + // started. This happens in two circumstances: (1) after the plugin instance + // is first initialized, and (2) after a plugin instance is returned to + // (e.g. by going back in the window history) after previously being stopped + // by the Stop method. - NS_IMETHOD - LockFactory(PRBool aLock) { return NS_ERROR_NOT_IMPLEMENTED; } + // nsIFactory Methods. + + NS_IMETHOD + CreateInstance(nsISupports *aOuter, const nsIID& aIID, void **aResult); - // nsIPlugin Methods. - - /** + NS_IMETHOD + LockFactory(PRBool aLock) { return NS_ERROR_NOT_IMPLEMENTED; } + + // nsIPlugin Methods. + + /** * Creates a new plugin instance, based on the MIME type. This * allows different impelementations to be created depending on * the specified MIME type. @@ -157,14 +163,14 @@ public: NS_IMETHOD GetValue(nsPluginVariable variable, void *value); - // JVM Plugin Methods. + // nsIJVMPlugin Methods. // This method us used to start the Java virtual machine. // It sets up any global state necessary to host Java programs. // Note that calling this method is distinctly separate from // initializing the nsIJVMPlugin object (done by the Initialize // method). - NS_IMETHOD + nsresult StartupJVM(void); // Causes the JVM to append a new directory to its classpath. @@ -177,7 +183,7 @@ public: NS_IMETHOD RemoveFromClassPath(const char* dirPath) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_ERROR_NOT_IMPLEMENTED; } // Returns the current classpath in use by the JVM. @@ -187,65 +193,82 @@ public: NS_IMETHOD GetJavaWrapper(JNIEnv* env, jint jsobj, jobject *jobj); - /** - * This creates a new secure communication channel with Java. The second parameter, - * nativeEnv, if non-NULL, will be the actual thread for Java communication. - * Otherwise, a new thread should be created. - * @param proxyEnv the env to be used by all clients on the browser side - * @return outSecureEnv the secure environment used by the proxyEnv - */ - NS_IMETHOD - CreateSecureEnv(JNIEnv* proxyEnv, nsISecureEnv* *outSecureEnv); + /** + * This creates a new secure communication channel with Java. The second parameter, + * nativeEnv, if non-NULL, will be the actual thread for Java communication. + * Otherwise, a new thread should be created. + * @param proxyEnv the env to be used by all clients on the browser side + * @return outSecureEnv the secure environment used by the proxyEnv + */ + NS_IMETHOD + CreateSecureEnv(JNIEnv* proxyEnv, nsISecureEnv* *outSecureEnv); - /** - * Gives time to the JVM from the main event loop of the browser. This is - * necessary when there aren't any plugin instances around, but Java threads exist. - */ - NS_IMETHOD - SpendTime(PRUint32 timeMillis); - - NS_IMETHOD - UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj); + /** + * Gives time to the JVM from the main event loop of the browser. This is + * necessary when there aren't any plugin instances around, but Java threads exist. + */ + NS_IMETHOD + SpendTime(PRUint32 timeMillis); + + NS_IMETHOD + UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj); - /** - * The Run method gives time to the JVM periodically. This makes SpendTIme() obsolete. - */ - NS_IMETHOD - Run(); - - // NON-INTERFACE methods, for internal use only. - MRJSession* getSession(); - nsIJVMManager* getManager(); - nsIThreadManager* getThreadManager(); + // nsIJVMConsole methods - MRJPluginInstance* getPluginInstance(jobject applet); + NS_IMETHOD + Show(void); + + NS_IMETHOD + Hide(void); + + NS_IMETHOD + IsVisible(PRBool *result); + + NS_IMETHOD + Print(const char* msg, const char* encodingName = NULL); + + // nsIRunnable methods + + /** + * The Run method gives time to the JVM periodically. This makes SpendTIme() obsolete. + */ + NS_IMETHOD + Run(); + + // NON-INTERFACE methods, for internal use only. + + MRJSession* getSession(); + nsIJVMManager* getManager(); + nsIThreadManager* getThreadManager(); + + MRJPluginInstance* getPluginInstance(jobject applet); MRJPluginInstance* getPluginInstance(JNIEnv* jenv); Boolean inPluginThread(); - + private: - nsIJVMManager* mManager; - nsIThreadManager* mThreadManager; - MRJSession* mSession; + nsIJVMManager* mManager; + nsIThreadManager* mThreadManager; + MRJSession* mSession; MRJConsole* mConsole; nsPluginThread *mPluginThreadID; - Boolean mIsEnabled; - - // support for SupportsMixin. - static const InterfaceInfo sInterfaces[]; - static const UInt32 kInterfaceCount; + Boolean mIsEnabled; + + // support for SupportsMixin. + static const InterfaceInfo sInterfaces[]; + static const UInt32 kInterfaceCount; }; -class MRJPluginInstance : public nsIPluginInstance, public nsIJVMPluginInstance, - public nsIEventHandler, public nsIPluginStreamListener, - private SupportsMixin { +class MRJPluginInstance : public nsIPluginInstance, public nsIJVMPluginInstance, + public nsIEventHandler, public nsIPluginStreamListener, + private SupportsMixin { public: - MRJPluginInstance(MRJPlugin* plugin); - virtual ~MRJPluginInstance(); + MRJPluginInstance(MRJPlugin* plugin); + virtual ~MRJPluginInstance(); - // NS_DECL_ISUPPORTS - DECL_SUPPORTS_MIXIN + // NS_DECL_ISUPPORTS + DECL_SUPPORTS_MIXIN // (Corresponds to NPP_HandleEvent.) NS_IMETHOD @@ -292,8 +315,8 @@ public: * * @result - NS_OK if this operation was successful */ - NS_IMETHOD - Stop(void); + NS_IMETHOD + Stop(void); /** * Called to instruct the plugin instance to destroy itself. This is called when @@ -303,8 +326,8 @@ public: * * @result - NS_OK if this operation was successful */ - NS_IMETHOD - Destroy(void); + NS_IMETHOD + Destroy(void); /** * Called when the window containing the plugin instance changes. @@ -314,12 +337,12 @@ public: * @param window - the plugin window structure * @result - NS_OK if this operation was successful */ - NS_IMETHOD - SetWindow(nsPluginWindow* window); + NS_IMETHOD + SetWindow(nsPluginWindow* window); /** * Called to tell the plugin that the initial src/data stream is - * ready. Expects the plugin to return a nsIPluginStreamListener. + * ready. Expects the plugin to return a nsIPluginStreamListener. * * (Corresponds to NPP_NewStream.) * @@ -328,11 +351,11 @@ public: */ NS_IMETHOD NewStream(nsIPluginStreamListener** listener) - { - *listener = this; - AddRef(); - return NS_OK; - } + { + *listener = this; + AddRef(); + return NS_OK; + } /** * Called to instruct the plugin instance to print itself to a printer. @@ -355,7 +378,7 @@ public: NS_IMETHOD GetValue(nsPluginInstanceVariable variable, void *value); - // nsIJVMPluginInstance methods. + // nsIJVMPluginInstance methods. // This method is called when LiveConnect wants to find the Java object // associated with this plugin instance, e.g. the Applet or JavaBean object. @@ -366,11 +389,11 @@ public: GetText(const char* *result) { *result = NULL; - return NS_OK; + return NS_OK; } - // nsIPluginStreamListener implementation. - + // nsIPluginStreamListener implementation. + /** * Notify the observer that the URL has started to load. This method is * called only once, at the beginning of a URL load.

@@ -381,7 +404,7 @@ public: NS_IMETHOD OnStartBinding(nsIPluginStreamInfo* pluginInfo) { - return NS_OK; + return NS_OK; } /** @@ -400,9 +423,9 @@ public: NS_IMETHOD OnFileAvailable(nsIPluginStreamInfo* pluginInfo, const char* fileName) { - return NS_ERROR_NOT_IMPLEMENTED; - } - + return NS_ERROR_NOT_IMPLEMENTED; + } + /** * Notify the observer that the URL has finished loading. This method is * called once when the networking library has finished processing the @@ -417,17 +440,17 @@ public: NS_IMETHOD OnStopBinding(nsIPluginStreamInfo* pluginInfo, nsresult status) { - return NS_OK; + return NS_OK; } - /** - * What is this method supposed to do? - */ + /** + * What is this method supposed to do? + */ NS_IMETHOD GetStreamType(nsPluginStreamType *result) { - *result = nsPluginStreamType_Normal; - return NS_OK; + *result = nsPluginStreamType_Normal; + return NS_OK; } // Accessing the list of instances. @@ -438,9 +461,9 @@ public: MRJSession* getSession(void); private: - void pushInstance(void); - void popInstance(void); - void inspectInstance(void); + void pushInstance(void); + void popInstance(void); + void inspectInstance(void); private: nsIPluginInstancePeer* mPeer; @@ -454,7 +477,7 @@ private: // maintain a list of instances. MRJPluginInstance* mNext; - // support for SupportsMixin. - static const InterfaceInfo sInterfaces[]; - static const UInt32 kInterfaceCount; + // support for SupportsMixin. + static const InterfaceInfo sInterfaces[]; + static const UInt32 kInterfaceCount; };