Commit 9877647a authored by Kershaw Chang's avatar Kershaw Chang
Browse files

Bug 1746543, r=necko-reviewers,valentin

parent f3281535
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -142,10 +142,6 @@ ProxyAutoConfigChild::~ProxyAutoConfigChild() {
mozilla::ipc::IPCResult ProxyAutoConfigChild::RecvConfigurePAC(
    const nsCString& aPACURI, const nsCString& aPACScriptData,
    const bool& aIncludePath, const uint32_t& aExtraHeapSize) {
  if (!mPAC) {
    return IPC_OK();
  }

  mPAC->ConfigurePAC(aPACURI, aPACScriptData, aIncludePath, aExtraHeapSize,
                     GetMainThreadSerialEventTarget());
  return IPC_OK();
@@ -154,10 +150,6 @@ mozilla::ipc::IPCResult ProxyAutoConfigChild::RecvConfigurePAC(
mozilla::ipc::IPCResult ProxyAutoConfigChild::RecvGetProxyForURI(
    const nsCString& aTestURI, const nsCString& aTestHost,
    GetProxyForURIResolver&& aResolver) {
  if (!mPAC) {
    return IPC_OK();
  }

  RefPtr<ProxyAutoConfigChild> self = this;
  auto callResolver = [self, testURI(aTestURI), testHost(aTestHost),
                       resolver{std::move(aResolver)}]() {
@@ -165,11 +157,6 @@ mozilla::ipc::IPCResult ProxyAutoConfigChild::RecvGetProxyForURI(
      return;
    }

    if (!self->mPAC) {
      MOZ_ASSERT(false, "Should not happen");
      return;
    }

    nsCString result;
    nsresult rv = self->mPAC->GetProxyForURI(testURI, testHost, result);
    resolver(Tuple<const nsresult&, const nsCString&>(rv, result));
@@ -185,17 +172,12 @@ mozilla::ipc::IPCResult ProxyAutoConfigChild::RecvGetProxyForURI(
}

mozilla::ipc::IPCResult ProxyAutoConfigChild::RecvGC() {
  if (!mPAC) {
    return IPC_OK();
  }

  mPAC->GC();
  return IPC_OK();
}

void ProxyAutoConfigChild::ActorDestroy(ActorDestroyReason aWhy) {
  UniquePtr<ProxyAutoConfig> pac(std::move(mPAC));
  pac->Shutdown();
  mPAC->Shutdown();

  // To avoid racing with the main thread, we need to dispatch
  // ProxyAutoConfigChild::Destroy again.