Title: [237866] trunk
Revision
237866
Author
you...@apple.com
Date
2018-11-06 07:56:59 -0800 (Tue, 06 Nov 2018)

Log Message

Make sure RTCIceCandidateStats address is undefined for host and peer reflexive case
https://bugs.webkit.org/show_bug.cgi?id=191263

Reviewed by Eric Carlson.

Source/WebCore:

Test: webrtc/datachannel/getStats-no-prflx-remote-candidate.html

* Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
(WebCore::fillRTCIceCandidateStats):

LayoutTests:

* webrtc/datachannel/getStats-no-prflx-remote-candidate-expected.txt: Added.
* webrtc/datachannel/getStats-no-prflx-remote-candidate.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237865 => 237866)


--- trunk/LayoutTests/ChangeLog	2018-11-06 15:54:34 UTC (rev 237865)
+++ trunk/LayoutTests/ChangeLog	2018-11-06 15:56:59 UTC (rev 237866)
@@ -1,5 +1,15 @@
 2018-11-06  Youenn Fablet  <you...@apple.com>
 
+        Make sure RTCIceCandidateStats address is undefined for host and peer reflexive case
+        https://bugs.webkit.org/show_bug.cgi?id=191263
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/datachannel/getStats-no-prflx-remote-candidate-expected.txt: Added.
+        * webrtc/datachannel/getStats-no-prflx-remote-candidate.html: Added.
+
+2018-11-06  Youenn Fablet  <you...@apple.com>
+
         Layout Test imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html is flaky
         https://bugs.webkit.org/show_bug.cgi?id=191278
 

Added: trunk/LayoutTests/webrtc/datachannel/getStats-no-prflx-remote-candidate-expected.txt (0 => 237866)


--- trunk/LayoutTests/webrtc/datachannel/getStats-no-prflx-remote-candidate-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/getStats-no-prflx-remote-candidate-expected.txt	2018-11-06 15:56:59 UTC (rev 237866)
@@ -0,0 +1,3 @@
+
+PASS Make sure remote peer reflexive candidates are not exposed in stats 
+

Added: trunk/LayoutTests/webrtc/datachannel/getStats-no-prflx-remote-candidate.html (0 => 237866)


--- trunk/LayoutTests/webrtc/datachannel/getStats-no-prflx-remote-candidate.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/getStats-no-prflx-remote-candidate.html	2018-11-06 15:56:59 UTC (rev 237866)
@@ -0,0 +1,59 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Make sure remote peer reflexive candidates are not exposed in stats</title>
+<script src=""
+<script src=""
+<script>
+  'use strict';
+const localPc = new RTCPeerConnection();
+const remotePc = new RTCPeerConnection();
+
+async function doSignalingHandshake(localPc, remotePc) {
+    const offer = await localPc.createOffer();
+    await localPc.setLocalDescription(offer);
+    await remotePc.setRemoteDescription(offer);
+
+    const answer = await remotePc.createAnswer();
+    await remotePc.setLocalDescription(answer);
+    await localPc.setRemoteDescription(answer);
+}
+
+function getRequiredStats(statsReport, type) {
+    for(const stats of statsReport.values()) {
+        if(stats.type === type)
+            return stats;
+    }
+}
+
+async function doTest()
+{
+    const promiseDataChannel = new Promise(resolve => {
+        remotePc.addEventListener('datachannel', (event) => {
+             resolve(event.channel);
+        });
+    });
+
+    const localDataChannel = localPc.createDataChannel('test');
+
+    localPc.addEventListener('icecandidate', event => {
+        remotePc.addIceCandidate(event.candidate);
+    });
+    doSignalingHandshake(localPc, remotePc);
+
+    const remoteDataChannel = await promiseDataChannel;
+
+    assert_true(!!remoteDataChannel, "remoteDataChannel is defined");
+    await new Promise(resolve => {
+        remoteDataChannel._onmessage_ = resolve;
+        localDataChannel.send("test");
+    });
+
+    const remoteCandidateStats = getRequiredStats(await localPc.getStats(), "remote-candidate");
+    assert_equals(remoteCandidateStats.address, undefined, "address should remain undefined");
+
+    done();
+}
+
+doTest();
+
+</script>

Modified: trunk/Source/WebCore/ChangeLog (237865 => 237866)


--- trunk/Source/WebCore/ChangeLog	2018-11-06 15:54:34 UTC (rev 237865)
+++ trunk/Source/WebCore/ChangeLog	2018-11-06 15:56:59 UTC (rev 237866)
@@ -1,3 +1,15 @@
+2018-11-06  Youenn Fablet  <you...@apple.com>
+
+        Make sure RTCIceCandidateStats address is undefined for host and peer reflexive case
+        https://bugs.webkit.org/show_bug.cgi?id=191263
+
+        Reviewed by Eric Carlson.
+
+        Test: webrtc/datachannel/getStats-no-prflx-remote-candidate.html
+
+        * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
+        (WebCore::fillRTCIceCandidateStats):
+
 2018-11-06  Thibault Saunier  <tsaun...@igalia.com>
 
         [GStreamer][WebRTC] Handle setting max number of frame between keyframes

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp (237865 => 237866)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp	2018-11-06 15:54:34 UTC (rev 237865)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp	2018-11-06 15:56:59 UTC (rev 237866)
@@ -310,9 +310,7 @@
     if (rtcStats.candidate_type.is_defined())
         stats.candidateType = iceCandidateState(*rtcStats.candidate_type);
 
-    if (stats.candidateType == RTCStatsReport::IceCandidateType::Prflx)
-        stats.candidateType = { };
-    if (stats.candidateType == RTCStatsReport::IceCandidateType::Prflx || stats.candidateType == RTCStatsReport::IceCandidateType::Host)
+    if (!stats.candidateType || stats.candidateType == RTCStatsReport::IceCandidateType::Prflx || stats.candidateType == RTCStatsReport::IceCandidateType::Host)
         stats.address = { };
 
     if (rtcStats.priority.is_defined())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to