2012-05-10 22:58:48 +04:00
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef nsStreamListenerWrapper_h__
|
|
|
|
#define nsStreamListenerWrapper_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIStreamListener.h"
|
|
|
|
#include "nsIRequestObserver.h"
|
2013-07-09 05:45:25 +04:00
|
|
|
#include "nsIThreadRetargetableStreamListener.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-10 22:58:48 +04:00
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2012-05-10 22:58:48 +04:00
|
|
|
// Wrapper class to make replacement of nsHttpChannel's listener
|
|
|
|
// from JavaScript possible. It is workaround for bug 433711 and 682305.
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsStreamListenerWrapper final
|
|
|
|
: public nsIStreamListener,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIThreadRetargetableStreamListener {
|
2012-05-10 22:58:48 +04:00
|
|
|
public:
|
2014-08-05 17:20:24 +04:00
|
|
|
explicit nsStreamListenerWrapper(nsIStreamListener *listener)
|
2012-05-10 22:58:48 +04:00
|
|
|
: mListener(listener) {
|
2016-12-09 14:28:00 +03:00
|
|
|
MOZ_ASSERT(mListener, "no stream listener specified");
|
2012-05-10 22:58:48 +04:00
|
|
|
}
|
|
|
|
|
2017-07-20 02:25:43 +03:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2016-12-09 14:28:00 +03:00
|
|
|
NS_FORWARD_SAFE_NSIREQUESTOBSERVER(mListener)
|
|
|
|
NS_FORWARD_SAFE_NSISTREAMLISTENER(mListener)
|
2013-07-09 05:45:25 +04:00
|
|
|
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
|
2012-05-10 22:58:48 +04:00
|
|
|
|
|
|
|
private:
|
2018-04-30 19:46:04 +03:00
|
|
|
~nsStreamListenerWrapper() = default;
|
2012-05-10 22:58:48 +04:00
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
};
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
2012-05-10 22:58:48 +04:00
|
|
|
|
|
|
|
#endif // nsStreamListenerWrapper_h__
|