Tue, 06 Jan 2015 21:39:09 +0100
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 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsStreamListenerWrapper_h__
6 #define nsStreamListenerWrapper_h__
8 #include "nsCOMPtr.h"
9 #include "nsIStreamListener.h"
10 #include "nsIRequestObserver.h"
11 #include "nsIThreadRetargetableStreamListener.h"
12 #include "mozilla/Attributes.h"
14 // Wrapper class to make replacement of nsHttpChannel's listener
15 // from JavaScript possible. It is workaround for bug 433711 and 682305.
16 class nsStreamListenerWrapper MOZ_FINAL : public nsIStreamListener
17 , public nsIThreadRetargetableStreamListener
18 {
19 public:
20 nsStreamListenerWrapper(nsIStreamListener *listener)
21 : mListener(listener)
22 {
23 NS_ASSERTION(mListener, "no stream listener specified");
24 }
26 NS_DECL_ISUPPORTS
27 NS_FORWARD_NSIREQUESTOBSERVER(mListener->)
28 NS_FORWARD_NSISTREAMLISTENER(mListener->)
29 NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
31 private:
32 ~nsStreamListenerWrapper() {}
33 nsCOMPtr<nsIStreamListener> mListener;
34 };
36 #endif // nsStreamListenerWrapper_h__