mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 17:16:12 +00:00
Bug 690135 - remove some bits of jsdbgapi and shell (r=jorendorff)
--HG-- extra : rebase_source : 6741e97b5279c41ec1b9a08fbf5e693b17820106
This commit is contained in:
parent
0713cb134c
commit
7ba08a89fa
@ -289,32 +289,3 @@ BEGIN_TEST(testDebugger_singleStepThrow)
|
||||
return JSTRAP_CONTINUE;
|
||||
}
|
||||
END_TEST(testDebugger_singleStepThrow)
|
||||
|
||||
BEGIN_TEST(testDebugger_emptyObjectPropertyIterator)
|
||||
{
|
||||
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JSScopeProperty *prop = NULL;
|
||||
CHECK(!JS_PropertyIterator(obj, &prop));
|
||||
CHECK(!prop);
|
||||
|
||||
return true;
|
||||
}
|
||||
END_TEST(testDebugger_emptyObjectPropertyIterator)
|
||||
|
||||
BEGIN_TEST(testDebugger_nonEmptyObjectPropertyIterator)
|
||||
{
|
||||
jsval v;
|
||||
EVAL("({a: 15})", &v);
|
||||
JSObject *obj = JSVAL_TO_OBJECT(v);
|
||||
JSScopeProperty *prop = NULL;
|
||||
CHECK(JS_PropertyIterator(obj, &prop));
|
||||
JSPropertyDesc desc;
|
||||
CHECK(JS_GetPropertyDesc(cx, obj, prop, &desc));
|
||||
CHECK_EQUAL(JSVAL_IS_INT(desc.value), true);
|
||||
CHECK_EQUAL(JSVAL_TO_INT(desc.value), 15);
|
||||
CHECK(!JS_PropertyIterator(obj, &prop));
|
||||
CHECK(!prop);
|
||||
|
||||
return true;
|
||||
}
|
||||
END_TEST(testDebugger_nonEmptyObjectPropertyIterator)
|
||||
|
@ -782,32 +782,10 @@ JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
|
||||
|
||||
/* This all should be reworked to avoid requiring JSScopeProperty types. */
|
||||
|
||||
JS_PUBLIC_API(JSScopeProperty *)
|
||||
JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp)
|
||||
{
|
||||
const Shape *shape;
|
||||
|
||||
/* The caller passes null in *iteratorp to get things started. */
|
||||
shape = (Shape *) *iteratorp;
|
||||
if (!shape)
|
||||
shape = obj->lastProperty();
|
||||
else
|
||||
shape = shape->previous();
|
||||
|
||||
if (!shape->previous()) {
|
||||
JS_ASSERT(shape->isEmptyShape());
|
||||
shape = NULL;
|
||||
}
|
||||
|
||||
return *iteratorp = reinterpret_cast<JSScopeProperty *>(const_cast<Shape *>(shape));
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyDesc(JSContext *cx, JSObject *obj_, JSScopeProperty *sprop,
|
||||
JSPropertyDesc *pd)
|
||||
static JSBool
|
||||
GetPropertyDesc(JSContext *cx, JSObject *obj_, Shape *shape, JSPropertyDesc *pd)
|
||||
{
|
||||
assertSameCompartment(cx, obj_);
|
||||
Shape *shape = (Shape *) sprop;
|
||||
pd->id = IdToJsval(shape->propid());
|
||||
|
||||
RootedVarObject obj(cx, obj_);
|
||||
@ -855,6 +833,7 @@ JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda)
|
||||
{
|
||||
assertSameCompartment(cx, obj);
|
||||
|
||||
Class *clasp = obj->getClass();
|
||||
if (!obj->isNative() || (clasp->flags & JSCLASS_NEW_ENUMERATE)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
@ -882,7 +861,7 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda)
|
||||
if (!js_AddRoot(cx, &pd[i].value, NULL))
|
||||
goto bad;
|
||||
Shape *shape = const_cast<Shape *>(&r.front());
|
||||
if (!JS_GetPropertyDesc(cx, obj, reinterpret_cast<JSScopeProperty *>(shape), &pd[i]))
|
||||
if (!GetPropertyDesc(cx, obj, shape, &pd[i]))
|
||||
goto bad;
|
||||
if ((pd[i].flags & JSPD_ALIAS) && !js_AddRoot(cx, &pd[i].alias, NULL))
|
||||
goto bad;
|
||||
|
@ -374,13 +374,6 @@ typedef struct JSPropertyDescArray {
|
||||
|
||||
typedef struct JSScopeProperty JSScopeProperty;
|
||||
|
||||
extern JS_PUBLIC_API(JSScopeProperty *)
|
||||
JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *shape,
|
||||
JSPropertyDesc *pd);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);
|
||||
|
||||
|
@ -1965,43 +1965,6 @@ DisassWithSrc(JSContext *cx, unsigned argc, jsval *vp)
|
||||
#undef LINE_BUF_LEN
|
||||
}
|
||||
|
||||
static void
|
||||
DumpScope(JSContext *cx, JSObject *obj, FILE *fp)
|
||||
{
|
||||
unsigned i = 0;
|
||||
for (JSScopeProperty *sprop = NULL; JS_PropertyIterator(obj, &sprop);) {
|
||||
fprintf(fp, "%3u %p ", i++, (void *) sprop);
|
||||
((Shape *) sprop)->dump(cx, fp);
|
||||
}
|
||||
}
|
||||
|
||||
static JSBool
|
||||
DumpStats(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
jsval *argv = JS_ARGV(cx, vp);
|
||||
for (unsigned i = 0; i < argc; i++) {
|
||||
JSString *str = JS_ValueToString(cx, argv[i]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
argv[i] = STRING_TO_JSVAL(str);
|
||||
JSFlatString *flatStr = JS_FlattenString(cx, str);
|
||||
if (!flatStr)
|
||||
return JS_FALSE;
|
||||
if (JS_FlatStringEqualsAscii(flatStr, "atom")) {
|
||||
js_DumpAtoms(cx, gOutFile);
|
||||
} else if (JS_FlatStringEqualsAscii(flatStr, "global")) {
|
||||
DumpScope(cx, cx->globalObject, stdout);
|
||||
} else {
|
||||
fputs("js: invalid stats argument ", gErrFile);
|
||||
JS_FileEscapedString(gErrFile, str, 0);
|
||||
putc('\n', gErrFile);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
DumpHeap(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -3640,10 +3603,6 @@ static JSFunctionSpecWithHelp shell_functions[] = {
|
||||
"notes([fun])",
|
||||
" Show source notes for functions."),
|
||||
|
||||
JS_FN_HELP("stats", DumpStats, 1, 0,
|
||||
"stats([string ...])",
|
||||
" Dump 'atom' or 'global' stats."),
|
||||
|
||||
JS_FN_HELP("findReferences", FindReferences, 1, 0,
|
||||
"findReferences(target)",
|
||||
" Walk the entire heap, looking for references to |target|, and return a\n"
|
||||
|
Loading…
Reference in New Issue
Block a user