Bug 1263392 - Console should reset the state of ConsoleCallData if the worker runnables are not correctly dispatched, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 11 Apr 2016 15:08:57 -0400
changeset 330535 7b1d75803c581a8d9b8c4f32eddb173b9f34a404
parent 330534 4b38540998a0b08f131bbf909c664ae6ebeca552
child 330536 5ccb2887c57f47eff0ab1698959d2ebc5a602585
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1263392
milestone48.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 1263392 - Console should reset the state of ConsoleCallData if the worker runnables are not correctly dispatched, r=smaug
dom/base/Console.cpp
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -402,24 +402,33 @@ private:
       ConsoleReleaseRunnable(WorkerPrivate* aWorkerPrivate,
                              ConsoleRunnable* aRunnable)
         : MainThreadWorkerControlRunnable(aWorkerPrivate)
         , mRunnable(aRunnable)
       {
         MOZ_ASSERT(aRunnable);
       }
 
+      // If something goes wrong, we still need to release the ConsoleCallData
+      // object. For this reason we have a custom Cancel method.
+      NS_IMETHOD
+      Cancel() override
+      {
+        mRunnable->ReleaseData();
+        mRunnable->mConsole = nullptr;
+        return NS_OK;
+      }
+
       virtual bool
       WorkerRun(JSContext* aCx, workers::WorkerPrivate* aWorkerPrivate) override
       {
         MOZ_ASSERT(aWorkerPrivate);
         aWorkerPrivate->AssertIsOnWorkerThread();
 
-        mRunnable->ReleaseData();
-        mRunnable->mConsole = nullptr;
+        Cancel();
 
         aWorkerPrivate->RemoveFeature(mRunnable);
         return true;
       }
 
     private:
       ~ConsoleReleaseRunnable()
       {}