mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 698395 - Give nsIScriptContext::CreateNativeGlobalForInner a JSObject outparam; r=peterv
This commit is contained in:
parent
6978939921
commit
42eac2ef8e
@ -2077,13 +2077,12 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
mCreatingInnerWindow = true;
|
||||
// Every script context we are initialized with must create a
|
||||
// new global.
|
||||
void *&newGlobal = (void *&)newInnerWindow->mJSObject;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> &holder = mInnerWindowHolder;
|
||||
rv = mContext->CreateNativeGlobalForInner(sgo, isChrome,
|
||||
aDocument->NodePrincipal(),
|
||||
&newGlobal,
|
||||
&newInnerWindow->mJSObject,
|
||||
getter_AddRefs(holder));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && newGlobal && holder,
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && newInnerWindow->mJSObject && holder,
|
||||
"Failed to get script global and holder");
|
||||
|
||||
mCreatingInnerWindow = false;
|
||||
|
@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
||||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||
|
||||
#define NS_ISCRIPTCONTEXT_IID \
|
||||
{ 0xe0ff5703, 0xc92b, 0x46b5, \
|
||||
{ 0x87, 0x82, 0xd0, 0xdc, 0x61, 0xba, 0x44, 0x03 } }
|
||||
{ 0x97b88c6e, 0x5ea3, 0x43aa, \
|
||||
{ 0x97, 0xfc, 0x39, 0xc2, 0x03, 0x1d, 0x8c, 0xd2 } }
|
||||
|
||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||
know what language we have is a little silly... */
|
||||
@ -302,7 +302,7 @@ public:
|
||||
nsIScriptGlobalObject *aNewInner,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
void **aNativeGlobal,
|
||||
JSObject** aNativeGlobal,
|
||||
nsISupports **aHolder) = 0;
|
||||
|
||||
/**
|
||||
|
@ -2201,11 +2201,10 @@ nsJSContext::CreateNativeGlobalForInner(
|
||||
nsIScriptGlobalObject *aNewInner,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
void **aNativeGlobal, nsISupports **aHolder)
|
||||
JSObject** aNativeGlobal, nsISupports **aHolder)
|
||||
{
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
PRUint32 flags = aIsChrome? nsIXPConnect::FLAG_SYSTEM_GLOBAL_OBJECT : 0;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> jsholder;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> systemPrincipal;
|
||||
if (aIsChrome) {
|
||||
@ -2213,17 +2212,18 @@ nsJSContext::CreateNativeGlobalForInner(
|
||||
ssm->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
|
||||
}
|
||||
|
||||
nsRefPtr<nsIXPConnectJSObjectHolder> jsholder;
|
||||
nsresult rv = xpc->
|
||||
InitClassesWithNewWrappedGlobal(mContext,
|
||||
aNewInner, NS_GET_IID(nsISupports),
|
||||
aIsChrome ? systemPrincipal.get() : aPrincipal,
|
||||
nsnull, flags,
|
||||
getter_AddRefs(jsholder));
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
jsholder->GetJSObject(reinterpret_cast<JSObject **>(aNativeGlobal));
|
||||
*aHolder = jsholder.get();
|
||||
NS_ADDREF(*aHolder);
|
||||
}
|
||||
jsholder->GetJSObject(aNativeGlobal);
|
||||
jsholder.forget(aHolder);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
nsIScriptGlobalObject *aGlobal,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
void **aNativeGlobal,
|
||||
JSObject** aNativeGlobal,
|
||||
nsISupports **aHolder);
|
||||
virtual nsresult ConnectToInner(nsIScriptGlobalObject *aNewInner,
|
||||
void *aOuterGlobal);
|
||||
|
Loading…
Reference in New Issue
Block a user