mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 694759 - Make nsIScriptContext::GetNativeGlobal return JSObject; r=jst
This commit is contained in:
parent
731edba0b8
commit
2da2151a18
@ -695,16 +695,16 @@ nsXULPDGlobalObject::SetScriptContext(PRUint32 lang_id, nsIScriptContext *aScrip
|
||||
|
||||
NS_ASSERTION(!aScriptContext || !mContext, "Bad call to SetContext()!");
|
||||
|
||||
void* script_glob = NULL;
|
||||
JSObject* global = NULL;
|
||||
|
||||
if (aScriptContext) {
|
||||
aScriptContext->SetGCOnDestruction(false);
|
||||
aScriptContext->DidInitializeContext();
|
||||
script_glob = aScriptContext->GetNativeGlobal();
|
||||
NS_ASSERTION(script_glob, "GetNativeGlobal returned NULL!");
|
||||
global = aScriptContext->GetNativeGlobal();
|
||||
NS_ASSERTION(global, "GetNativeGlobal returned NULL!");
|
||||
}
|
||||
mContext = aScriptContext;
|
||||
mJSObject = static_cast<JSObject*>(script_glob);
|
||||
mJSObject = global;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2157,7 +2157,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
mContext->CreateOuterObject(this, newInnerWindow);
|
||||
mContext->DidInitializeContext();
|
||||
|
||||
mJSObject = (JSObject *)mContext->GetNativeGlobal();
|
||||
mJSObject = mContext->GetNativeGlobal();
|
||||
SetWrapper(mJSObject);
|
||||
} else {
|
||||
JSObject *outerObject =
|
||||
|
@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
||||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||
|
||||
#define NS_ISCRIPTCONTEXT_IID \
|
||||
{ 0x827d1e82, 0x5aab, 0x4e3a, \
|
||||
{ 0x88, 0x76, 0x53, 0xf7, 0xed, 0x1e, 0x3f, 0xbe } }
|
||||
{ 0x21529edb, 0x29b6, 0x47ba, \
|
||||
{ 0x8e, 0xe1, 0x51, 0xf2, 0xb5, 0x95, 0xe2, 0x02 } }
|
||||
|
||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||
know what language we have is a little silly... */
|
||||
@ -296,7 +296,7 @@ public:
|
||||
* Return the native global object for this context.
|
||||
*
|
||||
**/
|
||||
virtual void *GetNativeGlobal() = 0;
|
||||
virtual JSObject* GetNativeGlobal() = 0;
|
||||
|
||||
/**
|
||||
* Create a new global object that will be used for an inner window.
|
||||
|
@ -2202,10 +2202,10 @@ nsJSContext::GetGlobalObject()
|
||||
return sgo;
|
||||
}
|
||||
|
||||
void *
|
||||
JSObject*
|
||||
nsJSContext::GetNativeGlobal()
|
||||
{
|
||||
return ::JS_GetGlobalObject(mContext);
|
||||
return JS_GetGlobalObject(mContext);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -2396,7 +2396,7 @@ nsJSContext::SetProperty(void *aTarget, const char *aPropName, nsISupports *aArg
|
||||
|
||||
nsresult
|
||||
nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||
void *aScope,
|
||||
JSObject *aScope,
|
||||
PRUint32 *aArgc,
|
||||
jsval **aArgv,
|
||||
Maybe<nsRootedJSValueArray> &aTempStorage)
|
||||
@ -2452,8 +2452,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||
}
|
||||
nsCOMPtr<nsIVariant> variant(do_QueryInterface(arg));
|
||||
if (variant != nsnull) {
|
||||
rv = xpc->VariantToJS(mContext, (JSObject *)aScope, variant,
|
||||
thisval);
|
||||
rv = xpc->VariantToJS(mContext, aScope, variant, thisval);
|
||||
} else {
|
||||
// And finally, support the nsISupportsPrimitives supplied
|
||||
// by the AppShell. It generally will pass only strings, but
|
||||
@ -2471,8 +2470,8 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||
#endif
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
|
||||
jsval v;
|
||||
rv = nsContentUtils::WrapNative(mContext, (JSObject *)aScope, arg,
|
||||
&v, getter_AddRefs(wrapper));
|
||||
rv = nsContentUtils::WrapNative(mContext, aScope, arg, &v,
|
||||
getter_AddRefs(wrapper));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*thisval = v;
|
||||
}
|
||||
@ -2480,10 +2479,10 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIVariant> variant(do_QueryInterface(aArgs));
|
||||
if (variant)
|
||||
rv = xpc->VariantToJS(mContext, (JSObject *)aScope, variant, argv);
|
||||
else {
|
||||
nsCOMPtr<nsIVariant> variant = do_QueryInterface(aArgs);
|
||||
if (variant) {
|
||||
rv = xpc->VariantToJS(mContext, aScope, variant, argv);
|
||||
} else {
|
||||
NS_ERROR("Not an array, not an interface?");
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public:
|
||||
virtual void SetDefaultLanguageVersion(PRUint32 aVersion);
|
||||
virtual nsIScriptGlobalObject *GetGlobalObject();
|
||||
virtual JSContext* GetNativeContext();
|
||||
virtual void *GetNativeGlobal();
|
||||
virtual JSObject* GetNativeGlobal();
|
||||
virtual nsresult CreateNativeGlobalForInner(
|
||||
nsIScriptGlobalObject *aGlobal,
|
||||
bool aIsChrome,
|
||||
@ -201,7 +201,7 @@ protected:
|
||||
|
||||
// Helper to convert xpcom datatypes to jsvals.
|
||||
nsresult ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||
void *aScope,
|
||||
JSObject *aScope,
|
||||
PRUint32 *aArgc,
|
||||
jsval **aArgv,
|
||||
mozilla::Maybe<nsRootedJSValueArray> &aPoolRelease);
|
||||
|
@ -148,8 +148,7 @@ HelperBase::WrapNative(JSContext* aCx,
|
||||
NS_ASSERTION(aResult, "Null pointer!");
|
||||
NS_ASSERTION(mRequest, "Null request!");
|
||||
|
||||
JSObject* global =
|
||||
static_cast<JSObject*>(mRequest->ScriptContext()->GetNativeGlobal());
|
||||
JSObject* global = mRequest->ScriptContext()->GetNativeGlobal();
|
||||
NS_ENSURE_TRUE(global, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsresult rv =
|
||||
|
@ -148,7 +148,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
|
||||
JSContext* cx = mScriptContext->GetNativeContext();
|
||||
NS_ASSERTION(cx, "Failed to get a context!");
|
||||
|
||||
JSObject* global = static_cast<JSObject*>(mScriptContext->GetNativeGlobal());
|
||||
JSObject* global = mScriptContext->GetNativeGlobal();
|
||||
NS_ASSERTION(global, "Failed to get global object!");
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
Loading…
Reference in New Issue
Block a user