Closed
Bug 612642
Opened 15 years ago
Closed 15 years ago
JS base64 code needs to be updated for removal of JS_GetStringBytesZ
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | betaN+ |
People
(Reporter: sayrer, Assigned: bent.mozilla)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
14.02 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
I added some code that passes tests for purposes of merging, but there are still four functions here that are mostly copy/pasted. That turned into a maintenance pain immediately on our first encounter with this code.
I'll upload my patch to make sure it is kosher before it gets into mozilla-central.
Reporter | ||
Updated•15 years ago
|
blocking2.0: --- → beta8+
Reporter | ||
Comment 1•15 years ago
|
||
This doesn't look to meet the standard of a beta8 blocker. Punting to betaN, feel free to disagree and/or triage to a different beta.
blocking2.0: beta8+ → betaN+
Comment 3•15 years ago
|
||
Ben, can you look over what sayrer did here and do any additional merging of code that makes sense to merge...
Component: XPConnect → DOM: Other
OS: Mac OS X → All
QA Contact: xpconnect → general
Hardware: x86 → All
![]() |
||
Updated•15 years ago
|
![]() |
||
Comment 4•15 years ago
|
||
Note that this code leaks; see bug 616834.
Assignee | ||
Comment 6•15 years ago
|
||
This further consolidates the JS callers and reuses the quickstubs string conversion class, also fixes the leak.
Assignee: nobody → bent.mozilla
Attachment #490968 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #496222 -
Flags: review?(jorendorff)
![]() |
||
Comment 7•15 years ago
|
||
Comment on attachment 496222 [details] [diff] [review]
Fixup, v1
>diff --git a/dom/src/threads/nsDOMWorker.cpp b/dom/src/threads/nsDOMWorker.cpp
>--- a/dom/src/threads/nsDOMWorker.cpp
dom/src/threads/nsDOMWorker.cpp, nsDOMWorkerFunctions::AtoB:
>+ jsval result;
>+ if (!nsXPConnect::Base64Decode(aCx, JS_ARGV(aCx, aVp)[0], &result)) {
> return JS_FALSE;
> }
>
>+ JS_SET_RVAL(aCx, aVp, result);
> return JS_TRUE;
It's OK to write, in place of these 6 lines:
return nsXPConnect::Base64Decode(aCx, JS_ARGV(aCx, aVp)[0], &JS_RVAL(aCx, aVp));
A little odd, that use of JS_RVAL, but OK.
Same thing in BtoA.
Attachment #496222 -
Flags: review?(jorendorff) → review+
Assignee | ||
Comment 8•15 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Comment 9•15 years ago
|
||
(In reply to comment #8)
> http://hg.mozilla.org/tracemonkey/rev/f205194a4128
Turned a weave crypt test orange... Investigating, backed out.
Whiteboard: fixed-in-tracemonkey
![]() |
||
Comment 10•15 years ago
|
||
(In reply to comment #9)
> (In reply to comment #8)
> > http://hg.mozilla.org/tracemonkey/rev/f205194a4128
>
> Turned a weave crypt test orange... Investigating, backed out.
One of my initial patches to eliminate JS_GetStringBytes usage turned orange as I used strlen in Base64-related code. Since those strings can include \0 that was wrong. It looks like the patch is hit by this bug again as xpc_qsACString::xpc_qsACString uses strlen in xpcquickstubs.cpp. That strlen should be replaced with JS_GetStringEncodingLength(NULL, str) (where NULL is passed for cx as the errors already checked).
![]() |
||
Comment 11•15 years ago
|
||
(In reply to comment #10)
> (In reply to comment #9)
> > (In reply to comment #8)
> > > http://hg.mozilla.org/tracemonkey/rev/f205194a4128
> >
> > Turned a weave crypt test orange... Investigating, backed out.
>
> One of my initial patches to eliminate JS_GetStringBytes usage turned orange as
> I used strlen in Base64-related code. Since those strings can include \0 that
> was wrong. It looks like the patch is hit by this bug again as
> xpc_qsACString::xpc_qsACString uses strlen in xpcquickstubs.cpp. That strlen
> should be replaced with JS_GetStringEncodingLength(NULL, str) (where NULL is
> passed for cx as the errors already checked).
Even better solution would be to encode string directly into mBuf after resizing it. I.e. first call JS_GetStringEncodingLength(cx, str) to get the encoding length (but remember to check for an error) and then use HS_EncodeStringToBuffer.
Assignee | ||
Comment 12•15 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Comment 13•15 years ago
|
||
Bah! I missed comments 10 and 11 this morning, sorry! I'll file a separate bug on avoiding the double copy.
Assignee | ||
Comment 14•15 years ago
|
||
Filed bug 618049.
Reporter | ||
Comment 15•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Component: DOM: Other → DOM
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•