Calling getUserMedia in a link that was opened with target="_blank" does not work...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 20:57:56 +0000 (20:57 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 20:57:56 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188088
<rdar://problem/42681448>

Reviewed by Eric Carlson.

On closing a page, we need to make sure to consider that the capture is ended,
as otherwise WebPageProxy will not get noticed from WebPage, since WebPageProxy is no longer an IPC receiver.

* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::endedCaptureSession):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238873 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/UserMediaProcessManager.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp

index 55dff1c..3a305c8 100644 (file)
@@ -1,3 +1,19 @@
+2018-12-04  Youenn Fablet  <youenn@apple.com>
+
+        Calling getUserMedia in a link that was opened with target="_blank" does not work the second time
+        https://bugs.webkit.org/show_bug.cgi?id=188088
+        <rdar://problem/42681448>
+
+        Reviewed by Eric Carlson.
+
+        On closing a page, we need to make sure to consider that the capture is ended,
+        as otherwise WebPageProxy will not get noticed from WebPage, since WebPageProxy is no longer an IPC receiver.
+
+        * UIProcess/UserMediaProcessManager.cpp:
+        (WebKit::UserMediaProcessManager::endedCaptureSession):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::close):
+
 2018-12-04  Chris Dumez  <cdumez@apple.com>
 
         Regression(r238817) PSON Page Cache API tests are failing
index 876f4bf..addb035 100644 (file)
@@ -224,6 +224,8 @@ void UserMediaProcessManager::endedCaptureSession(UserMediaPermissionRequestMana
     bool hasAudioCapture = false;
     bool hasVideoCapture = false;
     for (auto& manager : state.managers()) {
+        if (manager == &proxy)
+            continue;
         if (manager->page().hasActiveAudioStream())
             hasAudioCapture = true;
         if (manager->page().hasActiveVideoStream())
index 9aa054a..ac80a7b 100644 (file)
@@ -954,6 +954,10 @@ void WebPageProxy::close()
 
     m_isClosed = true;
 
+#if ENABLE(MEDIA_STREAM)
+    m_userMediaPermissionRequestManager = nullptr;
+#endif
+
     reportPageLoadResult(ResourceError { ResourceError::Type::Cancellation });
 
     if (m_activePopupMenu)