mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Bug 380831: incorrect uneval trying to output a getter function that is a sharp definition, r=igor
This commit is contained in:
parent
725585f1ce
commit
6e003e6a16
@ -955,6 +955,34 @@ js_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
if (needOldStyleGetterSetter)
|
||||
gsop[j] = gsopold[j];
|
||||
|
||||
/* If val[j] is a non-sharp object, consider sharpening it. */
|
||||
vsharp = NULL;
|
||||
vsharplength = 0;
|
||||
#if JS_HAS_SHARP_VARS
|
||||
if (!JSVAL_IS_PRIMITIVE(val[j]) && vchars[0] != '#') {
|
||||
he = js_EnterSharpObject(cx, JSVAL_TO_OBJECT(val[j]), NULL,
|
||||
&vsharp);
|
||||
if (!he) {
|
||||
ok = JS_FALSE;
|
||||
goto error;
|
||||
}
|
||||
if (IS_SHARP(he)) {
|
||||
vchars = vsharp;
|
||||
vlength = js_strlen(vchars);
|
||||
needOldStyleGetterSetter = JS_TRUE;
|
||||
gsop[j] = gsopold[j];
|
||||
} else {
|
||||
if (vsharp) {
|
||||
vsharplength = js_strlen(vsharp);
|
||||
MAKE_SHARP(he);
|
||||
needOldStyleGetterSetter = JS_TRUE;
|
||||
gsop[j] = gsopold[j];
|
||||
}
|
||||
js_LeaveSharpObject(cx, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OLD_GETTER_SETTER
|
||||
/*
|
||||
* Remove '(function ' from the beginning of valstr and ')' from the
|
||||
@ -1000,34 +1028,6 @@ js_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
gsop[j] = gsopold[j];
|
||||
#endif
|
||||
|
||||
/* If val[j] is a non-sharp object, consider sharpening it. */
|
||||
vsharp = NULL;
|
||||
vsharplength = 0;
|
||||
#if JS_HAS_SHARP_VARS
|
||||
if (!JSVAL_IS_PRIMITIVE(val[j]) && vchars[0] != '#') {
|
||||
he = js_EnterSharpObject(cx, JSVAL_TO_OBJECT(val[j]), NULL,
|
||||
&vsharp);
|
||||
if (!he) {
|
||||
ok = JS_FALSE;
|
||||
goto error;
|
||||
}
|
||||
if (IS_SHARP(he)) {
|
||||
vchars = vsharp;
|
||||
vlength = js_strlen(vchars);
|
||||
needOldStyleGetterSetter = JS_TRUE;
|
||||
gsop[j] = gsopold[j];
|
||||
} else {
|
||||
if (vsharp) {
|
||||
vsharplength = js_strlen(vsharp);
|
||||
MAKE_SHARP(he);
|
||||
needOldStyleGetterSetter = JS_TRUE;
|
||||
gsop[j] = gsopold[j];
|
||||
}
|
||||
js_LeaveSharpObject(cx, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SAFE_ADD(n) \
|
||||
JS_BEGIN_MACRO \
|
||||
size_t n_ = (n); \
|
||||
|
Loading…
Reference in New Issue
Block a user