Skip to content

Commit fe61e6a

Browse files
committed
Implement Crypto.randomUUID()
https://bugs.webkit.org/show_bug.cgi?id=229240 Reviewed by Geoffrey 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: Canonical link: https://commits.webkit.org/240647@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent ed5c083 commit fe61e6a

7 files changed

Lines changed: 46 additions & 6 deletions

File tree

LayoutTests/imported/w3c/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2021-08-18 Chris Dumez <[email protected]>
2+
3+
Implement Crypto.randomUUID()
4+
https://bugs.webkit.org/show_bug.cgi?id=229240
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Rebaseline WPT tests that are now passing.
9+
10+
* web-platform-tests/WebCryptoAPI/randomUUID.https.any-expected.txt:
11+
* web-platform-tests/WebCryptoAPI/randomUUID.https.any.worker-expected.txt:
12+
113
2021-08-18 Martin Robinson <[email protected]>
214

315
[css-scroll-snap] Don't snap to offscreen snap areas in unidirectional scrolls
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
FAIL namespace format self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
3-
FAIL version set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
4-
FAIL variant set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
2+
PASS namespace format
3+
PASS version set
4+
PASS variant set
55

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
FAIL namespace format self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
3-
FAIL version set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
4-
FAIL variant set self.crypto.randomUUID is not a function. (In 'self.crypto.randomUUID()', 'self.crypto.randomUUID' is undefined)
2+
PASS namespace format
3+
PASS version set
4+
PASS variant set
55

Source/WebCore/ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2021-08-18 Chris Dumez <[email protected]>
2+
3+
Implement Crypto.randomUUID()
4+
https://bugs.webkit.org/show_bug.cgi?id=229240
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Implement Crypto.randomUUID():
9+
- https://wicg.github.io/uuid/#extensions-to-the-crypto-interface
10+
11+
Chrome already implements this and Firefox seems to be working on it
12+
(https://bugzilla.mozilla.org/show_bug.cgi?id=1705264).
13+
14+
No new tests, rebaselined existing tests.
15+
16+
* page/Crypto.cpp:
17+
(WebCore::Crypto::randomUUID const):
18+
* page/Crypto.h:
19+
* page/Crypto.idl:
20+
121
2021-08-18 Andres Gonzalez <[email protected]>
222

323
Add layout test for WebAccessibilityObjectWrapper handler for attribute AXLineForTextMarker on MacOS.

Source/WebCore/page/Crypto.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "SubtleCrypto.h"
3636
#include <JavaScriptCore/ArrayBufferView.h>
3737
#include <wtf/CryptographicallyRandomNumber.h>
38+
#include <wtf/UUID.h>
3839

3940
#if OS(DARWIN)
4041
#include <CommonCrypto/CommonCryptor.h>
@@ -68,6 +69,11 @@ ExceptionOr<void> Crypto::getRandomValues(ArrayBufferView& array)
6869
return { };
6970
}
7071

72+
String Crypto::randomUUID() const
73+
{
74+
return createCanonicalUUIDString();
75+
}
76+
7177
#if ENABLE(WEB_CRYPTO)
7278

7379
SubtleCrypto& Crypto::subtle()

Source/WebCore/page/Crypto.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Crypto : public ContextDestructionObserver, public RefCounted<Crypto> {
4646
virtual ~Crypto();
4747

4848
ExceptionOr<void> getRandomValues(JSC::ArrayBufferView&);
49+
String randomUUID() const;
4950

5051
#if ENABLE(WEB_CRYPTO)
5152
SubtleCrypto& subtle();

Source/WebCore/page/Crypto.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@
3333
] interface Crypto {
3434
[Conditional=WEB_CRYPTO, SecureContext] readonly attribute SubtleCrypto subtle;
3535
ArrayBufferView getRandomValues([ReturnValue] ArrayBufferView array);
36+
[SecureContext] DOMString randomUUID();
3637
};

0 commit comments

Comments
 (0)