cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Clelland <>
Subject Re: window.btoa
Date Wed, 11 Sep 2013 23:12:35 GMT
cordova.js has an implementation of btoa in lib/common/base64.js, there for
passing binary data over the bridge to native. It wouldn't be much of a
stretch to include atob() if there's a reason for it.

We could update FIleTransfer.js to use the cordova-supplied version. That
would make sense if we want to support platforms that don't provide it.


On Wed, Sep 11, 2013 at 6:44 PM, Jesse <> wrote:

> I have 2 failing tests left on wp7 due to a lack of support for window.btoa
> The current FileTransfer.js implementation of getBasicAuthHeader relies on
> window.btoa otherwise it does nothing.
> There is no reason the conversion could not be done in native code,
> presumably faster and easier, so I am wondering why someone chose to just
> return null if the window did not have the method.
> I also cannot easily override/clobber this method, since it is essentially
> private.
> (note all tests pass on wp8, which uses ie10.  wp7 is eternally ie9)
> I have several options for fixing this, each with their own
> strengths/weaknesses
> a. polyfill window.btoa ( and atob ) using [1]
> b. fix the js implementation so it will pass username:password on to
> native, if it cannot pass base64 encoded data. ( this means changing the
> common FileTransfer.js )
> c. provide a different implementation in js for windows phone ( using a
> windows phone only version of FileTransfer.js and clobbering )
> d. some sort of mixture of the above, like polyfill via plugin.xml so we
> can only include the polyfill in wp7
> Thinking through this while writing it, I am thinking d. makes the most
> sense, although it should probably be done by the File plugin, which needs
> it also, and is a dependency of FileTransfer anyway.
> Any other thoughts, platform specific considerations here?
> [1]
> @purplecabbage

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message