uriloader/exthandler/ExternalHelperAppParent.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #include "mozilla/dom/PExternalHelperAppParent.h"
     8 #include "nsIChannel.h"
     9 #include "nsIMultiPartChannel.h"
    10 #include "nsIResumableChannel.h"
    11 #include "nsIStreamListener.h"
    12 #include "nsHashPropertyBag.h"
    14 namespace IPC {
    15 class URI;
    16 }
    18 namespace mozilla {
    20 namespace ipc {
    21 class OptionalURIParams;
    22 } // namespace ipc
    24 namespace net {
    25 class PChannelDiverterParent;
    26 } // namespace net
    28 namespace dom {
    30 class ContentParent;
    31 class PBrowserParent;
    33 class ExternalHelperAppParent : public PExternalHelperAppParent
    34                               , public nsHashPropertyBag
    35                               , public nsIChannel
    36                               , public nsIMultiPartChannel
    37                               , public nsIResumableChannel
    38                               , public nsIStreamListener
    39 {
    40     typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
    42 public:
    43     NS_DECL_ISUPPORTS
    44     NS_DECL_NSIREQUEST
    45     NS_DECL_NSICHANNEL
    46     NS_DECL_NSIMULTIPARTCHANNEL
    47     NS_DECL_NSIRESUMABLECHANNEL
    48     NS_DECL_NSISTREAMLISTENER
    49     NS_DECL_NSIREQUESTOBSERVER
    51     bool RecvOnStartRequest(const nsCString& entityID) MOZ_OVERRIDE;
    52     bool RecvOnDataAvailable(const nsCString& data,
    53                              const uint64_t& offset,
    54                              const uint32_t& count) MOZ_OVERRIDE;
    55     bool RecvOnStopRequest(const nsresult& code) MOZ_OVERRIDE;
    57     bool RecvDivertToParentUsing(PChannelDiverterParent* diverter) MOZ_OVERRIDE;
    59     ExternalHelperAppParent(const OptionalURIParams& uri, const int64_t& contentLength);
    60     void Init(ContentParent *parent,
    61               const nsCString& aMimeContentType,
    62               const nsCString& aContentDisposition,
    63               const uint32_t& aContentDispositionHint,
    64               const nsString& aContentDispositionFilename,
    65               const bool& aForceSave,
    66               const OptionalURIParams& aReferrer,
    67               PBrowserParent* aBrowser);
    68     virtual ~ExternalHelperAppParent();
    70 protected:
    71   virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
    72   void Delete();
    74 private:
    75   nsCOMPtr<nsIStreamListener> mListener;
    76   nsCOMPtr<nsIURI> mURI;
    77   bool mPending;
    78   DebugOnly<bool> mDiverted;
    79   bool mIPCClosed;
    80   nsLoadFlags mLoadFlags;
    81   nsresult mStatus;
    82   int64_t mContentLength;
    83   uint32_t mContentDisposition;
    84   nsString mContentDispositionFilename;
    85   nsCString mContentDispositionHeader;
    86   nsCString mEntityID;
    87 };
    89 } // namespace dom
    90 } // namespace mozilla

mercurial