From kde-commits Mon Mar 22 16:19:21 2010 From: Maks Orlovich Date: Mon, 22 Mar 2010 16:19:21 +0000 To: kde-commits Subject: KDE/kdelibs/kjs Message-Id: <20100322161921.A20E3AC86C () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=126927477020094 SVN commit 1106363 by orlovich: Apply patch from pcc (username peter, host pcc.me, tld uk) that fixes updating of lastIndex in Regexp.prototype.test. Thanks! M +7 -4 regexp_object.cpp --- trunk/KDE/kdelibs/kjs/regexp_object.cpp #1106362:1106363 @@ -113,18 +113,21 @@ bool didMatch = !match.isNull(); + if (globalFlag) { + if (didMatch) + thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(foundIndex + match.size()), DontDelete | DontEnum); + else + thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(0), DontDelete | DontEnum); + } + // Test if (id == Test) return jsBoolean(didMatch); // Exec if (didMatch) { - if (globalFlag) - thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(foundIndex + match.size()), DontDelete | DontEnum); return regExpObj->arrayOfMatches(exec, match); } else { - if (globalFlag) - thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(0), DontDelete | DontEnum); return jsNull(); } }