Throw in case of PeerConnection created for detached documents
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 20:22:51 +0000 (20:22 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 20:22:51 +0000 (20:22 +0000)
commit5a356f4e3315fedf73b67579d8f1c7919c4a077b
treec4a48060cc8e1ff24bb9d7c89e06fd3a30d70331
parent1c5475a84df1d32271cb3b1dca35863db5aa8438
Throw in case of PeerConnection created for detached documents
https://bugs.webkit.org/show_bug.cgi?id=184921
<rdar://problem/39629216>

Reviewed by Eric Carlson.

Source/WebCore:

Add a check to ensure that page is not null when creating a peer connection backend.
In that case, the peer connection constructor will later on throw.
The same for setConfiguration is done.
Behavior is consistent with Chrome.

Test: webrtc/pc-detached-document.html

* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::createLibWebRTCPeerConnectionBackend):
(WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
(WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
(WebCore::libWebRTCProvider): Deleted.
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:

LayoutTests:

* webrtc/pc-detached-document-expected.txt: Added.
* webrtc/pc-detached-document.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webrtc/pc-detached-document-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/pc-detached-document.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h