зеркало из https://github.com/mozilla/gecko-dev.git
added GetJSContext()
This commit is contained in:
Родитель
0fea208890
Коммит
fe7b181a91
|
@ -22,6 +22,7 @@
|
|||
#include "nsIPluginInstancePeer.h"
|
||||
|
||||
struct JSObject;
|
||||
struct JSContext;
|
||||
|
||||
// {e7d48c00-e1f1-11d2-8360-fbc8abc4ae7c}
|
||||
#define NS_IPLUGININSTANCEPEER2_IID \
|
||||
|
@ -54,6 +55,15 @@ public:
|
|||
*/
|
||||
NS_IMETHOD
|
||||
GetJSThread(PRUint32 *outThreadID) = 0;
|
||||
|
||||
/**
|
||||
* Get the JavaScript context to this plugin instance.
|
||||
*
|
||||
* @param outContext - the resulting JavaScript context
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetJSContext(JSContext* *outContext) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -803,6 +803,29 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSThread(PRUint32 *outThreadID)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSContext(JSContext* *outContext)
|
||||
{
|
||||
*outContext = NULL;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
#if defined(OJI)
|
||||
nsIDocument* document = nsnull;
|
||||
if (mOwner->GetDocument(&document) == NS_OK) {
|
||||
nsIScriptContextOwner* contextOwner = document->GetScriptContextOwner();
|
||||
if (nsnull != contextOwner) {
|
||||
nsIScriptContext* context = nsnull;
|
||||
if (contextOwner->GetScriptContext(&context) == NS_OK) {
|
||||
*outContext = (JSContext*) context->GetNativeContext();
|
||||
NS_RELEASE(context);
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_RELEASE(contextOwner);
|
||||
}
|
||||
NS_RELEASE(document);
|
||||
}
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsPluginInstancePeerImpl::Initialize(nsIPluginInstanceOwner *aOwner,
|
||||
const nsMIMEType aMIMEType)
|
||||
{
|
||||
|
|
|
@ -66,6 +66,9 @@ public:
|
|||
NS_IMETHOD
|
||||
GetJSThread(PRUint32 *outThreadID);
|
||||
|
||||
NS_IMETHOD
|
||||
GetJSContext(JSContext* *outContext);
|
||||
|
||||
// nsIWindowlessPluginInstancePeer
|
||||
|
||||
// (Corresponds to NPN_InvalidateRect.)
|
||||
|
|
|
@ -803,6 +803,29 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSThread(PRUint32 *outThreadID)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSContext(JSContext* *outContext)
|
||||
{
|
||||
*outContext = NULL;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
#if defined(OJI)
|
||||
nsIDocument* document = nsnull;
|
||||
if (mOwner->GetDocument(&document) == NS_OK) {
|
||||
nsIScriptContextOwner* contextOwner = document->GetScriptContextOwner();
|
||||
if (nsnull != contextOwner) {
|
||||
nsIScriptContext* context = nsnull;
|
||||
if (contextOwner->GetScriptContext(&context) == NS_OK) {
|
||||
*outContext = (JSContext*) context->GetNativeContext();
|
||||
NS_RELEASE(context);
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_RELEASE(contextOwner);
|
||||
}
|
||||
NS_RELEASE(document);
|
||||
}
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsPluginInstancePeerImpl::Initialize(nsIPluginInstanceOwner *aOwner,
|
||||
const nsMIMEType aMIMEType)
|
||||
{
|
||||
|
|
|
@ -66,6 +66,9 @@ public:
|
|||
NS_IMETHOD
|
||||
GetJSThread(PRUint32 *outThreadID);
|
||||
|
||||
NS_IMETHOD
|
||||
GetJSContext(JSContext* *outContext);
|
||||
|
||||
// nsIWindowlessPluginInstancePeer
|
||||
|
||||
// (Corresponds to NPN_InvalidateRect.)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsIPluginInstancePeer.h"
|
||||
|
||||
struct JSObject;
|
||||
struct JSContext;
|
||||
|
||||
// {e7d48c00-e1f1-11d2-8360-fbc8abc4ae7c}
|
||||
#define NS_IPLUGININSTANCEPEER2_IID \
|
||||
|
@ -54,6 +55,15 @@ public:
|
|||
*/
|
||||
NS_IMETHOD
|
||||
GetJSThread(PRUint32 *outThreadID) = 0;
|
||||
|
||||
/**
|
||||
* Get the JavaScript context to this plugin instance.
|
||||
*
|
||||
* @param outContext - the resulting JavaScript context
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetJSContext(JSContext* *outContext) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче