Commit 6cb34f5e authored by Andrew Sutherland's avatar Andrew Sutherland
Browse files

Bug 1854076 - ESR115 Improve MessagePort state machine. r=dom-worker-reviewers,edenchuang, a=dsmith

parent 0c1f5667
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -211,6 +211,11 @@ MessagePort::MessagePort(nsIGlobalObject* aGlobal, State aState)

MessagePort::~MessagePort() {
  CloseForced();
  MOZ_ASSERT(!mActor);
  if (mActor) {
    mActor->SetPort(nullptr);
    mActor = nullptr;
  }
  MOZ_ASSERT(!mWorkerRef);
}

@@ -283,8 +288,7 @@ void MessagePort::Initialize(const nsID& aUUID, const nsID& aDestinationUUID,
        workerPrivate, "MessagePort", [self]() { self->CloseForced(); });
    if (NS_WARN_IF(!strongWorkerRef)) {
      // The worker is shutting down.
      mState = eStateDisentangled;
      UpdateMustKeepAlive();
      CloseForced();
      aRv.Throw(NS_ERROR_FAILURE);
      return;
    }