Backed out 6 changesets (bug 1486949) for causing hazard bustage on TextDecoderStream.cpp. CLOSED TREE

Backed out changeset e3dc48b94eef (bug 1486949)
Backed out changeset 57edeeebac29 (bug 1486949)
Backed out changeset f86c3b21e21c (bug 1486949)
Backed out changeset 862135f6c27f (bug 1486949)
Backed out changeset 8dd9f5b9e042 (bug 1486949)
Backed out changeset 7cb29e4feb27 (bug 1486949)
This commit is contained in:
Csoregi Natalia 2022-08-12 06:36:41 +03:00
Родитель 03daa81222
Коммит 3f2ae76b30
43 изменённых файлов: 1783 добавлений и 955 удалений

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

@ -717,6 +717,10 @@ DOMInterfaces = {
'implicitJSContext': ['close'],
},
'ReadableStreamDefaultReader': {
'implicitJSContext': ['read'],
},
'Request': {
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text' ],
},

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

@ -44,10 +44,8 @@ void TextDecoder::InitWithEncoding(NotNull<const Encoding*> aEncoding,
}
}
void TextDecoderCommon::DecodeNative(Span<const uint8_t> aInput,
const bool aStream,
nsAString& aOutDecodedString,
ErrorResult& aRv) {
void TextDecoder::Decode(Span<const uint8_t> aInput, const bool aStream,
nsAString& aOutDecodedString, ErrorResult& aRv) {
aOutDecodedString.Truncate();
CheckedInt<nsAString::size_type> needed =
@ -101,7 +99,7 @@ void TextDecoder::Decode(const Optional<ArrayBufferViewOrArrayBuffer>& aBuffer,
const TextDecodeOptions& aOptions,
nsAString& aOutDecodedString, ErrorResult& aRv) {
if (!aBuffer.WasPassed()) {
DecodeNative(nullptr, aOptions.mStream, aOutDecodedString, aRv);
Decode(nullptr, aOptions.mStream, aOutDecodedString, aRv);
return;
}
const ArrayBufferViewOrArrayBuffer& buf = aBuffer.Value();
@ -117,10 +115,10 @@ void TextDecoder::Decode(const Optional<ArrayBufferViewOrArrayBuffer>& aBuffer,
data = buf.GetAsArrayBuffer().Data();
length = buf.GetAsArrayBuffer().Length();
}
DecodeNative(Span(data, length), aOptions.mStream, aOutDecodedString, aRv);
Decode(Span(data, length), aOptions.mStream, aOutDecodedString, aRv);
}
void TextDecoderCommon::GetEncoding(nsAString& aEncoding) {
void TextDecoder::GetEncoding(nsAString& aEncoding) {
CopyASCIItoUTF16(mEncoding, aEncoding);
nsContentUtils::ASCIIToLower(aEncoding);
}

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

@ -18,47 +18,7 @@ namespace mozilla::dom {
class ArrayBufferViewOrArrayBuffer;
class TextDecoderCommon {
public:
/**
* Decodes incoming byte stream of characters in charset indicated by
* encoding.
*
* The encoding algorithm state is reset if aOptions.mStream is not set.
*
* If the fatal flag is set then a decoding error will throw EncodingError.
* Else the decoder will return a decoded string with replacement
* character(s) for unidentified character(s).
*
* @param aInput, incoming byte stream of characters to be decoded to
* to UTF-16 code points.
* @param aStream, indicates if streaming or not.
* @param aOutDecodedString, decoded string of UTF-16 code points.
* @param aRv, error result.
*/
void DecodeNative(mozilla::Span<const uint8_t> aInput, const bool aStream,
nsAString& aOutDecodedString, ErrorResult& aRv);
/**
* Return the encoding name.
*
* @param aEncoding, current encoding.
*/
void GetEncoding(nsAString& aEncoding);
bool Fatal() const { return mFatal; }
bool IgnoreBOM() const { return mIgnoreBOM; }
protected:
mozilla::UniquePtr<mozilla::Decoder> mDecoder;
nsCString mEncoding;
bool mFatal = false;
bool mIgnoreBOM = false;
};
class TextDecoder final : public NonRefcountedDOMObject,
public TextDecoderCommon {
class TextDecoder final : public NonRefcountedDOMObject {
public:
// The WebIDL constructor.
static TextDecoder* Constructor(const GlobalObject& aGlobal,
@ -73,7 +33,9 @@ class TextDecoder final : public NonRefcountedDOMObject,
return txtDecoder.release();
}
TextDecoder() { MOZ_COUNT_CTOR(TextDecoder); }
TextDecoder() : mFatal(false), mIgnoreBOM(false) {
MOZ_COUNT_CTOR(TextDecoder);
}
MOZ_COUNTED_DTOR(TextDecoder)
@ -102,11 +64,45 @@ class TextDecoder final : public NonRefcountedDOMObject,
void InitWithEncoding(NotNull<const Encoding*> aEncoding,
const TextDecoderOptions& aOptions);
/**
* Return the encoding name.
*
* @param aEncoding, current encoding.
*/
void GetEncoding(nsAString& aEncoding);
/**
* Decodes incoming byte stream of characters in charset indicated by
* encoding.
*
* The encoding algorithm state is reset if aOptions.mStream is not set.
*
* If the fatal flag is set then a decoding error will throw EncodingError.
* Else the decoder will return a decoded string with replacement
* character(s) for unidentified character(s).
*
* @param aView, incoming byte stream of characters to be decoded to
* to UTF-16 code points.
* @param aOptions, indicates if streaming or not.
* @param aOutDecodedString, decoded string of UTF-16 code points.
* @param aRv, error result.
*/
void Decode(mozilla::Span<const uint8_t> aInput, const bool aStream,
nsAString& aOutDecodedString, ErrorResult& aRv);
void Decode(const Optional<ArrayBufferViewOrArrayBuffer>& aBuffer,
const TextDecodeOptions& aOptions, nsAString& aOutDecodedString,
ErrorResult& aRv);
bool Fatal() const { return mFatal; }
bool IgnoreBOM() const { return mIgnoreBOM; }
private:
nsCString mEncoding;
mozilla::UniquePtr<mozilla::Decoder> mDecoder;
bool mFatal;
bool mIgnoreBOM;
};
} // namespace mozilla::dom

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

@ -1,245 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#include "mozilla/dom/TextDecoderStream.h"
#include "nsContentUtils.h"
#include "nsIGlobalObject.h"
#include "mozilla/Encoding.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/TextDecoderStreamBinding.h"
#include "mozilla/dom/TransformerCallbackHelpers.h"
#include "mozilla/dom/TransformStream.h"
#include "mozilla/dom/UnionTypes.h"
namespace mozilla::dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TextDecoderStream, mGlobal, mStream)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TextDecoderStream)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TextDecoderStream)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextDecoderStream)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
TextDecoderStream::TextDecoderStream(nsISupports* aGlobal,
const Encoding& aEncoding, bool aFatal,
bool aIgnoreBOM, TransformStream& aStream)
: mGlobal(aGlobal), mStream(&aStream) {
mFatal = aFatal;
mIgnoreBOM = aIgnoreBOM;
aEncoding.Name(mEncoding);
if (aIgnoreBOM) {
mDecoder = aEncoding.NewDecoderWithoutBOMHandling();
} else {
mDecoder = aEncoding.NewDecoderWithBOMRemoval();
}
}
TextDecoderStream::~TextDecoderStream() = default;
JSObject* TextDecoderStream::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return TextDecoderStream_Binding::Wrap(aCx, this, aGivenProto);
}
// TODO: This function should probably be generated by bindings layer. (Bug
// 1784266)
// TODO: This does not allow shared array buffers, just as the non-stream
// TextDecoder/Encoder don't. (Bug 1561594)
static Span<const uint8_t> ExtractSpanFromBufferSource(
JSContext* aCx, JS::Handle<JS::Value> aBufferSource, ErrorResult& aRv) {
if (!aBufferSource.isObject()) {
aRv.ThrowTypeError("Input is not an ArrayBuffer nor an ArrayBufferView");
return Span<const uint8_t>();
}
bool tryNext;
OwningArrayBufferViewOrArrayBuffer bufferSource;
if (bufferSource.TrySetToArrayBufferView(aCx, aBufferSource, tryNext,
false) &&
!tryNext) {
ArrayBufferView& view = bufferSource.GetAsArrayBufferView();
view.ComputeState();
return Span(view.Data(), view.Length());
}
if (!tryNext) {
aRv.MightThrowJSException();
aRv.StealExceptionFromJSContext(aCx);
return Span<const uint8_t>();
}
if (bufferSource.TrySetToArrayBuffer(aCx, aBufferSource, tryNext, false) &&
!tryNext) {
ArrayBuffer& buffer = bufferSource.GetAsArrayBuffer();
buffer.ComputeState();
return Span(buffer.Data(), buffer.Length());
}
if (!tryNext) {
aRv.MightThrowJSException();
aRv.StealExceptionFromJSContext(aCx);
return Span<const uint8_t>();
}
aRv.ThrowTypeError("Input is not an ArrayBuffer nor an ArrayBufferView");
return Span<const uint8_t>();
}
class TextDecoderStreamAlgorithms : public TransformerAlgorithmsWrapper {
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextDecoderStreamAlgorithms,
TransformerAlgorithmsBase)
void SetDecoderStream(TextDecoderStream& aStream) {
mDecoderStream = &aStream;
}
// The common part of decode-and-enqueue and flush-and-enqueue.
// Note that the most of the decoding algorithm is implemented in
// mozilla::Decoder, and this is mainly about calling it properly.
// https://encoding.spec.whatwg.org/#decode-and-enqueue-a-chunk
MOZ_CAN_RUN_SCRIPT void DecodeSpanAndEnqueue(
JSContext* aCx, Span<const uint8_t> aInput, bool aFlush,
TransformStreamDefaultController& aController, ErrorResult& aRv) {
CheckedInt<nsAString::size_type> needed =
mDecoderStream->Decoder()->MaxUTF16BufferLength(aInput.Length());
if (!needed.isValid()) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
nsString outDecodedString;
auto output = outDecodedString.GetMutableData(needed.value(), fallible);
if (!output) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
mDecoderStream->DecodeNative(aInput, !aFlush, outDecodedString, aRv);
if (aRv.Failed()) {
return;
}
if (outDecodedString.Length()) {
// Step 4.2. If outputChunk is non-empty, then enqueue outputChunk in
// decoders transform.
JS::Rooted<JS::Value> outputChunk(aCx);
if (!xpc::NonVoidStringToJsval(aCx, outDecodedString, &outputChunk)) {
JS_ClearPendingException(aCx);
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
aController.Enqueue(aCx, outputChunk, aRv);
}
}
// https://encoding.spec.whatwg.org/#dom-textdecoderstream
MOZ_CAN_RUN_SCRIPT void TransformCallbackImpl(
JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController,
ErrorResult& aRv) override {
// Step 7. Let transformAlgorithm be an algorithm which takes a chunk
// argument and runs the decode and enqueue a chunk algorithm with this and
// chunk.
// https://encoding.spec.whatwg.org/#decode-and-enqueue-a-chunk
AutoJSAPI jsapi;
if (!jsapi.Init(aController.GetParentObject())) {
aRv.ThrowUnknownError("Internal error");
return;
}
JSContext* cx = jsapi.cx();
// Step 1. Let bufferSource be the result of converting chunk to an
// [AllowShared] BufferSource.
// (But here we get a mozilla::Span instead)
Span<const uint8_t> input = ExtractSpanFromBufferSource(cx, aChunk, aRv);
if (aRv.Failed()) {
return;
}
DecodeSpanAndEnqueue(cx, input, false, aController, aRv);
}
// https://encoding.spec.whatwg.org/#dom-textdecoderstream
MOZ_CAN_RUN_SCRIPT void FlushCallbackImpl(
TransformStreamDefaultController& aController,
ErrorResult& aRv) override {
// Step 8. Let flushAlgorithm be an algorithm which takes no arguments and
// runs the flush and enqueue algorithm with this.
AutoJSAPI jsapi;
if (!jsapi.Init(aController.GetParentObject())) {
aRv.ThrowUnknownError("Internal error");
return;
}
JSContext* cx = jsapi.cx();
// https://encoding.spec.whatwg.org/#flush-and-enqueue
// (The flush and enqueue algorithm is basically a subset of decode and
// enqueue one, so let's reuse it)
DecodeSpanAndEnqueue(cx, Span<const uint8_t>(), true, aController, aRv);
}
private:
~TextDecoderStreamAlgorithms() override = default;
RefPtr<TextDecoderStream> mDecoderStream;
};
NS_IMPL_CYCLE_COLLECTION_INHERITED(TextDecoderStreamAlgorithms,
TransformerAlgorithmsBase, mDecoderStream)
NS_IMPL_ADDREF_INHERITED(TextDecoderStreamAlgorithms, TransformerAlgorithmsBase)
NS_IMPL_RELEASE_INHERITED(TextDecoderStreamAlgorithms,
TransformerAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextDecoderStreamAlgorithms)
NS_INTERFACE_MAP_END_INHERITING(TransformerAlgorithmsBase)
// https://encoding.spec.whatwg.org/#dom-textdecoderstream
already_AddRefed<TextDecoderStream> TextDecoderStream::Constructor(
const GlobalObject& aGlobal, const nsAString& aLabel,
const TextDecoderOptions& aOptions, ErrorResult& aRv) {
// Step 1. Let encoding be the result of getting an encoding from label.
const Encoding* encoding = Encoding::ForLabelNoReplacement(aLabel);
// Step 2. If encoding is failure or replacement, then throw a RangeError
if (!encoding) {
NS_ConvertUTF16toUTF8 label(aLabel);
label.Trim(" \t\n\f\r");
aRv.ThrowRangeError<MSG_ENCODING_NOT_SUPPORTED>(label);
return nullptr;
}
// Step 3-6. (Done in the constructor)
// Step 7-8.
auto algorithms = MakeRefPtr<TextDecoderStreamAlgorithms>();
// Step 9-10.
RefPtr<TransformStream> transformStream =
TransformStream::CreateGeneric(aGlobal, *algorithms, aRv);
if (aRv.Failed()) {
return nullptr;
}
// Step 11. (Done in the constructor)
auto decoderStream = MakeRefPtr<TextDecoderStream>(
aGlobal.GetAsSupports(), *encoding, aOptions.mFatal, aOptions.mIgnoreBOM,
*transformStream);
algorithms->SetDecoderStream(*decoderStream);
return decoderStream.forget();
}
ReadableStream* TextDecoderStream::Readable() const {
return mStream->Readable();
}
WritableStream* TextDecoderStream::Writable() const {
return mStream->Writable();
}
} // namespace mozilla::dom

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

