Title: [292878] trunk/Source/WebCore
- Revision
- 292878
- Author
- [email protected]
- Date
- 2022-04-14 10:46:32 -0700 (Thu, 14 Apr 2022)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (292877 => 292878)
--- trunk/Source/WebCore/ChangeLog 2022-04-14 17:26:29 UTC (rev 292877)
+++ trunk/Source/WebCore/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
@@ -1,3 +1,23 @@
+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-14 Chris Dumez <[email protected]>
Update ContainerNode::getElementsByName() to take in an AtomString
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (292877 => 292878)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2022-04-14 17:26:29 UTC (rev 292877)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2022-04-14 17:46:32 UTC (rev 292878)
@@ -5913,10 +5913,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