Closed
Bug 503166
Opened 15 years ago
Closed 15 years ago
XPCStringConvert::ReadableToJSString shouldn't allocate for empty string
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla1.9.2a1
People
(Reporter: peterv, Assigned: peterv)
Details
Attachments
(1 file)
4.88 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
Every time XPCStringConvert::ReadableToJSString is passed an empty string, it'll try to get the nsStringBuffer without getting one, and it'll actually allocate a new buffer and JS string object. I think we should return a cached JSString in that case, and the JS engine seems to already have one in |cx->runtime->atomState.emptyAtom|. I've also made ReadableToJSString return a jsval, all callers want a jsval (and do STRING_TO_JSVAL), and we already have a jsval for emptyAtom anyway.
Attachment #387521 -
Flags: superreview?(jst)
Attachment #387521 -
Flags: review?(jst)
Comment 1•15 years ago
|
||
Comment on attachment 387521 [details] [diff] [review] v1 r+sr=jst, but should we rename ReadableToJSString() to ReadableToJSVal() now that it returns a jsval, which actually may not be a string (if it returns JSVAL_NULL)?
Attachment #387521 -
Flags: superreview?(jst)
Attachment #387521 -
Flags: superreview+
Attachment #387521 -
Flags: review?(jst)
Attachment #387521 -
Flags: review+
Assignee | ||
Comment 2•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/790e9b3af32b
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•