зеркало из https://github.com/mozilla/pjs.git
1.) WebShell no longer implements nsIScriptContextOwner.
2.) WebShell now implements the new nsIScriptGlobalObjectOwner. 3.) WebShell supports GetInterface to nsIScriptGlobalObject. 4.) Documents no longer carry around a reference to nsIScriptContextOwner. Instead they hold on to a nsIScriptGlobalObject. nsIDocument::GetScriptContextOwner has now become nsIDocument::GetScriptGlobalObject(). Same change to the set methods.
This commit is contained in:
Родитель
12cf325764
Коммит
fb7fad4bed
|
@ -35,7 +35,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
|
@ -781,31 +780,23 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSWindow(JSObject* *outJSWindow)
|
|||
*outJSWindow = NULL;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
NS_WITH_SERVICE ( nsIJVMManager, jvm, nsIJVMManager::GetCID(), &rv);
|
||||
if ( NS_SUCCEEDED ( rv ) && jvm != nsnull )
|
||||
{
|
||||
nsIDocument* document = nsnull;
|
||||
if (mOwner->GetDocument(&document) == NS_OK) {
|
||||
nsIScriptContextOwner* contextOwner = document->GetScriptContextOwner();
|
||||
if (nsnull != contextOwner) {
|
||||
nsIScriptGlobalObject *global = nsnull;
|
||||
contextOwner->GetScriptGlobalObject(&global);
|
||||
nsIScriptContext* context = nsnull;
|
||||
contextOwner->GetScriptContext(&context);
|
||||
if (nsnull != global && nsnull != context) {
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
nsIScriptObjectOwner* window = nsnull;
|
||||
if (global->QueryInterface(kIScriptObjectOwnerIID, (void **)&window) == NS_OK) {
|
||||
rv = window->GetScriptObject(context, (void**)outJSWindow);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(global);
|
||||
NS_IF_RELEASE(context);
|
||||
NS_RELEASE(contextOwner);
|
||||
}
|
||||
NS_RELEASE(document);
|
||||
}
|
||||
}
|
||||
if ( NS_SUCCEEDED ( rv ) && jvm != nsnull ) {
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (mOwner->GetDocument(getter_AddRefs(document)) == NS_OK) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
document->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if(global) {
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
global->GetContext(getter_AddRefs(context));
|
||||
if (nsnull != context) {
|
||||
nsCOMPtr<nsIScriptObjectOwner> window(do_QueryInterface(global));
|
||||
if (window) {
|
||||
rv = window->GetScriptObject(context, (void**)outJSWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -821,21 +812,19 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSContext(JSContext* *outContext)
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
NS_WITH_SERVICE(nsIJVMManager, jvm, nsIJVMManager::GetCID(), &rv);
|
||||
if (NS_SUCCEEDED(rv) && jvm != nsnull ) {
|
||||
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) {
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (mOwner->GetDocument(getter_AddRefs(document)) == NS_OK) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
document->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if (global) {
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
if (global->GetContext(getter_AddRefs(context)) == NS_OK) {
|
||||
*outContext = (JSContext*) context->GetNativeContext();
|
||||
NS_RELEASE(context);
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_RELEASE(contextOwner);
|
||||
}
|
||||
NS_RELEASE(document);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
|
@ -781,31 +780,23 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSWindow(JSObject* *outJSWindow)
|
|||
*outJSWindow = NULL;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
NS_WITH_SERVICE ( nsIJVMManager, jvm, nsIJVMManager::GetCID(), &rv);
|
||||
if ( NS_SUCCEEDED ( rv ) && jvm != nsnull )
|
||||
{
|
||||
nsIDocument* document = nsnull;
|
||||
if (mOwner->GetDocument(&document) == NS_OK) {
|
||||
nsIScriptContextOwner* contextOwner = document->GetScriptContextOwner();
|
||||
if (nsnull != contextOwner) {
|
||||
nsIScriptGlobalObject *global = nsnull;
|
||||
contextOwner->GetScriptGlobalObject(&global);
|
||||
nsIScriptContext* context = nsnull;
|
||||
contextOwner->GetScriptContext(&context);
|
||||
if (nsnull != global && nsnull != context) {
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
nsIScriptObjectOwner* window = nsnull;
|
||||
if (global->QueryInterface(kIScriptObjectOwnerIID, (void **)&window) == NS_OK) {
|
||||
rv = window->GetScriptObject(context, (void**)outJSWindow);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(global);
|
||||
NS_IF_RELEASE(context);
|
||||
NS_RELEASE(contextOwner);
|
||||
}
|
||||
NS_RELEASE(document);
|
||||
}
|
||||
}
|
||||
if ( NS_SUCCEEDED ( rv ) && jvm != nsnull ) {
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (mOwner->GetDocument(getter_AddRefs(document)) == NS_OK) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
document->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if(global) {
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
global->GetContext(getter_AddRefs(context));
|
||||
if (nsnull != context) {
|
||||
nsCOMPtr<nsIScriptObjectOwner> window(do_QueryInterface(global));
|
||||
if (window) {
|
||||
rv = window->GetScriptObject(context, (void**)outJSWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -821,21 +812,19 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetJSContext(JSContext* *outContext)
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
NS_WITH_SERVICE(nsIJVMManager, jvm, nsIJVMManager::GetCID(), &rv);
|
||||
if (NS_SUCCEEDED(rv) && jvm != nsnull ) {
|
||||
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) {
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (mOwner->GetDocument(getter_AddRefs(document)) == NS_OK) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
document->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if (global) {
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
if (global->GetContext(getter_AddRefs(context)) == NS_OK) {
|
||||
*outContext = (JSContext*) context->GetNativeContext();
|
||||
NS_RELEASE(context);
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_RELEASE(contextOwner);
|
||||
}
|
||||
NS_RELEASE(document);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче