Implement IDL surface for RTCDtlsTransport
This provides the IDL surface only, there is no connection to the
underlying objects.
Bug: 907849
Change-Id: Ie11bac767c6a26628c1bc757d2529f1192a07e40
Reviewed-on: https://chromium-review.googlesource.com/c/1348064
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610730}
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/idlharness.https.window-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webrtc/idlharness.https.window-expected.txt
index bea78a5..a3166f9 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/idlharness.https.window-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/idlharness.https.window-expected.txt
@@ -303,17 +303,17 @@
FAIL RTCRtpTransceiver interface: new RTCPeerConnection().addTransceiver('audio') must inherit property "stop()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'. 'unified-plan' will become the default behavior in the future, but it is currently experimental. To try it out, construct the RTCPeerConnection with sdpSemantics:'unified-plan' present in the RTCConfiguration argument."
FAIL RTCRtpTransceiver interface: new RTCPeerConnection().addTransceiver('audio') must inherit property "setCodecPreferences([object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'. 'unified-plan' will become the default behavior in the future, but it is currently experimental. To try it out, construct the RTCPeerConnection with sdpSemantics:'unified-plan' present in the RTCConfiguration argument."
FAIL RTCRtpTransceiver interface: calling setCodecPreferences([object Object]) on new RTCPeerConnection().addTransceiver('audio') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'. 'unified-plan' will become the default behavior in the future, but it is currently experimental. To try it out, construct the RTCPeerConnection with sdpSemantics:'unified-plan' present in the RTCConfiguration argument."
-FAIL RTCDtlsTransport interface: existence and properties of interface object assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface object length assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface object name assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: existence and properties of interface prototype object assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute iceTransport assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute state assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: operation getRemoteCertificates() assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute onstatechange assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute onerror assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
+PASS RTCDtlsTransport interface: existence and properties of interface object
+PASS RTCDtlsTransport interface object length
+PASS RTCDtlsTransport interface object name
+PASS RTCDtlsTransport interface: existence and properties of interface prototype object
+PASS RTCDtlsTransport interface: existence and properties of interface prototype object's "constructor" property
+PASS RTCDtlsTransport interface: existence and properties of interface prototype object's @@unscopables property
+PASS RTCDtlsTransport interface: attribute iceTransport
+PASS RTCDtlsTransport interface: attribute state
+PASS RTCDtlsTransport interface: operation getRemoteCertificates()
+PASS RTCDtlsTransport interface: attribute onstatechange
+PASS RTCDtlsTransport interface: attribute onerror
FAIL RTCDtlsTransport must be primary interface of idlTestObjects.dtlsTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL Stringification of idlTestObjects.dtlsTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL RTCDtlsTransport interface: idlTestObjects.dtlsTransport must inherit property "iceTransport" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
diff --git a/third_party/WebKit/LayoutTests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt b/third_party/WebKit/LayoutTests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt
index 3a0032a..7fbb562 100644
--- a/third_party/WebKit/LayoutTests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt
@@ -303,17 +303,17 @@
FAIL RTCRtpTransceiver interface: new RTCPeerConnection().addTransceiver('audio') must inherit property "stop()" with the proper type assert_inherits: property "stop" not found in prototype chain
FAIL RTCRtpTransceiver interface: new RTCPeerConnection().addTransceiver('audio') must inherit property "setCodecPreferences([object Object])" with the proper type assert_inherits: property "setCodecPreferences" not found in prototype chain
FAIL RTCRtpTransceiver interface: calling setCodecPreferences([object Object]) on new RTCPeerConnection().addTransceiver('audio') with too few arguments must throw TypeError assert_inherits: property "setCodecPreferences" not found in prototype chain
-FAIL RTCDtlsTransport interface: existence and properties of interface object assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface object length assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface object name assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: existence and properties of interface prototype object assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute iceTransport assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute state assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: operation getRemoteCertificates() assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute onstatechange assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
-FAIL RTCDtlsTransport interface: attribute onerror assert_own_property: self does not have own property "RTCDtlsTransport" expected property "RTCDtlsTransport" missing
+PASS RTCDtlsTransport interface: existence and properties of interface object
+PASS RTCDtlsTransport interface object length
+PASS RTCDtlsTransport interface object name
+PASS RTCDtlsTransport interface: existence and properties of interface prototype object
+PASS RTCDtlsTransport interface: existence and properties of interface prototype object's "constructor" property
+PASS RTCDtlsTransport interface: existence and properties of interface prototype object's @@unscopables property
+PASS RTCDtlsTransport interface: attribute iceTransport
+PASS RTCDtlsTransport interface: attribute state
+PASS RTCDtlsTransport interface: operation getRemoteCertificates()
+PASS RTCDtlsTransport interface: attribute onstatechange
+PASS RTCDtlsTransport interface: attribute onerror
FAIL RTCDtlsTransport must be primary interface of idlTestObjects.dtlsTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL Stringification of idlTestObjects.dtlsTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL RTCDtlsTransport interface: idlTestObjects.dtlsTransport must inherit property "iceTransport" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index 4dc7945..4cb466a 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -5509,6 +5509,16 @@
attribute @@toStringTag
getter channel
method constructor
+interface RTCDtlsTransport : EventTarget
+ attribute @@toStringTag
+ getter iceTransport
+ getter onerror
+ getter onstatechange
+ getter state
+ method constructor
+ method getRemoteCertificates
+ setter onerror
+ setter onstatechange
interface RTCIceCandidate
attribute @@toStringTag
getter candidate
diff --git a/third_party/blink/renderer/modules/event_target_modules_names.json5 b/third_party/blink/renderer/modules/event_target_modules_names.json5
index d41558c..3f5aec4 100644
--- a/third_party/blink/renderer/modules/event_target_modules_names.json5
+++ b/third_party/blink/renderer/modules/event_target_modules_names.json5
@@ -29,6 +29,7 @@
"MediaStreamTrack",
"RTCDTMFSender",
"RTCDataChannel",
+ "RTCDtlsTransport",
"RTCPeerConnection",
"NetworkInformation",
"Notification",
diff --git a/third_party/blink/renderer/modules/modules_idl_files.gni b/third_party/blink/renderer/modules/modules_idl_files.gni
index 1fe3cd8..35f32d6b 100644
--- a/third_party/blink/renderer/modules/modules_idl_files.gni
+++ b/third_party/blink/renderer/modules/modules_idl_files.gni
@@ -223,6 +223,7 @@
"peerconnection/rtc_certificate.idl",
"peerconnection/rtc_data_channel.idl",
"peerconnection/rtc_data_channel_event.idl",
+ "peerconnection/rtc_dtls_transport.idl",
"peerconnection/rtc_dtmf_sender.idl",
"peerconnection/rtc_dtmf_tone_change_event.idl",
"peerconnection/rtc_ice_candidate.idl",
diff --git a/third_party/blink/renderer/modules/peerconnection/BUILD.gn b/third_party/blink/renderer/modules/peerconnection/BUILD.gn
index ff6e6b92..a4fce2bd 100644
--- a/third_party/blink/renderer/modules/peerconnection/BUILD.gn
+++ b/third_party/blink/renderer/modules/peerconnection/BUILD.gn
@@ -44,6 +44,8 @@
"rtc_data_channel.h",
"rtc_data_channel_event.cc",
"rtc_data_channel_event.h",
+ "rtc_dtls_transport.cc",
+ "rtc_dtls_transport.h",
"rtc_dtmf_sender.cc",
"rtc_dtmf_sender.h",
"rtc_dtmf_tone_change_event.cc",
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc
new file mode 100644
index 0000000..feadf0a
--- /dev/null
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc
@@ -0,0 +1,72 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.h"
+
+#include "third_party/blink/public/platform/platform.h"
+#include "third_party/blink/public/web/web_local_frame.h"
+#include "third_party/blink/renderer/core/dom/document.h"
+#include "third_party/blink/renderer/core/dom/events/event.h"
+#include "third_party/blink/renderer/core/frame/local_frame.h"
+#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
+#include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_adapter_cross_thread_factory.h"
+#include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_adapter_impl.h"
+#include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_error_util.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_ice_candidate.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_ice_gather_options.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_ice_transport.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_ice_event.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_ice_event_init.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_quic_transport.h"
+#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
+#include "third_party/webrtc/api/jsepicecandidate.h"
+#include "third_party/webrtc/api/peerconnectioninterface.h"
+#include "third_party/webrtc/p2p/base/portallocator.h"
+#include "third_party/webrtc/p2p/base/transportdescription.h"
+#include "third_party/webrtc/pc/iceserverparsing.h"
+#include "third_party/webrtc/pc/webrtcsdp.h"
+
+namespace blink {
+
+RTCDtlsTransport* RTCDtlsTransport::Create(ExecutionContext* context) {
+ return new RTCDtlsTransport(context);
+}
+
+RTCDtlsTransport::RTCDtlsTransport(ExecutionContext* context)
+ : ContextClient(context) {}
+
+RTCDtlsTransport::~RTCDtlsTransport() {}
+
+String RTCDtlsTransport::state() const {
+ NOTIMPLEMENTED();
+ return "";
+}
+
+const HeapVector<Member<DOMArrayBuffer>>&
+RTCDtlsTransport::getRemoteCertificates() const {
+ return remote_certificates_;
+}
+
+RTCIceTransport* RTCDtlsTransport::iceTransport() const {
+ // TODO(crbug.com/907849): Implement returning an IceTransport
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+const AtomicString& RTCDtlsTransport::InterfaceName() const {
+ return event_target_names::kRTCDtlsTransport;
+}
+
+ExecutionContext* RTCDtlsTransport::GetExecutionContext() const {
+ return ContextClient::GetExecutionContext();
+}
+
+void RTCDtlsTransport::Trace(Visitor* visitor) {
+ visitor->Trace(remote_certificates_);
+ EventTargetWithInlineData::Trace(visitor);
+ ContextClient::Trace(visitor);
+}
+
+} // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.h b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.h
new file mode 100644
index 0000000..afe492c7
--- /dev/null
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.h
@@ -0,0 +1,59 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_DTLS_TRANSPORT_H_
+#define THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_DTLS_TRANSPORT_H_
+
+#include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h"
+#include "third_party/blink/renderer/core/dom/context_lifecycle_observer.h"
+#include "third_party/blink/renderer/modules/event_target_modules.h"
+
+namespace blink {
+
+class DOMArrayBuffer;
+class RTCIceTransport;
+
+enum class RTCDtlsTransportState {
+ kNew,
+ kChecking,
+ kConnected,
+ kCompleted,
+ kDisconnected,
+ kFailed,
+ kClosed
+};
+
+// Blink bindings for the RTCDtlsTransport JavaScript object.
+//
+class MODULES_EXPORT RTCDtlsTransport final : public EventTargetWithInlineData,
+ public ContextClient {
+ DEFINE_WRAPPERTYPEINFO();
+ USING_GARBAGE_COLLECTED_MIXIN(RTCDtlsTransport);
+
+ public:
+ static RTCDtlsTransport* Create(ExecutionContext* context);
+
+ ~RTCDtlsTransport() override;
+
+ // rtc_dtls_transport.idl
+ RTCIceTransport* iceTransport() const;
+ String state() const;
+ const HeapVector<Member<DOMArrayBuffer>>& getRemoteCertificates() const;
+
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange, kStatechange);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(error, kError);
+
+ // EventTarget overrides.
+ const AtomicString& InterfaceName() const override;
+ ExecutionContext* GetExecutionContext() const override;
+ // For garbage collection.
+ void Trace(blink::Visitor* visitor) override;
+
+ private:
+ explicit RTCDtlsTransport(ExecutionContext* context);
+ HeapVector<Member<DOMArrayBuffer>> remote_certificates_;
+};
+
+} // namespace blink
+#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_DTLS_TRANSPORT_H_
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.idl b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.idl
new file mode 100644
index 0000000..c514ca9
--- /dev/null
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.idl
@@ -0,0 +1,24 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// http://w3c.github.io/webrtc-pc/#rtcdtlstransport-interface
+
+enum RTCDtlsTransportState {
+ "new",
+ "connecting",
+ "connected",
+ "closed",
+ "failed"
+};
+
+[
+ Exposed=Window,
+ RuntimeEnabled=RTCDtlsTransport
+] interface RTCDtlsTransport : EventTarget {
+ readonly attribute RTCIceTransport iceTransport;
+ readonly attribute RTCDtlsTransportState state;
+ sequence<ArrayBuffer> getRemoteCertificates();
+ attribute EventHandler onstatechange;
+ attribute EventHandler onerror;
+};
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
index 8071d80..db8881a 100644
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1059,6 +1059,11 @@
origin_trial_feature_name: "RtcAudioJitterBufferMaxPackets",
status: "experimental",
},
+ // Enables the use of the RTCDtlsTransport object.
+ {
+ name: "RTCDtlsTransport",
+ status: "test",
+ },
// Enables the use of the RTCIceTransport with extensions.
{
name: "RTCIceTransportExtension",