Changeset 230970 in webkit
- Timestamp:
- Apr 24, 2018 1:22:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r230968 r230970 1 2018-04-24 Youenn Fablet <youenn@apple.com> 2 3 Throw in case of PeerConnection created for detached documents 4 https://bugs.webkit.org/show_bug.cgi?id=184921 5 <rdar://problem/39629216> 6 7 Reviewed by Eric Carlson. 8 9 * webrtc/pc-detached-document-expected.txt: Added. 10 * webrtc/pc-detached-document.html: Added. 11 1 12 2018-04-24 John Wilander <wilander@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r230968 r230970 1 2018-04-24 Youenn Fablet <youenn@apple.com> 2 3 Throw in case of PeerConnection created for detached documents 4 https://bugs.webkit.org/show_bug.cgi?id=184921 5 <rdar://problem/39629216> 6 7 Reviewed by Eric Carlson. 8 9 Add a check to ensure that page is not null when creating a peer connection backend. 10 In that case, the peer connection constructor will later on throw. 11 The same for setConfiguration is done. 12 Behavior is consistent with Chrome. 13 14 Test: webrtc/pc-detached-document.html 15 16 * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: 17 (WebCore::createLibWebRTCPeerConnectionBackend): 18 (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend): 19 (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration): 20 (WebCore::libWebRTCProvider): Deleted. 21 * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: 22 1 23 2018-04-24 John Wilander <wilander@apple.com> 2 24 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp
r230548 r230970 50 50 if (!LibWebRTCProvider::webRTCAvailable()) 51 51 return nullptr; 52 return std::make_unique<LibWebRTCPeerConnectionBackend>(peerConnection); 52 53 auto* page = downcast<Document>(*peerConnection.scriptExecutionContext()).page(); 54 if (!page) 55 return nullptr; 56 return std::make_unique<LibWebRTCPeerConnectionBackend>(peerConnection, page->libWebRTCProvider()); 53 57 } 54 58 55 59 CreatePeerConnectionBackend PeerConnectionBackend::create = createLibWebRTCPeerConnectionBackend; 56 60 57 static inline LibWebRTCProvider& libWebRTCProvider(RTCPeerConnection& peerConnection) 58 { 59 return downcast<Document>(*peerConnection.scriptExecutionContext()).page()->libWebRTCProvider(); 60 } 61 62 LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend(RTCPeerConnection& peerConnection) 61 LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend(RTCPeerConnection& peerConnection, LibWebRTCProvider& provider) 63 62 : PeerConnectionBackend(peerConnection) 64 , m_endpoint(LibWebRTCMediaEndpoint::create(*this, libWebRTCProvider(peerConnection)))63 , m_endpoint(LibWebRTCMediaEndpoint::create(*this, provider)) 65 64 { 66 65 } … … 121 120 bool LibWebRTCPeerConnectionBackend::setConfiguration(MediaEndpointConfiguration&& configuration) 122 121 { 123 return m_endpoint->setConfiguration(libWebRTCProvider(m_peerConnection), configurationFromMediaEndpointConfiguration(WTFMove(configuration))); 122 auto* page = downcast<Document>(*m_peerConnection.scriptExecutionContext()).page(); 123 if (!page) 124 return false; 125 126 return m_endpoint->setConfiguration(page->libWebRTCProvider(), configurationFromMediaEndpointConfiguration(WTFMove(configuration))); 124 127 } 125 128 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h
r229645 r230970 37 37 38 38 class LibWebRTCMediaEndpoint; 39 class LibWebRTCProvider; 39 40 class RTCRtpReceiver; 40 41 class RTCSessionDescription; … … 47 48 class LibWebRTCPeerConnectionBackend final : public PeerConnectionBackend { 48 49 public: 49 explicit LibWebRTCPeerConnectionBackend(RTCPeerConnection&);50 LibWebRTCPeerConnectionBackend(RTCPeerConnection&, LibWebRTCProvider&); 50 51 ~LibWebRTCPeerConnectionBackend(); 51 52
Note: See TracChangeset
for help on using the changeset viewer.