<!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>[209164] 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/209164">209164</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2016-11-30 16:28:04 -0800 (Wed, 30 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update SubtleCrypto::digest to match the latest spec
https://bugs.webkit.org/show_bug.cgi?id=164742
<rdar://problem/29258037>
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
* WebCryptoAPI/digest/test_digest-expected.txt:
* WebCryptoAPI/idlharness-expected.txt:
Source/WebCore:
This patch updates the SubtleCrypto::digest method to match the latest spec:
https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-digest.
It also refers to the latest Editor's Draft to a certain degree:
https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-digest.
Currently supported digest algorithms are SHA-1, SHA-224, SHA-256, SHA-384,
and SHA-512.
Tests: crypto/subtle/digest-malformed-parameters.html
crypto/subtle/sha1-digest.html
crypto/subtle/sha224-digest.html
crypto/subtle/sha256-digest.html
crypto/subtle/sha384-digest.html
crypto/subtle/sha512-digest.html
crypto/workers/subtle/sha1-digest.html
crypto/workers/subtle/sha224-digest.html
crypto/workers/subtle/sha256-digest.html
crypto/workers/subtle/sha384-digest.html
crypto/workers/subtle/sha512-digest.html
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::jsSubtleCryptoFunctionDigestPromise):
(WebCore::JSSubtleCrypto::digest):
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::digest):
* crypto/CryptoAlgorithm.h:
* crypto/SubtleCrypto.idl:
* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::digest):
* crypto/algorithms/CryptoAlgorithmSHA1.h:
* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
(WebCore::CryptoAlgorithmSHA224::digest):
* crypto/algorithms/CryptoAlgorithmSHA224.h:
* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::digest):
* crypto/algorithms/CryptoAlgorithmSHA256.h:
* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::digest):
* crypto/algorithms/CryptoAlgorithmSHA384.h:
* crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::digest):
* crypto/algorithms/CryptoAlgorithmSHA512.h:
LayoutTests:
* crypto/subtle/digest-malformed-parameters-expected.txt: Added.
* crypto/subtle/digest-malformed-parameters.html: Added.
* crypto/subtle/sha1-digest-expected.txt: Added.
* crypto/subtle/sha1-digest.html: Added.
* crypto/subtle/sha224-digest-expected.txt: Added.
* crypto/subtle/sha224-digest.html: Added.
* crypto/subtle/sha256-digest-expected.txt: Added.
* crypto/subtle/sha256-digest.html: Added.
* crypto/subtle/sha384-digest-expected.txt: Added.
* crypto/subtle/sha384-digest.html: Added.
* crypto/subtle/sha512-digest-expected.txt: Added.
* crypto/subtle/sha512-digest.html: Added.
* crypto/workers/subtle/resources/sha1-digest.js: Added.
* crypto/workers/subtle/resources/sha224-digest.js: Added.
* crypto/workers/subtle/resources/sha256-digest.js: Added.
* crypto/workers/subtle/resources/sha384-digest.js: Added.
* crypto/workers/subtle/resources/sha512-digest.js: Added.
* crypto/workers/subtle/sha1-digest-expected.txt: Added.
* crypto/workers/subtle/sha1-digest.html: Added.
* crypto/workers/subtle/sha224-digest-expected.txt: Added.
* crypto/workers/subtle/sha224-digest.html: Added.
* crypto/workers/subtle/sha256-digest-expected.txt: Added.
* crypto/workers/subtle/sha256-digest.html: Added.
* crypto/workers/subtle/sha384-digest-expected.txt: Added.
* crypto/workers/subtle/sha384-digest.html: Added.
* crypto/workers/subtle/sha512-digest-expected.txt: Added.
* crypto/workers/subtle/sha512-digest.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cWebCryptoAPIdigesttest_digestexpectedtxt">trunk/LayoutTests/imported/w3c/WebCryptoAPI/digest/test_digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cWebCryptoAPIidlharnessexpectedtxt">trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp">trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmcpp">trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmh">trunk/Source/WebCore/crypto/CryptoAlgorithm.h</a></li>
<li><a href="#trunkSourceWebCorecryptoSubtleCryptoidl">trunk/Source/WebCore/crypto/SubtleCrypto.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtledigestmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/digest-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtledigestmalformedparametershtml">trunk/LayoutTests/crypto/subtle/digest-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha1digestexpectedtxt">trunk/LayoutTests/crypto/subtle/sha1-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha1digesthtml">trunk/LayoutTests/crypto/subtle/sha1-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha224digestexpectedtxt">trunk/LayoutTests/crypto/subtle/sha224-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha224digesthtml">trunk/LayoutTests/crypto/subtle/sha224-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha256digestexpectedtxt">trunk/LayoutTests/crypto/subtle/sha256-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha256digesthtml">trunk/LayoutTests/crypto/subtle/sha256-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha384digestexpectedtxt">trunk/LayoutTests/crypto/subtle/sha384-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha384digesthtml">trunk/LayoutTests/crypto/subtle/sha384-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha512digestexpectedtxt">trunk/LayoutTests/crypto/subtle/sha512-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesha512digesthtml">trunk/LayoutTests/crypto/subtle/sha512-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcessha1digestjs">trunk/LayoutTests/crypto/workers/subtle/resources/sha1-digest.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcessha224digestjs">trunk/LayoutTests/crypto/workers/subtle/resources/sha224-digest.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcessha256digestjs">trunk/LayoutTests/crypto/workers/subtle/resources/sha256-digest.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcessha384digestjs">trunk/LayoutTests/crypto/workers/subtle/resources/sha384-digest.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcessha512digestjs">trunk/LayoutTests/crypto/workers/subtle/resources/sha512-digest.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha1digestexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/sha1-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha1digesthtml">trunk/LayoutTests/crypto/workers/subtle/sha1-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha224digestexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/sha224-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha224digesthtml">trunk/LayoutTests/crypto/workers/subtle/sha224-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha256digestexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/sha256-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha256digesthtml">trunk/LayoutTests/crypto/workers/subtle/sha256-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha384digestexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/sha384-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha384digesthtml">trunk/LayoutTests/crypto/workers/subtle/sha384-digest.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha512digestexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/sha512-digest-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlesha512digesthtml">trunk/LayoutTests/crypto/workers/subtle/sha512-digest.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/LayoutTests/ChangeLog        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-11-26 Jiewen Tan <jiewen_tan@apple.com>
+
+ Update SubtleCrypto::digest to match the latest spec
+ https://bugs.webkit.org/show_bug.cgi?id=164742
+ <rdar://problem/29258037>
+
+ Reviewed by Darin Adler.
+
+ * crypto/subtle/digest-malformed-parameters-expected.txt: Added.
+ * crypto/subtle/digest-malformed-parameters.html: Added.
+ * crypto/subtle/sha1-digest-expected.txt: Added.
+ * crypto/subtle/sha1-digest.html: Added.
+ * crypto/subtle/sha224-digest-expected.txt: Added.
+ * crypto/subtle/sha224-digest.html: Added.
+ * crypto/subtle/sha256-digest-expected.txt: Added.
+ * crypto/subtle/sha256-digest.html: Added.
+ * crypto/subtle/sha384-digest-expected.txt: Added.
+ * crypto/subtle/sha384-digest.html: Added.
+ * crypto/subtle/sha512-digest-expected.txt: Added.
+ * crypto/subtle/sha512-digest.html: Added.
+ * crypto/workers/subtle/resources/sha1-digest.js: Added.
+ * crypto/workers/subtle/resources/sha224-digest.js: Added.
+ * crypto/workers/subtle/resources/sha256-digest.js: Added.
+ * crypto/workers/subtle/resources/sha384-digest.js: Added.
+ * crypto/workers/subtle/resources/sha512-digest.js: Added.
+ * crypto/workers/subtle/sha1-digest-expected.txt: Added.
+ * crypto/workers/subtle/sha1-digest.html: Added.
+ * crypto/workers/subtle/sha224-digest-expected.txt: Added.
+ * crypto/workers/subtle/sha224-digest.html: Added.
+ * crypto/workers/subtle/sha256-digest-expected.txt: Added.
+ * crypto/workers/subtle/sha256-digest.html: Added.
+ * crypto/workers/subtle/sha384-digest-expected.txt: Added.
+ * crypto/workers/subtle/sha384-digest.html: Added.
+ * crypto/workers/subtle/sha512-digest-expected.txt: Added.
+ * crypto/workers/subtle/sha512-digest.html: Added.
+
</ins><span class="cx"> 2016-11-30 Antoine Quint <graouts@apple.com>
</span><span class="cx">
</span><span class="cx"> [Modern Media Controls] UI Library: <audio> controls
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtledigestmalformedparametersexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/digest-malformed-parameters-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/digest-malformed-parameters-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/digest-malformed-parameters-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test digest with malformed parameters
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.subtle.digest() rejected promise with TypeError: Not enough arguments.
+PASS crypto.subtle.digest(1) rejected promise with TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtledigestmalformedparametershtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/digest-malformed-parameters.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/digest-malformed-parameters.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/digest-malformed-parameters.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test digest with malformed parameters");
+
+var message = asciiToUint8Array("Hello, World!");
+
+// Not enough arguments.
+shouldReject('crypto.subtle.digest()');
+shouldReject('crypto.subtle.digest(1)');
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha1digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha1-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha1-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha1-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test digest with SHA-1
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha1digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha1-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha1-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha1-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test digest with SHA-1");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "0a0a9f2a6772942557ab5355d76af442f8f65e01";
+
+crypto.subtle.digest("sha-1", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha224digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha224-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha224-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha224-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test digest with SHA-224
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha224digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha224-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha224-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha224-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test digest with SHA-224");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "72a23dfa411ba6fde01dbfabf3b00a709c93ebf273dc29e2d8b261ff";
+
+crypto.subtle.digest("sha-224", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha256digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha256-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha256-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha256-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test digest with SHA-256
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha256digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha256-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha256-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha256-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test digest with SHA-256");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f";
+
+crypto.subtle.digest("sha-256", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha384digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha384-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha384-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha384-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test digest with SHA-384
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha384digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha384-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha384-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha384-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test digest with SHA-384");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "5485cc9b3365b4305dfb4e8337e0a598a574f8242bf17289e0dd6c20a3cd44a089de16ab4ab308f63e44b1170eb5f515";
+
+crypto.subtle.digest("sha-384", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha512digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha512-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha512-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha512-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test digest with SHA-512
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesha512digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sha512-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sha512-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sha512-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test digest with SHA-512");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387";
+
+crypto.subtle.digest("sha-512", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcessha1digestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/sha1-digest.js (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/sha1-digest.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/sha1-digest.js        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test digest with SHA-1 in workers");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "0a0a9f2a6772942557ab5355d76af442f8f65e01";
+
+crypto.subtle.digest("sha-1", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcessha224digestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/sha224-digest.js (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/sha224-digest.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/sha224-digest.js        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test digest with SHA-224 in workers");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "72a23dfa411ba6fde01dbfabf3b00a709c93ebf273dc29e2d8b261ff";
+
+crypto.subtle.digest("sha-224", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcessha256digestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/sha256-digest.js (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/sha256-digest.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/sha256-digest.js        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test digest with SHA-256 in workers");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f";
+
+crypto.subtle.digest("sha-256", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcessha384digestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/sha384-digest.js (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/sha384-digest.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/sha384-digest.js        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test digest with SHA-384 in workers");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "5485cc9b3365b4305dfb4e8337e0a598a574f8242bf17289e0dd6c20a3cd44a089de16ab4ab308f63e44b1170eb5f515";
+
+crypto.subtle.digest("sha-384", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcessha512digestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/sha512-digest.js (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/sha512-digest.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/sha512-digest.js        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test digest with SHA-512 in workers");
+
+jsTestIsAsync = true;
+
+var message = asciiToUint8Array("Hello, World!");
+var expectedDigest = "374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387";
+
+crypto.subtle.digest("sha-512", message).then(function(result){
+ digest = result;
+ shouldBe("bytesToHexString(digest)", "expectedDigest");
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha1digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha1-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha1-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha1-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test digest with SHA-1 in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/sha1-digest.js
+PASS [Worker] bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha1digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha1-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha1-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha1-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/sha1-digest.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha224digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha224-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha224-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha224-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test digest with SHA-224 in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/sha224-digest.js
+PASS [Worker] bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha224digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha224-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha224-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha224-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/sha224-digest.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha256digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha256-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha256-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha256-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test digest with SHA-256 in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/sha256-digest.js
+PASS [Worker] bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha256digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha256-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha256-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha256-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/sha256-digest.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha384digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha384-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha384-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha384-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test digest with SHA-384 in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/sha384-digest.js
+PASS [Worker] bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha384digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha384-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha384-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha384-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/sha384-digest.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha512digestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha512-digest-expected.txt (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha512-digest-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha512-digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test digest with SHA-512 in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/sha512-digest.js
+PASS [Worker] bytesToHexString(digest) is expectedDigest
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlesha512digesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/sha512-digest.html (0 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/sha512-digest.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/sha512-digest.html        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/sha512-digest.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-11-26 Jiewen Tan <jiewen_tan@apple.com>
+
+ Update SubtleCrypto::digest to match the latest spec
+ https://bugs.webkit.org/show_bug.cgi?id=164742
+ <rdar://problem/29258037>
+
+ Reviewed by Darin Adler.
+
+ * WebCryptoAPI/digest/test_digest-expected.txt:
+ * WebCryptoAPI/idlharness-expected.txt:
+
</ins><span class="cx"> 2016-11-30 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> Update SubtleCrypto::wrapKey to match the latest spec
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cWebCryptoAPIdigesttest_digestexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/WebCryptoAPI/digest/test_digest-expected.txt (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/WebCryptoAPI/digest/test_digest-expected.txt        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/LayoutTests/imported/w3c/WebCryptoAPI/digest/test_digest-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -1,84 +1,84 @@
</span><span class="cx"> encrypt Tests for digest method
</span><span class="cx">
</span><span class="cx">
</span><del>-FAIL SHA-1 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-1 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-1 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-1 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-256 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-256 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-256 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-256 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-384 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-384 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-384 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-384 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-512 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-512 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-512 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-512 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-1 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-1 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-1 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-1 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-256 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-256 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-256 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-256 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-384 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-384 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-384 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-384 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-512 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-512 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-512 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-512 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-1 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-1 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-1 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-1 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-256 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-256 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-256 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-256 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-384 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-384 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-384 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-384 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-512 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-512 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-512 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-512 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-1 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-1 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-1 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-1 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-256 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-256 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-256 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-256 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-384 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-384 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-384 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-384 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL SHA-512 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL sha-512 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL Sha-512 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL SHA-512 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
-FAIL AES-GCM with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL RSA-OAEP with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL PBKDF2 with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-KW with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-GCM with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL RSA-OAEP with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL PBKDF2 with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-KW with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-GCM with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL RSA-OAEP with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL PBKDF2 with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-KW with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-GCM with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL RSA-OAEP with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL PBKDF2 with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
-FAIL AES-KW with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
</del><ins>+PASS SHA-1 with empty source data
+PASS sha-1 with empty source data
+PASS Sha-1 with empty source data
+PASS SHA-1 with empty source data and altered buffer after call
+PASS SHA-256 with empty source data
+PASS sha-256 with empty source data
+PASS Sha-256 with empty source data
+PASS SHA-256 with empty source data and altered buffer after call
+PASS SHA-384 with empty source data
+PASS sha-384 with empty source data
+PASS Sha-384 with empty source data
+PASS SHA-384 with empty source data and altered buffer after call
+PASS SHA-512 with empty source data
+PASS sha-512 with empty source data
+PASS Sha-512 with empty source data
+PASS SHA-512 with empty source data and altered buffer after call
+PASS SHA-1 with short source data
+PASS sha-1 with short source data
+PASS Sha-1 with short source data
+PASS SHA-1 with short source data and altered buffer after call
+PASS SHA-256 with short source data
+PASS sha-256 with short source data
+PASS Sha-256 with short source data
+PASS SHA-256 with short source data and altered buffer after call
+PASS SHA-384 with short source data
+PASS sha-384 with short source data
+PASS Sha-384 with short source data
+PASS SHA-384 with short source data and altered buffer after call
+PASS SHA-512 with short source data
+PASS sha-512 with short source data
+PASS Sha-512 with short source data
+PASS SHA-512 with short source data and altered buffer after call
+PASS SHA-1 with medium source data
+PASS sha-1 with medium source data
+PASS Sha-1 with medium source data
+PASS SHA-1 with medium source data and altered buffer after call
+PASS SHA-256 with medium source data
+PASS sha-256 with medium source data
+PASS Sha-256 with medium source data
+PASS SHA-256 with medium source data and altered buffer after call
+PASS SHA-384 with medium source data
+PASS sha-384 with medium source data
+PASS Sha-384 with medium source data
+PASS SHA-384 with medium source data and altered buffer after call
+PASS SHA-512 with medium source data
+PASS sha-512 with medium source data
+PASS Sha-512 with medium source data
+PASS SHA-512 with medium source data and altered buffer after call
+PASS SHA-1 with long source data
+PASS sha-1 with long source data
+PASS Sha-1 with long source data
+PASS SHA-1 with long source data and altered buffer after call
+PASS SHA-256 with long source data
+PASS sha-256 with long source data
+PASS Sha-256 with long source data
+PASS SHA-256 with long source data and altered buffer after call
+PASS SHA-384 with long source data
+PASS sha-384 with long source data
+PASS Sha-384 with long source data
+PASS SHA-384 with long source data and altered buffer after call
+PASS SHA-512 with long source data
+PASS sha-512 with long source data
+PASS Sha-512 with long source data
+PASS SHA-512 with long source data and altered buffer after call
+PASS AES-GCM with empty
+PASS RSA-OAEP with empty
+PASS PBKDF2 with empty
+PASS AES-KW with empty
+PASS AES-GCM with short
+PASS RSA-OAEP with short
+PASS PBKDF2 with short
+PASS AES-KW with short
+PASS AES-GCM with medium
+PASS RSA-OAEP with medium
+PASS PBKDF2 with medium
+PASS AES-KW with medium
+PASS AES-GCM with long
+PASS RSA-OAEP with long
+PASS PBKDF2 with long
+PASS AES-KW with long
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cWebCryptoAPIidlharnessexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -51,8 +51,8 @@
</span><span class="cx"> PASS SubtleCrypto interface: calling sign(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError
</span><span class="cx"> PASS SubtleCrypto interface: crypto.subtle must inherit property "verify" with the proper type (3)
</span><span class="cx"> PASS SubtleCrypto interface: calling verify(AlgorithmIdentifier,CryptoKey,BufferSource,BufferSource) on crypto.subtle with too few arguments must throw TypeError
</span><del>-FAIL SubtleCrypto interface: crypto.subtle must inherit property "digest" with the proper type (4) assert_inherits: property "digest" not found in prototype chain
-FAIL SubtleCrypto interface: calling digest(AlgorithmIdentifier,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "digest" not found in prototype chain
</del><ins>+PASS SubtleCrypto interface: crypto.subtle must inherit property "digest" with the proper type (4)
+PASS SubtleCrypto interface: calling digest(AlgorithmIdentifier,BufferSource) on crypto.subtle with too few arguments must throw TypeError
</ins><span class="cx"> PASS SubtleCrypto interface: crypto.subtle must inherit property "generateKey" with the proper type (5)
</span><span class="cx"> PASS SubtleCrypto interface: calling generateKey(AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError
</span><span class="cx"> FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveKey" with the proper type (6) assert_inherits: property "deriveKey" not found in prototype chain
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/ChangeLog        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2016-11-26 Jiewen Tan <jiewen_tan@apple.com>
+
+ Update SubtleCrypto::digest to match the latest spec
+ https://bugs.webkit.org/show_bug.cgi?id=164742
+ <rdar://problem/29258037>
+
+ Reviewed by Darin Adler.
+
+ This patch updates the SubtleCrypto::digest method to match the latest spec:
+ https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-digest.
+ It also refers to the latest Editor's Draft to a certain degree:
+ https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-digest.
+ Currently supported digest algorithms are SHA-1, SHA-224, SHA-256, SHA-384,
+ and SHA-512.
+
+ Tests: crypto/subtle/digest-malformed-parameters.html
+ crypto/subtle/sha1-digest.html
+ crypto/subtle/sha224-digest.html
+ crypto/subtle/sha256-digest.html
+ crypto/subtle/sha384-digest.html
+ crypto/subtle/sha512-digest.html
+ crypto/workers/subtle/sha1-digest.html
+ crypto/workers/subtle/sha224-digest.html
+ crypto/workers/subtle/sha256-digest.html
+ crypto/workers/subtle/sha384-digest.html
+ crypto/workers/subtle/sha512-digest.html
+
+ * bindings/js/JSSubtleCryptoCustom.cpp:
+ (WebCore::jsSubtleCryptoFunctionDigestPromise):
+ (WebCore::JSSubtleCrypto::digest):
+ * crypto/CryptoAlgorithm.cpp:
+ (WebCore::CryptoAlgorithm::digest):
+ * crypto/CryptoAlgorithm.h:
+ * crypto/SubtleCrypto.idl:
+ * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
+ (WebCore::CryptoAlgorithmSHA1::digest):
+ * crypto/algorithms/CryptoAlgorithmSHA1.h:
+ * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
+ (WebCore::CryptoAlgorithmSHA224::digest):
+ * crypto/algorithms/CryptoAlgorithmSHA224.h:
+ * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
+ (WebCore::CryptoAlgorithmSHA256::digest):
+ * crypto/algorithms/CryptoAlgorithmSHA256.h:
+ * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
+ (WebCore::CryptoAlgorithmSHA384::digest):
+ * crypto/algorithms/CryptoAlgorithmSHA384.h:
+ * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
+ (WebCore::CryptoAlgorithmSHA512::digest):
+ * crypto/algorithms/CryptoAlgorithmSHA512.h:
+
</ins><span class="cx"> 2016-11-30 Antoine Quint <graouts@apple.com>
</span><span class="cx">
</span><span class="cx"> [Modern Media Controls] UI Library: <audio> controls
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -645,6 +645,38 @@
</span><span class="cx"> algorithm->verify(key.releaseNonNull(), WTFMove(signature), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&state), subtle->wrapped().workQueue());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void jsSubtleCryptoFunctionDigestPromise(ExecState& state, Ref<DeferredPromise>&& promise)
+{
+ VM& vm = state.vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ if (UNLIKELY(state.argumentCount() < 2)) {
+ promise->reject<JSValue>(createNotEnoughArgumentsError(&state));
+ return;
+ }
+
+ auto params = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(0), Operations::Digest);
+ RETURN_IF_EXCEPTION(scope, void());
+
+ auto data = toVector(state, state.uncheckedArgument(1));
+ RETURN_IF_EXCEPTION(scope, void());
+
+ auto algorithm = createAlgorithm(state, params->identifier);
+ RETURN_IF_EXCEPTION(scope, void());
+
+ auto callback = [capturedPromise = promise.copyRef()](const Vector<uint8_t>& digest) mutable {
+ fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), digest.data(), digest.size());
+ return;
+ };
+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
+ rejectWithException(WTFMove(capturedPromise), ec);
+ };
+
+ auto subtle = jsDynamicDowncast<JSSubtleCrypto*>(state.thisValue());
+ ASSERT(subtle);
+ algorithm->digest(WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&state), subtle->wrapped().workQueue());
+}
+
</ins><span class="cx"> static void jsSubtleCryptoFunctionGenerateKeyPromise(ExecState& state, Ref<DeferredPromise>&& promise)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state.vm();
</span><span class="lines">@@ -910,6 +942,11 @@
</span><span class="cx"> return callPromiseFunction<jsSubtleCryptoFunctionVerifyPromise, PromiseExecutionScope::WindowOrWorker>(state);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSValue JSSubtleCrypto::digest(ExecState& state)
+{
+ return callPromiseFunction<jsSubtleCryptoFunctionDigestPromise, PromiseExecutionScope::WindowOrWorker>(state);
+}
+
</ins><span class="cx"> JSValue JSSubtleCrypto::generateKey(ExecState& state)
</span><span class="cx"> {
</span><span class="cx"> return callPromiseFunction<jsSubtleCryptoFunctionGenerateKeyPromise, PromiseExecutionScope::WindowOrWorker>(state);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -52,6 +52,11 @@
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithm::digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+{
+ exceptionCallback(NOT_SUPPORTED_ERR);
+}
+
</ins><span class="cx"> void CryptoAlgorithm::generateKey(const CryptoAlgorithmParameters&, bool, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&)
</span><span class="cx"> {
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.h (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> virtual void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</span><span class="cx"> virtual void sign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</span><span class="cx"> virtual void verify(Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</span><ins>+ virtual void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</ins><span class="cx"> virtual void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&);
</span><span class="cx"> virtual void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&);
</span><span class="cx"> virtual void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoSubtleCryptoidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/SubtleCrypto.idl (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/SubtleCrypto.idl        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/SubtleCrypto.idl        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> [Custom] Promise<any> decrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
</span><span class="cx"> [Custom] Promise<any> sign(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
</span><span class="cx"> [Custom] Promise<any> verify(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource signature, BufferSource data);
</span><ins>+ [Custom] Promise<any> digest(AlgorithmIdentifier algorithm, BufferSource data);
</ins><span class="cx"> // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
</span><span class="cx"> [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
</span><span class="cx"> [Custom] Promise<CryptoKey> importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolen extractable, sequence<CryptoKeyUsage> keyUsages);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoDigest.h"
</span><ins>+#include "ExceptionCode.h"
+#include "ScriptExecutionContext.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -42,6 +44,25 @@
</span><span class="cx"> return s_identifier;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmSHA1::digest(Vector<uint8_t>&& message, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_1);
+ if (!digest) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ context.ref();
+ workQueue.dispatch([digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), &context]() mutable {
+ digest->addBytes(message.data(), message.size());
+ auto result = digest->computeHash();
+ context.postTask([callback = WTFMove(callback), result = WTFMove(result)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmSHA1::digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</span><span class="cx"> {
</span><span class="cx"> auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_1);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx"> CryptoAlgorithmSHA1() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><ins>+ void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> ExceptionOr<void> digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoDigest.h"
</span><ins>+#include "ExceptionCode.h"
+#include "ScriptExecutionContext.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -42,6 +44,25 @@
</span><span class="cx"> return s_identifier;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmSHA224::digest(Vector<uint8_t>&& message, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_224);
+ if (!digest) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ context.ref();
+ workQueue.dispatch([digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), &context]() mutable {
+ digest->addBytes(message.data(), message.size());
+ auto result = digest->computeHash();
+ context.postTask([callback = WTFMove(callback), result = WTFMove(result)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmSHA224::digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</span><span class="cx"> {
</span><span class="cx"> auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_224);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx"> CryptoAlgorithmSHA224() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><ins>+ void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> ExceptionOr<void> digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoDigest.h"
</span><ins>+#include "ExceptionCode.h"
+#include "ScriptExecutionContext.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -42,6 +44,25 @@
</span><span class="cx"> return s_identifier;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmSHA256::digest(Vector<uint8_t>&& message, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
+ if (!digest) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ context.ref();
+ workQueue.dispatch([digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), &context]() mutable {
+ digest->addBytes(message.data(), message.size());
+ auto result = digest->computeHash();
+ context.postTask([callback = WTFMove(callback), result = WTFMove(result)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmSHA256::digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</span><span class="cx"> {
</span><span class="cx"> auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx"> CryptoAlgorithmSHA256() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><ins>+ void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> ExceptionOr<void> digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoDigest.h"
</span><ins>+#include "ExceptionCode.h"
+#include "ScriptExecutionContext.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -42,6 +44,25 @@
</span><span class="cx"> return s_identifier;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmSHA384::digest(Vector<uint8_t>&& message, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_384);
+ if (!digest) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ context.ref();
+ workQueue.dispatch([digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), &context]() mutable {
+ digest->addBytes(message.data(), message.size());
+ auto result = digest->computeHash();
+ context.postTask([callback = WTFMove(callback), result = WTFMove(result)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmSHA384::digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</span><span class="cx"> {
</span><span class="cx"> auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_384);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx"> CryptoAlgorithmSHA384() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><ins>+ void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> ExceptionOr<void> digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoDigest.h"
</span><ins>+#include "ExceptionCode.h"
+#include "ScriptExecutionContext.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -42,6 +44,25 @@
</span><span class="cx"> return s_identifier;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmSHA512::digest(Vector<uint8_t>&& message, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_512);
+ if (!digest) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ context.ref();
+ workQueue.dispatch([digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), &context]() mutable {
+ digest->addBytes(message.data(), message.size());
+ auto result = digest->computeHash();
+ context.postTask([callback = WTFMove(callback), result = WTFMove(result)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmSHA512::digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</span><span class="cx"> {
</span><span class="cx"> auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_512);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h (209163 => 209164)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h        2016-12-01 00:14:19 UTC (rev 209163)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h        2016-12-01 00:28:04 UTC (rev 209164)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx"> CryptoAlgorithmSHA512() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><ins>+ void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> ExceptionOr<void> digest(const CryptoAlgorithmParametersDeprecated&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>