Skip to content

Write back every element in Array.prototype.sort - #579

Open
theaddonn wants to merge 2 commits into
bellard:masterfrom
theaddonn:fix-sort-write-back
Open

theaddonn wants to merge 2 commits into
bellard:masterfrom
theaddonn:fix-sort-write-back

Conversation

@theaddonn

Copy link
Copy Markdown

sort skipped writing elements that were already in place, so Array.prototype.sort.call("aa") and Object.freeze([1, 2]).sort() didn't throw like the spec (and other engines) do.

Port of quickjs-ng/quickjs#1843

sort skipped the write for elements that were already in place. The
spec writes every sorted value back with Set(obj, j, v, true), so a
read-only receiver such as a String or a frozen array must throw.

Port of quickjs-ng/quickjs#1843
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.

1 participant