Source/WebCore/ChangeLog

 12020-09-10 Chris Dumez <cdumez@apple.com>
 2
 3 AudioContext does not start rendering until an AudioNode is constructed
 4 https://bugs.webkit.org/show_bug.cgi?id=216393
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 AudioContext does not start rendering until an AudioNode is constructed. This is not as per specification
 9 and does not match Chrome's behavior.
 10
 11 Specification section is here:
 12 - https://www.w3.org/TR/webaudio/#dom-audiocontext-audiocontext
 13 and says
 14 "If the context is allowed to start, send a control message to start processing."
 15
 16 No new tests, rebaselined existing test.
 17
 18 * Modules/webaudio/BaseAudioContext.cpp:
 19 (WebCore::BaseAudioContext::BaseAudioContext):
 20 * dom/Document.cpp:
 21 (WebCore::Document::addMediaCanStartListener):
 22
1232020-09-10 Chris Dumez <cdumez@apple.com>
224
325 Unreviewed, reverting r266842 and r266883.

Source/WebCore/Modules/webaudio/BaseAudioContext.cpp

@@BaseAudioContext::BaseAudioContext(Document& document, const AudioContextOptions
139139
140140 document.addAudioProducer(*this);
141141 document.registerForVisibilityStateChangedCallbacks(*this);
 142
 143 // Unlike OfflineAudioContext, AudioContext does not require calling resume() to start rendering.
 144 // Lazy initialization is what starts rendering so we schedule a task here to make sure lazy
 145 // initialization ends up happening, even if no audio node gets constructed.
 146 postTask([this] {
 147 if (m_isStopScheduled)
 148 return;
 149
 150 lazyInitialize();
 151 });
142152}
143153
144154// Constructor for offline (non-realtime) rendering.

Source/WebCore/dom/Document.cpp

@@void Document::dispatchPopstateEvent(RefPtr<SerializedScriptValue>&& stateObject
65136513
65146514void Document::addMediaCanStartListener(MediaCanStartListener& listener)
65156515{
6516  ASSERT(!m_mediaCanStartListeners.contains(listener));
65176516 m_mediaCanStartListeners.add(listener);
65186517}
65196518

LayoutTests/imported/w3c/ChangeLog

 12020-09-10 Chris Dumez <cdumez@apple.com>
 2
 3 AudioContext does not start rendering until an AudioNode is constructed
 4 https://bugs.webkit.org/show_bug.cgi?id=216393
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Rebaseline test that is now passing.
 9
 10 * web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/constructor-allowed-to-start-expected.txt:
 11
1122020-09-10 Chris Dumez <cdumez@apple.com>
213
314 Unreviewed, reverting r266842 and r266883.

LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/constructor-allowed-to-start-expected.txt

11
2 Harness Error (TIMEOUT), message = null
3 
4 NOTRUN AudioContext state around "allowed to start" in constructor
 2PASS AudioContext state around "allowed to start" in constructor
53