@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 DOM_ENCODING_TEXTDECODERSTREAM_H_
#define DOM_ENCODING_TEXTDECODERSTREAM_H_
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/TextDecoder.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
class nsIGlobalObject;
namespace mozilla {
class Decoder;
class Encoding;
namespace dom {
class ReadableStream;
class WritableStream;
struct TextDecoderOptions;
class TransformStream;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
class TextDecoderStream final : public nsISupports,
public nsWrapperCache,
public TextDecoderCommon {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextDecoderStream)
public:
TextDecoderStream(nsISupports* aGlobal, const Encoding& aEncoding,
bool aFatal, bool aIgnoreBOM, TransformStream& aStream);
nsISupports* GetParentObject() const { return mGlobal; }
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
mozilla::Decoder* Decoder() { return mDecoder.get(); }
// TODO: Mark as MOZ_CAN_RUN_SCRIPT when IDL constructors can be (bug 1749042)
MOZ_CAN_RUN_SCRIPT_BOUNDARY static already_AddRefed<TextDecoderStream>
Constructor(const GlobalObject& aGlobal, const nsAString& aLabel,
const TextDecoderOptions& aOptions, ErrorResult& aRv);
ReadableStream* Readable() const;
WritableStream* Writable() const;
private:
~TextDecoderStream();
nsCOMPtr<nsISupports> mGlobal;
RefPtr<TransformStream> mStream;
};
} // namespace mozilla::dom
#endif // DOM_ENCODING_TEXTDECODERSTREAM_H_

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

