Closed Bug 1484143 Opened 6 years ago Closed 6 years ago

StringBuilder::ToString should use fallible appends

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: hsivonen, Assigned: hsivonen)

Details

StringBuilder::ToString assumes that appends can't fail after a fallible SetCapacity. However, entity-encoding expands the length in a way that's not taken into account in the SetCapacity call, so any of the appends could fail if the expansion necessitates a larger jemalloc bucket.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Additionally, this code runs on a performance-sensitive path (innerHTML getter), but it makes the string implementation do a frightening amount of work on a per-code unit basis. I'm going to try rewriting this in terms of BulkWrite.
The initial bug report here is wrong. There's still opportunity for per improvement. Filed a new bug for that: bug 1488697.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Summary: StringBuilder::ToString should use fallible appends → StringBuilder::ToString should use BulkWrite
Summary: StringBuilder::ToString should use BulkWrite → StringBuilder::ToString should use fallible appends
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.