Title: [245889] trunk/Source/WebCore
Revision
245889
Author
jer.no...@apple.com
Date
2019-05-30 09:49:29 -0700 (Thu, 30 May 2019)

Log Message

ASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudioDidChange()
https://bugs.webkit.org/show_bug.cgi?id=181597
<rdar://problem/36474088>

Reviewed by Eric Carlson.

Because document() is usually null-checked before using (and we can add null-checks where missing),
there's no good reason to debug-assert that m_scriptExecutionContext is non-null before downcast<>ing
to Document*.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon):
(WebCore::AudioContext::stop):
(WebCore::AudioContext::document const):
(WebCore::AudioContext::visibilityStateChanged):
(WebCore::AudioContext::willBeginPlayback):
(WebCore::AudioContext::willPausePlayback):
(WebCore::AudioContext::pageMutedStateDidChange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (245888 => 245889)


--- trunk/Source/WebCore/ChangeLog	2019-05-30 16:36:44 UTC (rev 245888)
+++ trunk/Source/WebCore/ChangeLog	2019-05-30 16:49:29 UTC (rev 245889)
@@ -1,5 +1,26 @@
 2019-05-30  Jer Noble  <jer.no...@apple.com>
 
+        ASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudioDidChange()
+        https://bugs.webkit.org/show_bug.cgi?id=181597
+        <rdar://problem/36474088>
+
+        Reviewed by Eric Carlson.
+
+        Because document() is usually null-checked before using (and we can add null-checks where missing),
+        there's no good reason to debug-assert that m_scriptExecutionContext is non-null before downcast<>ing
+        to Document*.
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::constructCommon):
+        (WebCore::AudioContext::stop):
+        (WebCore::AudioContext::document const):
+        (WebCore::AudioContext::visibilityStateChanged):
+        (WebCore::AudioContext::willBeginPlayback):
+        (WebCore::AudioContext::willPausePlayback):
+        (WebCore::AudioContext::pageMutedStateDidChange):
+
+2019-05-30  Jer Noble  <jer.no...@apple.com>
+
         Video playback in Safari should continue when CarPlay is plugged in
         https://bugs.webkit.org/show_bug.cgi?id=198345
         <rdar://problem/45505750>

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (245888 => 245889)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2019-05-30 16:36:44 UTC (rev 245888)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2019-05-30 16:49:29 UTC (rev 245889)
@@ -107,7 +107,7 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(AudioContext);
 
-#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(document()->page() && document()->page()->isAlwaysOnLoggingAllowed(), Media, "%p - AudioContext::" fmt, this, ##__VA_ARGS__)
+#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(document() && document()->page() && document()->page()->isAlwaysOnLoggingAllowed(), Media, "%p - AudioContext::" fmt, this, ##__VA_ARGS__)
     
 bool AudioContext::isSampleRateRangeGood(float sampleRate)
 {
@@ -180,6 +180,7 @@
     
     m_listener = AudioListener::create();
 
+    ASSERT(document());
     if (document()->audioPlaybackRequiresUserGesture())
         addBehaviorRestriction(RequireUserGestureForAudioStartRestriction);
     else
@@ -329,6 +330,7 @@
         return;
     m_isStopScheduled = true;
 
+    ASSERT(document());
     document()->updateIsPlayingMedia();
 
     m_eventQueue->close();
@@ -350,7 +352,6 @@
 
 Document* AudioContext::document() const
 {
-    ASSERT(m_scriptExecutionContext);
     return downcast<Document>(m_scriptExecutionContext);
 }
 
@@ -382,7 +383,7 @@
 void AudioContext::visibilityStateChanged()
 {
     // Do not suspend if audio is audible.
-    if (mediaState() == MediaProducer::IsPlayingAudio || m_isStopScheduled)
+    if (!document() || mediaState() == MediaProducer::IsPlayingAudio || m_isStopScheduled)
         return;
 
     if (document()->hidden()) {
@@ -1083,6 +1084,9 @@
 
 bool AudioContext::willBeginPlayback()
 {
+    if (!document())
+        return false;
+
     if (userGestureRequiredForAudioStart()) {
         if (!processingUserGestureForMedia() && !document()->isCapturing()) {
             ALWAYS_LOG(LOGIDENTIFIER, "returning false, not processing user gesture or capturing");
@@ -1109,6 +1113,9 @@
 
 bool AudioContext::willPausePlayback()
 {
+    if (!document())
+        return false;
+
     if (userGestureRequiredForAudioStart()) {
         if (!processingUserGestureForMedia())
             return false;
@@ -1154,7 +1161,7 @@
 
 void AudioContext::pageMutedStateDidChange()
 {
-    if (m_destinationNode && document()->page())
+    if (m_destinationNode && document() && document()->page())
         m_destinationNode->setMuted(document()->page()->isAudioMuted());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to