Commit 27495aa3 authored by valenting's avatar valenting
Browse files

Bug 1780094 - Add diagnostic asserts that ProxyAutoConfig::SetRunning is...

Bug 1780094 - Add diagnostic asserts that ProxyAutoConfig::SetRunning is called at the correct times. r=kershaw, a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D157199
parent 2d331367
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ static ProxyAutoConfig* GetRunning() {

static void SetRunning(ProxyAutoConfig* arg) {
  MOZ_ASSERT(RunningIndex() != 0xdeadbeef);
  MOZ_DIAGNOSTIC_ASSERT_IF(!arg, GetRunning() != nullptr);
  MOZ_DIAGNOSTIC_ASSERT_IF(arg, GetRunning() == nullptr);
  PR_SetThreadPrivate(RunningIndex(), arg);
}

@@ -518,7 +520,10 @@ nsresult ProxyAutoConfig::ConfigurePAC(const nsCString& aPACURI,

nsresult ProxyAutoConfig::SetupJS() {
  mJSNeedsSetup = false;
  MOZ_ASSERT(!GetRunning(), "JIT is running");
  MOZ_DIAGNOSTIC_ASSERT(!GetRunning(), "JIT is running");
  if (GetRunning()) {
    return NS_ERROR_ALREADY_INITIALIZED;
  }

#if defined(XP_MACOSX)
  nsMacUtilsImpl::EnableTCSMIfAvailable();