Title: [268999] trunk
- Revision
- 268999
- Author
- [email protected]
- Date
- 2020-10-26 16:09:16 -0700 (Mon, 26 Oct 2020)
Log Message
Improve exception messages when AudioContext.suspend() / resume() promises are rejected
https://bugs.webkit.org/show_bug.cgi?id=218210
Reviewed by Geoffrey Garen.
Source/WebCore:
Improve exception messages when AudioContext.suspend() / resume() promises are rejected.
No new tests, rebaselined existing tests.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::suspendRendering):
(WebCore::AudioContext::resumeRendering):
LayoutTests:
* webaudio/audiocontext-state.html:
Stop expecting that the resume() promise is rejected without any exception.
This is not standard behavior and does not match the behavior of other
browsers either.
* webaudio/construct-node-with-closed-context-expected.txt:
Rebaseline test now that exception messages have been improved.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (268998 => 268999)
--- trunk/LayoutTests/ChangeLog 2020-10-26 22:11:47 UTC (rev 268998)
+++ trunk/LayoutTests/ChangeLog 2020-10-26 23:09:16 UTC (rev 268999)
@@ -1,3 +1,18 @@
+2020-10-26 Chris Dumez <[email protected]>
+
+ Improve exception messages when AudioContext.suspend() / resume() promises are rejected
+ https://bugs.webkit.org/show_bug.cgi?id=218210
+
+ Reviewed by Geoffrey Garen.
+
+ * webaudio/audiocontext-state.html:
+ Stop expecting that the resume() promise is rejected without any exception.
+ This is not standard behavior and does not match the behavior of other
+ browsers either.
+
+ * webaudio/construct-node-with-closed-context-expected.txt:
+ Rebaseline test now that exception messages have been improved.
+
2020-10-26 Truitt Savell <[email protected]>
Unreviewed, reverting r268947.
Modified: trunk/LayoutTests/webaudio/audiocontext-state.html (268998 => 268999)
--- trunk/LayoutTests/webaudio/audiocontext-state.html 2020-10-26 22:11:47 UTC (rev 268998)
+++ trunk/LayoutTests/webaudio/audiocontext-state.html 2020-10-26 23:09:16 UTC (rev 268999)
@@ -93,8 +93,6 @@
function resumeFailedCorrectly(value) {
testPassed('context.resume() promise rejected (correctly)');
- if (typeof value != 'undefined')
- testFailed('No value should be passed to the context.resume() promise rejected callback');
shouldBe('context.state', '"closed"');
debug('Calling context.suspend() (should fail)');
Modified: trunk/LayoutTests/webaudio/construct-node-with-closed-context-expected.txt (268998 => 268999)
--- trunk/LayoutTests/webaudio/construct-node-with-closed-context-expected.txt 2020-10-26 22:11:47 UTC (rev 268998)
+++ trunk/LayoutTests/webaudio/construct-node-with-closed-context-expected.txt 2020-10-26 23:09:16 UTC (rev 268999)
@@ -40,8 +40,8 @@
PASS context.createStereoPanner() did not throw exception.
PASS context.createWaveShaper() did not throw exception.
PASS context.createScriptProcessor() did not throw exception.
-PASS context.suspend() rejected promise with InvalidStateError: The object is in an invalid state..
-PASS context.resume() rejected promise with InvalidStateError: The object is in an invalid state..
+PASS context.suspend() rejected promise with InvalidStateError: Context is closed.
+PASS context.resume() rejected promise with InvalidStateError: Context is closed.
PASS context.close() rejected promise with InvalidStateError: The object is in an invalid state..
PASS successfullyParsed is true
Modified: trunk/Source/WebCore/ChangeLog (268998 => 268999)
--- trunk/Source/WebCore/ChangeLog 2020-10-26 22:11:47 UTC (rev 268998)
+++ trunk/Source/WebCore/ChangeLog 2020-10-26 23:09:16 UTC (rev 268999)
@@ -1,3 +1,18 @@
+2020-10-26 Chris Dumez <[email protected]>
+
+ Improve exception messages when AudioContext.suspend() / resume() promises are rejected
+ https://bugs.webkit.org/show_bug.cgi?id=218210
+
+ Reviewed by Geoffrey Garen.
+
+ Improve exception messages when AudioContext.suspend() / resume() promises are rejected.
+
+ No new tests, rebaselined existing tests.
+
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::suspendRendering):
+ (WebCore::AudioContext::resumeRendering):
+
2020-10-26 Adrian Perez de Castro <[email protected]>
Unreviewed non-unified build fix
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (268998 => 268999)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2020-10-26 22:11:47 UTC (rev 268998)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2020-10-26 23:09:16 UTC (rev 268999)
@@ -204,13 +204,13 @@
void AudioContext::suspendRendering(DOMPromiseDeferred<void>&& promise)
{
- if (isOfflineContext() || isStopped()) {
- promise.reject(InvalidStateError);
+ if (isOfflineContext()) {
+ promise.reject(Exception { InvalidStateError, "Cannot call suspend() on an OfflineAudioContext"_s });
return;
}
- if (state() == State::Closed || state() == State::Interrupted || !destinationNode()) {
- promise.reject();
+ if (isStopped() || state() == State::Closed || state() == State::Interrupted || !destinationNode()) {
+ promise.reject(Exception { InvalidStateError, "Context is closed"_s });
return;
}
@@ -229,13 +229,13 @@
void AudioContext::resumeRendering(DOMPromiseDeferred<void>&& promise)
{
- if (isOfflineContext() || isStopped()) {
- promise.reject(InvalidStateError);
+ if (isOfflineContext()) {
+ promise.reject(Exception { InvalidStateError, "Cannot call resume() on an OfflineAudioContext"_s });
return;
}
- if (state() == State::Closed || !destinationNode()) {
- promise.reject();
+ if (isStopped() || state() == State::Closed || !destinationNode()) {
+ promise.reject(Exception { InvalidStateError, "Context is closed"_s });
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes