- Revision
- 266791
- Author
- [email protected]
- Date
- 2020-09-09 11:23:23 -0700 (Wed, 09 Sep 2020)
Log Message
Cherry-pick r266616. rdar://problem/68584190
REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken
https://bugs.webkit.org/show_bug.cgi?id=216163
<rdar://problem/68198173>
Reviewed by Eric Carlson.
Source/WebCore:
Address a crash and a backward-compatibility issue on https://magenta.github.io/lofi-player/.
Test: webaudio/webkitofflineaudiocontext-startRendering-crash.html
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioListener.idl:
* Modules/webaudio/OscillatorNode.idl:
Even after fixing the crash, the game would fail to load because it expected
window.OscillatorNode to exist. When we started working on modern Web Audio,
we renamed the non-standard oscillator node to WebKitOscillatorNode and
added a new standards compliant OscillatorNode behind a runtime flag (off
by default). As a result, window.OscillatorNode no longer existed on Big Sur,
which is not backward compatible. To address the issue, we now expose
window.OscillatorNode even if modern unprefixed WebAudio is not enabled and
we merely disable its constructor at runtime. The same policy applies to
AudioBufferSourceNode & AudioListener because we did the exact same thing
for these interfaces.
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::startRendering):
Make sure we call lazyInitialize() before we start offline rendering.
The context may not be initialized yet if no audio nodes were created
for this context. This is similar to what is done in our modern Web
Audio code in OfflineAudioContext::startOfflineRendering(), which is
why the crash was not reproducible when enabling the Modern Web Audio
experimental feature.
LayoutTests:
Add layout test that was reproducing the crash on https://magenta.github.io/lofi-player/.
* webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt: Added.
* webaudio/webkitofflineaudiocontext-startRendering-crash.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266616 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-610-branch/LayoutTests/ChangeLog (266790 => 266791)
--- branches/safari-610-branch/LayoutTests/ChangeLog 2020-09-09 18:21:54 UTC (rev 266790)
+++ branches/safari-610-branch/LayoutTests/ChangeLog 2020-09-09 18:23:23 UTC (rev 266791)
@@ -1,3 +1,65 @@
+2020-09-09 Alan Coon <[email protected]>
+
+ Cherry-pick r266616. rdar://problem/68584190
+
+ REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken
+ https://bugs.webkit.org/show_bug.cgi?id=216163
+ <rdar://problem/68198173>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Address a crash and a backward-compatibility issue on https://magenta.github.io/lofi-player/.
+
+ Test: webaudio/webkitofflineaudiocontext-startRendering-crash.html
+
+ * Modules/webaudio/AudioBufferSourceNode.idl:
+ * Modules/webaudio/AudioListener.idl:
+ * Modules/webaudio/OscillatorNode.idl:
+ Even after fixing the crash, the game would fail to load because it expected
+ window.OscillatorNode to exist. When we started working on modern Web Audio,
+ we renamed the non-standard oscillator node to WebKitOscillatorNode and
+ added a new standards compliant OscillatorNode behind a runtime flag (off
+ by default). As a result, window.OscillatorNode no longer existed on Big Sur,
+ which is not backward compatible. To address the issue, we now expose
+ window.OscillatorNode even if modern unprefixed WebAudio is not enabled and
+ we merely disable its constructor at runtime. The same policy applies to
+ AudioBufferSourceNode & AudioListener because we did the exact same thing
+ for these interfaces.
+
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::startRendering):
+ Make sure we call lazyInitialize() before we start offline rendering.
+ The context may not be initialized yet if no audio nodes were created
+ for this context. This is similar to what is done in our modern Web
+ Audio code in OfflineAudioContext::startOfflineRendering(), which is
+ why the crash was not reproducible when enabling the Modern Web Audio
+ experimental feature.
+
+ LayoutTests:
+
+ Add layout test that was reproducing the crash on https://magenta.github.io/lofi-player/.
+
+ * webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt: Added.
+ * webaudio/webkitofflineaudiocontext-startRendering-crash.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266616 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-04 Chris Dumez <[email protected]>
+
+ REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken
+ https://bugs.webkit.org/show_bug.cgi?id=216163
+ <rdar://problem/68198173>
+
+ Reviewed by Eric Carlson.
+
+ Add layout test that was reproducing the crash on https://magenta.github.io/lofi-player/.
+
+ * webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt: Added.
+ * webaudio/webkitofflineaudiocontext-startRendering-crash.html: Added.
+
2020-09-03 Alan Coon <[email protected]>
Cherry-pick r266156. rdar://problem/68168945
Added: branches/safari-610-branch/LayoutTests/webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt (0 => 266791)
--- branches/safari-610-branch/LayoutTests/webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt (rev 0)
+++ branches/safari-610-branch/LayoutTests/webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt 2020-09-09 18:23:23 UTC (rev 266791)
@@ -0,0 +1,10 @@
+Checks that starting rendering on a webkitOfflineAudioContext that has no nodes does not crash.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Finished rendering
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-610-branch/LayoutTests/webaudio/webkitofflineaudiocontext-startRendering-crash.html (0 => 266791)
--- branches/safari-610-branch/LayoutTests/webaudio/webkitofflineaudiocontext-startRendering-crash.html (rev 0)
+++ branches/safari-610-branch/LayoutTests/webaudio/webkitofflineaudiocontext-startRendering-crash.html 2020-09-09 18:23:23 UTC (rev 266791)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Checks that starting rendering on a webkitOfflineAudioContext that has no nodes does not crash.");
+jsTestIsAsync = true;
+
+let context = new webkitOfflineAudioContext(1, 128, 44100);
+context._oncomplete_ = () => {
+ testPassed("Finished rendering");
+ finishJSTest();
+};
+context.startRendering();
+</script>
+</body>
+</html>
Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (266790 => 266791)
--- branches/safari-610-branch/Source/WebCore/ChangeLog 2020-09-09 18:21:54 UTC (rev 266790)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog 2020-09-09 18:23:23 UTC (rev 266791)
@@ -1,3 +1,87 @@
+2020-09-09 Alan Coon <[email protected]>
+
+ Cherry-pick r266616. rdar://problem/68584190
+
+ REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken
+ https://bugs.webkit.org/show_bug.cgi?id=216163
+ <rdar://problem/68198173>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Address a crash and a backward-compatibility issue on https://magenta.github.io/lofi-player/.
+
+ Test: webaudio/webkitofflineaudiocontext-startRendering-crash.html
+
+ * Modules/webaudio/AudioBufferSourceNode.idl:
+ * Modules/webaudio/AudioListener.idl:
+ * Modules/webaudio/OscillatorNode.idl:
+ Even after fixing the crash, the game would fail to load because it expected
+ window.OscillatorNode to exist. When we started working on modern Web Audio,
+ we renamed the non-standard oscillator node to WebKitOscillatorNode and
+ added a new standards compliant OscillatorNode behind a runtime flag (off
+ by default). As a result, window.OscillatorNode no longer existed on Big Sur,
+ which is not backward compatible. To address the issue, we now expose
+ window.OscillatorNode even if modern unprefixed WebAudio is not enabled and
+ we merely disable its constructor at runtime. The same policy applies to
+ AudioBufferSourceNode & AudioListener because we did the exact same thing
+ for these interfaces.
+
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::startRendering):
+ Make sure we call lazyInitialize() before we start offline rendering.
+ The context may not be initialized yet if no audio nodes were created
+ for this context. This is similar to what is done in our modern Web
+ Audio code in OfflineAudioContext::startOfflineRendering(), which is
+ why the crash was not reproducible when enabling the Modern Web Audio
+ experimental feature.
+
+ LayoutTests:
+
+ Add layout test that was reproducing the crash on https://magenta.github.io/lofi-player/.
+
+ * webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt: Added.
+ * webaudio/webkitofflineaudiocontext-startRendering-crash.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266616 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-04 Chris Dumez <[email protected]>
+
+ REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken
+ https://bugs.webkit.org/show_bug.cgi?id=216163
+ <rdar://problem/68198173>
+
+ Reviewed by Eric Carlson.
+
+ Address a crash and a backward-compatibility issue on https://magenta.github.io/lofi-player/.
+
+ Test: webaudio/webkitofflineaudiocontext-startRendering-crash.html
+
+ * Modules/webaudio/AudioBufferSourceNode.idl:
+ * Modules/webaudio/AudioListener.idl:
+ * Modules/webaudio/OscillatorNode.idl:
+ Even after fixing the crash, the game would fail to load because it expected
+ window.OscillatorNode to exist. When we started working on modern Web Audio,
+ we renamed the non-standard oscillator node to WebKitOscillatorNode and
+ added a new standards compliant OscillatorNode behind a runtime flag (off
+ by default). As a result, window.OscillatorNode no longer existed on Big Sur,
+ which is not backward compatible. To address the issue, we now expose
+ window.OscillatorNode even if modern unprefixed WebAudio is not enabled and
+ we merely disable its constructor at runtime. The same policy applies to
+ AudioBufferSourceNode & AudioListener because we did the exact same thing
+ for these interfaces.
+
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::startRendering):
+ Make sure we call lazyInitialize() before we start offline rendering.
+ The context may not be initialized yet if no audio nodes were created
+ for this context. This is similar to what is done in our modern Web
+ Audio code in OfflineAudioContext::startOfflineRendering(), which is
+ why the crash was not reproducible when enabling the Modern Web Audio
+ experimental feature.
+
2020-09-03 Alan Coon <[email protected]>
Cherry-pick r266265. rdar://problem/68168939
Modified: branches/safari-610-branch/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl (266790 => 266791)
--- branches/safari-610-branch/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl 2020-09-09 18:21:54 UTC (rev 266790)
+++ branches/safari-610-branch/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl 2020-09-09 18:23:23 UTC (rev 266791)
@@ -27,9 +27,8 @@
[
Conditional=WEB_AUDIO,
JSGenerateToJSObject,
- EnabledBySetting=ModernUnprefixedWebAudio
] interface AudioBufferSourceNode : AudioScheduledSourceNode {
- [MayThrowException] constructor (BaseAudioContext context, optional AudioBufferSourceOptions options);
+ [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional AudioBufferSourceOptions options);
attribute AudioBuffer? buffer;
Modified: branches/safari-610-branch/Source/WebCore/Modules/webaudio/AudioListener.idl (266790 => 266791)
--- branches/safari-610-branch/Source/WebCore/Modules/webaudio/AudioListener.idl 2020-09-09 18:21:54 UTC (rev 266790)
+++ branches/safari-610-branch/Source/WebCore/Modules/webaudio/AudioListener.idl 2020-09-09 18:23:23 UTC (rev 266791)
@@ -29,7 +29,6 @@
[
Conditional=WEB_AUDIO,
- EnabledBySetting=ModernUnprefixedWebAudio,
] interface AudioListener {
readonly attribute AudioParam positionX;
readonly attribute AudioParam positionY;
Modified: branches/safari-610-branch/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (266790 => 266791)
--- branches/safari-610-branch/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-09-09 18:21:54 UTC (rev 266790)
+++ branches/safari-610-branch/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-09-09 18:23:23 UTC (rev 266791)
@@ -211,7 +211,7 @@
if (m_destinationNode) {
m_destinationNode->initialize();
- if (!isOfflineContext()) {
+ if (!isOfflineContext() && state() != State::Running) {
// This starts the audio thread. The destination node's provideInput() method will now be called repeatedly to render audio.
// Each time provideInput() is called, a portion of the audio stream is rendered. Let's call this time period a "render quantum".
// NOTE: for now default AudioContext does not need an explicit startRendering() call from _javascript_.
@@ -1056,8 +1056,10 @@
makePendingActivity();
+ setState(State::Running);
+
+ lazyInitialize();
destination()->startRendering();
- setState(State::Running);
}
void BaseAudioContext::mediaCanStart(Document& document)
Modified: branches/safari-610-branch/Source/WebCore/Modules/webaudio/OscillatorNode.idl (266790 => 266791)
--- branches/safari-610-branch/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2020-09-09 18:21:54 UTC (rev 266790)
+++ branches/safari-610-branch/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2020-09-09 18:23:23 UTC (rev 266791)
@@ -27,9 +27,8 @@
Conditional=WEB_AUDIO,
JSGenerateToJSObject,
ActiveDOMObject,
- EnabledBySetting=WebAudio&ModernUnprefixedWebAudio
] interface OscillatorNode : AudioScheduledSourceNode {
- [MayThrowException] constructor (BaseAudioContext context, optional OscillatorOptions options);
+ [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional OscillatorOptions options);
attribute OscillatorType type;