Closed
Bug 1034689
Opened 10 years ago
Closed 10 years ago
Make the rest of the browser work with Latin1 strings and nursery-allocated strings
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(3 files)
(deleted),
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bzbarsky
:
review+
terrence
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
Bug 1034191, bug 1032726 and bug 1034627 did most of the work, but there are still a few API calls left.
Assignee | ||
Comment 1•10 years ago
|
||
This patch adds a JS_ParseJSON overload that takes a HandleString instead of jschar* + length. This API could be useful elsewhere, and I want to keep the changes to AndroidBridge as small as possible because I can't compile it locally :)
Attachment #8451151 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 2•10 years ago
|
||
This patch adds AssignJSFlatString, which is just like AssignJSString but it takes a JSFlatString and it's infallible. It also doesn't need a JSContext so we can use it in some places where we can't easily use AssignJSString.
Attachment #8451154 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 3•10 years ago
|
||
I think this should be it. If not we'll find out when we remove or change the APIs :)
Attachment #8451159 -
Flags: review?(bzbarsky)
Comment 4•10 years ago
|
||
Comment on attachment 8451151 [details] [diff] [review]
Part 1 - AndroidBridge
Review of attachment 8451151 [details] [diff] [review]:
-----------------------------------------------------------------
Please update the JSAPI reference for the new overloads:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_ParseJSON
Also add a note to https://developer.mozilla.org/en-US/docs/SpiderMonkey/38 about this.
::: js/src/jsapi.cpp
@@ +5731,5 @@
> return ParseJSONWithReviver(cx, mozilla::Range<const jschar>(chars, len), reviver, vp);
> }
>
> JS_PUBLIC_API(bool)
> +JS_ParseJSON(JSContext *cx, HandleString str, MutableHandleValue vp)
If you're going to add this overload, could you add the same one for JS_ParseJSONWithReviver as well?
Attachment #8451151 -
Flags: review?(jwalden+bmo) → review+
Comment 5•10 years ago
|
||
Comment on attachment 8451154 [details] [diff] [review]
Part 2 - AssignJSFlatString
>+ MOZ_ASSERT(mExpr.Length() == 0);
MOZ_ASSERT(mExpr.IsEmpty());
r=me on the non-js/src bits with that.
Attachment #8451154 -
Flags: review?(bzbarsky) → review+
Comment 6•10 years ago
|
||
Comment on attachment 8451159 [details] [diff] [review]
Part 3 - The rest
r=me
Attachment #8451159 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 7•10 years ago
|
||
Comment on attachment 8451154 [details] [diff] [review]
Part 2 - AssignJSFlatString
Review from Terrence on the js/src changes (bz reviewed the rest).
Attachment #8451154 -
Flags: review?(terrence)
Comment 8•10 years ago
|
||
Comment on attachment 8451154 [details] [diff] [review]
Part 2 - AssignJSFlatString
Review of attachment 8451154 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
Attachment #8451154 -
Flags: review?(terrence) → review+
Assignee | ||
Comment 9•10 years ago
|
||
Parts 2 and 3:
https://hg.mozilla.org/integration/mozilla-inbound/rev/046c577511ef
https://hg.mozilla.org/integration/mozilla-inbound/rev/06fc258b16f8
Keywords: leave-open
Comment 10•10 years ago
|
||
Comment on attachment 8451154 [details] [diff] [review]
Part 2 - AssignJSFlatString
>+ dest.SetCapacity(len + 1);
>+ js::CopyFlatStringChars(dest.BeginWriting(), s, len);
>+ dest.BeginWriting()[len] = '\0';
>+ dest.SetLength(len);
1. SetLength calls SetCapacity
2. SetCapacity (and therefore SetLength) writes the null terminator
3. It follows that SetCapacity adds 1 for the null terminator
Assignee | ||
Comment 11•10 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #10)
> 1. SetLength calls SetCapacity
> 2. SetCapacity (and therefore SetLength) writes the null terminator
> 3. It follows that SetCapacity adds 1 for the null terminator
Thanks. You also mentioned this in the AssignJSString bug and I needinfo'ed myself on it; I'll fix them both soonish.
Comment 12•10 years ago
|
||
Assignee | ||
Comment 13•10 years ago
|
||
And part 1:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8b9e1310637c
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #4)
> Please update the JSAPI reference for the new overloads:
>
> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/
> JSAPI_reference/JS_ParseJSON
>
> Also add a note to https://developer.mozilla.org/en-US/docs/SpiderMonkey/38
> about this.
needinfo'ing myself to do this once the patch is on m-c.
> If you're going to add this overload, could you add the same one for
> JS_ParseJSONWithReviver as well?
Done.
Keywords: leave-open
Comment 14•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•