Index: Source/modules/webaudio/OfflineAudioContext.cpp |
diff --git a/Source/modules/webaudio/OfflineAudioContext.cpp b/Source/modules/webaudio/OfflineAudioContext.cpp |
index b79d2e5d259e5b22a4e383ac40f362a34e7231f1..d3488419e947e373d50f13cb105be0fb0604d178 100644 |
--- a/Source/modules/webaudio/OfflineAudioContext.cpp |
+++ b/Source/modules/webaudio/OfflineAudioContext.cpp |
@@ -101,6 +101,16 @@ OfflineAudioContext::~OfflineAudioContext() |
ScriptPromise OfflineAudioContext::startOfflineRendering(ScriptState* scriptState) |
{ |
+ // Calling close() on an OfflineAudioContext is not supported/allowed, |
+ // but it might well have been stopped by its execution context. |
+ if (isContextClosed()) { |
+ return ScriptPromise::rejectWithDOMException( |
+ scriptState, |
+ DOMException::create( |
+ InvalidStateError, |
+ "cannot call startRendering on an OfflineAudioContext in a stopped state.")); |
+ } |
+ |
if (m_offlineResolver) { |
// Can't call startRendering more than once. Return a rejected promise now. |
return ScriptPromise::rejectWithDOMException( |