@ -1,230 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#include "mozilla/dom/TextEncoderStream.h"
#include "js/ArrayBuffer.h"
#include "js/experimental/TypedData.h"
#include "nsIGlobalObject.h"
#include "mozilla/Encoding.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/TextEncoderStreamBinding.h"
#include "mozilla/dom/TransformerCallbackHelpers.h"
#include "mozilla/dom/TransformStream.h"
namespace mozilla::dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TextEncoderStream, mGlobal, mStream)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TextEncoderStream)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TextEncoderStream)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextEncoderStream)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
TextEncoderStream::TextEncoderStream(nsISupports* aGlobal,
TransformStream& aStream)
: mGlobal(aGlobal), mStream(&aStream) {
// See the comment in EncodeNative() about why this uses a decoder instead of
// `UTF_8_ENCODING->NewEncoder()`.
mDecoder = UTF_16LE_ENCODING->NewDecoder();
}
TextEncoderStream::~TextEncoderStream() = default;
JSObject* TextEncoderStream::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return TextEncoderStream_Binding::Wrap(aCx, this, aGivenProto);
}
// Note that the most of the encoding algorithm is implemented in
// mozilla::Decoder (see the comment in EncodeNative()), and this is mainly
// about calling it properly.
static void EncodeNative(JSContext* aCx, mozilla::Decoder* aDecoder,
Span<const char16_t> aInput, const bool aFlush,
JS::MutableHandle<JSObject*> aOutputArrayBufferView,
ErrorResult& aRv) {
// Adjust the length since Decoder always accepts uint8_t (whereas Encoder
// also accepts char16_t, see below).
if (aInput.Length() > SIZE_MAX / 2) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
size_t lengthU8 = aInput.Length() * 2;
CheckedInt<nsAString::size_type> needed =
aDecoder->MaxUTF8BufferLength(lengthU8);
if (!needed.isValid()) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
UniquePtr<uint8_t> buffer(
static_cast<uint8_t*>(JS_malloc(aCx, needed.value())));
if (!buffer) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
mozilla::Span<uint8_t> input((uint8_t*)aInput.data(), lengthU8);
mozilla::Span<uint8_t> output(buffer, needed.value());
// This originally wanted to use mozilla::Encoder::Encode() that accepts
// char16_t*, but it lacks the pending-high-surrogate feature to properly
// implement
// https://encoding.spec.whatwg.org/#convert-code-unit-to-scalar-value.
// See also https://github.com/hsivonen/encoding_rs/issues/82 about the
// reasoning.
// The code is a bit more verbose here since we need to convert to
// uint8_t* which is the only type mozilla::Decoder accepts.
uint32_t result;
size_t read;
size_t written;
std::tie(result, read, written, std::ignore) =
aDecoder->DecodeToUTF8(input, output, aFlush);
MOZ_ASSERT(result == kInputEmpty);
MOZ_ASSERT(read == lengthU8);
MOZ_ASSERT(written <= needed.value());
// https://encoding.spec.whatwg.org/#encode-and-enqueue-a-chunk
// Step 4.2.2.1. Let chunk be a Uint8Array object wrapping an ArrayBuffer
// containing output.
JS::Rooted<JSObject*> arrayBuffer(
aCx, JS::NewArrayBufferWithContents(aCx, written, buffer.release()));
if (!arrayBuffer.get()) {
JS_ClearPendingException(aCx);
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
aOutputArrayBufferView.set(JS_NewUint8ArrayWithBuffer(
aCx, arrayBuffer, 0, static_cast<int64_t>(written)));
}
class TextEncoderStreamAlgorithms : public TransformerAlgorithmsWrapper {
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextEncoderStreamAlgorithms,
TransformerAlgorithmsBase)
void SetEncoderStream(TextEncoderStream& aStream) {
mEncoderStream = &aStream;
}
// The common part of encode-and-enqueue and encode-and-flush.
// https://encoding.spec.whatwg.org/#decode-and-enqueue-a-chunk
MOZ_CAN_RUN_SCRIPT void EncodeAndEnqueue(
JSContext* aCx, const nsAString& aInput,
TransformStreamDefaultController& aController, bool aFlush,
ErrorResult& aRv) {
JS::Rooted<JSObject*> outView(aCx);
// Passing a Decoder for a reason, see the comments in the method.
EncodeNative(aCx, mEncoderStream->Decoder(), aInput, aFlush, &outView, aRv);
if (JS_GetTypedArrayLength(outView) > 0) {
// Step 4.2.2.2. Enqueue chunk into encoders transform.
JS::Rooted<JS::Value> value(aCx, JS::ObjectValue(*outView));
aController.Enqueue(aCx, value, aRv);
}
}
// https://encoding.spec.whatwg.org/#dom-textencoderstream
MOZ_CAN_RUN_SCRIPT void TransformCallbackImpl(
JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController,
ErrorResult& aRv) override {
// Step 2. Let transformAlgorithm be an algorithm which takes a chunk
// argument and runs the encode and enqueue a chunk algorithm with this and
// chunk.
AutoJSAPI jsapi;
if (!jsapi.Init(aController.GetParentObject())) {
aRv.ThrowUnknownError("Internal error");
return;
}
JSContext* cx = jsapi.cx();
// https://encoding.spec.whatwg.org/#encode-and-enqueue-a-chunk
// Step 1. Let input be the result of converting chunk to a DOMString.
// Step 2. Convert input to an I/O queue of code units.
nsString str;
if (!ConvertJSValueToString(cx, aChunk, eStringify, eStringify, str)) {
aRv.MightThrowJSException();
aRv.StealExceptionFromJSContext(cx);
return;
}
EncodeAndEnqueue(cx, str, aController, false, aRv);
}
// https://encoding.spec.whatwg.org/#dom-textencoderstream
MOZ_CAN_RUN_SCRIPT void FlushCallbackImpl(
TransformStreamDefaultController& aController,
ErrorResult& aRv) override {
// Step 3. Let flushAlgorithm be an algorithm which runs the encode and
// flush algorithm with this.
AutoJSAPI jsapi;
if (!jsapi.Init(aController.GetParentObject())) {
aRv.ThrowUnknownError("Internal error");
return;
}
JSContext* cx = jsapi.cx();
// The spec manually manages pending high surrogate here, but let's call the
// encoder as it's managed there.
EncodeAndEnqueue(cx, u""_ns, aController, true, aRv);
}
private:
~TextEncoderStreamAlgorithms() override = default;
RefPtr<TextEncoderStream> mEncoderStream;
};
NS_IMPL_CYCLE_COLLECTION_INHERITED(TextEncoderStreamAlgorithms,
TransformerAlgorithmsBase, mEncoderStream)
NS_IMPL_ADDREF_INHERITED(TextEncoderStreamAlgorithms, TransformerAlgorithmsBase)
NS_IMPL_RELEASE_INHERITED(TextEncoderStreamAlgorithms,
TransformerAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextEncoderStreamAlgorithms)
NS_INTERFACE_MAP_END_INHERITING(TransformerAlgorithmsBase)
// https://encoding.spec.whatwg.org/#dom-textencoderstream
already_AddRefed<TextEncoderStream> TextEncoderStream::Constructor(
const GlobalObject& aGlobal, ErrorResult& aRv) {
// Step 1. Set thiss encoder to an instance of the UTF-8 encoder.
// Step 2-3
auto algorithms = MakeRefPtr<TextEncoderStreamAlgorithms>();
// Step 4-5
RefPtr<TransformStream> transformStream =
TransformStream::CreateGeneric(aGlobal, *algorithms, aRv);
if (aRv.Failed()) {
return nullptr;
}
// Step 6. Set thiss transform to transformStream.
// (Done in the constructor)
auto encoderStream =
MakeRefPtr<TextEncoderStream>(aGlobal.GetAsSupports(), *transformStream);
algorithms->SetEncoderStream(*encoderStream);
return encoderStream.forget();
}
ReadableStream* TextEncoderStream::Readable() const {
return mStream->Readable();
}
WritableStream* TextEncoderStream::Writable() const {
return mStream->Writable();
}
void TextEncoderStream::GetEncoding(nsCString& aRetVal) const {
aRetVal.AssignLiteral("utf-8");
}
} // namespace mozilla::dom

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

@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 DOM_ENCODING_TEXTENCODERSTREAM_H_
#define DOM_ENCODING_TEXTENCODERSTREAM_H_
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
class nsIGlobalObject;
namespace mozilla {
class Decoder;
namespace dom {
class ReadableStream;
class WritableStream;
class TransformStream;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
class TextEncoderStream final : public nsISupports, public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextEncoderStream)
public:
TextEncoderStream(nsISupports* aGlobal, TransformStream& aStream);
nsISupports* GetParentObject() const { return mGlobal; }
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
mozilla::Decoder* Decoder() { return mDecoder.get(); }
// TODO: Mark as MOZ_CAN_RUN_SCRIPT when IDL constructors can be (bug 1749042)
MOZ_CAN_RUN_SCRIPT_BOUNDARY static already_AddRefed<TextEncoderStream>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
ReadableStream* Readable() const;
WritableStream* Writable() const;
void GetEncoding(nsCString& aRetVal) const;
private:
~TextEncoderStream();
nsCOMPtr<nsISupports> mGlobal;
RefPtr<TransformStream> mStream;
mozilla::UniquePtr<mozilla::Decoder> mDecoder;
};
} // namespace mozilla::dom
#endif // DOM_ENCODING_TEXTENCODERSTREAM_H_

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

@ -9,16 +9,12 @@ with Files("**"):
EXPORTS.mozilla.dom += [
"TextDecoder.h",
"TextDecoderStream.h",
"TextEncoder.h",
"TextEncoderStream.h",
]
UNIFIED_SOURCES += [
"TextDecoder.cpp",
"TextDecoderStream.cpp",
"TextEncoder.cpp",
"TextEncoderStream.cpp",
]
FINAL_LIBRARY = "xul"

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

