Closed Bug 1123059 Opened 10 years ago Closed 5 years ago

Some other operations should use ES6 ToLength

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: 446240525, Unassigned)

References

(Blocks 1 open bug)

Details

js> "123".split("2", -1) ["1", "3"] // should be [] js> re=/a/y; /a/y js> re.lastIndex = -1 -1 js> re.test("ab") false // should be true js> re.lastIndex 0 // should be 1 js> ((...arg) => arg.length).apply(null, {length: -1}) RangeError: arguments array passed to Function.prototype.apply is too large // should be 0
(In reply to ziyunfei from comment #0) > js> "123".split("2", -1) > ["1", "3"] // should be [] > Should be ["1","3"] according to https://tc39.github.io/ecma262/#sec-string.prototype.split step 6. (IIRC, the spec reverted to the older semantics because arrays didn’t switch to ToLength.) > > js> re=/a/y; > /a/y > js> re.lastIndex = -1 > -1 > js> re.test("ab") > false // should be true Works as expected (yields `true`) in current stable FF release. > js> re.lastIndex > 0 // should be 1 > Ditto. > > js> ((...arg) => arg.length).apply(null, {length: -1}) > RangeError: arguments array passed to Function.prototype.apply is too large > // should be 0 Ditto. Evaluates to `0` in current FF.

I don't think there is any actual work left here. Otherwise just opens a bug with a concrete example. Thanks.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME

Same for docs, file an issue if something needs updating on MDN for this still.

Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
You need to log in before you can comment on or make changes to this bug.