author Jan de Mooij <>
Wed, 13 Feb 2019 06:41:44 +0000
changeset 516733 8c306186cbd7672259b3a730471cfcbe44a9b0d0
parent 505471 66eb1f485c1a3ea81372758bc92292c9428b17cd
child 562609 2ca26ca71fa0f4b459f1e02e8a73e537e07e8d20
permissions -rw-r--r--
Bug 1526588 - Fix some issues with js::GetFirstGlobalInCompartment and XPCWrappedNativeScope::UpdateWeakPointersInAllScopesAfterGC. r=bzbarsky Differential Revision:

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef WebBrowserPersistRemoteDocument_h__
#define WebBrowserPersistRemoteDocument_h__

#include "mozilla/Maybe.h"
#include "mozilla/PWebBrowserPersistDocumentParent.h"
#include "nsCOMPtr.h"
#include "nsIWebBrowserPersistDocument.h"
#include "nsIInputStream.h"

class nsIPrincipal;

// This class is the XPCOM half of the glue between the
// nsIWebBrowserPersistDocument interface and a remote document; it is
// created by WebBrowserPersistDocumentParent when (and if) it
// receives the information needed to populate the interface's
// properties.
// This object has a normal refcounted lifetime.  The corresponding
// IPC actor holds a weak reference to this class; when the last
// strong reference is released, it sends an IPC delete message and
// thereby removes that reference.

namespace mozilla {

class WebBrowserPersistDocumentParent;

class WebBrowserPersistRemoteDocument final
    : public nsIWebBrowserPersistDocument {

  using Attrs = WebBrowserPersistDocumentAttrs;
  WebBrowserPersistDocumentParent* mActor;
  Attrs mAttrs;
  nsCOMPtr<nsIInputStream> mPostData;
  nsCOMPtr<nsIPrincipal> mPrincipal;

  friend class WebBrowserPersistDocumentParent;
  WebBrowserPersistRemoteDocument(WebBrowserPersistDocumentParent* aActor,
                                  const Attrs& aAttrs,
                                  nsIInputStream* aPostData);

  void ActorDestroy(void);

}  // namespace mozilla

#endif  // WebBrowserPersistRemoteDocument_h__