We need to release the clients held by MediaStreamFrameController when a document is detached since they are not valid for the new document. A specific problem that this solves: a LocalMediaStream object should stop [it's generation of media] when a web page is reloaded. This is not the case today, meaning that a camera capture device will be blocked until the garbage collector has deleted the old document (which would in turn delete and stop the MediaStream objects).
Created attachment 100945 [details] Patch
Comment on attachment 100945 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=100945&action=review r- for lack of test > Source/WebCore/ChangeLog:10 > + No new tests because the patch is just a bug fix. In WebKit, fixing a bug is usually a great reason to add a test. This is the sort of edge case that could easily break during future refactoring, so please add a test so we don't regress here. > Source/WebCore/dom/Document.cpp:1778 > + if (mediaStreamFrameController) If you prefer, a common idiom in WebKit is: if (MediaStreamFrameController* mediaStreamFrameController = m_frame->mediaStreamFrameController()) mediaStreamFrameController->clearAllClients();
Comment on attachment 100945 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=100945&action=review >> Source/WebCore/ChangeLog:10 >> + No new tests because the patch is just a bug fix. > > In WebKit, fixing a bug is usually a great reason to add a test. This is the sort of edge case that could easily break during future refactoring, so please add a test so we don't regress here. Check out LayoutTests/fast/dom/Geolocation/page-reload-cancel-permission-requests.html for a possible way to do a test involving a reload.
The MediaStream object handling will be rewritten in bug 68171, and that change shall ensure that the issue described in this bug is resolved. *** This bug has been marked as a duplicate of bug 68171 ***