diff options
-rw-r--r-- | dom/base/EventSource.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 35a7835cf4..06cabc3098 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -1930,6 +1930,13 @@ EventSourceImpl::Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags) } if (IsShutDown()) { + // If the worker is shut down, we don't want to leave this event hanging. + // If it is a cancelable we should call Cancel() to make sure it stops. + // That way we can safely return NS_OK to prevent shutdown error messages. + nsCOMPtr<nsICancelableRunnable> cancelable = do_QueryInterface(event_ref); + if (cancelable) { + cancelable->Cancel(); + } return NS_OK; } MOZ_ASSERT(mWorkerPrivate); |