You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crash when accessing OfflineAudioContext.length after failing to construct rendering AudioBuffer
https://bugs.webkit.org/show_bug.cgi?id=218754
<rdar://problem/71186978>
Reviewed by Eric Carlson.
Source/WebCore:
OfflineAudioContext.length should return the length passed to the constructor, even if we
failed to construct the internal AudioBuffer (and obviously we should not crash). This
matches the behavior of Firefox and Chrome.
I have also added a console message when we fail to construct the internal rendering
AudioBuffer, for clarity.
Test: webaudio/OfflineAudioContext/bad-buffer-length.html
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::OfflineAudioContext):
(WebCore::OfflineAudioContext::create):
* Modules/webaudio/OfflineAudioContext.h:
LayoutTests:
Add layout test coverage and rebaseline a couple of tests now that a console message is logged.
* webaudio/OfflineAudioContext-bad-buffer-crash-expected.txt:
* webaudio/OfflineAudioContext/bad-buffer-length-expected.txt: Added.
* webaudio/OfflineAudioContext/bad-buffer-length.html: Added.
* webaudio/dom-exceptions-expected.txt:
Canonical link: https://commits.webkit.org/231422@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
return Exception { SyntaxError, "sampleRate is not in range"_s };
56
57
57
58
auto renderTarget = AudioBuffer::create(numberOfChannels, length, sampleRate);
58
-
auto audioContext = adoptRef(*newOfflineAudioContext(downcast<Document>(context), numberOfChannels, sampleRate, WTFMove(renderTarget)));
59
+
if (!renderTarget)
60
+
context.addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("Failed to construct internal AudioBuffer with ", numberOfChannels, " channel(s), a sample rate of ", sampleRate, " and a length of ", length, "."));
61
+
62
+
auto audioContext = adoptRef(*newOfflineAudioContext(downcast<Document>(context), numberOfChannels, length, sampleRate, WTFMove(renderTarget)));
0 commit comments