Created attachment 520493 [details] [diff] [review] patch 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?
Attachment #520493 - Flags: review? → review?(jwalden+bmo)
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-
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?
4 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;
Hi, Richard. Thanks for introducing me to BackstagePass. I had no idea. We'll give it a try!
Bug 809218 appears to have landed the patch for this. Taking the liberty of closing this bug. Please re-open if I'm incorrect.
No longer blocks: 935232
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 809218
You need to log in before you can comment on or make changes to this bug.