mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-17 04:37:46 +09:00
Issue #1442 - Part 9: Stream shutdown handling. https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
This commit is contained in:
parent
bff1f3bc60
commit
3979e4847c
2 changed files with 182 additions and 4 deletions
|
|
@ -9,7 +9,9 @@
|
|||
#include "Fetch.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
|
|
@ -18,16 +20,26 @@ class nsIInputStream;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace workers {
|
||||
class WorkerHolder;
|
||||
}
|
||||
|
||||
class FetchStream final : public nsIInputStreamCallback
|
||||
, public nsIObserver
|
||||
, public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIINPUTSTREAMCALLBACK
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static JSObject*
|
||||
Create(JSContext* aCx, nsIGlobalObject* aGlobal,
|
||||
nsIInputStream* aInputStream, ErrorResult& aRv);
|
||||
|
||||
void
|
||||
Close();
|
||||
|
||||
private:
|
||||
FetchStream(nsIGlobalObject* aGlobal, nsIInputStream* aInputStream);
|
||||
~FetchStream();
|
||||
|
|
@ -63,6 +75,9 @@ private:
|
|||
void
|
||||
ErrorPropagation(JSContext* aCx, JS::HandleObject aStream, nsresult aRv);
|
||||
|
||||
void
|
||||
CloseAndReleaseObjects();
|
||||
|
||||
// Common methods
|
||||
|
||||
enum State {
|
||||
|
|
@ -98,6 +113,8 @@ private:
|
|||
|
||||
nsCOMPtr<nsIEventTarget> mOwningEventTarget;
|
||||
|
||||
UniquePtr<workers::WorkerHolder> mWorkerHolder;
|
||||
|
||||
JS::Heap<JSObject*> mReadableStream;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue