mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 514570: Adapt XPConnect to new JS_GetFrameThis arguments. r=jorendorff
It used to be: JSObject *JS_GetFrameThis(JSContext *, JSStackFrame *); Now it is: JSBool JS_GetFrameThis(JSContext *, JSStackFrame *, jsval *); (In strict mode code, |this| values that are primitives don't get wrapped.)
This commit is contained in:
parent
e54a804e93
commit
a271637595
@ -70,7 +70,8 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
|
||||
{
|
||||
JSPropertyDescArray callProps = {0, nsnull};
|
||||
JSPropertyDescArray thisProps = {0, nsnull};
|
||||
JSObject* thisObj = nsnull;
|
||||
JSBool gotThisVal;
|
||||
jsval thisVal;
|
||||
JSObject* callObj = nsnull;
|
||||
const char* funname = nsnull;
|
||||
const char* filename = nsnull;
|
||||
@ -108,11 +109,13 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
|
||||
callProps.array = nsnull; // just to be sure
|
||||
}
|
||||
|
||||
thisObj = JS_GetFrameThis(cx, fp);
|
||||
if(showThisProps)
|
||||
gotThisVal = JS_GetFrameThis(cx, fp, &thisVal);
|
||||
if (!gotThisVal ||
|
||||
!showThisProps ||
|
||||
JSVAL_IS_PRIMITIVE(thisVal) ||
|
||||
!JS_GetPropertyDescArray(cx, JSVAL_TO_OBJECT(thisVal),
|
||||
&thisProps))
|
||||
{
|
||||
if(thisObj)
|
||||
if(!JS_GetPropertyDescArray(cx, thisObj, &thisProps))
|
||||
thisProps.array = nsnull; // just to be sure
|
||||
}
|
||||
}
|
||||
@ -219,21 +222,25 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
|
||||
|
||||
// print the value of 'this'
|
||||
|
||||
if(showLocals && thisObj)
|
||||
if(showLocals)
|
||||
{
|
||||
if(gotThisVal)
|
||||
{
|
||||
jsval thisJSVal = OBJECT_TO_JSVAL(thisObj);
|
||||
JSString* thisValStr;
|
||||
char* thisVal;
|
||||
char* thisValChars;
|
||||
|
||||
if(nsnull != (thisValStr = JS_ValueToString(cx, thisJSVal)) &&
|
||||
nsnull != (thisVal = JS_GetStringBytes(thisValStr)))
|
||||
if(nsnull != (thisValStr = JS_ValueToString(cx, thisVal)) &&
|
||||
nsnull != (thisValChars = JS_GetStringBytes(thisValStr)))
|
||||
{
|
||||
buf = JS_sprintf_append(buf, TAB "this = %s\n", thisVal);
|
||||
buf = JS_sprintf_append(buf, TAB "this = %s\n", thisValChars);
|
||||
if(!buf) goto out;
|
||||
}
|
||||
}
|
||||
else
|
||||
buf = JS_sprintf_append(buf, TAB "<failed to get 'this' value>\n");
|
||||
}
|
||||
|
||||
// print the properties of 'this'
|
||||
// print the properties of 'this', if it is an object
|
||||
|
||||
if(showThisProps && thisProps.array)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user