mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 698408 - Pass JSObject to nsIScriptContext::SetOuterObject; r=jst
This commit is contained in:
parent
66c4623fdb
commit
0f27987dfd
@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
|||||||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||||
|
|
||||||
#define NS_ISCRIPTCONTEXT_IID \
|
#define NS_ISCRIPTCONTEXT_IID \
|
||||||
{ 0x495479ff, 0xaf40, 0x4bcd, \
|
{ 0x18b25592, 0xb1f3, 0x4e96, \
|
||||||
{ 0x93, 0x46, 0x5a, 0x46, 0x84, 0x06, 0xff, 0x7f } }
|
{ 0xab, 0x50, 0x3d, 0x91, 0xf4, 0xc8, 0x1d, 0xa1 } }
|
||||||
|
|
||||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||||
know what language we have is a little silly... */
|
know what language we have is a little silly... */
|
||||||
@ -330,7 +330,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Given an outer object, updates this context with that outer object.
|
* Given an outer object, updates this context with that outer object.
|
||||||
*/
|
*/
|
||||||
virtual nsresult SetOuterObject(void *aOuterObject) = 0;
|
virtual nsresult SetOuterObject(JSObject* aOuterObject) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares this context for use with the current inner window for the
|
* Prepares this context for use with the current inner window for the
|
||||||
|
@ -2294,15 +2294,13 @@ nsJSContext::CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsJSContext::SetOuterObject(void *aOuterObject)
|
nsJSContext::SetOuterObject(JSObject* aOuterObject)
|
||||||
{
|
{
|
||||||
JSObject *outer = static_cast<JSObject *>(aOuterObject);
|
|
||||||
|
|
||||||
// Force our context's global object to be the outer.
|
// Force our context's global object to be the outer.
|
||||||
JS_SetGlobalObject(mContext, outer);
|
JS_SetGlobalObject(mContext, aOuterObject);
|
||||||
|
|
||||||
// NB: JS_SetGlobalObject sets mContext->compartment.
|
// NB: JS_SetGlobalObject sets mContext->compartment.
|
||||||
JSObject *inner = JS_GetParent(mContext, outer);
|
JSObject *inner = JS_GetParent(mContext, aOuterObject);
|
||||||
|
|
||||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||||
@ -2312,7 +2310,7 @@ nsJSContext::SetOuterObject(void *aOuterObject)
|
|||||||
NS_ABORT_IF_FALSE(wrapper, "bad wrapper");
|
NS_ABORT_IF_FALSE(wrapper, "bad wrapper");
|
||||||
|
|
||||||
wrapper->RefreshPrototype();
|
wrapper->RefreshPrototype();
|
||||||
JS_SetPrototype(mContext, outer, JS_GetPrototype(mContext, inner));
|
JS_SetPrototype(mContext, aOuterObject, JS_GetPrototype(mContext, inner));
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public:
|
|||||||
virtual nsresult InitContext();
|
virtual nsresult InitContext();
|
||||||
virtual nsresult CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
|
virtual nsresult CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
|
||||||
nsIScriptGlobalObject *aCurrentInner);
|
nsIScriptGlobalObject *aCurrentInner);
|
||||||
virtual nsresult SetOuterObject(void *aOuterObject);
|
virtual nsresult SetOuterObject(JSObject* aOuterObject);
|
||||||
virtual nsresult InitOuterWindow();
|
virtual nsresult InitOuterWindow();
|
||||||
virtual bool IsContextInitialized();
|
virtual bool IsContextInitialized();
|
||||||
virtual void FinalizeContext();
|
virtual void FinalizeContext();
|
||||||
|
Loading…
Reference in New Issue
Block a user