Changeset 226804 in webkit
- Timestamp:
- Jan 11, 2018 1:54:23 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r226802 r226804 1 2018-01-11 Youenn Fablet <youenn@apple.com> 2 3 RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin 4 https://bugs.webkit.org/show_bug.cgi?id=180851 5 6 Reviewed by Eric Carlson. 7 8 * http/wpt/webrtc/resources/third-party-frame-ice-candidate-filtering-iframe.html: Added. 9 * http/wpt/webrtc/third-party-frame-ice-candidate-filtering-expected.txt: Added. 10 * http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html: Added. 11 1 12 2018-01-11 Ali Juma <ajuma@chromium.org> 2 13 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r226375 r226804 131 131 webrtc [ Skip ] 132 132 http/tests/webrtc [ Skip ] 133 http/wpt/webrtc [ Skip ] 133 134 webrtc/datachannel [ Pass ] 134 135 webrtc/datachannel/bufferedAmountLowThreshold.html [ Pass Failure ] -
trunk/Source/WebCore/ChangeLog
r226802 r226804 1 2018-01-11 Youenn Fablet <youenn@apple.com> 2 3 RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin 4 https://bugs.webkit.org/show_bug.cgi?id=180851 5 6 Reviewed by Eric Carlson. 7 8 Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html 9 10 RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access. 11 For any such client origin, PeerConnection objects ICE candidate filtering is disabled. 12 ICE candidate filtering is reset whenever navigating/reloading the page. 13 14 * Modules/mediastream/RTCController.cpp: 15 (WebCore::RTCController::reset): 16 (WebCore::matchDocumentOrigin): 17 (WebCore::RTCController::shouldDisableICECandidateFiltering): 18 (WebCore::RTCController::add): 19 (WebCore::RTCController::disableICECandidateFilteringForAllOrigins): 20 (WebCore::RTCController::disableICECandidateFiltering): 21 (WebCore::RTCController::enableICECandidateFiltering): 22 * Modules/mediastream/RTCController.h: 23 * Modules/mediastream/RTCPeerConnection.cpp: 24 (WebCore::RTCPeerConnection::create): 25 * Modules/mediastream/UserMediaRequest.cpp: 26 (WebCore::UserMediaRequest::allow): 27 * page/Page.cpp: 28 (WebCore::Page::disableICECandidateFiltering): 29 * testing/Internals.cpp: 30 (WebCore::Internals::setICECandidateFiltering): 31 1 32 2018-01-11 Ali Juma <ajuma@chromium.org> 2 33 -
trunk/Source/WebCore/Modules/mediastream/RTCController.cpp
r219331 r226804 45 45 connection.clearController(); 46 46 m_peerConnections.clear(); 47 m_filteringDisabledOrigins.clear(); 47 48 } 48 49 … … 54 55 } 55 56 57 static inline bool matchDocumentOrigin(Document& document, SecurityOrigin& topOrigin, SecurityOrigin& clientOrigin) 58 { 59 if (originsMatch(topOrigin, document.securityOrigin())) 60 return true; 61 return originsMatch(topOrigin, document.topOrigin()) && originsMatch(clientOrigin, document.securityOrigin()); 62 } 63 64 bool RTCController::shouldDisableICECandidateFiltering(Document& document) 65 { 66 if (!m_shouldFilterICECandidates) 67 return true; 68 return notFound != m_filteringDisabledOrigins.findMatching([&] (const auto& origin) { 69 return matchDocumentOrigin(document, origin.topOrigin, origin.clientOrigin); 70 }); 71 } 72 56 73 void RTCController::add(RTCPeerConnection& connection) 57 74 { 58 75 m_peerConnections.append(connection); 59 if ( !m_shouldFilterICECandidates)76 if (shouldDisableICECandidateFiltering(downcast<Document>(*connection.scriptExecutionContext()))) 60 77 connection.disableICECandidateFiltering(); 61 78 } 62 79 63 void RTCController::disableICECandidateFiltering ()80 void RTCController::disableICECandidateFilteringForAllOrigins() 64 81 { 65 82 if (!LibWebRTCProvider::webRTCAvailable()) … … 71 88 } 72 89 90 void RTCController::disableICECandidateFilteringForDocument(Document& document) 91 { 92 if (!LibWebRTCProvider::webRTCAvailable()) 93 return; 94 95 m_filteringDisabledOrigins.append(PeerConnectionOrigin { document.topOrigin(), document.securityOrigin() }); 96 for (RTCPeerConnection& connection : m_peerConnections) { 97 if (auto* peerConnectionDocument = downcast<Document>(connection.scriptExecutionContext())) { 98 if (matchDocumentOrigin(*peerConnectionDocument, document.topOrigin(), document.securityOrigin())) 99 connection.disableICECandidateFiltering(); 100 } 101 } 102 } 103 73 104 void RTCController::enableICECandidateFiltering() 74 105 { … … 76 107 return; 77 108 109 m_filteringDisabledOrigins.clear(); 78 110 m_shouldFilterICECandidates = true; 79 111 for (RTCPeerConnection& connection : m_peerConnections) -
trunk/Source/WebCore/Modules/mediastream/RTCController.h
r219331 r226804 25 25 #pragma once 26 26 27 #include "SecurityOrigin.h" 27 28 #include <wtf/Vector.h> 28 29 29 30 namespace WebCore { 30 31 32 class Document; 31 33 class RTCPeerConnection; 32 34 … … 43 45 void remove(RTCPeerConnection&); 44 46 45 WEBCORE_EXPORT void disableICECandidateFiltering(); 47 WEBCORE_EXPORT void disableICECandidateFilteringForAllOrigins(); 48 WEBCORE_EXPORT void disableICECandidateFilteringForDocument(Document&); 46 49 WEBCORE_EXPORT void enableICECandidateFiltering(); 47 50 48 51 private: 52 53 bool shouldDisableICECandidateFiltering(Document&); 54 55 struct PeerConnectionOrigin { 56 Ref<SecurityOrigin> topOrigin; 57 Ref<SecurityOrigin> clientOrigin; 58 }; 59 Vector<PeerConnectionOrigin> m_filteringDisabledOrigins; 49 60 Vector<std::reference_wrapper<RTCPeerConnection>> m_peerConnections; 50 61 bool m_shouldFilterICECandidates { true }; -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r224459 r226804 70 70 if (!peerConnection->isClosed()) { 71 71 peerConnection->setPendingActivity(peerConnection.ptr()); 72 73 // ICE candidate filtering can only be disabled for connections from documents that have the same origin as the top document, 74 // or if the page was set to disable it. 75 auto& document = downcast<Document>(context); 76 auto* page = document.page(); 77 if (page && (!page->shouldEnableICECandidateFilteringByDefault() || document.origin() == document.topDocument().origin())) 72 if (auto* page = downcast<Document>(context).page()) 78 73 peerConnection->registerToController(page->rtcController()); 79 74 } -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
r226383 r226804 252 252 253 253 #if ENABLE(WEB_RTC) 254 auto * page = downcast<Document>(*m_scriptExecutionContext).page();255 if ( page)256 page->rtcController().disableICECandidateFiltering ();254 auto& document = downcast<Document>(*m_scriptExecutionContext); 255 if (auto* page = document.page()) 256 page->rtcController().disableICECandidateFilteringForDocument(document); 257 257 #endif 258 258 } -
trunk/Source/WebCore/page/Page.cpp
r225449 r226804 2331 2331 m_shouldEnableICECandidateFilteringByDefault = false; 2332 2332 #if ENABLE(WEB_RTC) 2333 m_rtcController.disableICECandidateFiltering ();2333 m_rtcController.disableICECandidateFilteringForAllOrigins(); 2334 2334 #endif 2335 2335 } -
trunk/Source/WebCore/testing/Internals.cpp
r226526 r226804 1317 1317 rtcController.enableICECandidateFiltering(); 1318 1318 else 1319 rtcController.disableICECandidateFiltering ();1319 rtcController.disableICECandidateFilteringForAllOrigins(); 1320 1320 } 1321 1321
Note: See TracChangeset
for help on using the changeset viewer.