MediaDevices should be collectable as soon as its document is stopped
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2018 20:53:17 +0000 (20:53 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2018 20:53:17 +0000 (20:53 +0000)
commit63c96f7c40410470c7001dea3c89b16dfda36fc9
tree3dc0334b08a53baf6213c3225fb5a7a336bfa3be
parent84c0830d079e831b34ebfe658041d3328276fdd3
MediaDevices should be collectable as soon as its document is stopped
https://bugs.webkit.org/show_bug.cgi?id=189021

Reviewed by Eric Carlson.

Source/WebCore:

Introduce ActiveDOMObject::isContextStopped to check whether the context is stopped.
Use this check in MediaDevices::hasPendingActivity so that it returns false as soon as active dom objects are stopped.

Test: http/tests/media/collect-media-devices.https.html

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::hasPendingActivity const):
* dom/ActiveDOMObject.cpp:
(WebCore::ActiveDOMObject::hasPendingActivity const):
(WebCore::ActiveDOMObject::isContextStopped const):
* dom/ActiveDOMObject.h:

LayoutTests:

* http/tests/media/media-stream/collect-media-devices.https-expected.txt: Added.
* http/tests/media/media-stream/collect-media-devices.https.html: Added.
* http/tests/media/media-stream/resources/mymediadevicesframe.htm: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaDevices.cpp
Source/WebCore/dom/ActiveDOMObject.cpp
Source/WebCore/dom/ActiveDOMObject.h