From 500f0a0301843c0c324bec0258d34353af310dab Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Mon, 26 Jan 2009 16:20:05 -0800 Subject: [PATCH] Bug 467499 - Pass the proper size argument to ResizeSlots. r=shaver/crowder --- js/src/jsarray.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index bc8915e0373..d8d98245a46 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -580,7 +580,9 @@ array_length_setter(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } if (OBJ_IS_DENSE_ARRAY(cx, obj)) { - if (ARRAY_DENSE_LENGTH(obj) && !ResizeSlots(cx, obj, oldlen, newlen)) + /* Don't reallocate if we're not actually shrinking our slots. */ + jsuint oldsize = ARRAY_DENSE_LENGTH(obj); + if (oldsize >= newlen && !ResizeSlots(cx, obj, oldsize, newlen)) return JS_FALSE; } else if (oldlen - newlen < (1 << 24)) { do {