Add API for JSD to get the parent of a scope object, no bug.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 28 Nov 2011 07:43:31 -0800
changeset 82143 5546f57c9567f4668e4033859d4a4f8c4a73f3f2
parent 82142 60f879bef90ef16c268b0230cf14ea20ae31c234
child 82144 1e8c03ba91d073d84da774ea9e5f1a3af5b2c550
push idunknown
push userunknown
push dateunknown
milestone11.0a1
Add API for JSD to get the parent of a scope object, no bug.
js/jsd/jsd_val.c
js/src/jsdbgapi.cpp
js/src/jsdbgapi.h
--- a/js/jsd/jsd_val.c
+++ b/js/jsd/jsd_val.c
@@ -742,17 +742,17 @@ jsd_GetValueParent(JSDContext* jsdc, JSD
             return NULL;
         JS_BeginRequest(jsdc->dumbContext);
         call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj);
         if(!call) {
             JS_EndRequest(jsdc->dumbContext);
 
             return NULL;
         }
-        parent = JS_GetParent(jsdc->dumbContext,obj);
+        parent = JS_GetParentOrScopeChain(jsdc->dumbContext,obj);
         JS_LeaveCrossCompartmentCall(call);
         JS_EndRequest(jsdc->dumbContext);
         if(!parent)
             return NULL;
         jsdval->parent = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(parent));
     }
     if(jsdval->parent)
         jsdval->parent->nref++;
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -614,16 +614,22 @@ JS_GetFrameFunctionObject(JSContext *cx,
     StackFrame *fp = Valueify(fpArg);
     if (!fp->isFunctionFrame())
         return NULL;
 
     JS_ASSERT(fp->callee().isFunction());
     return &fp->callee();
 }
 
+JS_PUBLIC_API(JSObject *)
+JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj)
+{
+    return obj->scopeChain();
+}
+
 JS_PUBLIC_API(JSBool)
 JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp)
 {
     return Valueify(fp)->isConstructing();
 }
 
 JS_PUBLIC_API(JSObject *)
 JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp)
--- a/js/src/jsdbgapi.h
+++ b/js/src/jsdbgapi.h
@@ -274,16 +274,19 @@ extern JS_PUBLIC_API(JSBool)
 JS_GetFrameThis(JSContext *cx, JSStackFrame *fp, jsval *thisv);
 
 extern JS_PUBLIC_API(JSFunction *)
 JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
 
 extern JS_PUBLIC_API(JSObject *)
 JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp);
 
+extern JS_PUBLIC_API(JSObject *)
+JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
+
 /* XXXrginda Initially published with typo */
 #define JS_IsContructorFrame JS_IsConstructorFrame
 extern JS_PUBLIC_API(JSBool)
 JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp);
 
 extern JS_PUBLIC_API(JSBool)
 JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp);