Title: [250552] trunk
Revision
250552
Author
you...@apple.com
Date
2019-10-01 06:43:10 -0700 (Tue, 01 Oct 2019)

Log Message

Remove races condition when validating capture sandbox extension revocation
https://bugs.webkit.org/show_bug.cgi?id=202133
<rdar://problem/55660905>

Reviewed by Eric Carlson.

Source/WebCore:

Covered by existing tests.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::endCapture):
Synchronously update document media state when capture is ended.
This allows to validate the fact that no document is capturing while we revoke sandbox extensions.

Source/WebKit:

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
Explicitly ask the page to stop capture.
This will make sure capture is stopped when revoking sandbox extensions.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
Updated test to not use page cache so that on going back, the page is reloaded and will call getUserMedia again.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250551 => 250552)


--- trunk/Source/WebCore/ChangeLog	2019-10-01 09:41:10 UTC (rev 250551)
+++ trunk/Source/WebCore/ChangeLog	2019-10-01 13:43:10 UTC (rev 250552)
@@ -1,5 +1,20 @@
 2019-10-01  youenn fablet  <you...@apple.com>
 
+        Remove races condition when validating capture sandbox extension revocation
+        https://bugs.webkit.org/show_bug.cgi?id=202133
+        <rdar://problem/55660905>
+
+        Reviewed by Eric Carlson.
+
+        Covered by existing tests.
+
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::endCapture):
+        Synchronously update document media state when capture is ended.
+        This allows to validate the fact that no document is capturing while we revoke sandbox extensions.
+
+2019-10-01  youenn fablet  <you...@apple.com>
+
         MediaDevices should be SecureContext
         https://bugs.webkit.org/show_bug.cgi?id=202267
 

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (250551 => 250552)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2019-10-01 09:41:10 UTC (rev 250551)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2019-10-01 13:43:10 UTC (rev 250552)
@@ -485,11 +485,15 @@
 
 void MediaStreamTrack::endCapture(Document& document)
 {
+    bool didEndCapture = false;
     for (auto* captureTrack : allCaptureTracks()) {
         if (captureTrack->document() != &document)
             continue;
         captureTrack->stopTrack(MediaStreamTrack::StopMode::PostEvent);
+        didEndCapture = true;
     }
+    if (didEndCapture)
+        document.updateIsPlayingMedia();
 }
 
 void MediaStreamTrack::trackStarted(MediaStreamTrackPrivate&)

Modified: trunk/Source/WebKit/ChangeLog (250551 => 250552)


--- trunk/Source/WebKit/ChangeLog	2019-10-01 09:41:10 UTC (rev 250551)
+++ trunk/Source/WebKit/ChangeLog	2019-10-01 13:43:10 UTC (rev 250552)
@@ -1,3 +1,16 @@
+2019-10-01  youenn fablet  <you...@apple.com>
+
+        Remove races condition when validating capture sandbox extension revocation
+        https://bugs.webkit.org/show_bug.cgi?id=202133
+        <rdar://problem/55660905>
+
+        Reviewed by Eric Carlson.
+
+        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
+        (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
+        Explicitly ask the page to stop capture.
+        This will make sure capture is stopped when revoking sandbox extensions.
+
 2019-09-30  Alex Christensen  <achristen...@webkit.org>
 
         Resurrect Mac CMake build

Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (250551 => 250552)


--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2019-10-01 09:41:10 UTC (rev 250551)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2019-10-01 13:43:10 UTC (rev 250552)
@@ -83,6 +83,7 @@
 
 UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy()
 {
+    m_page.process().send(Messages::WebPage::StopMediaCapture { }, m_page.webPageID());
 #if ENABLE(MEDIA_STREAM)
     UserMediaProcessManager::singleton().revokeSandboxExtensionsIfNeeded(page().process());
     proxies().remove(this);

Modified: trunk/Tools/ChangeLog (250551 => 250552)


--- trunk/Tools/ChangeLog	2019-10-01 09:41:10 UTC (rev 250551)
+++ trunk/Tools/ChangeLog	2019-10-01 13:43:10 UTC (rev 250552)
@@ -1,3 +1,14 @@
+2019-10-01  youenn fablet  <you...@apple.com>
+
+        Remove races condition when validating capture sandbox extension revocation
+        https://bugs.webkit.org/show_bug.cgi?id=202133
+        <rdar://problem/55660905>
+
+        Reviewed by Eric Carlson.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+        Updated test to not use page cache so that on going back, the page is reloaded and will call getUserMedia again.
+
 2019-09-30  Alex Christensen  <achristen...@webkit.org>
 
         Resurrect Mac CMake build

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (250551 => 250552)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-10-01 09:41:10 UTC (rev 250551)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-10-01 13:43:10 UTC (rev 250552)
@@ -6119,6 +6119,7 @@
 TEST(ProcessSwap, GetUserMediaCaptureState)
 {
     auto processPoolConfiguration = psonProcessPoolConfiguration();
+    processPoolConfiguration.get().pageCacheEnabled = NO;
     auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
 
     auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to