Skip to content

Commit fe81a72

Browse files
committed
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. Canonical link: https://commits.webkit.org/204092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 8f34bcf commit fe81a72

5 files changed

Lines changed: 38 additions & 1 deletion

File tree

LayoutTests/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2018-08-28 Youenn Fablet <youenn@apple.com>
2+
3+
MediaDevices should be collectable as soon as its document is stopped
4+
https://bugs.webkit.org/show_bug.cgi?id=189021
5+
6+
Reviewed by Eric Carlson.
7+
8+
* http/tests/media/media-stream/collect-media-devices.https-expected.txt: Added.
9+
* http/tests/media/media-stream/collect-media-devices.https.html: Added.
10+
* http/tests/media/media-stream/resources/mymediadevicesframe.htm: Added.
11+
112
2018-08-28 Basuke Suzuki <Basuke.Suzuki@sony.com>
213

314
[Curl] Fix issue that extra cookie is added when redirect happens.

Source/WebCore/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2018-08-28 Youenn Fablet <youenn@apple.com>
2+
3+
MediaDevices should be collectable as soon as its document is stopped
4+
https://bugs.webkit.org/show_bug.cgi?id=189021
5+
6+
Reviewed by Eric Carlson.
7+
8+
Introduce ActiveDOMObject::isContextStopped to check whether the context is stopped.
9+
Use this check in MediaDevices::hasPendingActivity so that it returns false as soon as active dom objects are stopped.
10+
11+
Test: http/tests/media/collect-media-devices.https.html
12+
13+
* Modules/mediastream/MediaDevices.cpp:
14+
(WebCore::MediaDevices::hasPendingActivity const):
15+
* dom/ActiveDOMObject.cpp:
16+
(WebCore::ActiveDOMObject::hasPendingActivity const):
17+
(WebCore::ActiveDOMObject::isContextStopped const):
18+
* dom/ActiveDOMObject.h:
19+
120
2018-08-28 Basuke Suzuki <Basuke.Suzuki@sony.com>
221

322
[Curl] Fix issue that extra cookie is added when redirect happens.

Source/WebCore/Modules/mediastream/MediaDevices.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void MediaDevices::scheduledEventTimerFired()
162162

163163
bool MediaDevices::hasPendingActivity() const
164164
{
165-
return scriptExecutionContext() && hasEventListeners(m_eventNames.devicechangeEvent);
165+
return !isContextStopped() && hasEventListeners(m_eventNames.devicechangeEvent);
166166
}
167167

168168
const char* MediaDevices::activeDOMObjectName() const

Source/WebCore/dom/ActiveDOMObject.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,9 @@ void ActiveDOMObject::stop()
106106
{
107107
}
108108

109+
bool ActiveDOMObject::isContextStopped() const
110+
{
111+
return !scriptExecutionContext() || scriptExecutionContext()->activeDOMObjectsAreStopped();
112+
}
113+
109114
} // namespace WebCore

Source/WebCore/dom/ActiveDOMObject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ class ActiveDOMObject : public ContextDestructionObserver {
110110
return adoptRef(*new PendingActivity<T>(thisObject));
111111
}
112112

113+
bool isContextStopped() const;
114+
113115
protected:
114116
explicit ActiveDOMObject(ScriptExecutionContext*);
115117
virtual ~ActiveDOMObject();

0 commit comments

Comments
 (0)