AppendLiteral after SetCapacity() undoes the effect of SetCapacity()

RESOLVED FIXED in Firefox 63

Status

()

defect
RESOLVED FIXED
11 months ago
11 months ago

People

(Reporter: hsivonen, Assigned: hsivonen)

Tracking

(Blocks 1 bug)

unspecified
mozilla63
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(1 attachment)

When mLength == 0, AppendLiteral() ends up calling AssignLiteral(). This is bad if SetCapacity() was called before AppendLiteral() and the caller in good faith assumed that SetCapacity() before a sequence of appends is OK.

AppendLiteral() should not call AssignLiteral() if mLength == 0 and the string already has a shared buffer.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Comment on attachment 9005583 [details]
Bug 1487606 - Make AppendLiteral() not undo the effect of SetCapacity().

Nathan Froyd [:froydnj] has approved the revision.
Attachment #9005583 - Flags: review+
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bf6f5ec86920
Make AppendLiteral() not undo the effect of SetCapacity(). r=froydnj
https://hg.mozilla.org/mozilla-central/rev/bf6f5ec86920
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.