michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsStreamListenerWrapper_h__ michael@0: #define nsStreamListenerWrapper_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIStreamListener.h" michael@0: #include "nsIRequestObserver.h" michael@0: #include "nsIThreadRetargetableStreamListener.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: // Wrapper class to make replacement of nsHttpChannel's listener michael@0: // from JavaScript possible. It is workaround for bug 433711 and 682305. michael@0: class nsStreamListenerWrapper MOZ_FINAL : public nsIStreamListener michael@0: , public nsIThreadRetargetableStreamListener michael@0: { michael@0: public: michael@0: nsStreamListenerWrapper(nsIStreamListener *listener) michael@0: : mListener(listener) michael@0: { michael@0: NS_ASSERTION(mListener, "no stream listener specified"); michael@0: } michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_FORWARD_NSIREQUESTOBSERVER(mListener->) michael@0: NS_FORWARD_NSISTREAMLISTENER(mListener->) michael@0: NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER michael@0: michael@0: private: michael@0: ~nsStreamListenerWrapper() {} michael@0: nsCOMPtr mListener; michael@0: }; michael@0: michael@0: #endif // nsStreamListenerWrapper_h__ michael@0: