Title: [293249] branches/safari-613.2.7.0-branch/Source/WebCore
Revision
293249
Author
[email protected]
Date
2022-04-22 13:43:38 -0700 (Fri, 22 Apr 2022)

Log Message

Cherry-pick r292878. rdar://problem/90248865

    ScriptDisallowedScope::isEventAllowedInMainThread assert failure when activating AudioSession
    https://bugs.webkit.org/show_bug.cgi?id=239343

    Reviewed by Eric Carlson.

    As part of HTMLMediaElement::clearMediaPlayer we call PlatformMediaSession::canProduceAudioChanged
    which can result in activating the AudioSession when the page is capturing audio.

    This sends a synchronous IPC message to the GPU process. As part of IPC::Connection::waitForSyncReply,
    we also end up  dispatching enqueued messages, including a WebPage_EndPrinting message that
    fires an event listener on the main thread.

    This patch will instead queue the PlatformMediaSession::canProduceAudioChanged as a task to avoid
    firing the event listener on the main thread, which results in assertion failure.

    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::clearMediaPlayer):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292878 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613.2.7.0-branch/Source/WebCore/ChangeLog (293248 => 293249)


--- branches/safari-613.2.7.0-branch/Source/WebCore/ChangeLog	2022-04-22 20:39:17 UTC (rev 293248)
+++ branches/safari-613.2.7.0-branch/Source/WebCore/ChangeLog	2022-04-22 20:43:38 UTC (rev 293249)
@@ -1,3 +1,48 @@
+2022-04-22  Alan Coon  <[email protected]>
+
+        Cherry-pick r292878. rdar://problem/90248865
+
+    ScriptDisallowedScope::isEventAllowedInMainThread assert failure when activating AudioSession
+    https://bugs.webkit.org/show_bug.cgi?id=239343
+    
+    Reviewed by Eric Carlson.
+    
+    As part of HTMLMediaElement::clearMediaPlayer we call PlatformMediaSession::canProduceAudioChanged
+    which can result in activating the AudioSession when the page is capturing audio.
+    
+    This sends a synchronous IPC message to the GPU process. As part of IPC::Connection::waitForSyncReply,
+    we also end up  dispatching enqueued messages, including a WebPage_EndPrinting message that
+    fires an event listener on the main thread.
+    
+    This patch will instead queue the PlatformMediaSession::canProduceAudioChanged as a task to avoid
+    firing the event listener on the main thread, which results in assertion failure.
+    
+    * html/HTMLMediaElement.cpp:
+    (WebCore::HTMLMediaElement::clearMediaPlayer):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-04-14  Gabriel Nava Marino  <[email protected]>
+
+            ScriptDisallowedScope::isEventAllowedInMainThread assert failure when activating AudioSession
+            https://bugs.webkit.org/show_bug.cgi?id=239343
+
+            Reviewed by Eric Carlson.
+
+            As part of HTMLMediaElement::clearMediaPlayer we call PlatformMediaSession::canProduceAudioChanged
+            which can result in activating the AudioSession when the page is capturing audio.
+
+            This sends a synchronous IPC message to the GPU process. As part of IPC::Connection::waitForSyncReply,
+            we also end up  dispatching enqueued messages, including a WebPage_EndPrinting message that
+            fires an event listener on the main thread.
+
+            This patch will instead queue the PlatformMediaSession::canProduceAudioChanged as a task to avoid
+            firing the event listener on the main thread, which results in assertion failure.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::clearMediaPlayer):
+
 2022-04-21  Alan Coon  <[email protected]>
 
         Cherry-pick r292095. rdar://problem/90240658

Modified: branches/safari-613.2.7.0-branch/Source/WebCore/html/HTMLMediaElement.cpp (293248 => 293249)


--- branches/safari-613.2.7.0-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-22 20:39:17 UTC (rev 293248)
+++ branches/safari-613.2.7.0-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-22 20:43:38 UTC (rev 293249)
@@ -5886,10 +5886,12 @@
     if (m_textTracks)
         configureTextTrackDisplay();
 
-    if (m_mediaSession) {
-        m_mediaSession->clientCharacteristicsChanged();
-        m_mediaSession->canProduceAudioChanged();
-    }
+    queueTaskKeepingObjectAlive(*this, TaskSource::MediaElement, [this] {
+        if (m_mediaSession) {
+            m_mediaSession->clientCharacteristicsChanged();
+            m_mediaSession->canProduceAudioChanged();
+        }
+    });
 
     m_resourceSelectionTaskCancellationGroup.cancel();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to