Closed
Bug 643212
Opened 14 years ago
Closed 11 years ago
Add btoa() and atob() to global environment in xpcshell
Categories
(Core :: XPConnect, enhancement)
Core
XPConnect
Tracking
()
RESOLVED
DUPLICATE
of bug 809218
People
(Reporter: zwol, Assigned: zwol)
Details
Attachments
(1 file)
3.43 KB,
patch
|
Waldo
:
review-
|
Details | Diff | Splinter Review |
xpcshell doesn't have the base64 encode and decode functions (btoa, atob) that are available in the component environment, or to code running in the context of a window. This patch adds them. I wanted to reuse the shims in nsXPConnect.cpp but the necessary header is apparently not visible to xpcshell.cpp, so I gave up and did it with bare JSAPI. Hopefully correctly.
Attachment #520493 -
Flags: review?
Assignee | ||
Updated•14 years ago
|
Attachment #520493 -
Flags: review? → review?(jwalden+bmo)
Comment 1•14 years ago
|
||
Comment on attachment 520493 [details] [diff] [review]
patch
I think it far better to do whatever signature-munging is necessary to use the canonical implementation here. That might just be #include "xpcprivate.h", possibly, looking at how window.atob is implemented. There were a bunch of duplications of this for awhile, then someone went and unified them all, and I am unwilling to see that work undone.
Attachment #520493 -
Flags: review?(jwalden+bmo) → review-
Comment 2•11 years ago
|
||
This problem appears to be half-way solved.
I find atob and btoa available in xpcshell tests when building with --enable-application=browser, but they are *not* defined in b2g builds. How is this possible?
Blake, do you have any ideas?
Flags: needinfo?(mrbkap)
Comment 3•11 years ago
|
||
Jed: are they available from a BackstagePass?
services/common/tests/unit/head_helpers.js
10:let btoa = Cu.import("resource://gre/modules/Log.jsm").btoa;
Comment 4•11 years ago
|
||
Hi, Richard. Thanks for introducing me to BackstagePass. I had no idea. We'll give it a try!
Comment 5•11 years ago
|
||
Bug 809218 appears to have landed the patch for this. Taking the liberty of closing this bug. Please re-open if I'm incorrect.
Updated•11 years ago
|
Flags: needinfo?(mrbkap)
You need to log in
before you can comment on or make changes to this bug.
Description
•