<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>55663</bug_id>
          
          <creation_ts>2011-03-03 04:40:54 -0800</creation_ts>
          <short_desc>Implement btoa and atob functions in Web Workers</short_desc>
          <delta_ts>2016-06-09 15:44:09 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>158576</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jon Leighton">j</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>adam</cc>
    
    <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>dmitry</cc>
    
    <cc>ericbidelman</cc>
    
    <cc>mathias</cc>
    
    <cc>popecode</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>361521</commentid>
    <comment_count>0</comment_count>
    <who name="Jon Leighton">j</who>
    <bug_when>2011-03-03 04:40:54 -0800</bug_when>
    <thetext>Firefox supports btoa() and atob() functions within workers, which do the same thing as window.btoa() and window.atob() in the DOM. It would be great if these were available in WebKit too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>361952</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-03-03 14:38:58 -0800</bug_when>
    <thetext>Could you please provide some use cases for using these functions in workers?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>361989</commentid>
    <comment_count>2</comment_count>
    <who name="Jon Leighton">j</who>
    <bug_when>2011-03-03 15:07:18 -0800</bug_when>
    <thetext>In a project I was working on I was downloading image data via XHR in a Web Worker and then encoding it into a data: URI. (I say &apos;was&apos; because I have since stopped doing it in a worker, for separate reasons, but there you go...)

I could imagine you might have, for example, a web-based email client which might want to encode a multipart message before sending it, all the background in a worker.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>698727</commentid>
    <comment_count>3</comment_count>
    <who name="Eric">ericbidelman</who>
    <bug_when>2012-08-17 15:33:22 -0700</bug_when>
    <thetext>My use case is similar. I&apos;m using GIFEncoder (https://github.com/antimatter15/jsgif/blob/master/GIFEncoder.js), in a worker to produce a data URL from of the encoded gif. GIFEncoder implements it&apos;s own encode64() method: https://github.com/antimatter15/jsgif/blob/master/Demos/b64.js</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>932417</commentid>
    <comment_count>4</comment_count>
    <who name="">popecode</who>
    <bug_when>2013-09-23 21:15:31 -0700</bug_when>
    <thetext>I wrote a frame buffer to handle image downloads from a worker thread.  For my application, this is necessary as the main thread is handling a video and an animation and performance is critical.   

To use the downloaded images in the browser, I first have to convert them via btoa().  Using firefox, I can perform this conversion before passing the data to the main thread.  Since chrome does not allow this, Firefox runs significantly faster than Chrome in my case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1055423</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry Chestnykh">dmitry</who>
    <bug_when>2014-12-13 06:13:57 -0800</bug_when>
    <thetext>Is there any progress on this? I use atob/btoa for base64 encoding in TweetNaCl-js instead of implementing my own routines, and I&apos;d like them to be available from web workers. FIY, both Firefox and Chrome have them.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1055433</commentid>
    <comment_count>6</comment_count>
    <who name="Mathias Bynens">mathias</who>
    <bug_when>2014-12-13 09:23:06 -0800</bug_when>
    <thetext>@Dmitry, as a workaround you can use a fully `btoa`/`atob`-compatible polyfill like https://github.com/mathiasbynens/base64.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1201021</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-06-09 15:44:09 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 158576 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>