Bug 158576

Summary: atob() / btoa() API should be exposed to workers
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: BindingsAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, commit-queue, darin, ggaren, j, rniwa, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar, WebExposed
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2016-06-09 13:11:19 PDT
atob() / btoa() API should be exposed to workers:
https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
Comment 1 Chris Dumez 2016-06-09 13:18:37 PDT
Test:
http://w3c-test.org/workers/interfaces.worker
Comment 2 Radar WebKit Bug Importer 2016-06-09 15:27:43 PDT
<rdar://problem/26729340>
Comment 3 Chris Dumez 2016-06-09 15:33:05 PDT
Created attachment 280958 [details]
Patch
Comment 4 Chris Dumez 2016-06-09 15:44:09 PDT
*** Bug 55663 has been marked as a duplicate of this bug. ***
Comment 5 WebKit Commit Bot 2016-06-09 18:40:35 PDT
Comment on attachment 280958 [details]
Patch

Clearing flags on attachment: 280958

Committed r201898: <http://trac.webkit.org/changeset/201898>
Comment 6 WebKit Commit Bot 2016-06-09 18:40:40 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Darin Adler 2016-06-09 18:55:32 PDT
Comment on attachment 280958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=280958&action=review

> Source/WebCore/page/Base64Utilities.h:36
> +    Base64Utilities() = default;
> +

We should just delete these two lines of code. This is what a class gets if you don’t explicitly define a constructor. We should do this only if we want to make the default constructor private or protected.
Comment 8 Chris Dumez 2016-06-09 18:56:49 PDT
Comment on attachment 280958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=280958&action=review

>> Source/WebCore/page/Base64Utilities.h:36
>> +
> 
> We should just delete these two lines of code. This is what a class gets if you don’t explicitly define a constructor. We should do this only if we want to make the default constructor private or protected.

My bad. I'll drop them in a follow up.
Comment 9 Darin Adler 2016-06-09 19:11:46 PDT
Comment on attachment 280958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=280958&action=review

> Source/WebCore/page/Base64Utilities.h:38
> +    String btoa(const String& stringToEncode, ExceptionCode&);
> +    String atob(const String& encodedString, ExceptionCode&);

Another thing: These should both be static member functions. More efficient that way. Neither makes any use of "this", directly or indirectly.
Comment 10 Chris Dumez 2016-06-09 20:18:33 PDT
Committed r201903: <http://trac.webkit.org/changeset/201903>