<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201898] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201898">201898</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-06-09 18:42:05 -0700 (Thu, 09 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>atob() / btoa() API should be exposed to workers
https://bugs.webkit.org/show_bug.cgi?id=158576
&lt;rdar://problem/26729340&gt;

Reviewed by Sam Weinig.

Source/WebCore:

Expose atob() / btoa() API to workers as per:
https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope

This aligns our behavior with Firefox and Chrome as well.

Test: fast/workers/atob-btoa.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* page/Base64Utilities.cpp: Added.
(WebCore::Base64Utilities::btoa):
(WebCore::Base64Utilities::atob):
* page/Base64Utilities.h: Added.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find): Deleted.
(WebCore::DOMWindow::offscreenBuffering): Deleted.
(WebCore::DOMWindow::outerHeight): Deleted.
(WebCore::DOMWindow::outerWidth): Deleted.
* page/DOMWindow.h:
* page/DOMWindow.idl:
* page/WindowBase64.idl: Removed.
* page/WindowOrWorkerGlobalScope.idl: Renamed from Source/WebCore/page/WindowTimers.idl.
* workers/WorkerGlobalScope.h:
* workers/WorkerGlobalScope.idl:

LayoutTests:

Add test for atob() / btoa() in workers.

* fast/workers/atob-btoa-expected.txt: Added.
* fast/workers/atob-btoa.html: Added.
* fast/workers/resources/worker-atob-btoa.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcescpp">trunk/Source/WebCore/DerivedSources.cpp</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowidl">trunk/Source/WebCore/page/DOMWindow.idl</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerGlobalScopeh">trunk/Source/WebCore/workers/WorkerGlobalScope.h</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerGlobalScopeidl">trunk/Source/WebCore/workers/WorkerGlobalScope.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastworkersatobbtoaexpectedtxt">trunk/LayoutTests/fast/workers/atob-btoa-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastworkersatobbtoahtml">trunk/LayoutTests/fast/workers/atob-btoa.html</a></li>
<li><a href="#trunkLayoutTestsfastworkersresourcesworkeratobbtoajs">trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js</a></li>
<li><a href="#trunkSourceWebCorepageBase64Utilitiescpp">trunk/Source/WebCore/page/Base64Utilities.cpp</a></li>
<li><a href="#trunkSourceWebCorepageBase64Utilitiesh">trunk/Source/WebCore/page/Base64Utilities.h</a></li>
<li><a href="#trunkSourceWebCorepageWindowOrWorkerGlobalScopeidl">trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorepageWindowBase64idl">trunk/Source/WebCore/page/WindowBase64.idl</a></li>
<li><a href="#trunkSourceWebCorepageWindowTimersidl">trunk/Source/WebCore/page/WindowTimers.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/LayoutTests/ChangeLog        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-06-09  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        atob() / btoa() API should be exposed to workers
+        https://bugs.webkit.org/show_bug.cgi?id=158576
+        &lt;rdar://problem/26729340&gt;
+
+        Reviewed by Sam Weinig.
+
+        Add test for atob() / btoa() in workers.
+
+        * fast/workers/atob-btoa-expected.txt: Added.
+        * fast/workers/atob-btoa.html: Added.
+        * fast/workers/resources/worker-atob-btoa.js: Added.
+
</ins><span class="cx"> 2016-06-09  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ES6: Reusing function name as a parameter name shouldn't throw Syntax Error
</span></span></pre></div>
<a id="trunkLayoutTestsfastworkersatobbtoaexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/workers/atob-btoa-expected.txt (0 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/atob-btoa-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/workers/atob-btoa-expected.txt        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+[Worker] tests that atob() / btoa() work in workers.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Starting worker: resources/worker-atob-btoa.js
+PASS [Worker] self.atob(&quot;YQ==&quot;) is &quot;a&quot;
+PASS [Worker] self.atob(&quot;YWI=&quot;) is &quot;ab&quot;
+PASS [Worker] self.atob(&quot;YWJj&quot;) is &quot;abc&quot;
+PASS [Worker] self.atob(&quot;YWJjZA==&quot;) is &quot;abcd&quot;
+PASS [Worker] self.atob(&quot;YWJjZGU=&quot;) is &quot;abcde&quot;
+PASS [Worker] self.atob(&quot;YWJjZGVm&quot;) is &quot;abcdef&quot;
+PASS [Worker] self.btoa(&quot;a&quot;) is &quot;YQ==&quot;
+PASS [Worker] self.btoa(&quot;ab&quot;) is &quot;YWI=&quot;
+PASS [Worker] self.btoa(&quot;abc&quot;) is &quot;YWJj&quot;
+PASS [Worker] self.btoa(&quot;abcd&quot;) is &quot;YWJjZA==&quot;
+PASS [Worker] self.btoa(&quot;abcde&quot;) is &quot;YWJjZGU=&quot;
+PASS [Worker] self.btoa(&quot;abcdef&quot;) is &quot;YWJjZGVm&quot;
+PASS [Worker] typeof self.btoa is &quot;function&quot;
+PASS [Worker] self.btoa() threw exception TypeError: Not enough arguments.
+PASS [Worker] self.btoa(&quot;&quot;) is &quot;&quot;
+PASS [Worker] self.btoa(null) is &quot;bnVsbA==&quot;
+PASS [Worker] self.btoa(undefined) is &quot;dW5kZWZpbmVk&quot;
+PASS [Worker] self.btoa(self) is &quot;W29iamVjdCBEZWRpY2F0ZWRXb3JrZXJHbG9iYWxTY29wZV0=&quot;
+PASS [Worker] self.btoa(&quot;éé&quot;) is &quot;6ek=&quot;
+PASS [Worker] self.btoa(&quot;\u0080\u0081&quot;) is &quot;gIE=&quot;
+PASS [Worker] self.btoa(&quot;тест&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.btoa is 0
+PASS [Worker] typeof self.btoa is &quot;number&quot;
+PASS [Worker] typeof self.atob is &quot;function&quot;
+PASS [Worker] self.atob() threw exception TypeError: Not enough arguments.
+PASS [Worker] self.atob(&quot;&quot;) is &quot;&quot;
+PASS [Worker] self.atob(null) is &quot;žée&quot;
+PASS [Worker] self.atob(undefined) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot; YQ==&quot;) is &quot;a&quot;
+PASS [Worker] self.atob(&quot;YQ==\u000a&quot;) is &quot;a&quot;
+PASS [Worker] self.atob(&quot;ab\tcd&quot;) is &quot;i·&quot;
+PASS [Worker] self.atob(&quot;ab\ncd&quot;) is &quot;i·&quot;
+PASS [Worker] self.atob(&quot;ab\fcd&quot;) is &quot;i·&quot;
+PASS [Worker] self.atob(&quot;ab cd&quot;) is &quot;i·&quot;
+PASS [Worker] self.atob(&quot;ab\t\n\f\r cd&quot;) is &quot;i·&quot;
+PASS [Worker] self.atob(&quot; \t\n\f\r ab\t\n\f\r cd\t\n\f\r &quot;) is &quot;i·&quot;
+PASS [Worker] self.atob(&quot;ab\t\n\f\r =\t\n\f\r =\t\n\f\r &quot;) is &quot;i&quot;
+PASS [Worker] self.atob(&quot;            &quot;) is &quot;&quot;
+PASS [Worker] self.atob(&quot; abcd===&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;abcd=== &quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;abcd ===&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;6ek=&quot;) is &quot;éé&quot;
+PASS [Worker] self.atob(&quot;6ek&quot;) is &quot;éé&quot;
+PASS [Worker] self.atob(&quot;gIE=&quot;) is &quot;€&quot;
+PASS [Worker] self.atob(&quot;тест&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;z&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;zz&quot;) is &quot;Ï&quot;
+PASS [Worker] self.atob(&quot;zzz&quot;) is &quot;Ï&lt;&quot;
+PASS [Worker] self.atob(&quot;zzz=&quot;) is &quot;Ï&lt;&quot;
+PASS [Worker] self.atob(&quot;zzz==&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;zzz===&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;zzz====&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;zzz=====&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;zzzz&quot;) is &quot;Ï&lt;ó&quot;
+PASS [Worker] self.atob(&quot;zzzzz&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;z=zz&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;=&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;==&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;===&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;====&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(&quot;=====&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob is 0
+PASS [Worker] typeof self.atob is &quot;number&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastworkersatobbtoahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/workers/atob-btoa.html (0 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/atob-btoa.html                                (rev 0)
+++ trunk/LayoutTests/fast/workers/atob-btoa.html        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+worker = startWorker('resources/worker-atob-btoa.js');
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastworkersresourcesworkeratobbtoajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js (0 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js                                (rev 0)
+++ trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+importScripts('../../../resources/js-test-pre.js');
+
+var global = this;
+global.jsTestIsAsync = true;
+
+description(&quot;tests that atob() / btoa() work in workers.&quot;);
+
+shouldBe('self.atob(&quot;YQ==&quot;)', '&quot;a&quot;');
+shouldBe('self.atob(&quot;YWI=&quot;)', '&quot;ab&quot;');
+shouldBe('self.atob(&quot;YWJj&quot;)', '&quot;abc&quot;');
+shouldBe('self.atob(&quot;YWJjZA==&quot;)', '&quot;abcd&quot;');
+shouldBe('self.atob(&quot;YWJjZGU=&quot;)', '&quot;abcde&quot;');
+shouldBe('self.atob(&quot;YWJjZGVm&quot;)', '&quot;abcdef&quot;');
+shouldBe('self.btoa(&quot;a&quot;)', '&quot;YQ==&quot;');
+shouldBe('self.btoa(&quot;ab&quot;)', '&quot;YWI=&quot;');
+shouldBe('self.btoa(&quot;abc&quot;)', '&quot;YWJj&quot;');
+shouldBe('self.btoa(&quot;abcd&quot;)', '&quot;YWJjZA==&quot;');
+shouldBe('self.btoa(&quot;abcde&quot;)', '&quot;YWJjZGU=&quot;');
+shouldBe('self.btoa(&quot;abcdef&quot;)', '&quot;YWJjZGVm&quot;');
+
+shouldBe('typeof self.btoa', '&quot;function&quot;');
+shouldThrow('self.btoa()', '&quot;TypeError: Not enough arguments&quot;');
+shouldBe('self.btoa(&quot;&quot;)', '&quot;&quot;');
+shouldBe('self.btoa(null)', '&quot;bnVsbA==&quot;'); // Gets converted to &quot;null&quot; string.
+shouldBe('self.btoa(undefined)', '&quot;dW5kZWZpbmVk&quot;');
+shouldBe('self.btoa(self)', '&quot;W29iamVjdCBEZWRpY2F0ZWRXb3JrZXJHbG9iYWxTY29wZV0=&quot;'); // &quot;[object DedicatedWorkerGlobalScope]&quot;
+shouldBe('self.btoa(&quot;éé&quot;)', '&quot;6ek=&quot;');
+shouldBe('self.btoa(&quot;\\u0080\\u0081&quot;)', '&quot;gIE=&quot;');
+shouldThrow('self.btoa(&quot;тест&quot;)');
+self.btoa = 0;
+shouldBe('self.btoa', '0');
+shouldBe('typeof self.btoa', '&quot;number&quot;');
+
+shouldBe('typeof self.atob', '&quot;function&quot;');
+shouldThrow('self.atob()', '&quot;TypeError: Not enough arguments&quot;');
+shouldBe('self.atob(&quot;&quot;)', '&quot;&quot;');
+shouldBe('self.atob(null)', '&quot;\x9Eée&quot;'); // Gets converted to &quot;null&quot; string.
+shouldThrow('self.atob(undefined)');
+shouldBe('self.atob(&quot; YQ==&quot;)', '&quot;a&quot;');
+shouldBe('self.atob(&quot;YQ==\\u000a&quot;)', '&quot;a&quot;');
+shouldBe('self.atob(&quot;ab\\tcd&quot;)', '&quot;i·\x1d&quot;');
+shouldBe('self.atob(&quot;ab\\ncd&quot;)', '&quot;i·\x1d&quot;');
+shouldBe('self.atob(&quot;ab\\fcd&quot;)', '&quot;i·\x1d&quot;');
+shouldBe('self.atob(&quot;ab cd&quot;)', '&quot;i·\x1d&quot;');
+shouldBe('self.atob(&quot;ab\\t\\n\\f\\r cd&quot;)', '&quot;i·\x1d&quot;');
+shouldBe('self.atob(&quot; \\t\\n\\f\\r ab\\t\\n\\f\\r cd\\t\\n\\f\\r &quot;)', '&quot;i·\x1d&quot;');
+shouldBe('self.atob(&quot;ab\\t\\n\\f\\r =\\t\\n\\f\\r =\\t\\n\\f\\r &quot;)', '&quot;i&quot;');
+shouldBe('self.atob(&quot;            &quot;)', '&quot;&quot;');
+shouldThrow('self.atob(&quot; abcd===&quot;)');
+shouldThrow('self.atob(&quot;abcd=== &quot;)');
+shouldThrow('self.atob(&quot;abcd ===&quot;)');
+shouldBe('self.atob(&quot;6ek=&quot;)', '&quot;éé&quot;');
+shouldBe('self.atob(&quot;6ek&quot;)', '&quot;éé&quot;');
+shouldBe('self.atob(&quot;gIE=&quot;)', '&quot;\u0080\u0081&quot;');
+shouldThrow('self.atob(&quot;тест&quot;)');
+shouldThrow('self.atob(&quot;z&quot;)');
+shouldBe('self.atob(&quot;zz&quot;)', '&quot;Ï&quot;');
+shouldBe('self.atob(&quot;zzz&quot;)', '&quot;Ï\u003C&quot;');
+shouldBe('self.atob(&quot;zzz=&quot;)', '&quot;Ï\u003C&quot;');
+shouldThrow('self.atob(&quot;zzz==&quot;)'); // excess pad characters.
+shouldThrow('self.atob(&quot;zzz===&quot;)'); // excess pad characters.
+shouldThrow('self.atob(&quot;zzz====&quot;)'); // excess pad characters.
+shouldThrow('self.atob(&quot;zzz=====&quot;)'); // excess pad characters.
+shouldBe('self.atob(&quot;zzzz&quot;)', '&quot;Ï\u003Có&quot;');
+shouldThrow('self.atob(&quot;zzzzz&quot;)');
+shouldThrow('self.atob(&quot;z=zz&quot;)');
+shouldThrow('self.atob(&quot;=&quot;)');
+shouldThrow('self.atob(&quot;==&quot;)');
+shouldThrow('self.atob(&quot;===&quot;)');
+shouldThrow('self.atob(&quot;====&quot;)');
+shouldThrow('self.atob(&quot;=====&quot;)');
+self.atob = 0;
+shouldBe('self.atob', '0');
+shouldBe('typeof self.atob', '&quot;number&quot;');
+
+finishJSTest();
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -616,9 +616,8 @@
</span><span class="cx">     page/UserMessageHandlersNamespace.idl
</span><span class="cx">     page/WebKitNamespace.idl
</span><span class="cx">     page/WebKitPoint.idl
</span><del>-    page/WindowBase64.idl
</del><span class="cx">     page/WindowEventHandlers.idl
</span><del>-    page/WindowTimers.idl
</del><ins>+    page/WindowOrWorkerGlobalScope.idl
</ins><span class="cx">     page/WorkerNavigator.idl
</span><span class="cx"> 
</span><span class="cx">     plugins/DOMMimeType.idl
</span><span class="lines">@@ -1988,6 +1987,7 @@
</span><span class="cx"> 
</span><span class="cx">     page/AutoscrollController.cpp
</span><span class="cx">     page/BarProp.cpp
</span><ins>+    page/Base64Utilities.cpp
</ins><span class="cx">     page/CaptionUserPreferences.cpp
</span><span class="cx">     page/Chrome.cpp
</span><span class="cx">     page/ContextMenuContext.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/ChangeLog        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-06-09  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        atob() / btoa() API should be exposed to workers
+        https://bugs.webkit.org/show_bug.cgi?id=158576
+        &lt;rdar://problem/26729340&gt;
+
+        Reviewed by Sam Weinig.
+
+        Expose atob() / btoa() API to workers as per:
+        https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
+
+        This aligns our behavior with Firefox and Chrome as well.
+
+        Test: fast/workers/atob-btoa.html
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * PlatformMac.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/Base64Utilities.cpp: Added.
+        (WebCore::Base64Utilities::btoa):
+        (WebCore::Base64Utilities::atob):
+        * page/Base64Utilities.h: Added.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::find): Deleted.
+        (WebCore::DOMWindow::offscreenBuffering): Deleted.
+        (WebCore::DOMWindow::outerHeight): Deleted.
+        (WebCore::DOMWindow::outerWidth): Deleted.
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+        * page/WindowBase64.idl: Removed.
+        * page/WindowOrWorkerGlobalScope.idl: Renamed from Source/WebCore/page/WindowTimers.idl.
+        * workers/WorkerGlobalScope.h:
+        * workers/WorkerGlobalScope.idl:
+
</ins><span class="cx"> 2016-06-09  John Wilander  &lt;wilander@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Restrict HTTP/0.9 responses to default ports and cancel HTTP/0.9 resource loads if the document was loaded with another HTTP protocol
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.cpp (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.cpp        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/DerivedSources.cpp        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -653,9 +653,8 @@
</span><span class="cx"> #include &quot;JSWebKitTransitionEvent.cpp&quot;
</span><span class="cx"> #include &quot;JSWebSocket.cpp&quot;
</span><span class="cx"> #include &quot;JSWheelEvent.cpp&quot;
</span><del>-#include &quot;JSWindowBase64.cpp&quot;
</del><span class="cx"> #include &quot;JSWindowEventHandlers.cpp&quot;
</span><del>-#include &quot;JSWindowTimers.cpp&quot;
</del><ins>+#include &quot;JSWindowOrWorkerGlobalScope.cpp&quot;
</ins><span class="cx"> #include &quot;JSWorker.cpp&quot;
</span><span class="cx"> #include &quot;JSWorkerGlobalScope.cpp&quot;
</span><span class="cx"> #include &quot;JSWorkerGlobalScopeFetch.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/DerivedSources.make        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -525,10 +525,9 @@
</span><span class="cx">     $(WebCore)/page/WebKitNamespace.idl \
</span><span class="cx">     $(WebCore)/page/UserMessageHandlersNamespace.idl \
</span><span class="cx">     $(WebCore)/page/UserMessageHandler.idl \
</span><del>-    $(WebCore)/page/WindowBase64.idl \
</del><span class="cx">     $(WebCore)/page/WindowEventHandlers.idl \
</span><del>-    $(WebCore)/page/WindowTimers.idl \
</del><span class="cx">     $(WebCore)/page/WorkerNavigator.idl \
</span><ins>+    $(WebCore)/page/WindowOrWorkerGlobalScope.idl \
</ins><span class="cx">     $(WebCore)/plugins/DOMMimeType.idl \
</span><span class="cx">     $(WebCore)/plugins/DOMMimeTypeArray.idl \
</span><span class="cx">     $(WebCore)/plugins/DOMPlugin.idl \
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/PlatformMac.cmake        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -904,9 +904,8 @@
</span><span class="cx">     NonElementParentNode
</span><span class="cx">     ParentNode
</span><span class="cx">     URLUtils
</span><del>-    WindowBase64
</del><span class="cx">     WindowEventHandlers
</span><del>-    WindowTimers
</del><ins>+    WindowOrWorkerGlobalScope
</ins><span class="cx">     WorkerGlobalScopeIndexedDatabase
</span><span class="cx">     WorkerGlobalScopeNotifications
</span><span class="cx">     XPathNSResolver
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -1658,8 +1658,8 @@
</span><span class="cx">                 439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */; };
</span><span class="cx">                 439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */; };
</span><span class="cx">                 439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
</span><ins>+                439046E912DA25E812AF80AC /* MathOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E812AF80AC /* MathOperator.cpp */; };
</ins><span class="cx">                 439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
</span><del>-                439046E912DA25E812AF80AC /* MathOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E812AF80AC /* MathOperator.cpp */; };
</del><span class="cx">                 439046EA12DA25E812AF80AC /* MathOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E812AF80AC /* MathOperator.h */; };
</span><span class="cx">                 439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */; };
</span><span class="cx">                 439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */; };
</span><span class="lines">@@ -1733,6 +1733,8 @@
</span><span class="cx">                 458FE40A1589DF0B005609E6 /* RenderSearchField.h in Headers */ = {isa = PBXBuildFile; fileRef = 458FE4081589DF0B005609E6 /* RenderSearchField.h */; };
</span><span class="cx">                 45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
</span><span class="cx">                 45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                460BB6151D0A1BF000221812 /* Base64Utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */; };
+                460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB6141D0A1BEC00221812 /* Base64Utilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
</span><span class="cx">                 463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; };
</span><span class="cx">                 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
</span><span class="lines">@@ -9205,8 +9207,8 @@
</span><span class="cx">                 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLScripts.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLScripts.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLUnderOver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                439046D512DA25E812AF80AC /* MathOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathOperator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLUnderOver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                439046D512DA25E812AF80AC /* MathOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathOperator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 439046D612DA25E812AF80AC /* MathOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathOperator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLToken.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLToken.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9285,6 +9287,8 @@
</span><span class="cx">                 458FE4081589DF0B005609E6 /* RenderSearchField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSearchField.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64Utilities.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                460BB6141D0A1BEC00221812 /* Base64Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64Utilities.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17981,6 +17985,8 @@
</span><span class="cx">                                 BC124EE40C2641CD009E2349 /* BarProp.cpp */,
</span><span class="cx">                                 BC124EE50C2641CD009E2349 /* BarProp.h */,
</span><span class="cx">                                 BC124EE60C2641CD009E2349 /* BarProp.idl */,
</span><ins>+                                460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */,
+                                460BB6141D0A1BEC00221812 /* Base64Utilities.h */,
</ins><span class="cx">                                 072CA86016CB4DC3008AE131 /* CaptionUserPreferences.cpp */,
</span><span class="cx">                                 079D0867162F20E800DB8658 /* CaptionUserPreferences.h */,
</span><span class="cx">                                 079D086A162F21F900DB8658 /* CaptionUserPreferencesMediaAF.cpp */,
</span><span class="lines">@@ -26281,6 +26287,7 @@
</span><span class="cx">                                 A8EA7D2D0A19385500A8EF5F /* HTMLImageElement.h in Headers */,
</span><span class="cx">                                 A8EA7D2B0A19385500A8EF5F /* HTMLImageLoader.h in Headers */,
</span><span class="cx">                                 A81369CC097374F600D74463 /* HTMLInputElement.h in Headers */,
</span><ins>+                                460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */,
</ins><span class="cx">                                 97BC849B12370A4B000C6161 /* HTMLInputStream.h in Headers */,
</span><span class="cx">                                 93309DE6099E64920056E581 /* HTMLInterchange.h in Headers */,
</span><span class="cx">                                 A81369E4097374F600D74463 /* HTMLKeygenElement.h in Headers */,
</span><span class="lines">@@ -29076,6 +29083,7 @@
</span><span class="cx">                                 CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */,
</span><span class="cx">                                 FD31603D12B0267600C1A359 /* AnalyserNode.cpp in Sources */,
</span><span class="cx">                                 31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */,
</span><ins>+                                460BB6151D0A1BF000221812 /* Base64Utilities.cpp in Sources */,
</ins><span class="cx">                                 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */,
</span><span class="cx">                                 49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */,
</span><span class="cx">                                 316FE1110E6E1DA700BF6088 /* AnimationBase.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepageBase64Utilitiescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/Base64Utilities.cpp (0 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Base64Utilities.cpp                                (rev 0)
+++ trunk/Source/WebCore/page/Base64Utilities.cpp        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;Base64Utilities.h&quot;
+
+#include &lt;wtf/text/Base64.h&gt;
+
+namespace WebCore {
+
+String Base64Utilities::btoa(const String&amp; stringToEncode, ExceptionCode&amp; ec)
+{
+    if (stringToEncode.isNull())
+        return String();
+
+    if (!stringToEncode.containsOnlyLatin1()) {
+        ec = INVALID_CHARACTER_ERR;
+        return String();
+    }
+
+    return base64Encode(stringToEncode.latin1());
+}
+
+String Base64Utilities::atob(const String&amp; encodedString, ExceptionCode&amp; ec)
+{
+    if (encodedString.isNull())
+        return String();
+
+    if (!encodedString.containsOnlyLatin1()) {
+        ec = INVALID_CHARACTER_ERR;
+        return String();
+    }
+
+    Vector&lt;char&gt; out;
+    if (!base64Decode(encodedString, out, Base64ValidatePadding | Base64IgnoreSpacesAndNewLines)) {
+        ec = INVALID_CHARACTER_ERR;
+        return String();
+    }
+
+    return String(out.data(), out.size());
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorepageBase64Utilitiesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/Base64Utilities.h (0 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Base64Utilities.h                                (rev 0)
+++ trunk/Source/WebCore/page/Base64Utilities.h        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;ExceptionCode.h&quot;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class Base64Utilities {
+public:
+    Base64Utilities() = default;
+
+    String btoa(const String&amp; stringToEncode, ExceptionCode&amp;);
+    String atob(const String&amp; encodedString, ExceptionCode&amp;);
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -109,7 +109,6 @@
</span><span class="cx"> #include &lt;wtf/MathExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><del>-#include &lt;wtf/text/Base64.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(USER_MESSAGE_HANDLERS)
</span><span class="lines">@@ -1137,38 +1136,6 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String DOMWindow::btoa(const String&amp; stringToEncode, ExceptionCode&amp; ec)
-{
-    if (stringToEncode.isNull())
-        return String();
-
-    if (!stringToEncode.containsOnlyLatin1()) {
-        ec = INVALID_CHARACTER_ERR;
-        return String();
-    }
-
-    return base64Encode(stringToEncode.latin1());
-}
-
-String DOMWindow::atob(const String&amp; encodedString, ExceptionCode&amp; ec)
-{
-    if (encodedString.isNull())
-        return String();
-
-    if (!encodedString.containsOnlyLatin1()) {
-        ec = INVALID_CHARACTER_ERR;
-        return String();
-    }
-
-    Vector&lt;char&gt; out;
-    if (!base64Decode(encodedString, out, Base64ValidatePadding | Base64IgnoreSpacesAndNewLines)) {
-        ec = INVALID_CHARACTER_ERR;
-        return String();
-    }
-
-    return String(out.data(), out.size());
-}
-
</del><span class="cx"> bool DOMWindow::find(const String&amp; string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const
</span><span class="cx"> {
</span><span class="cx">     if (!isCurrentlyDisplayedInFrame())
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #ifndef DOMWindow_h
</span><span class="cx"> #define DOMWindow_h
</span><span class="cx"> 
</span><ins>+#include &quot;Base64Utilities.h&quot;
</ins><span class="cx"> #include &quot;ContextDestructionObserver.h&quot;
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><span class="cx"> #include &quot;FrameDestructionObserver.h&quot;
</span><span class="lines">@@ -97,6 +98,7 @@
</span><span class="cx">         , public EventTargetWithInlineData
</span><span class="cx">         , public ContextDestructionObserver
</span><span class="cx">         , public FrameDestructionObserver
</span><ins>+        , public Base64Utilities
</ins><span class="cx">         , public Supplementable&lt;DOMWindow&gt; {
</span><span class="cx">     public:
</span><span class="cx">         static Ref&lt;DOMWindow&gt; create(Document* document) { return adoptRef(*new DOMWindow(document)); }
</span><span class="lines">@@ -175,8 +177,6 @@
</span><span class="cx">         void alert(const String&amp; message);
</span><span class="cx">         bool confirm(const String&amp; message);
</span><span class="cx">         String prompt(const String&amp; message, const String&amp; defaultValue);
</span><del>-        String btoa(const String&amp; stringToEncode, ExceptionCode&amp;);
-        String atob(const String&amp; encodedString, ExceptionCode&amp;);
</del><span class="cx"> 
</span><span class="cx">         bool find(const String&amp;, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.idl (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.idl        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/DOMWindow.idl        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -231,6 +231,5 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> DOMWindow implements GlobalEventHandlers;
</span><del>-DOMWindow implements WindowBase64;
</del><span class="cx"> DOMWindow implements WindowEventHandlers;
</span><del>-DOMWindow implements WindowTimers;
</del><ins>+DOMWindow implements WindowOrWorkerGlobalScope;
</ins></span></pre></div>
<a id="trunkSourceWebCorepageWindowBase64idl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/page/WindowBase64.idl (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WindowBase64.idl        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/WindowBase64.idl        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -1,33 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
-    NoInterfaceObject,
-] interface WindowBase64 {
-    [RaisesException] DOMString atob(DOMString string);
-    [RaisesException] DOMString btoa(DOMString string);
-};
</del></span></pre></div>
<a id="trunkSourceWebCorepageWindowOrWorkerGlobalScopeidlfromrev201897trunkSourceWebCorepageWindowTimersidl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl (from rev 201897, trunk/Source/WebCore/page/WindowTimers.idl) (0 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl                                (rev 0)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2006-2009, 2013, 1016 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    NoInterfaceObject,
+] interface WindowOrWorkerGlobalScope {
+    // Timers.
+    [Custom] long setTimeout(any handler, optional long timeout = 0);
+    void clearTimeout(optional long handle = 0);
+    [Custom] long setInterval(any handler, optional long timeout = 0);
+    void clearInterval(optional long handle = 0);
+
+    // Base64 utility methods.
+    [RaisesException] DOMString atob(DOMString string);
+    [RaisesException] DOMString btoa(DOMString string);
+};
+
</ins></span></pre></div>
<a id="trunkSourceWebCorepageWindowTimersidl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/page/WindowTimers.idl (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WindowTimers.idl        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/WindowTimers.idl        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -1,36 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
-    NoInterfaceObject,
-] interface WindowTimers {
-    [Custom] long setTimeout(any handler, optional long timeout = 0);
-    void clearTimeout(optional long handle = 0);
-    [Custom] long setInterval(any handler, optional long timeout = 0);
-    void clearInterval(optional long handle = 0);
-};
-
</del></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerGlobalScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerGlobalScope.h        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;Base64Utilities.h&quot;
</ins><span class="cx"> #include &quot;EventListener.h&quot;
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx"> class IDBConnectionProxy;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-class WorkerGlobalScope : public RefCounted&lt;WorkerGlobalScope&gt;, public Supplementable&lt;WorkerGlobalScope&gt;, public ScriptExecutionContext, public EventTargetWithInlineData {
</del><ins>+class WorkerGlobalScope : public RefCounted&lt;WorkerGlobalScope&gt;, public Supplementable&lt;WorkerGlobalScope&gt;, public ScriptExecutionContext, public EventTargetWithInlineData, public Base64Utilities {
</ins><span class="cx"> public:
</span><span class="cx">     virtual ~WorkerGlobalScope();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerGlobalScopeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.idl (201897 => 201898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerGlobalScope.idl        2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.idl        2016-06-10 01:42:05 UTC (rev 201898)
</span><span class="lines">@@ -64,4 +64,4 @@
</span><span class="cx">     [Conditional=INDEXED_DATABASE_IN_WORKERS, EnabledAtRuntime=IndexedDBWorkers] attribute IDBVersionChangeEventConstructor IDBVersionChangeEvent;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-WorkerGlobalScope implements WindowTimers;
</del><ins>+WorkerGlobalScope implements WindowOrWorkerGlobalScope;
</ins></span></pre>
</div>
</div>

</body>
</html>