Bug 637014 - use the right global in MakeFinalizeObserver (r=luke)

This commit is contained in:
Andreas Gal 2012-06-19 11:13:42 -07:00
parent e47bd654e8
commit 6ab97d439e
2 changed files with 8 additions and 2 deletions

View File

@ -482,10 +482,14 @@ static JSClass FinalizeCounterClass = {
static JSBool
MakeFinalizeObserver(JSContext *cx, unsigned argc, jsval *vp)
{
JSObject *obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, NULL,
JS_GetGlobalObject(cx));
JSObject *scope = JS_GetGlobalForScopeChain(cx);
if (!scope)
return false;
JSObject *obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, NULL, scope);
if (!obj)
return false;
*vp = OBJECT_TO_JSVAL(obj);
return true;
}

View File

@ -0,0 +1,2 @@
var o = newGlobal('new-compartment');
o.makeFinalizeObserver();