Bug 64525

Summary: MediaStream API: Release script objects when detaching document
Product: WebKit Reporter: Henrik Grunell <grunell>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: donggwan.kim, tommyw, tonyg, wjjeon
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 56459    
Attachments:
Description Flags
Patch tonyg: review-

Description Henrik Grunell 2011-07-14 05:54:40 PDT
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).
Comment 1 Henrik Grunell 2011-07-15 01:08:40 PDT
Created attachment 100945 [details]
Patch
Comment 2 Tony Gentilcore 2011-07-15 02:32:23 PDT
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 3 John Knottenbelt 2011-07-15 05:44:18 PDT
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.
Comment 4 Henrik Grunell 2011-09-15 23:59:22 PDT
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 ***