@ -327,12 +327,8 @@ let interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextDecoder",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextDecoderStream",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextEncoder",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextEncoderStream",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextMetrics",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TransformStream",

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

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ReadableStreamDefaultReader.h"
#include "mozilla/dom/AutoEntryScript.h"
#include "mozilla/dom/ReadableStream.h"
#include "mozilla/dom/RootedDictionary.h"
#include "js/PropertyAndElement.h"
@ -239,7 +238,8 @@ void ReadableStreamDefaultReaderRead(JSContext* aCx,
// Return a raw pointer here to avoid refcounting, but make sure it's safe
// (the object should be kept alive by the callee).
// https://streams.spec.whatwg.org/#default-reader-read
already_AddRefed<Promise> ReadableStreamDefaultReader::Read(ErrorResult& aRv) {
already_AddRefed<Promise> ReadableStreamDefaultReader::Read(JSContext* aCx,
ErrorResult& aRv) {
// Step 1.
if (!mStream) {
aRv.ThrowTypeError("Reading is not possible after calling releaseLock.");
@ -253,10 +253,7 @@ already_AddRefed<Promise> ReadableStreamDefaultReader::Read(ErrorResult& aRv) {
RefPtr<ReadRequest> request = new Read_ReadRequest(promise);
// Step 4.
AutoEntryScript aes(mGlobal, "ReadableStreamDefaultReader::Read");
JSContext* cx = aes.cx();
ReadableStreamDefaultReaderRead(cx, this, request, aRv);
ReadableStreamDefaultReaderRead(aCx, this, request, aRv);
if (aRv.Failed()) {
return nullptr;
}

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

@ -75,7 +75,8 @@ class ReadableStreamDefaultReader final : public ReadableStreamGenericReader,
static already_AddRefed<ReadableStreamDefaultReader> Constructor(
const GlobalObject& aGlobal, ReadableStream& stream, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> Read(ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> Read(JSContext* aCx,
ErrorResult& aRv);
void ReleaseLock(ErrorResult& aRv);

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

@ -40,63 +40,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransformStream)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
// https://streams.spec.whatwg.org/#transformstream-set-up
// (except this instead creates a new TransformStream rather than accepting an
// existing instance)
already_AddRefed<TransformStream> TransformStream::CreateGeneric(
const GlobalObject& aGlobal, TransformerAlgorithmsWrapper& aAlgorithms,
ErrorResult& aRv) {
// Step 1. Let writableHighWaterMark be 1.
double writableHighWaterMark = 1;
// Step 2. Let writableSizeAlgorithm be an algorithm that returns 1.
// Note: Callers should recognize nullptr as a callback that returns 1. See
// also WritableStream::Constructor for this design decision.
RefPtr<QueuingStrategySize> writableSizeAlgorithm;
// Step 3. Let readableHighWaterMark be 0.
double readableHighWaterMark = 0;
// Step 4. Let readableSizeAlgorithm be an algorithm that returns 1.
// Note: Callers should recognize nullptr as a callback that returns 1. See
// also ReadableStream::Constructor for this design decision.
RefPtr<QueuingStrategySize> readableSizeAlgorithm;
// Step 5. Let transformAlgorithmWrapper be an algorithm that runs these steps
// given a value chunk:
// Step 6. Let flushAlgorithmWrapper be an algorithm that runs these steps:
// (Done by TransformerAlgorithmsWrapper)
// Step 7. Let startPromise be a promise resolved with undefined.
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<Promise> startPromise =
Promise::CreateResolvedWithUndefined(global, aRv);
if (!startPromise) {
return nullptr;
}
// Step 8. Perform ! InitializeTransformStream(stream, startPromise,
// writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,
// readableSizeAlgorithm).
auto stream = MakeRefPtr<TransformStream>(global, nullptr, nullptr);
stream->Initialize(aGlobal.Context(), startPromise, writableHighWaterMark,
writableSizeAlgorithm, readableHighWaterMark,
readableSizeAlgorithm, aRv);
if (aRv.Failed()) {
return nullptr;
}
// Step 9. Let controller be a new TransformStreamDefaultController.
auto controller = MakeRefPtr<TransformStreamDefaultController>(global);
// Step 10. Perform ! SetUpTransformStreamDefaultController(stream,
// controller, transformAlgorithmWrapper, flushAlgorithmWrapper).
SetUpTransformStreamDefaultController(aGlobal.Context(), *stream, *controller,
aAlgorithms);
return stream.forget();
}
TransformStream::TransformStream(nsIGlobalObject* aGlobal) : mGlobal(aGlobal) {
mozilla::HoldJSObjects(this);
}
@ -137,7 +80,7 @@ void TransformStreamErrorWritableAndUnblockWrite(JSContext* aCx,
// Step 3: If stream.[[backpressure]] is true, perform !
// TransformStreamSetBackpressure(stream, false).
if (aStream->Backpressure()) {
aStream->SetBackpressure(false, aRv);
TransformStreamSetBackpressure(aStream, false, aRv);
}
}
@ -164,7 +107,7 @@ TransformStreamDefaultControllerPerformTransform(
JS::Handle<JS::Value> aChunk, ErrorResult& aRv) {
// Step 1: Let transformPromise be the result of performing
// controller.[[transformAlgorithm]], passing chunk.
RefPtr<TransformerAlgorithmsBase> algorithms = aController->Algorithms();
RefPtr<TransformerAlgorithms> algorithms = aController->Algorithms();
RefPtr<Promise> transformPromise =
algorithms->TransformCallback(aCx, aChunk, *aController, aRv);
if (aRv.Failed()) {
@ -337,7 +280,7 @@ class TransformStreamUnderlyingSinkAlgorithms final
// Step 3: Let flushPromise be the result of performing
// controller.[[flushAlgorithm]].
RefPtr<TransformerAlgorithmsBase> algorithms = controller->Algorithms();
RefPtr<TransformerAlgorithms> algorithms = controller->Algorithms();
RefPtr<Promise> flushPromise =
algorithms->FlushCallback(aCx, *controller, aRv);
if (aRv.Failed()) {
@ -460,7 +403,7 @@ class TransformStreamUnderlyingSourceAlgorithms final
MOZ_ASSERT(mStream->BackpressureChangePromise());
// Step 3: Perform ! TransformStreamSetBackpressure(stream, false).
mStream->SetBackpressure(false, aRv);
TransformStreamSetBackpressure(mStream, false, aRv);
// Step 4: Return stream.[[backpressureChangePromise]].
return do_AddRef(mStream->BackpressureChangePromise());
@ -508,25 +451,26 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
NS_INTERFACE_MAP_END_INHERITING(TransformStreamUnderlyingSourceAlgorithms)
// https://streams.spec.whatwg.org/#transform-stream-set-backpressure
void TransformStream::SetBackpressure(bool aBackpressure, ErrorResult& aRv) {
void TransformStreamSetBackpressure(TransformStream* aStream,
bool aBackpressure, ErrorResult& aRv) {
// Step 1. Assert: stream.[[backpressure]] is not backpressure.
MOZ_ASSERT(Backpressure() != aBackpressure);
MOZ_ASSERT(aStream->Backpressure() != aBackpressure);
// Step 2. If stream.[[backpressureChangePromise]] is not undefined, resolve
// stream.[[backpressureChangePromise]] with undefined.
if (Promise* promise = BackpressureChangePromise()) {
if (Promise* promise = aStream->BackpressureChangePromise()) {
promise->MaybeResolveWithUndefined();
}
// Step 3. Set stream.[[backpressureChangePromise]] to a new promise.
RefPtr<Promise> promise = Promise::Create(GetParentObject(), aRv);
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
if (aRv.Failed()) {
return;
}
mBackpressureChangePromise = promise;
aStream->SetBackpressureChangePromise(promise);
// Step 4. Set stream.[[backpressure]] to backpressure.
mBackpressure = aBackpressure;
aStream->SetBackpressure(aBackpressure);
}
// https://streams.spec.whatwg.org/#initialize-transform-stream
@ -574,7 +518,7 @@ void TransformStream::Initialize(JSContext* aCx, Promise* aStartPromise,
mBackpressureChangePromise = nullptr;
// Step 10. Perform ! TransformStreamSetBackpressure(stream, true).
SetBackpressure(true, aRv);
TransformStreamSetBackpressure(this, true, aRv);
if (aRv.Failed()) {
return;
}
@ -704,4 +648,12 @@ already_AddRefed<TransformStream> TransformStream::Constructor(
return transformStream.forget();
}
already_AddRefed<ReadableStream> TransformStream::GetReadable() {
return mReadable.forget();
}
already_AddRefed<WritableStream> TransformStream::GetWritable() {
return mWritable.forget();
}
} // namespace mozilla::dom

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

@ -21,26 +21,22 @@ class WritableStream;
class ReadableStream;
class UniqueMessagePortId;
class MessagePort;
class TransformerAlgorithmsWrapper;
class TransformStream final : public nsISupports, public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TransformStream)
// https://streams.spec.whatwg.org/#transformstream-set-up
// Intended to be used by interfaces using GenericTransformStream mixin.
MOZ_CAN_RUN_SCRIPT static already_AddRefed<TransformStream> CreateGeneric(
const GlobalObject& aGlobal, TransformerAlgorithmsWrapper& aAlgorithms,
ErrorResult& aRv);
TransformStream(nsIGlobalObject* aGlobal, ReadableStream* aReadable,
WritableStream* aWritable);
// Internal slot accessors
bool Backpressure() const { return mBackpressure; }
void SetBackpressure(bool aBackpressure) { mBackpressure = aBackpressure; }
Promise* BackpressureChangePromise() { return mBackpressureChangePromise; }
void SetBackpressure(bool aBackpressure, ErrorResult& aRv);
void SetBackpressureChangePromise(Promise* aPromise) {
mBackpressureChangePromise = aPromise;
}
MOZ_KNOWN_LIVE TransformStreamDefaultController* Controller() {
return mController;
}
@ -48,6 +44,8 @@ class TransformStream final : public nsISupports, public nsWrapperCache {
MOZ_ASSERT(!mController);
mController = &aController;
}
MOZ_KNOWN_LIVE ReadableStream* Readable() { return mReadable; }
MOZ_KNOWN_LIVE WritableStream* Writable() { return mWritable; }
// [Transferable]
// https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps
@ -82,8 +80,8 @@ class TransformStream final : public nsISupports, public nsWrapperCache {
const QueuingStrategy& aWritableStrategy,
const QueuingStrategy& aReadableStrategy, ErrorResult& aRv);
ReadableStream* Readable() const { return mReadable; }
WritableStream* Writable() const { return mWritable; }
already_AddRefed<ReadableStream> GetReadable();
already_AddRefed<WritableStream> GetWritable();
private:
nsCOMPtr<nsIGlobalObject> mGlobal;
@ -106,6 +104,9 @@ MOZ_CAN_RUN_SCRIPT void TransformStreamError(JSContext* aCx,
JS::Handle<JS::Value> aError,
ErrorResult& aRv);
void TransformStreamSetBackpressure(TransformStream* aStream,
bool aBackpressure, ErrorResult& aRv);
} // namespace mozilla::dom
#endif // DOM_STREAMS_TRANSFORMSTREAM_H_

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

@ -33,12 +33,12 @@ void TransformStreamDefaultController::SetStream(TransformStream& aStream) {
mStream = &aStream;
}
TransformerAlgorithmsBase* TransformStreamDefaultController::Algorithms() {
TransformerAlgorithms* TransformStreamDefaultController::Algorithms() {
return mTransformerAlgorithms;
}
void TransformStreamDefaultController::SetAlgorithms(
TransformerAlgorithmsBase* aTransformerAlgorithms) {
TransformerAlgorithms* aTransformerAlgorithms) {
mTransformerAlgorithms = aTransformerAlgorithms;
}
@ -139,8 +139,8 @@ void TransformStreamDefaultController::Enqueue(JSContext* aCx,
// Step 7.1: Assert: backpressure is true.
MOZ_ASSERT(backpressure);
// Step 7.2: Perform ! TransformStreamSetBackpressure(true).
stream->SetBackpressure(true, aRv);
// Step 7.2: Perform ! TransformStreamSetBackpressure(stream, true).
TransformStreamSetBackpressure(stream, true, aRv);
}
}
@ -196,7 +196,7 @@ void TransformStreamDefaultController::Terminate(JSContext* aCx,
void SetUpTransformStreamDefaultController(
JSContext* aCx, TransformStream& aStream,
TransformStreamDefaultController& aController,
TransformerAlgorithmsBase& aTransformerAlgorithms) {
TransformerAlgorithms& aTransformerAlgorithms) {
// Step 1. Assert: stream implements TransformStream.
// Step 2. Assert: stream.[[controller]] is undefined.
MOZ_ASSERT(!aStream.Controller());

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

@ -19,7 +19,7 @@
namespace mozilla::dom {
class TransformStream;
class TransformerAlgorithmsBase;
class TransformerAlgorithms;
class TransformStreamDefaultController final : public nsISupports,
public nsWrapperCache {
@ -29,8 +29,8 @@ class TransformStreamDefaultController final : public nsISupports,
MOZ_KNOWN_LIVE TransformStream* Stream();
void SetStream(TransformStream& aStream);
TransformerAlgorithmsBase* Algorithms();
void SetAlgorithms(TransformerAlgorithmsBase* aTransformerAlgorithms);
TransformerAlgorithms* Algorithms();
void SetAlgorithms(TransformerAlgorithms* aTransformerAlgorithms);
explicit TransformStreamDefaultController(nsIGlobalObject* aGlobal);
@ -55,14 +55,9 @@ class TransformStreamDefaultController final : public nsISupports,
// Internal slots
RefPtr<TransformStream> mStream;
RefPtr<TransformerAlgorithmsBase> mTransformerAlgorithms;
RefPtr<TransformerAlgorithms> mTransformerAlgorithms;
};
void SetUpTransformStreamDefaultController(
JSContext* aCx, TransformStream& aStream,
TransformStreamDefaultController& aController,
TransformerAlgorithmsBase& aTransformerAlgorithms);
void SetUpTransformStreamDefaultControllerFromTransformer(
JSContext* aCx, TransformStream& aStream,
JS::Handle<JSObject*> aTransformer, Transformer& aTransformerDict);

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

@ -11,20 +11,12 @@
using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION(TransformerAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TransformerAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TransformerAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransformerAlgorithmsBase)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_INHERITED_WITH_JS_MEMBERS(
TransformerAlgorithms, TransformerAlgorithmsBase,
(mGlobal, mTransformCallback, mFlushCallback), (mTransformer))
NS_IMPL_ADDREF_INHERITED(TransformerAlgorithms, TransformerAlgorithmsBase)
NS_IMPL_RELEASE_INHERITED(TransformerAlgorithms, TransformerAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransformerAlgorithms)
NS_INTERFACE_MAP_END_INHERITING(TransformerAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTION_WITH_JS_MEMBERS(TransformerAlgorithms,
(mGlobal, mTransformCallback,
mFlushCallback),
(mTransformer))
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(TransformerAlgorithms, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(TransformerAlgorithms, Release)
// https://streams.spec.whatwg.org/#set-up-transform-stream-default-controller-from-transformer
already_AddRefed<Promise> TransformerAlgorithms::TransformCallback(
@ -83,47 +75,3 @@ already_AddRefed<Promise> TransformerAlgorithms::FlushCallback(
"TransformStreamDefaultController.[[flushAlgorithm]]",
CallbackObject::eRethrowExceptions);
}
// https://streams.spec.whatwg.org/#transformstream-set-up
// Step 5 and 6.
template <typename T>
MOZ_CAN_RUN_SCRIPT static already_AddRefed<Promise> Promisify(
nsIGlobalObject* aGlobal, T aFunc, mozilla::ErrorResult& aRv) {
// Step 1. Let result be the result of running (algorithm). If this throws an
// exception e, return a promise rejected with e.
aFunc(aRv);
if (aRv.Failed()) {
return Promise::CreateRejectedWithErrorResult(aGlobal, aRv);
}
// Step 2. If result is a Promise, then return result.
// (This supports no return value since currently no subclass needs one)
// Step 3. Return a promise resolved with undefined.
return Promise::CreateResolvedWithUndefined(aGlobal, aRv);
}
already_AddRefed<Promise> TransformerAlgorithmsWrapper::TransformCallback(
JSContext*, JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController, ErrorResult& aRv) {
nsCOMPtr<nsIGlobalObject> global = aController.GetParentObject();
return Promisify(
global,
[this, &aChunk, &aController](ErrorResult& aRv)
MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
return TransformCallbackImpl(aChunk, aController, aRv);
},
aRv);
}
already_AddRefed<Promise> TransformerAlgorithmsWrapper::FlushCallback(
JSContext*, TransformStreamDefaultController& aController,
ErrorResult& aRv) {
nsCOMPtr<nsIGlobalObject> global = aController.GetParentObject();
return Promisify(
global,
[this, &aController](ErrorResult& aRv) MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
return FlushCallbackImpl(aController, aRv);
},
aRv);
}

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

@ -15,29 +15,11 @@ namespace mozilla::dom {
class Promise;
class TransformerAlgorithmsBase : public nsISupports {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(TransformerAlgorithmsBase)
MOZ_CAN_RUN_SCRIPT virtual already_AddRefed<Promise> TransformCallback(
JSContext* aCx, JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController, ErrorResult& aRv) = 0;
MOZ_CAN_RUN_SCRIPT virtual already_AddRefed<Promise> FlushCallback(
JSContext* aCx, TransformStreamDefaultController& aController,
ErrorResult& aRv) = 0;
protected:
virtual ~TransformerAlgorithmsBase() = default;
};
// https://streams.spec.whatwg.org/#set-up-transform-stream-default-controller-from-transformer
class TransformerAlgorithms final : public TransformerAlgorithmsBase {
class TransformerAlgorithms final {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
TransformerAlgorithms, TransformerAlgorithmsBase)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(TransformerAlgorithms)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(TransformerAlgorithms)
TransformerAlgorithms(nsIGlobalObject* aGlobal,
JS::Handle<JSObject*> aTransformer,
@ -60,11 +42,11 @@ class TransformerAlgorithms final : public TransformerAlgorithmsBase {
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> TransformCallback(
JSContext* aCx, JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController, ErrorResult& aRv) override;
TransformStreamDefaultController& aController, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> FlushCallback(
JSContext* aCx, TransformStreamDefaultController& aController,
ErrorResult& aRv) override;
ErrorResult& aRv);
protected:
~TransformerAlgorithms() { mozilla::DropJSObjects(this); }
@ -77,24 +59,6 @@ class TransformerAlgorithms final : public TransformerAlgorithmsBase {
MOZ_KNOWN_LIVE RefPtr<TransformerFlushCallback> mFlushCallback;
};
// https://streams.spec.whatwg.org/#transformstream-set-up
class TransformerAlgorithmsWrapper : public TransformerAlgorithmsBase {
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> TransformCallback(
JSContext*, JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController, ErrorResult& aRv) final;
MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> FlushCallback(
JSContext*, TransformStreamDefaultController& aController,
ErrorResult& aRv) final;
MOZ_CAN_RUN_SCRIPT virtual void TransformCallbackImpl(
JS::Handle<JS::Value> aChunk,
TransformStreamDefaultController& aController, ErrorResult& aRv) = 0;
MOZ_CAN_RUN_SCRIPT virtual void FlushCallbackImpl(
TransformStreamDefaultController& aController, ErrorResult& aRv) = 0;
};
} // namespace mozilla::dom
#endif // DOM_STREAMS_TRANSFORMERCALLBACKHELPERS_H_

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

@ -14,6 +14,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(UnderlyingSinkAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(UnderlyingSinkAlgorithmsBase)
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,

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

@ -26,7 +26,7 @@ class WritableStreamDefaultController;
class UnderlyingSinkAlgorithmsBase : public nsISupports {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(UnderlyingSinkAlgorithmsBase)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(UnderlyingSinkAlgorithmsBase)
MOZ_CAN_RUN_SCRIPT virtual void StartCallback(
JSContext* aCx, WritableStreamDefaultController& aController,

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

@ -17,6 +17,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(UnderlyingSourceAlgorithmsBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(UnderlyingSourceAlgorithmsBase)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(UnderlyingSourceAlgorithmsBase)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_INHERITED_WITH_JS_MEMBERS(
UnderlyingSourceAlgorithms, UnderlyingSourceAlgorithmsBase,

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

@ -30,7 +30,7 @@ class ReadableStreamController;
class UnderlyingSourceAlgorithmsBase : public nsISupports {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(UnderlyingSourceAlgorithmsBase)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(UnderlyingSourceAlgorithmsBase)
MOZ_CAN_RUN_SCRIPT virtual void StartCallback(
JSContext* aCx, ReadableStreamController& aController,

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

@ -27,7 +27,6 @@ EXPORTS.mozilla.dom += [
"ReadRequest.h",
"StreamUtils.h",
"TeeState.h",
"TransformerCallbackHelpers.h",
"TransformStream.h",
"TransformStreamDefaultController.h",
"UnderlyingSinkCallbackHelpers.h",

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

@ -1266,12 +1266,8 @@ let interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextDecoder", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextDecoderStream", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextEncoder", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextEncoderStream", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextMetrics", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextTrack", insecureContext: true },

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

@ -1,13 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://streams.spec.whatwg.org/#other-specs-ts-wrapping
*/
interface mixin GenericTransformStream {
readonly attribute ReadableStream readable;
readonly attribute WritableStream writable;
};

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

@ -5,27 +5,26 @@
*
* The origin of this IDL file is
* http://encoding.spec.whatwg.org/#interface-textdecoder
*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
interface mixin TextDecoderCommon {
[Constant]
readonly attribute DOMString encoding;
[Constant]
readonly attribute boolean fatal;
[Constant]
readonly attribute boolean ignoreBOM;
};
[Exposed=(Window,Worker)]
interface TextDecoder {
[Throws]
constructor(optional DOMString label = "utf-8",
optional TextDecoderOptions options = {});
[Constant]
readonly attribute DOMString encoding;
[Constant]
readonly attribute boolean fatal;
[Constant]
readonly attribute boolean ignoreBOM;
[Throws]
USVString decode(optional BufferSource input, optional TextDecodeOptions options = {});
};
TextDecoder includes TextDecoderCommon;
dictionary TextDecoderOptions {
boolean fatal = false;
@ -35,3 +34,4 @@ dictionary TextDecoderOptions {
dictionary TextDecodeOptions {
boolean stream = false;
};

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

@ -1,16 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://encoding.spec.whatwg.org/#interface-textdecoderstream
*/
[Exposed=*]
interface TextDecoderStream {
[Throws]
constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {});
};
TextDecoderStream includes TextDecoderCommon;
TextDecoderStream includes GenericTransformStream;

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

@ -5,19 +5,11 @@
*
* The origin of this IDL file is
* http://encoding.spec.whatwg.org/#interface-textencoder
*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
interface mixin TextEncoderCommon {
/*
* This is DOMString in the spec, but the value is always ASCII
* and short. By declaring this as ByteString, we get the same
* end result (storage as inline Latin1 string in SpiderMonkey)
* with fewer conversions.
*/
[Constant]
readonly attribute ByteString encoding;
};
dictionary TextEncoderEncodeIntoResult {
unsigned long long read;
unsigned long long written;
@ -27,6 +19,15 @@ dictionary TextEncoderEncodeIntoResult {
interface TextEncoder {
constructor();
/*
* This is DOMString in the spec, but the value is always ASCII
* and short. By declaring this as ByteString, we get the same
* end result (storage as inline Latin1 string in SpiderMonkey)
* with fewer conversions.
*/
[Constant]
readonly attribute ByteString encoding;
/*
* This is spec-wise USVString but marking it as UTF8String as an
* optimization. (The SpiderMonkey-provided conversion to UTF-8 takes care of
@ -45,4 +46,3 @@ interface TextEncoder {
[CanOOM]
TextEncoderEncodeIntoResult encodeInto(JSString source, Uint8Array destination);
};
TextEncoder includes TextEncoderCommon;

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

@ -1,16 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://encoding.spec.whatwg.org/#interface-textdecoderstream
*/
[Exposed=*]
interface TextEncoderStream {
[Throws]
constructor();
};
TextEncoderStream includes TextEncoderCommon;
TextEncoderStream includes GenericTransformStream;

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

@ -571,7 +571,6 @@ WEBIDL_FILES = [
"GamepadPose.webidl",
"GamepadServiceTest.webidl",
"GamepadTouch.webidl",
"GenericTransformStream.webidl",
"Geolocation.webidl",
"GeolocationCoordinates.webidl",
"GeolocationPosition.webidl",
@ -947,9 +946,7 @@ WEBIDL_FILES = [
"Text.webidl",
"TextClause.webidl",
"TextDecoder.webidl",
"TextDecoderStream.webidl",
"TextEncoder.webidl",
"TextEncoderStream.webidl",
"TextTrack.webidl",
"TextTrackCue.webidl",
"TextTrackCueList.webidl",

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

@ -309,12 +309,8 @@ let interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextDecoder", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextDecoderStream", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextEncoder", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextEncoderStream", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TextMetrics", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "TransformStream", insecureContext: true },

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

@ -0,0 +1,202 @@
[idlharness.https.any.serviceworker.html]
expected: TIMEOUT
[idlharness.any.worker.html]
[TextEncoderStream interface object length]
expected: FAIL
[TextDecoderStream interface object length]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextEncoderStream interface object name]
expected: FAIL
[TextDecoderStream interface: attribute fatal]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextDecoderStream interface: attribute ignoreBOM]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: attribute encoding]
expected: FAIL
[TextEncoderStream interface: attribute encoding]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[TextDecoderStream interface object name]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[idlharness.any.sharedworker.html]
[TextEncoderStream interface object length]
expected: FAIL
[TextDecoderStream interface object length]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextEncoderStream interface object name]
expected: FAIL
[TextDecoderStream interface: attribute fatal]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextDecoderStream interface: attribute ignoreBOM]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: attribute encoding]
expected: FAIL
[TextEncoderStream interface: attribute encoding]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[TextDecoderStream interface object name]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[idlharness.any.html]
[TextEncoderStream interface object length]
expected: FAIL
[TextDecoderStream interface object length]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextEncoderStream interface object name]
expected: FAIL
[TextDecoderStream interface: attribute fatal]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextDecoderStream interface: attribute ignoreBOM]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: attribute encoding]
expected: FAIL
[TextEncoderStream interface: attribute encoding]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[TextDecoderStream interface object name]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[idlharness.any.serviceworker.html]
[TextEncoderStream interface object length]
expected: FAIL
[TextDecoderStream interface object length]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextEncoderStream interface object name]
expected: FAIL
[TextDecoderStream interface: attribute fatal]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[TextDecoderStream interface: attribute ignoreBOM]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface object]
expected: FAIL
[TextDecoderStream interface: attribute encoding]
expected: FAIL
[TextEncoderStream interface: attribute encoding]
expected: FAIL
[TextDecoderStream interface: existence and properties of interface prototype object]
expected: FAIL
[TextDecoderStream interface object name]
expected: FAIL
[TextEncoderStream interface: existence and properties of interface prototype object]
expected: FAIL

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

@ -0,0 +1,58 @@
[backpressure.any.html]
[write() should not complete until read relieves backpressure for TextEncoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextDecoderStream]
expected: FAIL
[write() should not complete until read relieves backpressure for TextDecoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextEncoderStream]
expected: FAIL
[backpressure.https.any.serviceworker.html]
expected: TIMEOUT
[backpressure.any.worker.html]
[write() should not complete until read relieves backpressure for TextEncoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextDecoderStream]
expected: FAIL
[write() should not complete until read relieves backpressure for TextDecoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextEncoderStream]
expected: FAIL
[backpressure.any.sharedworker.html]
[write() should not complete until read relieves backpressure for TextEncoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextDecoderStream]
expected: FAIL
[write() should not complete until read relieves backpressure for TextDecoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextEncoderStream]
expected: FAIL
[backpressure.any.serviceworker.html]
[write() should not complete until read relieves backpressure for TextEncoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextDecoderStream]
expected: FAIL
[write() should not complete until read relieves backpressure for TextDecoderStream]
expected: FAIL
[additional writes should wait for backpressure to be relieved for class TextEncoderStream]
expected: FAIL

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

@ -0,0 +1,343 @@
[decode-attributes.any.serviceworker.html]
[a throwing fatal member should cause the constructor to throw]
expected: FAIL
[setting ignoreBOM to 'null' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'iso-8859-2']
expected: FAIL
[setting fatal to 'undefined' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'unicode-1-1-utf-8']
expected: FAIL
[setting ignoreBOM to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to '1' should set the attribute to true]
expected: FAIL
[a throwing ignoreBOM member should cause the constructor to throw]
expected: FAIL
[setting fatal to '0' should set the attribute to false]
expected: FAIL
[constructing with a non-stringifiable encoding should throw]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to true]
expected: FAIL
[constructing with an invalid encoding should throw]
expected: FAIL
[setting fatal to '' should set the attribute to false]
expected: FAIL
[setting fatal to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to false]
expected: FAIL
[setting fatal to '1' should set the attribute to true]
expected: FAIL
[setting fatal to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting fatal to 'true' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to 'undefined' should set the attribute to false]
expected: FAIL
[setting fatal to 'null' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'yes' should set the attribute to true]
expected: FAIL
[setting fatal to 'yes' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'utf-16']
expected: FAIL
[setting ignoreBOM to '0' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'true' should set the attribute to true]
expected: FAIL
[setting fatal to '' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'ascii']
expected: FAIL
[decode-attributes.any.sharedworker.html]
[a throwing fatal member should cause the constructor to throw]
expected: FAIL
[setting ignoreBOM to 'null' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'iso-8859-2']
expected: FAIL
[setting fatal to 'undefined' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'unicode-1-1-utf-8']
expected: FAIL
[setting ignoreBOM to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to '1' should set the attribute to true]
expected: FAIL
[a throwing ignoreBOM member should cause the constructor to throw]
expected: FAIL
[setting fatal to '0' should set the attribute to false]
expected: FAIL
[constructing with a non-stringifiable encoding should throw]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to true]
expected: FAIL
[constructing with an invalid encoding should throw]
expected: FAIL
[setting fatal to '' should set the attribute to false]
expected: FAIL
[setting fatal to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to false]
expected: FAIL
[setting fatal to '1' should set the attribute to true]
expected: FAIL
[setting fatal to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting fatal to 'true' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to 'undefined' should set the attribute to false]
expected: FAIL
[setting fatal to 'null' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'yes' should set the attribute to true]
expected: FAIL
[setting fatal to 'yes' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'utf-16']
expected: FAIL
[setting ignoreBOM to '0' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'true' should set the attribute to true]
expected: FAIL
[setting fatal to '' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'ascii']
expected: FAIL
[decode-attributes.any.html]
[a throwing fatal member should cause the constructor to throw]
expected: FAIL
[setting ignoreBOM to 'null' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'iso-8859-2']
expected: FAIL
[setting fatal to 'undefined' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'unicode-1-1-utf-8']
expected: FAIL
[setting ignoreBOM to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to '1' should set the attribute to true]
expected: FAIL
[a throwing ignoreBOM member should cause the constructor to throw]
expected: FAIL
[setting fatal to '0' should set the attribute to false]
expected: FAIL
[constructing with a non-stringifiable encoding should throw]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to true]
expected: FAIL
[constructing with an invalid encoding should throw]
expected: FAIL
[setting fatal to '' should set the attribute to false]
expected: FAIL
[setting fatal to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to false]
expected: FAIL
[setting fatal to '1' should set the attribute to true]
expected: FAIL
[setting fatal to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting fatal to 'true' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to 'undefined' should set the attribute to false]
expected: FAIL
[setting fatal to 'null' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'yes' should set the attribute to true]
expected: FAIL
[setting fatal to 'yes' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'utf-16']
expected: FAIL
[setting ignoreBOM to '0' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'true' should set the attribute to true]
expected: FAIL
[setting fatal to '' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'ascii']
expected: FAIL
[decode-attributes.any.worker.html]
[a throwing fatal member should cause the constructor to throw]
expected: FAIL
[setting ignoreBOM to 'null' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'iso-8859-2']
expected: FAIL
[setting fatal to 'undefined' should set the attribute to false]
expected: FAIL
[encoding attribute should have correct value for 'unicode-1-1-utf-8']
expected: FAIL
[setting ignoreBOM to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to '1' should set the attribute to true]
expected: FAIL
[a throwing ignoreBOM member should cause the constructor to throw]
expected: FAIL
[setting fatal to '0' should set the attribute to false]
expected: FAIL
[constructing with a non-stringifiable encoding should throw]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to true]
expected: FAIL
[constructing with an invalid encoding should throw]
expected: FAIL
[setting fatal to '' should set the attribute to false]
expected: FAIL
[setting fatal to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'false' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to '' should set the attribute to false]
expected: FAIL
[setting fatal to '1' should set the attribute to true]
expected: FAIL
[setting fatal to '[object Object\]' should set the attribute to true]
expected: FAIL
[setting fatal to 'true' should set the attribute to true]
expected: FAIL
[setting ignoreBOM to 'undefined' should set the attribute to false]
expected: FAIL
[setting fatal to 'null' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'yes' should set the attribute to true]
expected: FAIL
[setting fatal to 'yes' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'utf-16']
expected: FAIL
[setting ignoreBOM to '0' should set the attribute to false]
expected: FAIL
[setting ignoreBOM to 'true' should set the attribute to true]
expected: FAIL
[setting fatal to '' should set the attribute to true]
expected: FAIL
[encoding attribute should have correct value for 'ascii']
expected: FAIL

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

@ -0,0 +1,70 @@
[decode-bad-chunks.any.sharedworker.html]
[chunk of type undefined should error the stream]
expected: FAIL
[chunk of type array should error the stream]
expected: FAIL
[chunk of type null should error the stream]
expected: FAIL
[chunk of type object, not BufferSource should error the stream]
expected: FAIL
[chunk of type numeric should error the stream]
expected: FAIL
[decode-bad-chunks.https.any.serviceworker.html]
expected: TIMEOUT
[decode-bad-chunks.any.worker.html]
[chunk of type undefined should error the stream]
expected: FAIL
[chunk of type array should error the stream]
expected: FAIL
[chunk of type null should error the stream]
expected: FAIL
[chunk of type object, not BufferSource should error the stream]
expected: FAIL
[chunk of type numeric should error the stream]
expected: FAIL
[decode-bad-chunks.any.html]
[chunk of type undefined should error the stream]
expected: FAIL
[chunk of type array should error the stream]
expected: FAIL
[chunk of type null should error the stream]
expected: FAIL
[chunk of type object, not BufferSource should error the stream]
expected: FAIL
[chunk of type numeric should error the stream]
expected: FAIL
[decode-bad-chunks.any.serviceworker.html]
[chunk of type undefined should error the stream]
expected: FAIL
[chunk of type array should error the stream]
expected: FAIL
[chunk of type null should error the stream]
expected: FAIL
[chunk of type object, not BufferSource should error the stream]
expected: FAIL
[chunk of type numeric should error the stream]
expected: FAIL

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

@ -0,0 +1,154 @@
[decode-ignore-bom.any.worker.html]
[ignoreBOM should work for encoding utf-16be, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 0]
expected: FAIL
[decode-ignore-bom.any.sharedworker.html]
[ignoreBOM should work for encoding utf-16be, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 0]
expected: FAIL
[decode-ignore-bom.https.any.serviceworker.html]
expected: TIMEOUT
[decode-ignore-bom.any.html]
[ignoreBOM should work for encoding utf-16be, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 0]
expected: FAIL
[decode-ignore-bom.any.serviceworker.html]
[ignoreBOM should work for encoding utf-16be, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16be, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 0]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-8, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 3]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 2]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 1]
expected: FAIL
[ignoreBOM should work for encoding utf-16le, split at character 0]
expected: FAIL

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

@ -0,0 +1,34 @@
[decode-incomplete-input.any.html]
[incomplete input with error mode "fatal" should error the stream]
expected: FAIL
[incomplete input with error mode "replacement" should end with a replacement character]
expected: FAIL
[decode-incomplete-input.any.worker.html]
[incomplete input with error mode "fatal" should error the stream]
expected: FAIL
[incomplete input with error mode "replacement" should end with a replacement character]
expected: FAIL
[decode-incomplete-input.any.sharedworker.html]
[incomplete input with error mode "fatal" should error the stream]
expected: FAIL
[incomplete input with error mode "replacement" should end with a replacement character]
expected: FAIL
[decode-incomplete-input.https.any.serviceworker.html]
expected: TIMEOUT
[decode-incomplete-input.any.serviceworker.html]
[incomplete input with error mode "fatal" should error the stream]
expected: FAIL
[incomplete input with error mode "replacement" should end with a replacement character]
expected: FAIL

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

@ -0,0 +1,166 @@
[decode-non-utf8.any.sharedworker.html]
[TextDecoderStream should be able to reject invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode ISO-8859-14]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to decode ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in ISO-2022-JP]
expected: FAIL
[decode-non-utf8.https.any.serviceworker.html]
expected: TIMEOUT
[decode-non-utf8.any.html]
[TextDecoderStream should be able to reject invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode ISO-8859-14]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to decode ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in ISO-2022-JP]
expected: FAIL
[decode-non-utf8.any.worker.html]
[TextDecoderStream should be able to reject invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode ISO-8859-14]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to decode ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in ISO-2022-JP]
expected: FAIL
[decode-non-utf8.any.serviceworker.html]
[TextDecoderStream should be able to reject invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode Shift_JIS]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in UTF-16BE]
expected: FAIL
[TextDecoderStream should be able to decode UTF-16LE]
expected: FAIL
[TextDecoderStream should be able to decode ISO-8859-14]
expected: FAIL
[TextDecoderStream should be able to decode invalid sequences in ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to decode ISO-2022-JP]
expected: FAIL
[TextDecoderStream should be able to reject invalid sequences in ISO-2022-JP]
expected: FAIL

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

@ -0,0 +1,142 @@
[decode-split-character.any.sharedworker.html]
[an empty chunk inside a code point split between chunks should not change the output; split point = 3]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 1]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 2]
expected: FAIL
[a code point should be emitted as soon as all bytes are available]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 4]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 5]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 6]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 4]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 5]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 2]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 3]
expected: FAIL
[decode-split-character.https.any.serviceworker.html]
expected: TIMEOUT
[decode-split-character.any.html]
[an empty chunk inside a code point split between chunks should not change the output; split point = 3]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 1]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 2]
expected: FAIL
[a code point should be emitted as soon as all bytes are available]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 4]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 5]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 6]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 4]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 5]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 2]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 3]
expected: FAIL
[decode-split-character.any.worker.html]
[an empty chunk inside a code point split between chunks should not change the output; split point = 3]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 1]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 2]
expected: FAIL
[a code point should be emitted as soon as all bytes are available]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 4]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 5]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 6]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 4]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 5]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 2]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 3]
expected: FAIL
[decode-split-character.any.serviceworker.html]
[an empty chunk inside a code point split between chunks should not change the output; split point = 3]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 1]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 2]
expected: FAIL
[a code point should be emitted as soon as all bytes are available]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 4]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 5]
expected: FAIL
[an empty chunk inside a code point split between chunks should not change the output; split point = 6]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 4]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 5]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 2]
expected: FAIL
[a code point split between chunks should not be emitted until all bytes are available; split point = 3]
expected: FAIL

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

@ -1,4 +1,16 @@
[decode-utf8.any.sharedworker.html]
[decoding one UTF-8 chunk should give one output string - ArrayBuffer]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding an empty chunk should give no output chunks - ArrayBuffer]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[an initial empty chunk should be ignored - ArrayBuffer]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding one UTF-8 chunk should give one output string - SharedArrayBuffer]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
@ -11,6 +23,20 @@
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding a transferred Uint8Array chunk should give no output]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding a transferred ArrayBuffer chunk should give no output]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[a trailing empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[UTF-8 EOF handling - ArrayBuffer]
expected: FAIL
[a trailing empty chunk should be ignored - SharedArrayBuffer]
expected: FAIL
@ -19,6 +45,15 @@
[decode-utf8.any.html]
[decoding one UTF-8 chunk should give one output string - ArrayBuffer]
expected: FAIL
[decoding an empty chunk should give no output chunks - ArrayBuffer]
expected: FAIL
[an initial empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[decoding one UTF-8 chunk should give one output string - SharedArrayBuffer]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
@ -31,6 +66,20 @@
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding a transferred Uint8Array chunk should give no output]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding a transferred ArrayBuffer chunk should give no output]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[a trailing empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[UTF-8 EOF handling - ArrayBuffer]
expected: FAIL
[a trailing empty chunk should be ignored - SharedArrayBuffer]
expected: FAIL
@ -39,6 +88,15 @@
[decode-utf8.any.worker.html]
[decoding one UTF-8 chunk should give one output string - ArrayBuffer]
expected: FAIL
[decoding an empty chunk should give no output chunks - ArrayBuffer]
expected: FAIL
[an initial empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[decoding one UTF-8 chunk should give one output string - SharedArrayBuffer]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
@ -51,6 +109,20 @@
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding a transferred Uint8Array chunk should give no output]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[decoding a transferred ArrayBuffer chunk should give no output]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1561594
expected: FAIL
[a trailing empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[UTF-8 EOF handling - ArrayBuffer]
expected: FAIL
[a trailing empty chunk should be ignored - SharedArrayBuffer]
expected: FAIL
@ -63,12 +135,33 @@
[decoding one UTF-8 chunk should give one output string - SharedArrayBuffer]
expected: FAIL
[decoding one UTF-8 chunk should give one output string - ArrayBuffer]
expected: FAIL
[an initial empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[an initial empty chunk should be ignored - SharedArrayBuffer]
expected: FAIL
[decoding a transferred Uint8Array chunk should give no output]
expected: FAIL
[decoding an empty chunk should give no output chunks - SharedArrayBuffer]
expected: FAIL
[decoding an empty chunk should give no output chunks - ArrayBuffer]
expected: FAIL
[decoding a transferred ArrayBuffer chunk should give no output]
expected: FAIL
[a trailing empty chunk should be ignored - ArrayBuffer]
expected: FAIL
[UTF-8 EOF handling - ArrayBuffer]
expected: FAIL
[a trailing empty chunk should be ignored - SharedArrayBuffer]
expected: FAIL

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

@ -0,0 +1,82 @@
[encode-bad-chunks.any.html]
[a chunk that cannot be converted to a string should error the streams]
expected: FAIL
[input of type numeric should be converted correctly to string]
expected: FAIL
[input of type undefined should be converted correctly to string]
expected: FAIL
[input of type array should be converted correctly to string]
expected: FAIL
[input of type object should be converted correctly to string]
expected: FAIL
[input of type null should be converted correctly to string]
expected: FAIL
[encode-bad-chunks.any.worker.html]
[a chunk that cannot be converted to a string should error the streams]
expected: FAIL
[input of type numeric should be converted correctly to string]
expected: FAIL
[input of type undefined should be converted correctly to string]
expected: FAIL
[input of type array should be converted correctly to string]
expected: FAIL
[input of type object should be converted correctly to string]
expected: FAIL
[input of type null should be converted correctly to string]
expected: FAIL
[encode-bad-chunks.any.sharedworker.html]
[a chunk that cannot be converted to a string should error the streams]
expected: FAIL
[input of type numeric should be converted correctly to string]
expected: FAIL
[input of type undefined should be converted correctly to string]
expected: FAIL
[input of type array should be converted correctly to string]
expected: FAIL
[input of type object should be converted correctly to string]
expected: FAIL
[input of type null should be converted correctly to string]
expected: FAIL
[encode-bad-chunks.https.any.serviceworker.html]
expected: TIMEOUT
[encode-bad-chunks.any.serviceworker.html]
[a chunk that cannot be converted to a string should error the streams]
expected: FAIL
[input of type numeric should be converted correctly to string]
expected: FAIL
[input of type undefined should be converted correctly to string]
expected: FAIL
[input of type array should be converted correctly to string]
expected: FAIL
[input of type object should be converted correctly to string]
expected: FAIL
[input of type null should be converted correctly to string]
expected: FAIL

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

@ -0,0 +1,238 @@
[encode-utf8.https.any.serviceworker.html]
expected: TIMEOUT
[encode-utf8.any.worker.html]
[two leading chunks should result in two replacement characters]
expected: FAIL
[characters in the ISO-8859-1 range should be encoded correctly]
expected: FAIL
[a terminal unpaired trailing surrogate should immediately be replaced]
expected: FAIL
[a character split between chunks should be correctly encoded]
expected: FAIL
[an empty string should result in no output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an ascii character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[a leading empty chunk should be ignored]
expected: FAIL
[encoding one string of UTF-8 should give one complete chunk]
expected: FAIL
[a leading surrogate chunk should be carried past empty chunks]
expected: FAIL
[a leading surrogate chunk should error when it is clear it didn't form a pair]
expected: FAIL
[a trailing empty chunk should be ignored]
expected: FAIL
[a plain ASCII chunk should be converted]
expected: FAIL
[a character following one split between chunks should be correctly encoded]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by a plane 1 character split into two chunks should result in the encoded plane 1 character appearing in the last output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an astral character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[two consecutive astral characters each split down the middle should be correctly reassembled]
expected: FAIL
[a non-terminal unpaired leading surrogate should immediately be replaced]
expected: FAIL
[two consecutive astral characters each split down the middle with an invalid surrogate in the middle should be correctly encoded]
expected: FAIL
[a stream ending in a leading surrogate should emit a replacement character as a final chunk]
expected: FAIL
[encode-utf8.any.html]
[two leading chunks should result in two replacement characters]
expected: FAIL
[characters in the ISO-8859-1 range should be encoded correctly]
expected: FAIL
[a terminal unpaired trailing surrogate should immediately be replaced]
expected: FAIL
[a character split between chunks should be correctly encoded]
expected: FAIL
[an empty string should result in no output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an ascii character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[a leading empty chunk should be ignored]
expected: FAIL
[encoding one string of UTF-8 should give one complete chunk]
expected: FAIL
[a leading surrogate chunk should be carried past empty chunks]
expected: FAIL
[a leading surrogate chunk should error when it is clear it didn't form a pair]
expected: FAIL
[a trailing empty chunk should be ignored]
expected: FAIL
[a plain ASCII chunk should be converted]
expected: FAIL
[a character following one split between chunks should be correctly encoded]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by a plane 1 character split into two chunks should result in the encoded plane 1 character appearing in the last output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an astral character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[two consecutive astral characters each split down the middle should be correctly reassembled]
expected: FAIL
[a non-terminal unpaired leading surrogate should immediately be replaced]
expected: FAIL
[two consecutive astral characters each split down the middle with an invalid surrogate in the middle should be correctly encoded]
expected: FAIL
[a stream ending in a leading surrogate should emit a replacement character as a final chunk]
expected: FAIL
[encode-utf8.any.sharedworker.html]
[two leading chunks should result in two replacement characters]
expected: FAIL
[characters in the ISO-8859-1 range should be encoded correctly]
expected: FAIL
[a terminal unpaired trailing surrogate should immediately be replaced]
expected: FAIL
[a character split between chunks should be correctly encoded]
expected: FAIL
[an empty string should result in no output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an ascii character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[a leading empty chunk should be ignored]
expected: FAIL
[encoding one string of UTF-8 should give one complete chunk]
expected: FAIL
[a leading surrogate chunk should be carried past empty chunks]
expected: FAIL
[a leading surrogate chunk should error when it is clear it didn't form a pair]
expected: FAIL
[a trailing empty chunk should be ignored]
expected: FAIL
[a plain ASCII chunk should be converted]
expected: FAIL
[a character following one split between chunks should be correctly encoded]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by a plane 1 character split into two chunks should result in the encoded plane 1 character appearing in the last output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an astral character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[two consecutive astral characters each split down the middle should be correctly reassembled]
expected: FAIL
[a non-terminal unpaired leading surrogate should immediately be replaced]
expected: FAIL
[two consecutive astral characters each split down the middle with an invalid surrogate in the middle should be correctly encoded]
expected: FAIL
[a stream ending in a leading surrogate should emit a replacement character as a final chunk]
expected: FAIL
[encode-utf8.any.serviceworker.html]
[two leading chunks should result in two replacement characters]
expected: FAIL
[characters in the ISO-8859-1 range should be encoded correctly]
expected: FAIL
[a terminal unpaired trailing surrogate should immediately be replaced]
expected: FAIL
[a character split between chunks should be correctly encoded]
expected: FAIL
[an empty string should result in no output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an ascii character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[a leading empty chunk should be ignored]
expected: FAIL
[encoding one string of UTF-8 should give one complete chunk]
expected: FAIL
[a leading surrogate chunk should be carried past empty chunks]
expected: FAIL
[a leading surrogate chunk should error when it is clear it didn't form a pair]
expected: FAIL
[a trailing empty chunk should be ignored]
expected: FAIL
[a plain ASCII chunk should be converted]
expected: FAIL
[a character following one split between chunks should be correctly encoded]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by a plane 1 character split into two chunks should result in the encoded plane 1 character appearing in the last output chunk]
expected: FAIL
[an unmatched surrogate at the end of a chunk followed by an astral character in the next chunk should be replaced with the replacement character at the start of the next output chunk]
expected: FAIL
[two consecutive astral characters each split down the middle should be correctly reassembled]
expected: FAIL
[a non-terminal unpaired leading surrogate should immediately be replaced]
expected: FAIL
[two consecutive astral characters each split down the middle with an invalid surrogate in the middle should be correctly encoded]
expected: FAIL
[a stream ending in a leading surrogate should emit a replacement character as a final chunk]
expected: FAIL

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

@ -0,0 +1,34 @@
[readable-writable-properties.any.sharedworker.html]
[TextDecoderStream readable and writable properties must pass brand checks]
expected: FAIL
[TextEncoderStream readable and writable properties must pass brand checks]
expected: FAIL
[readable-writable-properties.https.any.serviceworker.html]
expected: TIMEOUT
[readable-writable-properties.any.html]
[TextDecoderStream readable and writable properties must pass brand checks]
expected: FAIL
[TextEncoderStream readable and writable properties must pass brand checks]
expected: FAIL
[readable-writable-properties.any.worker.html]
[TextDecoderStream readable and writable properties must pass brand checks]
expected: FAIL
[TextEncoderStream readable and writable properties must pass brand checks]
expected: FAIL
[readable-writable-properties.any.serviceworker.html]
[TextDecoderStream readable and writable properties must pass brand checks]
expected: FAIL
[TextEncoderStream readable and writable properties must pass brand checks]
expected: FAIL

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

@ -0,0 +1,36 @@
[realms.window.html]
[a TextEncoderStream object should be associated with the realm the constructor came from]
expected: FAIL
[TextEncoderStream's readable and writable attributes should come from the same realm as the constructor definition]
expected: FAIL
[the output chunks when read is called after write should come from the same realm as the constructor of TextEncoderStream]
expected: FAIL
[the output chunks when write is called with a pending read should come from the same realm as the constructor of TextEncoderStream]
expected: FAIL
[TypeError for unconvertable chunk should come from constructor realm of TextEncoderStream]
expected: FAIL
[a TextDecoderStream object should be associated with the realm the constructor came from]
expected: FAIL
[TextDecoderStream's readable and writable attributes should come from the same realm as the constructor definition]
expected: FAIL
[the result object when read is called after write should come from the same realm as the constructor of TextDecoderStream]
expected: FAIL
[the result object when write is called with a pending read should come from the same realm as the constructor of TextDecoderStream]
expected: FAIL
[TypeError for chunk with the wrong type should come from constructor realm of TextDecoderStream]
expected: FAIL
[TypeError for invalid chunk should come from constructor realm of TextDecoderStream]
expected: FAIL
[TypeError for incomplete input should come from constructor realm of TextDecoderStream]
expected: FAIL