haikuwebkit/Source/WebCore/dom/TextDecoderStream.idl

39 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

Add support for TextDecoderStream https://bugs.webkit.org/show_bug.cgi?id=215919 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/encoding/streams/backpressure.any-expected.txt: * web-platform-tests/encoding/streams/backpressure.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-attributes.any-expected.txt: * web-platform-tests/encoding/streams/decode-attributes.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-bad-chunks.any-expected.txt: * web-platform-tests/encoding/streams/decode-bad-chunks.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-ignore-bom.any-expected.txt: * web-platform-tests/encoding/streams/decode-ignore-bom.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-incomplete-input.any-expected.txt: * web-platform-tests/encoding/streams/decode-incomplete-input.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-non-utf8.any-expected.txt: * web-platform-tests/encoding/streams/decode-non-utf8.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-split-character.any-expected.txt: * web-platform-tests/encoding/streams/decode-split-character.any.worker-expected.txt: * web-platform-tests/encoding/streams/decode-utf8.any-expected.txt: * web-platform-tests/encoding/streams/decode-utf8.any.worker-expected.txt: * web-platform-tests/encoding/streams/encode-bad-chunks.any-expected.txt: * web-platform-tests/encoding/streams/encode-bad-chunks.any.worker-expected.txt: * web-platform-tests/encoding/streams/readable-writable-properties.any-expected.txt: * web-platform-tests/encoding/streams/readable-writable-properties.any.worker-expected.txt: * web-platform-tests/encoding/streams/realms.window-expected.txt: Source/WebCore: Implement TextEncoderStream as a JS built-in. It is enabled by transform stream runtime flag. TextDecoderStream takes a TransformStream and TextDecoderStreamEncoder as private slots. Add TextDecoderStreamEncoder to implement the actual UTF-8 encoding steps, as a wrapper around TextDecoder. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/TextDecoderStream.idl: Added. * dom/TextDecoderStream.js: Added. (initializeTextDecoderStream): (getter.encoding): (getter.fatal): (getter.ignoreBOM): (getter.readable): (getter.writable): * dom/TextDecoderStreamDecoder.cpp: Added. (WebCore::TextDecoderStreamDecoder::create): (WebCore::TextDecoderStreamDecoder::TextDecoderStreamDecoder): (WebCore::TextDecoderStreamDecoder::decode): (WebCore::TextDecoderStreamDecoder::flush): * dom/TextDecoderStreamDecoder.h: Added. (WebCore::TextDecoderStreamDecoder::encoding const): * dom/TextDecoderStreamDecoder.idl: Added. LayoutTests: * TestExpectations: Unskipping encoding tests except legacy-* tests which are big and slow. Canonical link: https://commits.webkit.org/228784@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266348 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-31 09:01:55 +00:00
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[
EnabledAtRuntime=TransformStreamAPI,
Exposed=(Window,Worker),
JSBuiltin,
] interface TextDecoderStream {
constructor(optional DOMString label, optional any options);
readonly attribute DOMString encoding;
readonly attribute boolean fatal;
readonly attribute boolean ignoreBOM;
readonly attribute ReadableStream readable;
readonly attribute WritableStream writable;
};