From d79d0ba0ed7f502e8ff8f62393e3428eb246849f Mon Sep 17 00:00:00 2001 From: Dan Witte Date: Thu, 5 Aug 2010 16:49:52 -0700 Subject: [PATCH] Bug 583099 - toolkit/components/ctypes uses the wrong global object. r=jorendorff, a=bsmedberg --- toolkit/components/ctypes/ctypes.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/toolkit/components/ctypes/ctypes.cpp b/toolkit/components/ctypes/ctypes.cpp index d6b8102c25f..79cecfc466a 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -113,7 +113,14 @@ Module::Call(nsIXPConnectWrappedNative* wrapper, jsval* vp, PRBool* _retval) { - JSObject* global = JS_GetGlobalObject(cx); + JSObject* scope = JS_GetScopeChain(cx); + if (!scope) + return NS_ERROR_NOT_AVAILABLE; + + JSObject* global = JS_GetGlobalForObject(cx, scope); + if (!global) + return NS_ERROR_NOT_AVAILABLE; + *_retval = InitAndSealCTypesClass(cx, global); return NS_OK; }