Closed Bug 1032238 Opened 10 years ago Closed 10 years ago

Make some API functions work with Latin1 strings

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
Just some things on the JS side that I ran into last week.
Attachment #8448031 - Flags: review?(luke)
Comment on attachment 8448031 [details] [diff] [review]
Patch

Review of attachment 8448031 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsapi.cpp
@@ -5645,5 @@
>      if (!js_Stringify(cx, vp, replacer, space, sb))
>          return false;
> -    if (sb.empty()) {
> -        HandlePropertyName null = cx->names().null;
> -        return callback(null->chars(), null->length(), data);

I'm confused by this change; it seems unrelated to latin1.
(In reply to Luke Wagner [:luke] from comment #1)
> I'm confused by this change; it seems unrelated to latin1.

The problem is that cx->names().null is a Latin1 string ("null"), so we can't call chars() on it and we have to inflate to pass it to the callback. There are a number of ways to fix this; the patch just appends it to the StringBuffer so that there's only one call to the callback function.
Attachment #8448031 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/e5494989d182
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: