Title: [252889] trunk
Revision
252889
Author
[email protected]
Date
2019-11-26 09:57:53 -0800 (Tue, 26 Nov 2019)

Log Message

Allow b/f cache in case of connected peer connections
https://bugs.webkit.org/show_bug.cgi?id=204583

Reviewed by Chris Dumez.

Source/WebCore:

Tests: webrtc/peerconnection-page-cache-long.html
       webrtc/peerconnection-page-cache.html

Remove guards against b/f cache.
When entering b/f cache, the packets are blocked which will trigger timeouts
and a connection failure of the peer connection after a few seconds.

* Modules/mediastream/RTCDTMFSender.cpp:
* Modules/mediastream/RTCDTMFSender.h:
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCPeerConnection.cpp:
* Modules/mediastream/RTCPeerConnection.h:

LayoutTests:

* fast/history/resources/page-cache-helper-10000ms.html: Added.
* webrtc/peerconnection-page-cache-expected.txt: Added.
* webrtc/peerconnection-page-cache-long-expected.txt: Added.
* webrtc/peerconnection-page-cache-long.html: Added.
* webrtc/peerconnection-page-cache.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252888 => 252889)


--- trunk/LayoutTests/ChangeLog	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/LayoutTests/ChangeLog	2019-11-26 17:57:53 UTC (rev 252889)
@@ -1,3 +1,16 @@
+2019-11-26  youenn fablet  <[email protected]>
+
+        Allow b/f cache in case of connected peer connections
+        https://bugs.webkit.org/show_bug.cgi?id=204583
+
+        Reviewed by Chris Dumez.
+
+        * fast/history/resources/page-cache-helper-10000ms.html: Added.
+        * webrtc/peerconnection-page-cache-expected.txt: Added.
+        * webrtc/peerconnection-page-cache-long-expected.txt: Added.
+        * webrtc/peerconnection-page-cache-long.html: Added.
+        * webrtc/peerconnection-page-cache.html: Added.
+
 2019-11-26  Alejandro G. Castro  <[email protected]>
 
         [GTK][WPE] New tests crashing after added in the r251377

Added: trunk/LayoutTests/fast/history/resources/page-cache-helper-10000ms.html (0 => 252889)


--- trunk/LayoutTests/fast/history/resources/page-cache-helper-10000ms.html	                        (rev 0)
+++ trunk/LayoutTests/fast/history/resources/page-cache-helper-10000ms.html	2019-11-26 17:57:53 UTC (rev 252889)
@@ -0,0 +1,9 @@
+This page should go back. If a test outputs the contents of this
+page, then the test page failed to enter the page cache.
+<script>
+  window.addEventListener("load", function() {
+    setTimeout(function() {
+      history.back();
+    }, 10000);
+  }, false);
+</script>

Added: trunk/LayoutTests/webrtc/peerconnection-page-cache-expected.txt (0 => 252889)


--- trunk/LayoutTests/webrtc/peerconnection-page-cache-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/peerconnection-page-cache-expected.txt	2019-11-26 17:57:53 UTC (rev 252889)
@@ -0,0 +1,4 @@
+
+
+PASS peerconnection-page-cache 
+

Added: trunk/LayoutTests/webrtc/peerconnection-page-cache-long-expected.txt (0 => 252889)


--- trunk/LayoutTests/webrtc/peerconnection-page-cache-long-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/peerconnection-page-cache-long-expected.txt	2019-11-26 17:57:53 UTC (rev 252889)
@@ -0,0 +1,4 @@
+
+
+PASS peerconnection-page-cache-long 
+

Added: trunk/LayoutTests/webrtc/peerconnection-page-cache-long.html (0 => 252889)


--- trunk/LayoutTests/webrtc/peerconnection-page-cache-long.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/peerconnection-page-cache-long.html	2019-11-26 17:57:53 UTC (rev 252889)
@@ -0,0 +1,63 @@
+<!-- webkit-test-runner [ enableBackForwardCache=true ] -->
+<!DOCTYPE html>
+<html>
+<body>
+<video id="video" autoplay=""></video>
+<script src=""
+<script src=""
+<script src=""
+<script>
+t = async_test();
+
+window.addEventListener("pageshow", async function(event) {
+    if (!event.persisted)
+        return;
+    assert_equals(t.pc1.connectionState, "disconnected");
+
+    t.pc1._onconnectionstatechange_ = () => {
+        if (t.pc1.connectionState === "connected")
+            t.done();
+    }
+
+    t.pc1._onicecandidate_ = (e) => t.pc2.addIceCandidate(e.candidate);
+    t.pc2._onicecandidate_ = (e) => t.pc1.addIceCandidate(e.candidate);
+
+    const offer = await t.pc1.createOffer();
+    await t.pc1.setLocalDescription(offer);
+    await t.pc2.setRemoteDescription(offer);
+
+    const answer = await t.pc2.createAnswer();
+    await t.pc2.setLocalDescription(answer);
+    await t.pc1.setRemoteDescription(answer);
+});
+
+window.addEventListener("pagehide", t.step_func((event) => {
+    assert_equals(t.pc1.connectionState, "connected");
+    if (!event.persisted)
+        assert_uneached("Page failed to enter page cache");
+
+}));
+
+_onload_ = () => {
+    setTimeout(async () => {
+        const localStream = await navigator.mediaDevices.getUserMedia({ video: true });
+        const stream = await new Promise((resolve, reject) => {
+            createConnections((firstConnection) => {
+                t.pc1 = firstConnection;
+                firstConnection.addTrack(localStream.getVideoTracks()[0], localStream);
+            }, (secondConnection) => {
+                t.pc2 = secondConnection;
+                secondConnection._ontrack_ = (trackEvent) => {
+                    resolve(trackEvent.streams[0]);
+                };
+            });
+            setTimeout(() => reject("Test timed out"), 5000);
+        });
+        video.srcObject = stream;
+        await video.play();
+
+        window.location = "../fast/history/resources/page-cache-helper-10000ms.html";
+    }, 0);
+};
+</script>
+</html>

Added: trunk/LayoutTests/webrtc/peerconnection-page-cache.html (0 => 252889)


--- trunk/LayoutTests/webrtc/peerconnection-page-cache.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/peerconnection-page-cache.html	2019-11-26 17:57:53 UTC (rev 252889)
@@ -0,0 +1,48 @@
+<!-- webkit-test-runner [ enableBackForwardCache=true ] -->
+<!DOCTYPE html>
+<html>
+<body>
+<video id="video" autoplay=""></video>
+<script src=""
+<script src=""
+<script src=""
+<script>
+t = async_test();
+
+window.addEventListener("pageshow", function(event) {
+    if (!event.persisted)
+        return;
+    assert_equals(t.pc1.connectionState, "connected");
+    t.done();
+});
+
+window.addEventListener("pagehide", t.step_func((event) => {
+    assert_equals(t.pc1.connectionState, "connected");
+    if (!event.persisted)
+        assert_uneached("Page failed to enter page cache");
+
+}));
+
+_onload_ = () => {
+    setTimeout(async () => {
+        const localStream = await navigator.mediaDevices.getUserMedia({video: true });
+        const stream = await new Promise((resolve, reject) => {
+            createConnections((firstConnection) => {
+                t.pc1 = firstConnection;
+                firstConnection.addTrack(localStream.getVideoTracks()[0], localStream);
+            }, (secondConnection) => {
+                t.pc2 = secondConnection;
+                secondConnection._ontrack_ = (trackEvent) => {
+                    resolve(trackEvent.streams[0]);
+                };
+            });
+            setTimeout(() => reject("Test timed out"), 5000);
+        });
+        video.srcObject = stream;
+        await video.play();
+
+        window.location = "../fast/history/resources/page-cache-helper.html";
+    }, 0);
+};
+</script>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (252888 => 252889)


--- trunk/Source/WebCore/ChangeLog	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/Source/WebCore/ChangeLog	2019-11-26 17:57:53 UTC (rev 252889)
@@ -1,3 +1,23 @@
+2019-11-26  youenn fablet  <[email protected]>
+
+        Allow b/f cache in case of connected peer connections
+        https://bugs.webkit.org/show_bug.cgi?id=204583
+
+        Reviewed by Chris Dumez.
+
+        Tests: webrtc/peerconnection-page-cache-long.html
+               webrtc/peerconnection-page-cache.html
+
+        Remove guards against b/f cache.
+        When entering b/f cache, the packets are blocked which will trigger timeouts
+        and a connection failure of the peer connection after a few seconds.
+
+        * Modules/mediastream/RTCDTMFSender.cpp:
+        * Modules/mediastream/RTCDTMFSender.h:
+        * Modules/mediastream/RTCDataChannel.h:
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        * Modules/mediastream/RTCPeerConnection.h:
+
 2019-11-26  Antti Koivisto  <[email protected]>
 
         [LFC] Don't leak Boxes

Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp (252888 => 252889)


--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp	2019-11-26 17:57:53 UTC (rev 252889)
@@ -148,12 +148,6 @@
     return "RTCDTMFSender";
 }
 
-// FIXME: This should never prevent entering the back/forward cache.
-bool RTCDTMFSender::shouldPreventEnteringBackForwardCache_DEPRECATED() const
-{
-    return m_sender && !m_sender->isStopped();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(WEB_RTC)

Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h (252888 => 252889)


--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h	2019-11-26 17:57:53 UTC (rev 252889)
@@ -58,7 +58,6 @@
 
     void stop() final;
     const char* activeDOMObjectName() const final;
-    bool shouldPreventEnteringBackForwardCache_DEPRECATED() const final;
 
     EventTargetInterface eventTargetInterface() const final { return RTCDTMFSenderEventTargetInterfaceType; }
     ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }

Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h (252888 => 252889)


--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h	2019-11-26 17:57:53 UTC (rev 252889)
@@ -95,9 +95,6 @@
     void stop() final;
     const char* activeDOMObjectName() const final { return "RTCDataChannel"; }
 
-    // FIXME: This should never prevent entering the back/forward cache.
-    bool shouldPreventEnteringBackForwardCache_DEPRECATED() const final { return m_readyState == RTCDataChannelState::Open; }
-
     // RTCDataChannelHandlerClient API
     void didChangeReadyState(RTCDataChannelState) final;
     void didReceiveStringData(const String&) final;

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (252888 => 252889)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2019-11-26 17:57:53 UTC (rev 252889)
@@ -498,12 +498,6 @@
     return "RTCPeerConnection";
 }
 
-// FIXME: This should never prevent entering the back/forward cache.
-bool RTCPeerConnection::shouldPreventEnteringBackForwardCache_DEPRECATED() const
-{
-    return m_iceConnectionState == RTCIceConnectionState::Completed || m_iceConnectionState == RTCIceConnectionState::Connected;
-}
-
 void RTCPeerConnection::suspend(ReasonForSuspension reason)
 {
     if (reason != ReasonForSuspension::BackForwardCache)

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (252888 => 252889)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2019-11-26 16:44:16 UTC (rev 252888)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2019-11-26 17:57:53 UTC (rev 252889)
@@ -211,7 +211,6 @@
     // ActiveDOMObject
     WEBCORE_EXPORT void stop() final;
     const char* activeDOMObjectName() const final;
-    bool shouldPreventEnteringBackForwardCache_DEPRECATED() const final;
     void suspend(ReasonForSuspension) final;
     void resume() final;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to