зеркало из https://github.com/mozilla/gecko-dev.git
fixed MRJPlugin::Initialize() to be more robust, added hasTagInfo to determine whether javascript: URL must be used to get the CODEBASE attribute.
This commit is contained in:
Родитель
24790878ed
Коммит
df2dcd4838
|
@ -34,6 +34,7 @@
|
||||||
#include "nsIAllocator.h"
|
#include "nsIAllocator.h"
|
||||||
#include "nsRepository.h"
|
#include "nsRepository.h"
|
||||||
#include "nsIJVMManager.h"
|
#include "nsIJVMManager.h"
|
||||||
|
#include "nsIJVMPluginTagInfo.h"
|
||||||
#include "nsIPluginManager2.h"
|
#include "nsIPluginManager2.h"
|
||||||
#include "nsIPluginInstancePeer.h"
|
#include "nsIPluginInstancePeer.h"
|
||||||
#include "nsIWindowlessPlugInstPeer.h"
|
#include "nsIWindowlessPlugInstPeer.h"
|
||||||
|
@ -218,23 +219,22 @@ NS_METHOD MRJPlugin::Initialize()
|
||||||
|
|
||||||
// see if the enhanced plugin manager exists.
|
// see if the enhanced plugin manager exists.
|
||||||
if (thePluginManager2 == NULL) {
|
if (thePluginManager2 == NULL) {
|
||||||
result = thePluginManager->QueryInterface(kIPluginManager2IID, &thePluginManager2);
|
if (thePluginManager->QueryInterface(kIPluginManager2IID, &thePluginManager2) != NS_OK)
|
||||||
if (result != NS_OK)
|
|
||||||
thePluginManager2 = NULL;
|
thePluginManager2 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to get a JVM manager. we have to be able to run without one.
|
// try to get a JVM manager. we have to be able to run without one.
|
||||||
result = theServiceManager->GetService(kJVMManagerCID, kIJVMManagerIID, (nsISupports**)&mManager);
|
if (theServiceManager->GetService(kJVMManagerCID, kIJVMManagerIID, (nsISupports**)&mManager) != NS_OK)
|
||||||
if (result != NS_OK)
|
|
||||||
mManager = NULL;
|
mManager = NULL;
|
||||||
|
|
||||||
// try to get a Thread manager.
|
// try to get a Thread manager.
|
||||||
result = mManager->QueryInterface(kIThreadManagerIID, &mThreadManager);
|
if (mManager != NULL) {
|
||||||
if (result != NS_OK)
|
if (mManager->QueryInterface(kIThreadManagerIID, &mThreadManager) != NS_OK)
|
||||||
mThreadManager = NULL;
|
mThreadManager = NULL;
|
||||||
|
|
||||||
if (mThreadManager != NULL)
|
if (mThreadManager != NULL)
|
||||||
mThreadManager->GetCurrentThread(&mPluginThreadID);
|
mThreadManager->GetCurrentThread(&mPluginThreadID);
|
||||||
|
}
|
||||||
|
|
||||||
// create a console, only if we can register windows.
|
// create a console, only if we can register windows.
|
||||||
if (thePluginManager2 != NULL) {
|
if (thePluginManager2 != NULL) {
|
||||||
|
@ -531,6 +531,16 @@ MRJPluginInstance::~MRJPluginInstance()
|
||||||
|
|
||||||
static const char* kGetCodeBaseScriptURL = "javascript:var href = window.location.href; href.substring(0, href.lastIndexOf('/') + 1)";
|
static const char* kGetCodeBaseScriptURL = "javascript:var href = window.location.href; href.substring(0, href.lastIndexOf('/') + 1)";
|
||||||
|
|
||||||
|
static bool hasTagInfo(nsISupports* supports)
|
||||||
|
{
|
||||||
|
nsIJVMPluginTagInfo* tagInfo;
|
||||||
|
if (supports->QueryInterface(nsIJVMPluginTagInfo::GetIID(), &tagInfo) == NS_OK) {
|
||||||
|
NS_RELEASE(tagInfo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
NS_METHOD MRJPluginInstance::Initialize(nsIPluginInstancePeer* peer)
|
NS_METHOD MRJPluginInstance::Initialize(nsIPluginInstancePeer* peer)
|
||||||
{
|
{
|
||||||
// Tell the peer we are retaining a reference.
|
// Tell the peer we are retaining a reference.
|
||||||
|
@ -544,7 +554,7 @@ NS_METHOD MRJPluginInstance::Initialize(nsIPluginInstancePeer* peer)
|
||||||
// create a context for the applet we will run.
|
// create a context for the applet we will run.
|
||||||
mContext = new MRJContext(mSession, this);
|
mContext = new MRJContext(mSession, this);
|
||||||
|
|
||||||
if (thePluginManager2 != NULL) {
|
if (hasTagInfo(mPeer)) {
|
||||||
mContext->processAppletTag();
|
mContext->processAppletTag();
|
||||||
mContext->createContext();
|
mContext->createContext();
|
||||||
} else {
|
} else {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче