Skip to content

Conversation

bnoordhuis
Copy link
Contributor

test262 doesn't test it but the spec mandates that negative .size
properties should result in a RangeError being raised, and that is
indeed what V8 and SpiderMonkey do. Now we do, too.

Adjust for another quirk, which is that Infinity is a legal size,
and, more generally, that sizes > Number.MAX_SAFE_INTEGER are not
illegal - which is okay, because the size is not actually used for
anything, because of course it isn't.


First commit is #1169.

test262 doesn't test it but the spec mandates that negative .size
properties should result in a RangeError being raised, and that is
indeed what V8 and SpiderMonkey do. Now we do, too.

Adjust for another quirk, which is that Infinity is a legal size,
and, more generally, that sizes > Number.MAX_SAFE_INTEGER are not
illegal - which is okay, because the size is not actually used for
anything, because of course it isn't.
@bnoordhuis bnoordhuis force-pushed the fix-setlike-size-handling branch from 93d4877 to f526708 Compare September 29, 2025 14:11
@bnoordhuis bnoordhuis merged commit 8c44d7e into quickjs-ng:master Sep 29, 2025
@bnoordhuis bnoordhuis deleted the fix-setlike-size-handling branch September 29, 2025 14:11
@bellard
Copy link
Contributor

bellard commented Sep 29, 2025

Your fix for .size is still not correct because it should be converted to integer before the < 0 test. You should run the test262/staging tests where many such corner cases are tested.

@bnoordhuis
Copy link
Contributor Author

I'll wait for those tests to get promoted out of staging. IMO it's not fruitful to spend time on staging tests, they have a habit of disappearing again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants