Index: jsd_xpc.cpp =================================================================== RCS file: /cvsroot/mozilla/js/jsd/jsd_xpc.cpp,v retrieving revision 1.72 diff -u -r1.72 jsd_xpc.cpp --- jsd_xpc.cpp +++ jsd_xpc.cpp @@ -2276,6 +2339,41 @@ return NS_OK; } +NS_IMETHODIMP +jsdValue::GetSize(PRInt32 *aSize) +{ + ASSERT_VALID_EPHEMERAL; + jsval val; + + val = JSD_GetValueWrappedJSVal (mCx, mValue); + + if (JSVAL_IS_NULL(val)) + *aSize = 4; + else if (JSVAL_IS_BOOLEAN(val)) + *aSize = 4; + else if (JSVAL_IS_DOUBLE(val)) + *aSize = 8; + else if (JSVAL_IS_INT(val)) + *aSize = 4; + else if (JSVAL_IS_STRING(val)) + *aSize = 2 * JS_GetStringLength(JSVAL_TO_STRING(val)); + else if (JSVAL_IS_VOID(val)) + *aSize = 4; + else { + JSContext *cx = JSD_GetDefaultJSContext (mCx); + if (JSD_IsValueFunction (mCx, mValue)) + *aSize = JS_GetFunctionTotalSize(cx, (JSFunction*)JSVAL_TO_OBJECT(val)); + else if (JSVAL_IS_OBJECT(val)) + *aSize = JS_GetObjectTotalSize(cx, JSVAL_TO_OBJECT(val)); + else { + *aSize = 0; + return NS_ERROR_UNEXPECTED; + } + } + + return NS_OK; +} + /****************************************************************************** * debugger service implementation ******************************************************************************/ Index: idl/jsdIDebuggerService.idl =================================================================== RCS file: /cvsroot/mozilla/js/jsd/idl/jsdIDebuggerService.idl,v retrieving revision 1.32 diff -u -r1.32 idl/jsdIDebuggerService.idl --- idl/jsdIDebuggerService.idl +++ idl/jsdIDebuggerService.idl @@ -1143,6 +1149,12 @@ * defined error code. */ void getWrappedValue(); + + /** + * Retrieves the size of the object (including space required for slots, + * but excluding space required by objects referenced by the object). + */ + readonly attribute long size; }; /**