Diff
Added: trunk/LayoutTests/http/wpt/webrtc/generateCertificate-expected.txt (0 => 237140)
--- trunk/LayoutTests/http/wpt/webrtc/generateCertificate-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/webrtc/generateCertificate-expected.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,7 @@
+
+PASS generateCertificate() with algorithm as a string fails
+PASS generateCertificate() with unsupported ECDSA curve
+PASS generateCertificate() with unsupported RSA hash
+PASS generateCertificate() with missing modulusLength should skip publicExponent
+PASS generateCertificate() with missing exponent should skip modulusLength
+
Added: trunk/LayoutTests/http/wpt/webrtc/generateCertificate.html (0 => 237140)
--- trunk/LayoutTests/http/wpt/webrtc/generateCertificate.html (rev 0)
+++ trunk/LayoutTests/http/wpt/webrtc/generateCertificate.html 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,42 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>RTCCertificate Tests</title>
+<script src=""
+<script src=""
+<script>
+promise_test(t => {
+ return promise_rejects(t, 'NotSupportedError', RTCPeerConnection.generateCertificate('ECDSA'));
+}, 'generateCertificate() with algorithm as a string fails');
+
+promise_test(t => {
+ return promise_rejects(t, 'NotSupportedError', RTCPeerConnection.generateCertificate({
+ name: 'ECDSA',
+ namedCurve: 'P-257'
+ }));
+}, 'generateCertificate() with unsupported ECDSA curve');
+
+promise_test(t => {
+ return promise_rejects(t, 'NotSupportedError', RTCPeerConnection.generateCertificate({
+ name: 'RSASSA-PKCS1-v1_5',
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([1, 0, 1]),
+ hash: 'SHA-255'
+ }));
+}, 'generateCertificate() with unsupported RSA hash');
+
+promise_test(t => {
+ return RTCPeerConnection.generateCertificate({
+ name: 'RSASSA-PKCS1-v1_5',
+ publicExponent: new Uint8Array([]),
+ hash: 'SHA-256'
+ });
+}, 'generateCertificate() with missing modulusLength should skip publicExponent');
+
+promise_test(t => {
+ return RTCPeerConnection.generateCertificate({
+ name: 'RSASSA-PKCS1-v1_5',
+ modulusLength: 0,
+ hash: 'SHA-256'
+ });
+}, 'generateCertificate() with missing exponent should skip modulusLength');
+</script>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (237139 => 237140)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-10-15 20:52:15 UTC (rev 237140)
@@ -1,3 +1,16 @@
+2018-10-15 Youenn Fablet <[email protected]>
+
+ RTCPeerConnection.generateCertificate is not a function
+ https://bugs.webkit.org/show_bug.cgi?id=173541
+ <rdar://problem/32638029>
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/webrtc/RTCCertificate-expected.txt:
+ * web-platform-tests/webrtc/RTCPeerConnection-generateCertificate-expected.txt:
+ * web-platform-tests/webrtc/interfaces.https-expected.txt:
+ * web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt:
+
2018-10-15 Commit Queue <[email protected]>
Unreviewed, rolling out r237054.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCCertificate-expected.txt (237139 => 237140)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCCertificate-expected.txt 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCCertificate-expected.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -1,23 +1,11 @@
-FAIL Constructing RTCPeerConnection with expired certificate should reject with InvalidAccessError RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256',
- expires: 0
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL Calling setConfiguration with different set of certs should reject with InvalidModificationError RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL RTCCertificate should have at least one fingerprint RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL RTCPeerConnection({ certificates }) should generate offer SDP with fingerprint of provided certificate RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL RTCPeerConnection({ certificates }) should generate offer SDP with fingerprint of all provided certificates RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
+FAIL Constructing RTCPeerConnection with expired certificate should reject with InvalidAccessError assert_throws: function "() =>
+ new RTCPeerConnection({ certificates: [cert] })" did not throw
+FAIL Calling setConfiguration with different set of certs should reject with InvalidModificationError assert_throws: function "() =>
+ pc.setConfiguration({
+ certificates: [cert2]
+ })" did not throw
+PASS RTCCertificate should have at least one fingerprint
+FAIL RTCPeerConnection({ certificates }) should generate offer SDP with fingerprint of provided certificate assert_true: Expect fingerprint line to be found in SDP expected true got false
+FAIL RTCPeerConnection({ certificates }) should generate offer SDP with fingerprint of all provided certificates assert_true: Expect fingerprint line to be found in SDP expected true got false
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-generateCertificate-expected.txt (237139 => 237140)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-generateCertificate-expected.txt 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-generateCertificate-expected.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -1,31 +1,10 @@
-FAIL generateCertificate() with compulsary RSASSA-PKCS1-v1_5 parameters should succeed undefined is not a function (near '...RTCPeerConnection.generateCertificate...')
-FAIL generateCertificate() with compulsary ECDSA parameters should succeed RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL generateCertificate() with invalid string algorithm should reject with NotSupportedError RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate('invalid-algo')', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL generateCertificate() with invalid algorithm dict should reject with NotSupportedError RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'invalid-algo'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL generateCertificate() with valid expires parameter should succeed RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256',
- expires: 2000
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL generateCertificate() with 0 expires parameter should generate expired cert RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256',
- expires: 0
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL generateCertificate() with invalid range for expires should reject with TypeError RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256',
- expires: -1
- })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL generateCertificate() with invalid type for expires should reject with TypeError RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({
- name: 'ECDSA',
- namedCurve: 'P-256',
- expires: 'invalid'
- })', 'RTCPeerConnection.generateCertificate' is undefined)
+PASS generateCertificate() with compulsary RSASSA-PKCS1-v1_5 parameters should succeed
+PASS generateCertificate() with compulsary ECDSA parameters should succeed
+PASS generateCertificate() with invalid string algorithm should reject with NotSupportedError
+PASS generateCertificate() with invalid algorithm dict should reject with NotSupportedError
+PASS generateCertificate() with valid expires parameter should succeed
+PASS generateCertificate() with 0 expires parameter should generate expired cert
+PASS generateCertificate() with invalid range for expires should reject with TypeError
+PASS generateCertificate() with invalid type for expires should reject with TypeError
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/interfaces.https-expected.txt (237139 => 237140)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/interfaces.https-expected.txt 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/interfaces.https-expected.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -1,6 +1,6 @@
PASS Main test driver
-FAIL Test driver for asyncInitCertificate undefined is not a function (near '...RTCPeerConnection.generateCertificate...')
+PASS Test driver for asyncInitCertificate
FAIL Test driver for asyncInitTransports assert_unreached: Failed to run asyncInitTransports: ReferenceError: Can't find variable: RTCSctpTransport Reached unreachable code
PASS Test driver for asyncInitMediaStreamTrack
PASS EventTarget interface: existence and properties of interface object
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt (237139 => 237140)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -77,8 +77,10 @@
eval(expr);
}" did not throw
PASS new RTCPeerConnection({ iceCandidatePoolSize: toNumberThrows })
-FAIL new RTCPeerConnection({ certificates: [certificate] }) RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256" })', 'RTCPeerConnection.generateCertificate' is undefined)
-FAIL new RTCPeerConnection({ certificates: [expiredCertificate] }) RTCPeerConnection.generateCertificate is not a function. (In 'RTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256", expires: 0 })', 'RTCPeerConnection.generateCertificate' is undefined)
+PASS new RTCPeerConnection({ certificates: [certificate] })
+FAIL new RTCPeerConnection({ certificates: [expiredCertificate] }) assert_throws: function "function () {
+ new RTCPeerConnection({ certificates: [certificate] });
+ }" did not throw
PASS localDescription initial value
PASS currentLocalDescription initial value
PASS pendingLocalDescription initial value
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (237139 => 237140)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2018-10-15 20:52:15 UTC (rev 237140)
@@ -1,3 +1,15 @@
+2018-10-15 Youenn Fablet <[email protected]>
+
+ RTCPeerConnection.generateCertificate is not a function
+ https://bugs.webkit.org/show_bug.cgi?id=173541
+ <rdar://problem/32638029>
+
+ Reviewed by Eric Carlson.
+
+ * Configurations/libwebrtc.iOS.exp:
+ * Configurations/libwebrtc.iOSsim.exp:
+ * Configurations/libwebrtc.mac.exp:
+
2018-10-12 Ryan Haddad <[email protected]>
Unreviewed build fix, remove executable file imported with r237075.
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (237139 => 237140)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -220,3 +220,11 @@
__ZN6webrtc30PeerConnectionFactoryInterface17CreateVideoSourceENSt3__110unique_ptrIN7cricket13VideoCapturerENS1_14default_deleteIS4_EEEE
__ZNK3rtc14NetworkManager16GetMDnsResponderEv
__ZTVN6webrtc18RtpSenderInterfaceE
+__ZN3rtc23RTCCertificateGeneratorC1EPNS_6ThreadES2_
+__ZN3rtc9KeyParams3RSAEii
+__ZN3rtc9KeyParams5ECDSAENS_7ECCurveE
+__ZNK3rtc14RTCCertificate7ExpiresEv
+__ZN3rtc19SSLCertificateStatsD1Ev
+__ZNK3rtc14RTCCertificate15ssl_certificateEv
+__ZNK3rtc14RTCCertificate5ToPEMEv
+__ZNK3rtc14SSLCertificate8GetStatsEv
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (237139 => 237140)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -221,3 +221,11 @@
__ZN6webrtc30PeerConnectionFactoryInterface17CreateVideoSourceENSt3__110unique_ptrIN7cricket13VideoCapturerENS1_14default_deleteIS4_EEEE
__ZNK3rtc14NetworkManager16GetMDnsResponderEv
__ZTVN6webrtc18RtpSenderInterfaceE
+__ZN3rtc23RTCCertificateGeneratorC1EPNS_6ThreadES2_
+__ZN3rtc9KeyParams3RSAEii
+__ZN3rtc9KeyParams5ECDSAENS_7ECCurveE
+__ZNK3rtc14RTCCertificate7ExpiresEv
+__ZN3rtc19SSLCertificateStatsD1Ev
+__ZNK3rtc14RTCCertificate15ssl_certificateEv
+__ZNK3rtc14RTCCertificate5ToPEMEv
+__ZNK3rtc14SSLCertificate8GetStatsEv
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (237139 => 237140)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -221,3 +221,11 @@
__ZN6webrtc30PeerConnectionFactoryInterface17CreateVideoSourceENSt3__110unique_ptrIN7cricket13VideoCapturerENS1_14default_deleteIS4_EEEE
__ZNK3rtc14NetworkManager16GetMDnsResponderEv
__ZTVN6webrtc18RtpSenderInterfaceE
+__ZN3rtc23RTCCertificateGeneratorC1EPNS_6ThreadES2_
+__ZN3rtc9KeyParams3RSAEii
+__ZN3rtc9KeyParams5ECDSAENS_7ECCurveE
+__ZNK3rtc14RTCCertificate7ExpiresEv
+__ZN3rtc19SSLCertificateStatsD1Ev
+__ZNK3rtc14RTCCertificate15ssl_certificateEv
+__ZNK3rtc14RTCCertificate5ToPEMEv
+__ZNK3rtc14SSLCertificate8GetStatsEv
Modified: trunk/Source/WebCore/CMakeLists.txt (237139 => 237140)
--- trunk/Source/WebCore/CMakeLists.txt 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/CMakeLists.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -38,6 +38,7 @@
"${WEBCORE_DIR}/Modules/mediasession"
"${WEBCORE_DIR}/Modules/mediasource"
"${WEBCORE_DIR}/Modules/mediastream"
+ "${WEBCORE_DIR}/Modules/mediastream/libwebrtc"
"${WEBCORE_DIR}/Modules/mediarecorder"
"${WEBCORE_DIR}/Modules/navigatorcontentutils"
"${WEBCORE_DIR}/Modules/notifications"
@@ -307,6 +308,7 @@
Modules/mediastream/OverconstrainedError.idl
Modules/mediastream/OverconstrainedErrorEvent.idl
Modules/mediastream/RTCAnswerOptions.idl
+ Modules/mediastream/RTCCertificate.idl
Modules/mediastream/RTCConfiguration.idl
Modules/mediastream/RTCDTMFSender.idl
Modules/mediastream/RTCDTMFToneChangeEvent.idl
Modified: trunk/Source/WebCore/ChangeLog (237139 => 237140)
--- trunk/Source/WebCore/ChangeLog 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/ChangeLog 2018-10-15 20:52:15 UTC (rev 237140)
@@ -1,3 +1,52 @@
+2018-10-15 Youenn Fablet <[email protected]>
+
+ RTCPeerConnection.generateCertificate is not a function
+ https://bugs.webkit.org/show_bug.cgi?id=173541
+ <rdar://problem/32638029>
+
+ Reviewed by Eric Carlson.
+
+ Add support for RTCCertificate generation through libwebrtc certificate generator.
+ Make generation in the webrtc network thread.
+ Support is as per spec (ECDSA and RSASSA_PKCS).
+
+ Partially covered by WPT tests.
+
+ * css/StyleBuilder.h: Fixing build.
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * Modules/webauthn/PublicKeyCredential.cpp: Fixing build.
+ * Modules/mediastream/PeerConnectionBackend.cpp:
+ (WebCore::PeerConnectionBackend::generateCertificate):
+ * Modules/mediastream/PeerConnectionBackend.h:
+ (WebCore::PeerConnectionBackend::CertificateInformation::RSASSA_PKCS1_v1_5):
+ (WebCore::PeerConnectionBackend::CertificateInformation::ECDSA_P256):
+ (WebCore::PeerConnectionBackend::CertificateInformation::CertificateInformation):
+ * Modules/mediastream/RTCCertificate.cpp: Added.
+ (WebCore::RTCCertificate::create):
+ (WebCore::RTCCertificate::RTCCertificate):
+ * Modules/mediastream/RTCCertificate.h: Added.
+ (WebCore::RTCCertificate::expires const):
+ (WebCore::RTCCertificate::getFingerprints const):
+ * Modules/mediastream/RTCCertificate.idl: Added.
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::certificateTypeFromAlgorithmIdentifier):
+ (WebCore::RTCPeerConnection::generateCertificate):
+ * Modules/mediastream/RTCPeerConnection.h:
+ * Modules/mediastream/RTCPeerConnection.idl:
+ * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp: Added.
+ (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::RTCCertificateGeneratorCallback):
+ (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::~RTCCertificateGeneratorCallback):
+ (WebCore::LibWebRTCCertificateGenerator::keyParamsFromCertificateType):
+ (WebCore::LibWebRTCCertificateGenerator::generateCertificate):
+ * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.h: Added.
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/WebCoreBuiltinNames.h:
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+ (WebCore::LibWebRTCProvider::certificateGenerator):
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+
2018-10-15 Simon Fraser <[email protected]>
Add compact logging for the paint-order RenderLayer tree
Modified: trunk/Source/WebCore/DerivedSources.make (237139 => 237140)
--- trunk/Source/WebCore/DerivedSources.make 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/DerivedSources.make 2018-10-15 20:52:15 UTC (rev 237140)
@@ -231,6 +231,7 @@
$(WebCore)/Modules/mediastream/OverconstrainedError.idl \
$(WebCore)/Modules/mediastream/OverconstrainedErrorEvent.idl \
$(WebCore)/Modules/mediastream/RTCAnswerOptions.idl \
+ $(WebCore)/Modules/mediastream/RTCCertificate.idl \
$(WebCore)/Modules/mediastream/RTCConfiguration.idl \
$(WebCore)/Modules/mediastream/RTCDTMFSender.idl \
$(WebCore)/Modules/mediastream/RTCDTMFToneChangeEvent.idl \
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp (237139 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -36,6 +36,7 @@
#include "EventNames.h"
#include "JSRTCSessionDescription.h"
+#include "LibWebRTCCertificateGenerator.h"
#include "Logging.h"
#include "Page.h"
#include "RTCIceCandidate.h"
@@ -545,6 +546,18 @@
return Exception { NotSupportedError, "Not implemented"_s };
}
+void PeerConnectionBackend::generateCertificate(Document& document, const CertificateInformation& info, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&& promise)
+{
+#if USE(LIBWEBRTC)
+ LibWebRTCCertificateGenerator::generateCertificate(document.page()->libWebRTCProvider(), info, WTFMove(promise));
+#else
+ UNUSED_PARAM(document);
+ UNUSED_PARAM(expires);
+ UNUSED_PARAM(type);
+ promise.reject(NotSupportedError);
+#endif
+}
+
#if !RELEASE_LOG_DISABLED
WTFLogChannel& PeerConnectionBackend::logChannel() const
{
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h (237139 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -43,9 +43,11 @@
namespace WebCore {
+class Document;
class MediaStream;
class MediaStreamTrack;
class PeerConnectionBackend;
+class RTCCertificate;
class RTCDataChannelHandler;
class RTCIceCandidate;
class RTCPeerConnection;
@@ -133,6 +135,35 @@
void finishedRegisteringMDNSName(const String& ipAddress, const String& name);
+ struct CertificateInformation {
+ enum class Type { RSASSAPKCS1v15, ECDSAP256 };
+ struct RSA {
+ unsigned modulusLength;
+ int publicExponent;
+ };
+
+ static CertificateInformation RSASSA_PKCS1_v1_5()
+ {
+ return CertificateInformation { Type::RSASSAPKCS1v15 };
+ }
+
+ static CertificateInformation ECDSA_P256()
+ {
+ return CertificateInformation { Type::ECDSAP256 };
+ }
+
+ explicit CertificateInformation(Type type)
+ : type(type)
+ {
+ }
+
+ Type type;
+ std::optional<double> expires;
+
+ std::optional<RSA> rsaParameters;
+ };
+ static void generateCertificate(Document&, const CertificateInformation&, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&&);
+
protected:
void fireICECandidateEvent(RefPtr<RTCIceCandidate>&&, String&& url);
void doneGatheringCandidates();
Added: trunk/Source/WebCore/Modules/mediastream/RTCCertificate.cpp (0 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/RTCCertificate.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/RTCCertificate.cpp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RTCCertificate.h"
+
+#if ENABLE(WEB_RTC)
+
+namespace WebCore {
+
+Ref<RTCCertificate> RTCCertificate::create(double expires, Vector<DtlsFingerprint>&& fingerprints, String&& pemCertificate, String&& pemPrivateKey)
+{
+ return adoptRef(*new RTCCertificate(expires, WTFMove(fingerprints), WTFMove(pemCertificate), WTFMove(pemPrivateKey)));
+}
+
+RTCCertificate::RTCCertificate(double expires, Vector<DtlsFingerprint>&& fingerprints, String&& pemCertificate, String&& pemPrivateKey)
+ : m_expires(expires)
+ , m_fingerprints(WTFMove(fingerprints))
+ , m_pemCertificate(WTFMove(pemCertificate))
+ , m_pemPrivateKey(WTFMove(pemPrivateKey))
+{
+}
+
+}
+
+#endif // ENABLE(WEB_RTC)
Added: trunk/Source/WebCore/Modules/mediastream/RTCCertificate.h (0 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/RTCCertificate.h (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/RTCCertificate.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_RTC)
+
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCCertificate : public RefCounted<RTCCertificate> {
+public:
+ struct DtlsFingerprint {
+ String algorithm;
+ String value;
+ };
+
+ static Ref<RTCCertificate> create(double expires, Vector<DtlsFingerprint>&&, String&& pemCertificate, String&& pemPrivateKey);
+
+ double expires() const { return m_expires; }
+ const Vector<DtlsFingerprint>& getFingerprints() const { return m_fingerprints; }
+
+ const String& pemCertificate() const { return m_pemCertificate; }
+ const String& pemPrivateKey() const { return m_pemPrivateKey; }
+
+private:
+ RTCCertificate(double expires, Vector<DtlsFingerprint>&&, String&& pemCertificate, String&& pemPrivateKey);
+
+ double m_expires { 0 };
+ Vector<DtlsFingerprint> m_fingerprints;
+ String m_pemCertificate;
+ String m_pemPrivateKey;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
Added: trunk/Source/WebCore/Modules/mediastream/RTCCertificate.idl (0 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/RTCCertificate.idl (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/RTCCertificate.idl 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,45 @@
+ /*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=WEB_RTC,
+ EnabledAtRuntime=PeerConnection,
+ JSGenerateToJSObject,
+] dictionary RTCDtlsFingerprint {
+ DOMString algorithm;
+ DOMString value;
+};
+
+typedef (object or DOMString) AlgorithmIdentifier;
+
+[
+ Conditional=WEB_RTC,
+ EnabledAtRuntime=PeerConnection,
+ ImplementationLacksVTable
+] interface RTCCertificate {
+ readonly attribute double expires;
+ sequence<RTCDtlsFingerprint> getFingerprints();
+ // FIXME: Expose getSupportedAlgorithms.
+};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (237139 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -40,6 +40,7 @@
#include "Event.h"
#include "EventNames.h"
#include "Frame.h"
+#include "JSRTCPeerConnection.h"
#include "Logging.h"
#include "MediaEndpointConfiguration.h"
#include "MediaStream.h"
@@ -539,6 +540,63 @@
EventTarget::dispatchEvent(event);
}
+static inline ExceptionOr<PeerConnectionBackend::CertificateInformation> certificateTypeFromAlgorithmIdentifier(JSC::ExecState& state, RTCPeerConnection::AlgorithmIdentifier&& algorithmIdentifier)
+{
+ if (WTF::holds_alternative<String>(algorithmIdentifier))
+ return Exception { NotSupportedError, "Algorithm is not supported"_s };
+
+ auto& value = WTF::get<JSC::Strong<JSC::JSObject>>(algorithmIdentifier);
+
+ JSC::VM& vm = state.vm();
+ auto scope = DECLARE_CATCH_SCOPE(vm);
+
+ auto parameters = convertDictionary<RTCPeerConnection::CertificateParameters>(state, value.get());
+ if (UNLIKELY(scope.exception())) {
+ scope.clearException();
+ return Exception { TypeError, "Unable to read certificate parameters"_s };
+ }
+
+ if (parameters.expires && *parameters.expires < 0)
+ return Exception { TypeError, "Expire value is invalid"_s };
+
+ if (parameters.name == "RSASSA-PKCS1-v1_5"_s) {
+ if (!parameters.hash.isNull() && parameters.hash != "SHA-256"_s)
+ return Exception { NotSupportedError, "Only SHA-256 is supported for RSASSA-PKCS1-v1_5"_s };
+
+ auto result = PeerConnectionBackend::CertificateInformation::RSASSA_PKCS1_v1_5();
+ if (parameters.modulusLength && parameters.publicExponent) {
+ int publicExponent = 0;
+ int value = 1;
+ for (unsigned counter = 0; counter < parameters.publicExponent->byteLength(); ++counter) {
+ publicExponent += parameters.publicExponent->data()[counter] * value;
+ value <<= 8;
+ }
+
+ result.rsaParameters = PeerConnectionBackend::CertificateInformation::RSA { *parameters.modulusLength, publicExponent };
+ }
+ result.expires = parameters.expires;
+ return WTFMove(result);
+ }
+ if (parameters.name == "ECDSA"_s && parameters.namedCurve == "P-256"_s) {
+ auto result = PeerConnectionBackend::CertificateInformation::ECDSA_P256();
+ result.expires = parameters.expires;
+ return WTFMove(result);
+ }
+
+ return Exception { NotSupportedError, "Algorithm is not supported"_s };
+}
+
+void RTCPeerConnection::generateCertificate(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&& promise)
+{
+ auto parameters = certificateTypeFromAlgorithmIdentifier(state, WTFMove(algorithmIdentifier));
+ if (parameters.hasException()) {
+ promise.reject(parameters.releaseException());
+ return;
+ }
+ auto& document = downcast<Document>(*JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext());
+ PeerConnectionBackend::generateCertificate(document, parameters.returnValue(), WTFMove(promise));
+}
+
#if !RELEASE_LOG_DISABLED
WTFLogChannel& RTCPeerConnection::logChannel() const
{
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (237139 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -45,6 +45,7 @@
#include "RTCPeerConnectionState.h"
#include "RTCRtpTransceiver.h"
#include "RTCSignalingState.h"
+#include <_javascript_Core/Uint8Array.h>
#include <wtf/LoggerHelper.h>
namespace WebCore {
@@ -80,6 +81,18 @@
ExceptionOr<void> initializeWith(Document&, RTCConfiguration&&);
+ struct CertificateParameters {
+ String name;
+ String hash;
+ String namedCurve;
+ std::optional<uint32_t> modulusLength;
+ RefPtr<Uint8Array> publicExponent;
+ std::optional<double> expires;
+ };
+
+ using AlgorithmIdentifier = Variant<JSC::Strong<JSC::JSObject>, String>;
+ static void generateCertificate(JSC::ExecState&, AlgorithmIdentifier&&, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&&);
+
// 4.3.2 RTCPeerConnection Interface
void queuedCreateOffer(RTCOfferOptions&&, PeerConnection::SessionDescriptionPromise&&);
void queuedCreateAnswer(RTCAnswerOptions&&, PeerConnection::SessionDescriptionPromise&&);
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (237139 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl 2018-10-15 20:52:15 UTC (rev 237140)
@@ -47,6 +47,20 @@
};
[
+Conditional=WEB_RTC,
+EnabledAtRuntime=PeerConnection
+] dictionary RTCCertificateParameters {
+ DOMString name;
+ DOMString hash;
+ DOMString namedCurve;
+ unsigned long modulusLength;
+ Uint8Array publicExponent;
+ double expires;
+};
+
+typedef (object or DOMString) AlgorithmIdentifier;
+
+[
Conditional=WEB_RTC,
EnabledAtRuntime=PeerConnection,
ImplementedAs=RTCRtpTransceiverInit
@@ -114,9 +128,8 @@
// 4.11 Certificate management
- // FIXME 169644: missing generateCertificate
+ [CallWith=ScriptState] static Promise<RTCCertificate> generateCertificate(AlgorithmIdentifier keygenAlgorithm);
-
// 5.1 RTCPeerConnection extensions
// RTP Media API extensions
sequence<RTCRtpSender> getSenders();
Added: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp (0 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2018 Apple Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LibWebRTCCertificateGenerator.h"
+
+#if USE(LIBWEBRTC)
+
+#include "JSRTCCertificate.h"
+#include "LibWebRTCMacros.h"
+
+ALLOW_UNUSED_PARAMETERS_BEGIN
+
+#include <webrtc/rtc_base/rtccertificategenerator.h>
+
+ALLOW_UNUSED_PARAMETERS_END
+
+namespace WebCore {
+
+namespace LibWebRTCCertificateGenerator {
+
+static inline String fromStdString(const std::string& value)
+{
+ return String::fromUTF8(value.data(), value.length());
+}
+
+class RTCCertificateGeneratorCallback : public ThreadSafeRefCounted<RTCCertificateGeneratorCallback, WTF::DestructionThread::Main>, public rtc::RTCCertificateGeneratorCallback {
+public:
+ explicit RTCCertificateGeneratorCallback(DOMPromiseDeferred<IDLInterface<RTCCertificate>>&& promise)
+ : m_promise(WTFMove(promise))
+ {
+ }
+
+ void AddRef() const final { ref(); }
+ rtc::RefCountReleaseStatus Release() const final
+ {
+ auto result = refCount() - 1;
+ deref();
+ return result ? rtc::RefCountReleaseStatus::kOtherRefsRemained : rtc::RefCountReleaseStatus::kDroppedLastRef;
+ }
+
+private:
+ void OnSuccess(const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) final
+ {
+ callOnMainThread([promise = WTFMove(m_promise.value()), certificate]() mutable {
+ Vector<RTCCertificate::DtlsFingerprint> fingerprints;
+ auto stats = certificate->ssl_certificate().GetStats();
+ auto* info = stats.get();
+ while (info) {
+ StringView fingerprint { reinterpret_cast<const unsigned char*>(info->fingerprint.data()), static_cast<unsigned>(info->fingerprint.length()) };
+ fingerprints.append({ fromStdString(info->fingerprint_algorithm), fingerprint.convertToASCIILowercase() });
+ info = info->issuer.get();
+ };
+
+ auto pem = certificate->ToPEM();
+ promise.resolve(RTCCertificate::create(certificate->Expires(), WTFMove(fingerprints), fromStdString(pem.certificate()), fromStdString(pem.private_key())));
+ });
+ }
+
+ void OnFailure() final
+ {
+ callOnMainThread([promise = WTFMove(m_promise.value())]() mutable {
+ promise.reject(Exception { TypeError, "Unable to create a certificate"_s});
+ });
+ }
+
+ std::optional<DOMPromiseDeferred<IDLInterface<RTCCertificate>>> m_promise;
+};
+
+static inline rtc::KeyParams keyParamsFromCertificateType(const PeerConnectionBackend::CertificateInformation& info)
+{
+ switch (info.type) {
+ case PeerConnectionBackend::CertificateInformation::Type::ECDSAP256:
+ return rtc::KeyParams::ECDSA();
+ case PeerConnectionBackend::CertificateInformation::Type::RSASSAPKCS1v15:
+ if (info.rsaParameters)
+ return rtc::KeyParams::RSA(info.rsaParameters->modulusLength, info.rsaParameters->publicExponent);
+ return rtc::KeyParams::RSA(2048, 65537);
+ }
+}
+
+void generateCertificate(LibWebRTCProvider& provider, const PeerConnectionBackend::CertificateInformation& info, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&& promise)
+{
+ rtc::scoped_refptr<RTCCertificateGeneratorCallback> callback(new RTCCertificateGeneratorCallback(WTFMove(promise)));
+
+ absl::optional<uint64_t> expiresMs;
+ if (info.expires)
+ expiresMs = static_cast<uint64_t>(*info.expires);
+
+ provider.certificateGenerator().GenerateCertificateAsync(keyParamsFromCertificateType(info), expiresMs, WTFMove(callback));
+}
+
+} // namespace LibWebRTCCertificateGenerator
+
+} // namespace WebCore
+
+#endif // USE(LIBWEBRTC)
Added: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.h (0 => 237140)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.h (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC)
+
+#include "PeerConnectionBackend.h"
+
+namespace WebCore {
+
+class LibWebRTCProvider;
+
+namespace LibWebRTCCertificateGenerator {
+
+void generateCertificate(LibWebRTCProvider&, const PeerConnectionBackend::CertificateInformation&, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&&);
+
+} // namespace LibWebRTCCertificateGenerator
+
+} // namespace WebCore
+
+#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp (237139 => 237140)
--- trunk/Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -28,7 +28,10 @@
#if ENABLE(WEB_AUTHN)
+#include "AuthenticatorAssertionResponse.h"
+#include "AuthenticatorAttestationResponse.h"
#include "AuthenticatorCoordinator.h"
+#include "AuthenticatorResponse.h"
#include "Document.h"
#include "JSDOMPromiseDeferred.h"
#include "Page.h"
Modified: trunk/Source/WebCore/Sources.txt (237139 => 237140)
--- trunk/Source/WebCore/Sources.txt 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/Sources.txt 2018-10-15 20:52:15 UTC (rev 237140)
@@ -167,6 +167,7 @@
Modules/mediastream/MediaTrackConstraints.cpp
Modules/mediastream/NavigatorMediaDevices.cpp
Modules/mediastream/PeerConnectionBackend.cpp
+Modules/mediastream/RTCCertificate.cpp
Modules/mediastream/RTCController.cpp
Modules/mediastream/RTCDTMFSender.cpp
Modules/mediastream/RTCDTMFToneChangeEvent.cpp
@@ -183,6 +184,8 @@
Modules/mediastream/UserMediaController.cpp
Modules/mediastream/UserMediaRequest.cpp
+Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp
+
Modules/navigatorcontentutils/NavigatorContentUtils.cpp
Modules/notifications/Notification.cpp
@@ -2879,6 +2882,7 @@
JSPublicKeyCredentialRequestOptions.cpp
JSPublicKeyCredentialType.cpp
JSRTCAnswerOptions.cpp
+JSRTCCertificate.cpp
JSRTCConfiguration.cpp
JSRTCDTMFSender.cpp
JSRTCDTMFToneChangeEvent.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237139 => 237140)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-15 20:52:15 UTC (rev 237140)
@@ -7231,6 +7231,11 @@
41189EF71AD8232800B90A0D /* ReadableStreamDefaultController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamDefaultController.idl; sourceTree = "<group>"; };
41189EF71AD8232800B93F64 /* ReadableByteStreamController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableByteStreamController.idl; sourceTree = "<group>"; };
41189EF71AD8232800B95672 /* ReadableStreamBYOBRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamBYOBRequest.idl; sourceTree = "<group>"; };
+ 41209E91216D593C00A73A12 /* RTCCertificate.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCCertificate.idl; sourceTree = "<group>"; };
+ 41209E93216D5C7900A73A12 /* RTCCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCCertificate.h; sourceTree = "<group>"; };
+ 41209E94216EA69A00A73A12 /* RTCCertificate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCCertificate.cpp; sourceTree = "<group>"; };
+ 41209E95216EC34E00A73A12 /* LibWebRTCCertificateGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCCertificateGenerator.h; path = libwebrtc/LibWebRTCCertificateGenerator.h; sourceTree = "<group>"; };
+ 41209E96216EC34F00A73A12 /* LibWebRTCCertificateGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCCertificateGenerator.cpp; path = libwebrtc/LibWebRTCCertificateGenerator.cpp; sourceTree = "<group>"; };
4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
4129C9801F5861C7009D7403 /* ReadableStreamSink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamSink.h; sourceTree = "<group>"; };
4129C9811F5861C7009D7403 /* ReadableStreamSink.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamSink.idl; sourceTree = "<group>"; };
@@ -15305,6 +15310,9 @@
5E2C434D1BCEE2E50001E2BC /* PeerConnectionBackend.h */,
316DCB2B1E78F3A9001B5F87 /* RTCAnswerOptions.h */,
316DCB2C1E78F3A9001B5F87 /* RTCAnswerOptions.idl */,
+ 41209E94216EA69A00A73A12 /* RTCCertificate.cpp */,
+ 41209E93216D5C7900A73A12 /* RTCCertificate.h */,
+ 41209E91216D593C00A73A12 /* RTCCertificate.idl */,
07AB996518DA3C010018771E /* RTCConfiguration.h */,
07AB996618DA3C010018771E /* RTCConfiguration.idl */,
418205481E53EAAD00D62207 /* RTCController.cpp */,
@@ -17099,6 +17107,8 @@
417612AA1E3A992300C3D81D /* libwebrtc */ = {
isa = PBXGroup;
children = (
+ 41209E96216EC34F00A73A12 /* LibWebRTCCertificateGenerator.cpp */,
+ 41209E95216EC34E00A73A12 /* LibWebRTCCertificateGenerator.h */,
5CDD833F1E43253D00621E92 /* LibWebRTCDataChannelHandler.cpp */,
5CDD83401E43253D00621E92 /* LibWebRTCDataChannelHandler.h */,
417612AB1E3A993B00C3D81D /* LibWebRTCMediaEndpoint.cpp */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (237139 => 237140)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -125,6 +125,7 @@
macro(PerformanceServerTiming) \
macro(PointerEvent) \
macro(PublicKeyCredential) \
+ macro(RTCCertificate) \
macro(RTCDTMFSender) \
macro(RTCDTMFToneChangeEvent) \
macro(RTCDataChannel) \
Modified: trunk/Source/WebCore/css/StyleBuilder.h (237139 => 237140)
--- trunk/Source/WebCore/css/StyleBuilder.h 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/css/StyleBuilder.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -32,6 +32,7 @@
class CSSValue;
class StyleResolver;
+struct CSSRegisteredCustomProperty;
class StyleBuilder {
public:
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (237139 => 237140)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2018-10-15 20:52:15 UTC (rev 237140)
@@ -106,6 +106,7 @@
std::unique_ptr<LibWebRTCAudioModule> audioDeviceModule;
std::unique_ptr<rtc::NetworkManager> networkManager;
std::unique_ptr<BasicPacketSocketFactory> packetSocketFactory;
+ std::unique_ptr<rtc::RTCCertificateGenerator> certificateGenerator;
private:
void OnMessage(rtc::Message*);
@@ -265,6 +266,15 @@
return m_factory->CreatePeerConnection(configuration, WTFMove(portAllocator), nullptr, &observer);
}
+rtc::RTCCertificateGenerator& LibWebRTCProvider::certificateGenerator()
+{
+ auto& factoryAndThreads = getStaticFactoryAndThreads(m_useNetworkThreadWithSocketServer);
+ if (!factoryAndThreads.certificateGenerator)
+ factoryAndThreads.certificateGenerator = std::make_unique<rtc::RTCCertificateGenerator>(factoryAndThreads.signalingThread.get(), factoryAndThreads.networkThread.get());
+
+ return *factoryAndThreads.certificateGenerator;
+}
+
#endif // USE(LIBWEBRTC)
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (237139 => 237140)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2018-10-15 20:09:15 UTC (rev 237139)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2018-10-15 20:52:15 UTC (rev 237140)
@@ -47,6 +47,7 @@
class NetworkManager;
class PacketSocketFactory;
class Thread;
+class RTCCertificateGenerator;
}
namespace webrtc {
@@ -111,6 +112,8 @@
void supportsVP8(bool value) { m_supportsVP8 = value; }
virtual void disableNonLocalhostConnections() { m_disableNonLocalhostConnections = true; }
+ rtc::RTCCertificateGenerator& certificateGenerator();
+
protected:
LibWebRTCProvider() = default;