Closed Bug 643212 Opened 14 years ago Closed 11 years ago

Add btoa() and atob() to global environment in xpcshell

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 809218

People

(Reporter: zwol, Assigned: zwol)

Details

Attachments

(1 file)

Attached patch patch (deleted) — 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?
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?
Flags: needinfo?(mrbkap)
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
Closed: 11 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(mrbkap)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: