Bug 1455057 - EventSource::Dispatch can fail if the worker is shutting down, r=asuth
authorAndrea Marchesini <amarchesini@mozilla.com>
Sun, 22 Apr 2018 09:20:45 +0200
changeset 468505 087038ccc3e3304d2ca8342ab3c155eb4222d1eb
parent 468504 1d87b41bac54668a11ca7103f152e373b130ae6e
child 468510 8d4cf28964f6956cd22d8710b316456e2c7c848d
child 468522 b154d7186790f01d339e9dd12df849230f447297
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1455057
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455057 - EventSource::Dispatch can fail if the worker is shutting down, r=asuth
dom/base/EventSource.cpp
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -1326,17 +1326,21 @@ EventSourceImpl::DispatchFailConnection(
   nsresult rv = ConsoleError();
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to print to the console error");
   }
   rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::FailConnection",
                                   this,
                                   &EventSourceImpl::FailConnection),
                 NS_DISPATCH_NORMAL);
-  MOZ_ASSERT(NS_SUCCEEDED(rv));
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    // if the worker is shutting down, the dispatching of normal WorkerRunnables
+    // fails.
+    return;
+  }
 }
 
 void
 EventSourceImpl::FailConnection()
 {
   AssertIsOnTargetThread();
   if (IsClosed()) {
     return;