Backed out changeset 544d6892423d (bug 1734886) for causing failures attransform-stream.html. CLOSED TREE

This commit is contained in:
Butkovits Atila 2022-03-24 00:29:41 +02:00
Родитель 50c68a8f00
Коммит 014927888b
15 изменённых файлов: 124 добавлений и 498 удалений

Просмотреть файл

@ -189,12 +189,6 @@ MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> ReadableStreamCancel(
already_AddRefed<ReadableStreamDefaultReader>
AcquireReadableStreamDefaultReader(ReadableStream* aStream, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<ReadableStream> CreateReadableStream(
JSContext* aCx, nsIGlobalObject* aGlobal,
UnderlyingSourceAlgorithmsBase* aAlgorithms,
mozilla::Maybe<double> aHighWaterMark, QueuingStrategySize* aSizeAlgorithm,
ErrorResult& aRv);
bool ReadableStreamHasBYOBReader(ReadableStream* aStream);
bool ReadableStreamHasDefaultReader(ReadableStream* aStream);

Просмотреть файл

@ -6,9 +6,6 @@
#include "mozilla/dom/TransformStream.h"
#include "UnderlyingSourceCallbackHelpers.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/WritableStream.h"
#include "mozilla/dom/ReadableStream.h"
#include "mozilla/dom/RootedDictionary.h"
@ -19,9 +16,7 @@
namespace mozilla::dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TransformStream, mGlobal,
mBackpressureChangePromise, mController,
mReadable, mWritable)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TransformStream, mGlobal, mController)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TransformStream)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TransformStream)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransformStream)
@ -40,216 +35,6 @@ JSObject* TransformStream::WrapObject(JSContext* aCx,
return TransformStream_Binding::Wrap(aCx, this, aGivenProto);
}
// https://streams.spec.whatwg.org/#initialize-transform-stream
class TransformStreamUnderlyingSinkAlgorithms final
: public UnderlyingSinkAlgorithmsBase {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(
TransformStreamUnderlyingSinkAlgorithms, UnderlyingSinkAlgorithmsBase)
TransformStreamUnderlyingSinkAlgorithms(Promise* aStartPromise,
TransformStream* aStream)
: mStartPromise(aStartPromise), mStream(aStream) {}
void StartCallback(JSContext* aCx,
WritableStreamDefaultController& aController,
JS::MutableHandle<JS::Value> aRetVal,
ErrorResult& aRv) override {
// Step 1. Let startAlgorithm be an algorithm that returns startPromise.
// (Same as TransformStreamUnderlyingSourceAlgorithms::StartCallback)
aRetVal.setObject(*mStartPromise->PromiseObj());
}
already_AddRefed<Promise> WriteCallback(
JSContext* aCx, JS::Handle<JS::Value> aChunk,
WritableStreamDefaultController& aController, ErrorResult& aRv) override {
// Step 2. Let writeAlgorithm be the following steps, taking a chunk
// argument:
// Step 1. Return ! TransformStreamDefaultSinkWriteAlgorithm(stream,
// chunk).
// TODO
return Promise::CreateResolvedWithUndefined(mStream->GetParentObject(),
aRv);
}
already_AddRefed<Promise> AbortCallback(
JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aReason,
ErrorResult& aRv) override {
// Step 3. Let abortAlgorithm be the following steps, taking a reason
// argument:
// Step 1. Return ! TransformStreamDefaultSinkAbortAlgorithm(stream,
// reason).
// TODO
return Promise::CreateResolvedWithUndefined(mStream->GetParentObject(),
aRv);
}
already_AddRefed<Promise> CloseCallback(JSContext* aCx,
ErrorResult& aRv) override {
// Step 4. Let closeAlgorithm be the following steps:
// Step 1. Return ! TransformStreamDefaultSinkCloseAlgorithm(stream).
// TODO
return Promise::CreateResolvedWithUndefined(mStream->GetParentObject(),
aRv);
}
protected:
~TransformStreamUnderlyingSinkAlgorithms() override = default;
private:
RefPtr<Promise> mStartPromise;
RefPtr<TransformStream> mStream;
};
NS_IMPL_CYCLE_COLLECTION_INHERITED(TransformStreamUnderlyingSinkAlgorithms,
UnderlyingSinkAlgorithmsBase, mStartPromise,
mStream)
NS_IMPL_ADDREF_INHERITED(TransformStreamUnderlyingSinkAlgorithms,
UnderlyingSinkAlgorithmsBase)
NS_IMPL_RELEASE_INHERITED(TransformStreamUnderlyingSinkAlgorithms,
UnderlyingSinkAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransformStreamUnderlyingSinkAlgorithms)
NS_INTERFACE_MAP_END_INHERITING(TransformStreamUnderlyingSinkAlgorithms)
// https://streams.spec.whatwg.org/#initialize-transform-stream
class TransformStreamUnderlyingSourceAlgorithms final
: public UnderlyingSourceAlgorithmsBase {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(
TransformStreamUnderlyingSourceAlgorithms, UnderlyingSourceAlgorithmsBase)
TransformStreamUnderlyingSourceAlgorithms(Promise* aStartPromise,
TransformStream* aStream)
: mStartPromise(aStartPromise), mStream(aStream) {}
void StartCallback(JSContext* aCx, ReadableStreamController& aController,
JS::MutableHandle<JS::Value> aRetVal,
ErrorResult& aRv) override {
// Step 1. Let startAlgorithm be an algorithm that returns startPromise.
// (Same as TransformStreamUnderlyingSinkAlgorithms::StartCallback)
aRetVal.setObject(*mStartPromise->PromiseObj());
}
already_AddRefed<Promise> PullCallback(JSContext* aCx,
ReadableStreamController& aController,
ErrorResult& aRv) override {
// Step 6. Let pullAlgorithm be the following steps:
// Step 1. Return ! TransformStreamDefaultSourcePullAlgorithm(stream).
// TODO
return Promise::CreateResolvedWithUndefined(mStream->GetParentObject(),
aRv);
}
already_AddRefed<Promise> CancelCallback(
JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aReason,
ErrorResult& aRv) override {
// Step 7. Let cancelAlgorithm be the following steps, taking a reason
// argument:
// Step 1. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream,
// reason).
// Step 2. Return a promise resolved with undefined.
// TODO
return Promise::CreateResolvedWithUndefined(mStream->GetParentObject(),
aRv);
}
void ErrorCallback() override {}
protected:
~TransformStreamUnderlyingSourceAlgorithms() override = default;
private:
RefPtr<Promise> mStartPromise;
RefPtr<TransformStream> mStream;
};
NS_IMPL_CYCLE_COLLECTION_INHERITED(TransformStreamUnderlyingSourceAlgorithms,
UnderlyingSourceAlgorithmsBase,
mStartPromise, mStream)
NS_IMPL_ADDREF_INHERITED(TransformStreamUnderlyingSourceAlgorithms,
UnderlyingSourceAlgorithmsBase)
NS_IMPL_RELEASE_INHERITED(TransformStreamUnderlyingSourceAlgorithms,
UnderlyingSourceAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
TransformStreamUnderlyingSourceAlgorithms)
NS_INTERFACE_MAP_END_INHERITING(TransformStreamUnderlyingSourceAlgorithms)
// https://streams.spec.whatwg.org/#transform-stream-set-backpressure
static void TransformStreamSetBackpressure(TransformStream* aStream,
bool aBackpressure,
ErrorResult& aRv) {
// Step 1. Assert: stream.[[backpressure]] is not backpressure.
MOZ_ASSERT(aStream->Backpressure() != aBackpressure);
// Step 2. If stream.[[backpressureChangePromise]] is not undefined, resolve
// stream.[[backpressureChangePromise]] with undefined.
if (Promise* promise = aStream->BackpressureChangePromise()) {
promise->MaybeResolveWithUndefined();
}
// Step 3. Set stream.[[backpressureChangePromise]] to a new promise.
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
if (aRv.Failed()) {
return;
}
aStream->SetBackpressureChangePromise(promise);
// Step 4. Set stream.[[backpressure]] to backpressure.
aStream->SetBackpressure(aBackpressure);
}
// https://streams.spec.whatwg.org/#initialize-transform-stream
void TransformStream::Initialize(JSContext* aCx, Promise* aStartPromise,
double aWritableHighWaterMark,
QueuingStrategySize* aWritableSizeAlgorithm,
double aReadableHighWaterMark,
QueuingStrategySize* aReadableSizeAlgorithm,
ErrorResult& aRv) {
// Step 1 - 4
auto sinkAlgorithms =
MakeRefPtr<TransformStreamUnderlyingSinkAlgorithms>(aStartPromise, this);
// Step 5. Set stream.[[writable]] to ! CreateWritableStream(startAlgorithm,
// writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark,
// writableSizeAlgorithm).
mWritable =
CreateWritableStream(aCx, MOZ_KnownLive(mGlobal), sinkAlgorithms,
aWritableHighWaterMark, aWritableSizeAlgorithm, aRv);
if (aRv.Failed()) {
return;
}
// Step 6 - 7
auto sourceAlgorithms = MakeRefPtr<TransformStreamUnderlyingSourceAlgorithms>(
aStartPromise, this);
// Step 8. Set stream.[[readable]] to ! CreateReadableStream(startAlgorithm,
// pullAlgorithm, cancelAlgorithm, readableHighWaterMark,
// readableSizeAlgorithm).
mReadable = CreateReadableStream(
aCx, MOZ_KnownLive(mGlobal), sourceAlgorithms,
Some(aReadableHighWaterMark), aReadableSizeAlgorithm, aRv);
if (aRv.Failed()) {
return;
}
// Step 9. Set stream.[[backpressure]] and
// stream.[[backpressureChangePromise]] to undefined.
mBackpressureChangePromise = nullptr;
// Step 10. Perform ! TransformStreamSetBackpressure(stream, true).
TransformStreamSetBackpressure(this, true, aRv);
if (aRv.Failed()) {
return;
}
// Step 11. Set stream.[[controller]] to undefined.
mController = nullptr;
}
// https://streams.spec.whatwg.org/#ts-constructor
already_AddRefed<TransformStream> TransformStream::Constructor(
const GlobalObject& aGlobal,
@ -294,35 +79,19 @@ already_AddRefed<TransformStream> TransformStream::Constructor(
// Step 5. Let readableHighWaterMark be ?
// ExtractHighWaterMark(readableStrategy, 0).
double readableHighWaterMark =
ExtractHighWaterMark(aReadableStrategy, 0, aRv);
if (aRv.Failed()) {
return nullptr;
}
// TODO
// Step 6. Let readableSizeAlgorithm be !
// ExtractSizeAlgorithm(readableStrategy).
// Note: Callers should recognize nullptr as a callback that returns 1. See
// also WritableStream::Constructor for this design decision.
RefPtr<QueuingStrategySize> readableSizeAlgorithm =
aReadableStrategy.mSize.WasPassed() ? &aReadableStrategy.mSize.Value()
: nullptr;
// TODO
// Step 7. Let writableHighWaterMark be ?
// ExtractHighWaterMark(writableStrategy, 1).
double writableHighWaterMark =
ExtractHighWaterMark(aWritableStrategy, 1, aRv);
if (aRv.Failed()) {
return nullptr;
}
// TODO
// Step 8. Let writableSizeAlgorithm be !
// ExtractSizeAlgorithm(writableStrategy).
// Note: Callers should recognize nullptr as a callback that returns 1. See
// also WritableStream::Constructor for this design decision.
RefPtr<QueuingStrategySize> writableSizeAlgorithm =
aWritableStrategy.mSize.WasPassed() ? &aWritableStrategy.mSize.Value()
: nullptr;
// TODO
// Step 9. Let startPromise be a new promise.
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
@ -335,9 +104,7 @@ already_AddRefed<TransformStream> TransformStream::Constructor(
// writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,
// readableSizeAlgorithm).
RefPtr<TransformStream> transformStream = new TransformStream(global);
transformStream->Initialize(
aGlobal.Context(), startPromise, writableHighWaterMark,
writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm, aRv);
// TODO: Init()
if (aRv.Failed()) {
return nullptr;
}
@ -351,22 +118,7 @@ already_AddRefed<TransformStream> TransformStream::Constructor(
// Step 12. If transformerDict["start"] exists, then resolve startPromise with
// the result of invoking transformerDict["start"] with argument list «
// this.[[controller]] » and callback this value transformer.
if (transformerDict.mStart.WasPassed()) {
RefPtr<TransformerStartCallback> callback = transformerDict.mStart.Value();
RefPtr<TransformStreamDefaultController> controller =
transformStream->Controller();
JS::Rooted<JS::Value> retVal(aGlobal.Context());
callback->Call(transformerObj, *controller, &retVal, aRv,
"Transformer.start", CallbackFunction::eRethrowExceptions);
if (aRv.Failed()) {
return nullptr;
}
startPromise->MaybeResolve(retVal);
} else {
// Step 13. Otherwise, resolve startPromise with undefined.
startPromise->MaybeResolveWithUndefined();
}
// TODO
return transformStream.forget();
}

Просмотреть файл

@ -29,13 +29,6 @@ class TransformStream final : public nsISupports, public nsWrapperCache {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TransformStream)
// Internal slot accessors
bool Backpressure() const { return mBackpressure; }
void SetBackpressure(bool aBackpressure) { mBackpressure = aBackpressure; }
Promise* BackpressureChangePromise() { return mBackpressureChangePromise; }
void SetBackpressureChangePromise(Promise* aPromise) {
mBackpressureChangePromise = aPromise;
}
TransformStreamDefaultController* Controller() { return mController; }
void SetController(TransformStreamDefaultController* aController) {
mController = aController;
@ -45,12 +38,6 @@ class TransformStream final : public nsISupports, public nsWrapperCache {
~TransformStream();
explicit TransformStream(nsIGlobalObject* aGlobal);
MOZ_CAN_RUN_SCRIPT void Initialize(
JSContext* aCx, Promise* aStartPromise, double aWritableHighWaterMark,
QueuingStrategySize* aWritableSizeAlgorithm,
double aReadableHighWaterMark,
QueuingStrategySize* aReadableSizeAlgorithm, ErrorResult& aRv);
public:
nsIGlobalObject* GetParentObject() const { return mGlobal; }
JSObject* WrapObject(JSContext* aCx,
@ -71,11 +58,7 @@ class TransformStream final : public nsISupports, public nsWrapperCache {
nsCOMPtr<nsIGlobalObject> mGlobal;
// Internal slots
bool mBackpressure;
RefPtr<Promise> mBackpressureChangePromise;
RefPtr<TransformStreamDefaultController> mController;
RefPtr<ReadableStream> mReadable;
RefPtr<WritableStream> mWritable;
};
} // namespace mozilla::dom

Просмотреть файл

@ -9,24 +9,16 @@
using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION(UnderlyingSinkAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTING_ADDREF(UnderlyingSinkAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTING_RELEASE(UnderlyingSinkAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(UnderlyingSinkAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTION_WITH_JS_MEMBERS(UnderlyingSinkAlgorithms,
(mGlobal, mStartCallback,
mWriteCallback, mCloseCallback,
mAbortCallback),
(mUnderlyingSink))
NS_IMPL_CYCLE_COLLECTING_ADDREF(UnderlyingSinkAlgorithms)
NS_IMPL_CYCLE_COLLECTING_RELEASE(UnderlyingSinkAlgorithms)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(UnderlyingSinkAlgorithms)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(UnderlyingSinkAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_INHERITED_WITH_JS_MEMBERS(
UnderlyingSinkAlgorithms, UnderlyingSinkAlgorithmsBase,
(mGlobal, mStartCallback, mWriteCallback, mCloseCallback, mAbortCallback),
(mUnderlyingSink))
NS_IMPL_ADDREF_INHERITED(UnderlyingSinkAlgorithms, UnderlyingSinkAlgorithmsBase)
NS_IMPL_RELEASE_INHERITED(UnderlyingSinkAlgorithms,
UnderlyingSinkAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(UnderlyingSinkAlgorithms)
NS_INTERFACE_MAP_END_INHERITING(UnderlyingSinkAlgorithmsBase)
// https://streams.spec.whatwg.org/#set-up-writable-stream-default-controller-from-underlying-sink
void UnderlyingSinkAlgorithms::StartCallback(

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/UnderlyingSinkBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupports.h"
#include "nsISupportsImpl.h"
@ -24,36 +23,11 @@ namespace mozilla::dom {
class WritableStreamDefaultController;
class UnderlyingSinkAlgorithmsBase : public nsISupports {
// https://streams.spec.whatwg.org/#set-up-writable-stream-default-controller-from-underlying-sink
class UnderlyingSinkAlgorithms : public nsISupports {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(UnderlyingSinkAlgorithmsBase)
MOZ_CAN_RUN_SCRIPT virtual void StartCallback(
JSContext* aCx, WritableStreamDefaultController& aController,
JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv) = 0;
MOZ_CAN_RUN_SCRIPT virtual already_AddRefed<Promise> WriteCallback(
JSContext* aCx, JS::Handle<JS::Value> aChunk,
WritableStreamDefaultController& aController, ErrorResult& aRv) = 0;
MOZ_CAN_RUN_SCRIPT virtual already_AddRefed<Promise> CloseCallback(
JSContext* aCx, ErrorResult& aRv) = 0;
MOZ_CAN_RUN_SCRIPT virtual already_AddRefed<Promise> AbortCallback(
JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aReason,
ErrorResult& aRv) = 0;
protected:
virtual ~UnderlyingSinkAlgorithmsBase() = default;
};
// https://streams.spec.whatwg.org/#set-up-writable-stream-default-controller-from-underlying-sink
class UnderlyingSinkAlgorithms final : public UnderlyingSinkAlgorithmsBase {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
UnderlyingSinkAlgorithms, UnderlyingSinkAlgorithmsBase)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(UnderlyingSinkAlgorithms)
UnderlyingSinkAlgorithms(nsIGlobalObject* aGlobal,
JS::HandleObject aUnderlyingSink,
@ -84,21 +58,21 @@ class UnderlyingSinkAlgorithms final : public UnderlyingSinkAlgorithmsBase {
MOZ_CAN_RUN_SCRIPT void StartCallback(
JSContext* aCx, WritableStreamDefaultController& aController,
JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv) override;
JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> WriteCallback(
JSContext* aCx, JS::Handle<JS::Value> aChunk,
WritableStreamDefaultController& aController, ErrorResult& aRv) override;
WritableStreamDefaultController& aController, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> CloseCallback(
JSContext* aCx, ErrorResult& aRv) override;
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> CloseCallback(JSContext* aCx,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> AbortCallback(
JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aReason,
ErrorResult& aRv) override;
ErrorResult& aRv);
protected:
~UnderlyingSinkAlgorithms() override { mozilla::DropJSObjects(this); }
virtual ~UnderlyingSinkAlgorithms() { mozilla::DropJSObjects(this); };
private:
// Virtually const, but are cycle collected

Просмотреть файл

@ -699,35 +699,6 @@ AcquireWritableStreamDefaultWriter(WritableStream* aStream, ErrorResult& aRv) {
return writer.forget();
}
// https://streams.spec.whatwg.org/#create-writable-stream
already_AddRefed<WritableStream> CreateWritableStream(
JSContext* aCx, nsIGlobalObject* aGlobal,
UnderlyingSinkAlgorithmsBase* aAlgorithms, double aHighWaterMark,
QueuingStrategySize* aSizeAlgorithm, ErrorResult& aRv) {
// Step 1: Assert: ! IsNonNegativeNumber(highWaterMark) is true.
MOZ_ASSERT(IsNonNegativeNumber(aHighWaterMark));
// Step 2: Let stream be a new WritableStream.
// Step 3: Perform ! InitializeWritableStream(stream).
auto stream = MakeRefPtr<WritableStream>(aGlobal);
// Step 4: Let controller be a new WritableStreamDefaultController.
auto controller =
MakeRefPtr<WritableStreamDefaultController>(aGlobal, *stream);
// Step 5: Perform ? SetUpWritableStreamDefaultController(stream, controller,
// startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,
// highWaterMark, sizeAlgorithm).
SetUpWritableStreamDefaultController(aCx, stream, controller, aAlgorithms,
aHighWaterMark, aSizeAlgorithm, aRv);
if (aRv.Failed()) {
return nullptr;
}
// Step 6: Return stream.
return stream.forget();
}
already_AddRefed<WritableStreamDefaultWriter> WritableStream::GetWriter(
ErrorResult& aRv) {
return AcquireWritableStreamDefaultWriter(this, aRv);

Просмотреть файл

@ -28,7 +28,6 @@ namespace mozilla::dom {
class Promise;
class WritableStreamDefaultController;
class WritableStreamDefaultWriter;
class UnderlyingSinkAlgorithmsBase;
class WritableStream : public nsISupports, public nsWrapperCache {
public:
@ -181,11 +180,6 @@ class WritableStream : public nsISupports, public nsWrapperCache {
nsCOMPtr<nsIGlobalObject> mGlobal;
};
MOZ_CAN_RUN_SCRIPT already_AddRefed<WritableStream> CreateWritableStream(
JSContext* aCx, nsIGlobalObject* aGlobal,
UnderlyingSinkAlgorithmsBase* aAlgorithms, double aHighWaterMark,
QueuingStrategySize* aSizeAlgorithm, ErrorResult& aRv);
inline bool IsWritableStreamLocked(WritableStream* aStream) {
return aStream->Locked();
}

Просмотреть файл

@ -91,7 +91,7 @@ already_AddRefed<Promise> WritableStreamDefaultController::AbortSteps(
JSContext* aCx, JS::Handle<JS::Value> aReason, ErrorResult& aRv) {
// Step 1. Let result be the result of performing this.[[abortAlgorithm]],
// passing reason.
RefPtr<UnderlyingSinkAlgorithmsBase> algorithms = mAlgorithms;
RefPtr<UnderlyingSinkAlgorithms> algorithms = mAlgorithms;
Optional<JS::Handle<JS::Value>> optionalReason(aCx, aReason);
RefPtr<Promise> abortPromise =
algorithms->AbortCallback(aCx, optionalReason, aRv);
@ -126,7 +126,7 @@ WritableStreamDefaultControllerAdvanceQueueIfNeeded(
void SetUpWritableStreamDefaultController(
JSContext* aCx, WritableStream* aStream,
WritableStreamDefaultController* aController,
UnderlyingSinkAlgorithmsBase* aAlgorithms, double aHighWaterMark,
UnderlyingSinkAlgorithms* aAlgorithms, double aHighWaterMark,
QueuingStrategySize* aSizeAlgorithm, ErrorResult& aRv) {
// Step 1. Assert: stream implements WritableStream.
// Step 2. Assert: stream.[[controller]] is undefined.
@ -260,8 +260,7 @@ MOZ_CAN_RUN_SCRIPT static void WritableStreamDefaultControllerProcessClose(
// Step 5. Let sinkClosePromise be the result of performing
// controller.[[closeAlgorithm]].
RefPtr<UnderlyingSinkAlgorithmsBase> algorithms =
aController->GetAlgorithms();
RefPtr<UnderlyingSinkAlgorithms> algorithms = aController->GetAlgorithms();
RefPtr<Promise> sinkClosePromise = algorithms->CloseCallback(aCx, aRv);
if (aRv.Failed()) {
return;
@ -304,8 +303,7 @@ MOZ_CAN_RUN_SCRIPT static void WritableStreamDefaultControllerProcessWrite(
// Step 3. Let sinkWritePromise be the result of performing
// controller.[[writeAlgorithm]], passing in chunk.
RefPtr<UnderlyingSinkAlgorithmsBase> algorithms =
aController->GetAlgorithms();
RefPtr<UnderlyingSinkAlgorithms> algorithms = aController->GetAlgorithms();
RefPtr<Promise> sinkWritePromise =
algorithms->WriteCallback(aCx, aChunk, *aController, aRv);
if (aRv.Failed()) {

Просмотреть файл

@ -84,8 +84,8 @@ class WritableStreamDefaultController final : public nsISupports,
mStrategySizeAlgorithm = aStrategySizeAlgorithm;
}
UnderlyingSinkAlgorithmsBase* GetAlgorithms() { return mAlgorithms; }
void SetAlgorithms(UnderlyingSinkAlgorithmsBase* aAlgorithms) {
UnderlyingSinkAlgorithms* GetAlgorithms() { return mAlgorithms; }
void SetAlgorithms(UnderlyingSinkAlgorithms* aAlgorithms) {
mAlgorithms = aAlgorithms;
}
@ -128,14 +128,14 @@ class WritableStreamDefaultController final : public nsISupports,
double mStrategyHWM = 0.0;
RefPtr<QueuingStrategySize> mStrategySizeAlgorithm;
RefPtr<UnderlyingSinkAlgorithmsBase> mAlgorithms;
RefPtr<UnderlyingSinkAlgorithms> mAlgorithms;
RefPtr<WritableStream> mStream;
};
MOZ_CAN_RUN_SCRIPT void SetUpWritableStreamDefaultController(
JSContext* aCx, WritableStream* aStream,
WritableStreamDefaultController* aController,
UnderlyingSinkAlgorithmsBase* aSinkCallbacks, double aHighWaterMark,
UnderlyingSinkAlgorithms* aSinkCallbacks, double aHighWaterMark,
QueuingStrategySize* aSizeAlgorithm, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void SetUpWritableStreamDefaultControllerFromUnderlyingSink(

Просмотреть файл

@ -12,8 +12,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "terminate()" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: new WritableStream() must inherit property "locked" with the proper type]
expected:
@ -36,8 +35,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "desiredSize" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface object length]
expected:
@ -120,8 +118,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling error(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: existence and properties of interface prototype object's @@unscopables property]
expected:
@ -180,8 +177,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling enqueue(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface: existence and properties of interface prototype object]
expected:
@ -240,8 +236,7 @@
if not domstreams: FAIL
[Stringification of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamDefaultReader interface: operation read()]
expected:
@ -276,12 +271,10 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "enqueue(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "error(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController interface: existence and properties of interface prototype object's "constructor" property]
expected:
@ -296,8 +289,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController must be primary interface of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController must be primary interface of self.readableByteStreamController]
expected:
@ -697,8 +689,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "terminate()" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: new WritableStream() must inherit property "locked" with the proper type]
expected:
@ -721,8 +712,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "desiredSize" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface object length]
expected:
@ -805,8 +795,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling error(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: existence and properties of interface prototype object's @@unscopables property]
expected:
@ -865,8 +854,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling enqueue(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface: existence and properties of interface prototype object]
expected:
@ -925,8 +913,7 @@
if not domstreams: FAIL
[Stringification of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamDefaultReader interface: operation read()]
expected:
@ -961,12 +948,10 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "enqueue(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "error(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController interface: existence and properties of interface prototype object's "constructor" property]
expected:
@ -981,8 +966,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController must be primary interface of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController must be primary interface of self.readableByteStreamController]
expected:
@ -1382,8 +1366,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "terminate()" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: new WritableStream() must inherit property "locked" with the proper type]
expected:
@ -1406,8 +1389,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "desiredSize" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface object length]
expected:
@ -1490,8 +1472,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling error(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: existence and properties of interface prototype object's @@unscopables property]
expected:
@ -1550,8 +1531,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling enqueue(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface: existence and properties of interface prototype object]
expected:
@ -1610,8 +1590,7 @@
if not domstreams: FAIL
[Stringification of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamDefaultReader interface: operation read()]
expected:
@ -1646,12 +1625,10 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "enqueue(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "error(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController interface: existence and properties of interface prototype object's "constructor" property]
expected:
@ -1666,8 +1643,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController must be primary interface of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController must be primary interface of self.readableByteStreamController]
expected:
@ -2067,8 +2043,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "terminate()" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: new WritableStream() must inherit property "locked" with the proper type]
expected:
@ -2091,8 +2066,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "desiredSize" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface object length]
expected:
@ -2175,8 +2149,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling error(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[WritableStream interface: existence and properties of interface prototype object's @@unscopables property]
expected:
@ -2235,8 +2208,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: calling enqueue(optional any) on self.transformStreamDefaultController with too few arguments must throw TypeError]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamBYOBReader interface: existence and properties of interface prototype object]
expected:
@ -2295,8 +2267,7 @@
if not domstreams: FAIL
[Stringification of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableStreamDefaultReader interface: operation read()]
expected:
@ -2331,12 +2302,10 @@
if not domstreams: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "enqueue(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[TransformStreamDefaultController interface: self.transformStreamDefaultController must inherit property "error(optional any)" with the proper type]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController interface: existence and properties of interface prototype object's "constructor" property]
expected:
@ -2351,8 +2320,7 @@
if not domstreams: FAIL
[TransformStreamDefaultController must be primary interface of self.transformStreamDefaultController]
expected:
if not domstreams: FAIL
expected: FAIL
[ReadableByteStreamController must be primary interface of self.readableByteStreamController]
expected:

Просмотреть файл

@ -11,6 +11,9 @@
[when controller.error is followed by a rejection, the error reason should come from controller.error]
expected: FAIL
[TransformStream constructor should throw when start does]
expected: FAIL
[when strategy.size throws inside start(), the constructor should throw the same error]
expected: FAIL
@ -53,9 +56,6 @@
[the readable should be errored with the reason passed to the writable abort() method]
expected: FAIL
[errored TransformStream should not enqueue new chunks]
expected: FAIL
[errors.any.serviceworker.html]
[TransformStream errors thrown in transform put the writable and readable in an errored state]
@ -70,6 +70,9 @@
[when controller.error is followed by a rejection, the error reason should come from controller.error]
expected: FAIL
[TransformStream constructor should throw when start does]
expected: FAIL
[when strategy.size throws inside start(), the constructor should throw the same error]
expected: FAIL
@ -112,9 +115,6 @@
[the readable should be errored with the reason passed to the writable abort() method]
expected: FAIL
[errored TransformStream should not enqueue new chunks]
expected: FAIL
[errors.any.worker.html]
[TransformStream errors thrown in transform put the writable and readable in an errored state]
@ -129,6 +129,9 @@
[when controller.error is followed by a rejection, the error reason should come from controller.error]
expected: FAIL
[TransformStream constructor should throw when start does]
expected: FAIL
[when strategy.size throws inside start(), the constructor should throw the same error]
expected: FAIL
@ -171,9 +174,6 @@
[the readable should be errored with the reason passed to the writable abort() method]
expected: FAIL
[errored TransformStream should not enqueue new chunks]
expected: FAIL
[errors.any.html]
[TransformStream errors thrown in transform put the writable and readable in an errored state]
@ -188,6 +188,9 @@
[when controller.error is followed by a rejection, the error reason should come from controller.error]
expected: FAIL
[TransformStream constructor should throw when start does]
expected: FAIL
[when strategy.size throws inside start(), the constructor should throw the same error]
expected: FAIL
@ -229,6 +232,3 @@
[the readable should be errored with the reason passed to the writable abort() method]
expected: FAIL
[errored TransformStream should not enqueue new chunks]
expected: FAIL

Просмотреть файл

@ -50,15 +50,12 @@
[terminate() should do nothing after readable.cancel()]
expected: FAIL
[start() should not be called twice]
expected: FAIL
[Subclassing TransformStream should work]
expected: FAIL
[enqueue() should throw after controller.terminate()]
expected: FAIL
[controller.terminate() should do nothing the second time it is called]
expected: FAIL
[general.any.html]
[TransformStream writable starts in the writable state]
@ -112,15 +109,12 @@
[terminate() should do nothing after readable.cancel()]
expected: FAIL
[start() should not be called twice]
expected: FAIL
[Subclassing TransformStream should work]
expected: FAIL
[enqueue() should throw after controller.terminate()]
expected: FAIL
[controller.terminate() should do nothing the second time it is called]
expected: FAIL
[general.any.worker.html]
[TransformStream writable starts in the writable state]
@ -174,15 +168,12 @@
[terminate() should do nothing after readable.cancel()]
expected: FAIL
[start() should not be called twice]
expected: FAIL
[Subclassing TransformStream should work]
expected: FAIL
[enqueue() should throw after controller.terminate()]
expected: FAIL
[controller.terminate() should do nothing the second time it is called]
expected: FAIL
[general.any.serviceworker.html]
[TransformStream writable starts in the writable state]
@ -236,11 +227,8 @@
[terminate() should do nothing after readable.cancel()]
expected: FAIL
[start() should not be called twice]
expected: FAIL
[Subclassing TransformStream should work]
expected: FAIL
[enqueue() should throw after controller.terminate()]
expected: FAIL
[controller.terminate() should do nothing the second time it is called]
expected: FAIL

Просмотреть файл

@ -1,4 +1,10 @@
[properties.any.worker.html]
[transformer method start should be called with the right number of arguments]
expected: FAIL
[transformer method start should be called even when it's located on the prototype chain]
expected: FAIL
[transformer method transform should be called with the right number of arguments]
expected: FAIL
@ -13,6 +19,12 @@
[properties.any.html]
[transformer method start should be called with the right number of arguments]
expected: FAIL
[transformer method start should be called even when it's located on the prototype chain]
expected: FAIL
[transformer method transform should be called with the right number of arguments]
expected: FAIL
@ -27,6 +39,12 @@
[properties.any.sharedworker.html]
[transformer method start should be called with the right number of arguments]
expected: FAIL
[transformer method start should be called even when it's located on the prototype chain]
expected: FAIL
[transformer method transform should be called with the right number of arguments]
expected: FAIL
@ -41,6 +59,12 @@
[properties.any.serviceworker.html]
[transformer method start should be called with the right number of arguments]
expected: FAIL
[transformer method start should be called even when it's located on the prototype chain]
expected: FAIL
[transformer method transform should be called with the right number of arguments]
expected: FAIL

Просмотреть файл

@ -14,6 +14,9 @@
[default readable strategy should be equivalent to { highWaterMark: 0 }]
expected: FAIL
[a RangeError should be thrown for an invalid highWaterMark]
expected: FAIL
[writableStrategy highWaterMark should be converted to a number]
expected: FAIL
@ -23,9 +26,6 @@
[a bad readableStrategy size function should error the stream on enqueue even when transformer.transform() catches the exception]
expected: FAIL
[readableStrategy highWaterMark should be converted to a number]
expected: FAIL
[strategies.any.serviceworker.html]
[writableStrategy highWaterMark should work]
@ -43,6 +43,9 @@
[default readable strategy should be equivalent to { highWaterMark: 0 }]
expected: FAIL
[a RangeError should be thrown for an invalid highWaterMark]
expected: FAIL
[writableStrategy highWaterMark should be converted to a number]
expected: FAIL
@ -52,9 +55,6 @@
[a bad readableStrategy size function should error the stream on enqueue even when transformer.transform() catches the exception]
expected: FAIL
[readableStrategy highWaterMark should be converted to a number]
expected: FAIL
[strategies.any.sharedworker.html]
[writableStrategy highWaterMark should work]
@ -72,6 +72,9 @@
[default readable strategy should be equivalent to { highWaterMark: 0 }]
expected: FAIL
[a RangeError should be thrown for an invalid highWaterMark]
expected: FAIL
[writableStrategy highWaterMark should be converted to a number]
expected: FAIL
@ -81,9 +84,6 @@
[a bad readableStrategy size function should error the stream on enqueue even when transformer.transform() catches the exception]
expected: FAIL
[readableStrategy highWaterMark should be converted to a number]
expected: FAIL
[strategies.any.worker.html]
[writableStrategy highWaterMark should work]
@ -101,6 +101,9 @@
[default readable strategy should be equivalent to { highWaterMark: 0 }]
expected: FAIL
[a RangeError should be thrown for an invalid highWaterMark]
expected: FAIL
[writableStrategy highWaterMark should be converted to a number]
expected: FAIL
@ -109,6 +112,3 @@
[a bad readableStrategy size function should error the stream on enqueue even when transformer.transform() catches the exception]
expected: FAIL
[readableStrategy highWaterMark should be converted to a number]
expected: FAIL

Просмотреть файл

@ -14,9 +14,6 @@
[controller.terminate() inside flush() should not prevent writer.close() from succeeding]
expected: FAIL
[controller.enqueue() should throw after controller.terminate()]
expected: FAIL
[terminate.any.worker.html]
[controller.terminate() should error pipeTo()]
@ -34,9 +31,6 @@
[controller.terminate() inside flush() should not prevent writer.close() from succeeding]
expected: FAIL
[controller.enqueue() should throw after controller.terminate()]
expected: FAIL
[terminate.any.serviceworker.html]
[controller.terminate() should error pipeTo()]
@ -54,9 +48,6 @@
[controller.terminate() inside flush() should not prevent writer.close() from succeeding]
expected: FAIL
[controller.enqueue() should throw after controller.terminate()]
expected: FAIL
[terminate.any.html]
[controller.terminate() should error pipeTo()]
@ -73,6 +64,3 @@
[controller.terminate() inside flush() should not prevent writer.close() from succeeding]
expected: FAIL
[controller.enqueue() should throw after controller.terminate()]
expected: FAIL