Note that we have a bug[1] open and a patch in review for that now. As of
now, it looks like a bug we're going to fix, but Jeff might come to a
different conclusion during the review.
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=887676
On Fri, Jun 28, 2013 at 1:23 PM, Paul Ruizendaal p...@planet.nl wrote:
From: Brendan Eich bren...@mozilla.com
Subject: Re: [JS-internals] additional test for 15.10.6.2,
RegExp.prototype.exec
Date: 27 June 2013 0:16:49 GMT+02:00
To: Paul Ruizendaal p...@planet.nl
Please resend to es-discuss. At least two browsers agree on each side of
the fence, so this isn't just a mozilla.dev.tech.js-engine.internal issue.
/be
Paul Ruizendaal wrote:
The Spidermonkey test suite contains the following test (in file
ecma_5/RegExp/exec.js):
r = /abc/;
r.lastIndex = -17;
res = r.exec(cdefg);
assertEq(res, null);
assertEq(r.lastIndex, -17);
In my understanding this test is wrong, lastIndex should be 0 due to
step 9.a.(i). Safari and Firefox report -17, Chrome and IE report 0. I
guess it is a tricky part of the spec as most real world implementations
will move the iteration of step 9 into the [[Match]] routine as to enable
first character optimizations and alike. The correct behavior is not
covered in test262. Recommend to add the following test:
/*
* @es5id 15.10.6.2 (step 9.a.i)
* @description If the pattern does not match, lastIndex is always set
to 0, even if the 'global' flag is false.
*/
function testCase()
{
var r = /abc/;
r.lastIndex = -17;
res = r.exec(defg);
return r.lastIndex===0;
}
Note that the original Spidermonkey test is in the public domain,
according to the file header. This post is also placed in the public domain.
Paul
___
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-intern...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss