Commit 23544d29 authored by Ehsan Akhgari's avatar Ehsan Akhgari
Browse files

Bug 1325119 - Assert that Init() has been called before...

Bug 1325119 - Assert that Init() has been called before DataStorage::WaitForReady() is called; r=keeler
parent 6a61c865
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -423,6 +423,8 @@ DataStorage::AsyncReadData(bool& aHaveProfileDir,
void
DataStorage::WaitForReady()
{
  MOZ_DIAGNOSTIC_ASSERT(mInitCalled, "Waiting before Init() has been called?");

  MonitorAutoLock readyLock(mReadyMonitor);
  while (!mReady) {
    nsresult rv = readyLock.Wait();
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#ifndef mozilla_DataStorage_h
#define mozilla_DataStorage_h

#include "mozilla/Atomics.h"
#include "mozilla/Monitor.h"
#include "mozilla/Mutex.h"
#include "mozilla/StaticPtr.h"
@@ -186,7 +187,7 @@ private:
  uint32_t mTimerDelay; // in milliseconds
  bool mPendingWrite; // true if a write is needed but hasn't been dispatched
  bool mShuttingDown;
  bool mInitCalled; // Indicates that Init() has been called.
  mozilla::Atomic<bool> mInitCalled; // Indicates that Init() has been called.
  // (End list of members protected by mMutex)

  Monitor mReadyMonitor; // Do not acquire this at the same time as mMutex.