Title: [235438] trunk
Revision
235438
Author
you...@apple.com
Date
2018-08-28 13:53:17 -0700 (Tue, 28 Aug 2018)

Log Message

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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235437 => 235438)


--- trunk/LayoutTests/ChangeLog	2018-08-28 20:50:19 UTC (rev 235437)
+++ trunk/LayoutTests/ChangeLog	2018-08-28 20:53:17 UTC (rev 235438)
@@ -1,3 +1,14 @@
+2018-08-28  Youenn Fablet  <you...@apple.com>
+
+        MediaDevices should be collectable as soon as its document is stopped
+        https://bugs.webkit.org/show_bug.cgi?id=189021
+
+        Reviewed by Eric Carlson.
+
+        * 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.
+
 2018-08-28  Basuke Suzuki  <basuke.suz...@sony.com>
 
         [Curl] Fix issue that extra cookie is added when redirect happens.

Modified: trunk/Source/WebCore/ChangeLog (235437 => 235438)


--- trunk/Source/WebCore/ChangeLog	2018-08-28 20:50:19 UTC (rev 235437)
+++ trunk/Source/WebCore/ChangeLog	2018-08-28 20:53:17 UTC (rev 235438)
@@ -1,3 +1,22 @@
+2018-08-28  Youenn Fablet  <you...@apple.com>
+
+        MediaDevices should be collectable as soon as its document is stopped
+        https://bugs.webkit.org/show_bug.cgi?id=189021
+
+        Reviewed by Eric Carlson.
+
+        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:
+
 2018-08-28  Basuke Suzuki  <basuke.suz...@sony.com>
 
         [Curl] Fix issue that extra cookie is added when redirect happens.

Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp (235437 => 235438)


--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp	2018-08-28 20:50:19 UTC (rev 235437)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp	2018-08-28 20:53:17 UTC (rev 235438)
@@ -162,7 +162,7 @@
 
 bool MediaDevices::hasPendingActivity() const
 {
-    return scriptExecutionContext() && hasEventListeners(m_eventNames.devicechangeEvent);
+    return !isContextStopped() && hasEventListeners(m_eventNames.devicechangeEvent);
 }
 
 const char* MediaDevices::activeDOMObjectName() const

Modified: trunk/Source/WebCore/dom/ActiveDOMObject.cpp (235437 => 235438)


--- trunk/Source/WebCore/dom/ActiveDOMObject.cpp	2018-08-28 20:50:19 UTC (rev 235437)
+++ trunk/Source/WebCore/dom/ActiveDOMObject.cpp	2018-08-28 20:53:17 UTC (rev 235438)
@@ -106,4 +106,9 @@
 {
 }
 
+bool ActiveDOMObject::isContextStopped() const
+{
+    return !scriptExecutionContext() || scriptExecutionContext()->activeDOMObjectsAreStopped();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/ActiveDOMObject.h (235437 => 235438)


--- trunk/Source/WebCore/dom/ActiveDOMObject.h	2018-08-28 20:50:19 UTC (rev 235437)
+++ trunk/Source/WebCore/dom/ActiveDOMObject.h	2018-08-28 20:53:17 UTC (rev 235438)
@@ -110,6 +110,8 @@
         return adoptRef(*new PendingActivity<T>(thisObject));
     }
 
+    bool isContextStopped() const;
+
 protected:
     explicit ActiveDOMObject(ScriptExecutionContext*);
     virtual ~ActiveDOMObject();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to