Detect cycles even when we're inserting a degenerate list of length 1. bug 328249, r=brendan

This commit is contained in:
mrbkap%gmail.com 2006-02-23 23:00:23 +00:00
parent 7e97371876
commit 19da7e1561

View File

@ -3592,6 +3592,12 @@ Replace(JSContext *cx, JSXML *xml, jsval id, jsval v);
static JSBool
CheckCycle(JSContext *cx, JSXML *xml, JSXML *kid)
{
if (kid->xml_class == JSXML_CLASS_LIST) {
JS_ASSERT(kid->xml_kids.length <= 1);
if (kid->xml_kids.length != 0)
kid = XMLARRAY_MEMBER(&kid->xml_kids, 0, JSXML);
}
do {
if (xml == kid) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,