Title: [281284] trunk
Revision
281284
Author
cdu...@apple.com
Date
2021-08-19 17:12:09 -0700 (Thu, 19 Aug 2021)

Log Message

Implement Crypto.randomUUID()
https://bugs.webkit.org/show_bug.cgi?id=229240

Reviewed by Geoff Garen.

LayoutTests/imported/w3c:

Rebaseline WPT tests that are now passing.

* web-platform-tests/WebCryptoAPI/randomUUID.https.any-expected.txt:
* web-platform-tests/WebCryptoAPI/randomUUID.https.any.worker-expected.txt:

Source/WebCore:

Implement Crypto.randomUUID():
- https://wicg.github.io/uuid/#extensions-to-the-crypto-interface

Chrome already implements this and Firefox seems to be working on it
(https://bugzilla.mozilla.org/show_bug.cgi?id=1705264).

No new tests, rebaselined existing tests.

* page/Crypto.cpp:
(WebCore::Crypto::randomUUID const):
* page/Crypto.h:
* page/Crypto.idl:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281283 => 281284)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-20 00:12:09 UTC (rev 281284)
@@ -1,3 +1,15 @@
+2021-08-19  Chris Dumez  <cdu...@apple.com>
+
+        Implement Crypto.randomUUID()
+        https://bugs.webkit.org/show_bug.cgi?id=229240
+
+        Reviewed by Geoff Garen.
+
+        Rebaseline WPT tests that are now passing.
+
+        * web-platform-tests/WebCryptoAPI/randomUUID.https.any-expected.txt:
+        * web-platform-tests/WebCryptoAPI/randomUUID.https.any.worker-expected.txt:
+
 2021-08-19  Zalan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Add support for overflow-wrap: anywhere

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/randomUUID.https.any-expected.txt (281283 => 281284)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/randomUUID.https.any-expected.txt	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/randomUUID.https.any-expected.txt	2021-08-20 00:12:09 UTC (rev 281284)
@@ -1,5 +1,5 @@
 
-FAIL namespace format self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
-FAIL version set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
-FAIL variant set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
+PASS namespace format
+PASS version set
+PASS variant set
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/randomUUID.https.any.worker-expected.txt (281283 => 281284)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/randomUUID.https.any.worker-expected.txt	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/randomUUID.https.any.worker-expected.txt	2021-08-20 00:12:09 UTC (rev 281284)
@@ -1,5 +1,5 @@
 
-FAIL namespace format self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
-FAIL version set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
-FAIL variant set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
+PASS namespace format
+PASS version set
+PASS variant set
 

Modified: trunk/Source/WebCore/ChangeLog (281283 => 281284)


--- trunk/Source/WebCore/ChangeLog	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/Source/WebCore/ChangeLog	2021-08-20 00:12:09 UTC (rev 281284)
@@ -1,3 +1,23 @@
+2021-08-19  Chris Dumez  <cdu...@apple.com>
+
+        Implement Crypto.randomUUID()
+        https://bugs.webkit.org/show_bug.cgi?id=229240
+
+        Reviewed by Geoff Garen.
+
+        Implement Crypto.randomUUID():
+        - https://wicg.github.io/uuid/#extensions-to-the-crypto-interface
+
+        Chrome already implements this and Firefox seems to be working on it
+        (https://bugzilla.mozilla.org/show_bug.cgi?id=1705264).
+
+        No new tests, rebaselined existing tests.
+
+        * page/Crypto.cpp:
+        (WebCore::Crypto::randomUUID const):
+        * page/Crypto.h:
+        * page/Crypto.idl:
+
 2021-08-19  Simon Fraser  <simon.fra...@apple.com>
 
         Remove unused RenderLayerCompositor member variable

Modified: trunk/Source/WebCore/page/Crypto.cpp (281283 => 281284)


--- trunk/Source/WebCore/page/Crypto.cpp	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/Source/WebCore/page/Crypto.cpp	2021-08-20 00:12:09 UTC (rev 281284)
@@ -35,6 +35,7 @@
 #include "SubtleCrypto.h"
 #include <_javascript_Core/ArrayBufferView.h>
 #include <wtf/CryptographicallyRandomNumber.h>
+#include <wtf/UUID.h>
 
 #if OS(DARWIN)
 #include <CommonCrypto/CommonCryptor.h>
@@ -68,6 +69,11 @@
     return { };
 }
 
+String Crypto::randomUUID() const
+{
+    return createCanonicalUUIDString();
+}
+
 #if ENABLE(WEB_CRYPTO)
 
 SubtleCrypto& Crypto::subtle()

Modified: trunk/Source/WebCore/page/Crypto.h (281283 => 281284)


--- trunk/Source/WebCore/page/Crypto.h	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/Source/WebCore/page/Crypto.h	2021-08-20 00:12:09 UTC (rev 281284)
@@ -46,6 +46,7 @@
     virtual ~Crypto();
 
     ExceptionOr<void> getRandomValues(JSC::ArrayBufferView&);
+    String randomUUID() const;
 
 #if ENABLE(WEB_CRYPTO)
     SubtleCrypto& subtle();

Modified: trunk/Source/WebCore/page/Crypto.idl (281283 => 281284)


--- trunk/Source/WebCore/page/Crypto.idl	2021-08-19 23:58:26 UTC (rev 281283)
+++ trunk/Source/WebCore/page/Crypto.idl	2021-08-20 00:12:09 UTC (rev 281284)
@@ -33,4 +33,5 @@
 ] interface Crypto {
     [Conditional=WEB_CRYPTO, SecureContext] readonly attribute SubtleCrypto subtle;
     ArrayBufferView getRandomValues([ReturnValue] ArrayBufferView array);
+    [SecureContext] DOMString randomUUID();
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to