[Streams API] Align internal structure of ReadableStream with spec
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Sep 2016 14:14:05 +0000 (14:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Sep 2016 14:14:05 +0000 (14:14 +0000)
commitf9b0ced2a16fe289bd852f48ce2324ea89b78848
tree96c30075b73d6fb0b602f71882d9108d37b961de
parentdf9ce4afdbc1e1624c85c855b6beff19d848dd09
[Streams API] Align internal structure of ReadableStream with spec
https://bugs.webkit.org/show_bug.cgi?id=160299

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2016-09-01
Reviewed by Xabier Rodriguez-Calvar.

LayoutTests/imported/w3c:

Aligned internal structure of ReadableStream with spec. Fixed one expectation
that was set to FAIL while it is now PASSing.

* web-platform-tests/streams/readable-streams/general.https-expected.txt:

Source/WebCore:

Aligned internal structure of ReadableStream with spec. Various
internal properties have been moved to ReadableStreamDefaultController.
In addition, various behaviors had to be updated. Several other changes
will have to be performed in order to align with spec, e.g. changing
functions names. This patch does not change them in order to make the
structural changes easier to follow.

No change in functionality except support for 1 specific case where
an error was not thrown while it should have been. Changed corresponding
test expectation (now PASS instead of FAIL).
Modified test expectation: web-platform-tests/streams/readable-streams/general.https-expected.txt

* Modules/fetch/FetchResponse.js:
(initializeFetchResponse): Replaced reference to underlyingSource as no
more a property of readableStream (use readableStreamController instead,
as defined by spec).
* Modules/streams/ReadableStream.js:
(initializeReadableStream): Removed various properties now hanlded by
ReadableStreamDefaultController.
* Modules/streams/ReadableStreamDefaultController.js:
(enqueue): Updated based on new properties repartition between reader and controller.
(error): Updated based on new properties repartition between reader and controller.
(close): Updated based on new properties repartition between reader and controller.
(desiredSize): Updated based on new properties repartition between reader and controller.
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamDefaultController): Added various properties now handled by
ReadableStreamDefaultController, as well as an internal pull function defined by spec.
(readableStreamDefaultControllerError): Added based on spec (error handling at controller level).
(teeReadableStream): Fixed typo and use readableStreamDefaultControllerError instead of errorReadableStream.
(doStructuredClone): Added "use strict";.
(teeReadableStreamPullFunction): Use readableStreamDefaultControllerClose instead of closeReadableStream.
(isReadableStream): Replaced check of underlyingSource by check that object is actually an instance of
ReadableStream (spec requires checking that readableStreamController slot is present, but this cannot
be checked).
(isReadableStreamDefaultReader): Replaced check of ownerReadableStream presence by check of readRequests,
in line with spec.
(isReadableStreamDefaultController): Replaced check of controlledReadableStream presence by check of unerlyingSource,
in line with spec.
(errorReadableStream): Updated based on new properties repartition between reader and controller.
(requestReadableStreamPull): Updated based on new properties repartition between reader and controller.
(readableStreamDefaultControllerGetDesiredSize): Replaces getReadableStreamDesiredSize (size now depends
on controller; new function name aligned with spec).
(cancelReadableStream): Updated based on new properties repartition between reader and controller.
(readableStreamDefaultControllerClose): Added based on spec (closing controller).
(closeReadableStream): Updated based on new properties repartition between reader and controller.
(enqueueInReadableStream): Updated based on new properties repartition between reader and controller.
(readFromReadableStreamDefaultReader): Updated based on new properties repartition between reader and controller.
* bindings/js/WebCoreBuiltinNames.h: Added pull (internal function of ReadableStreamDefaultController)
and readableStreamController (defined by spec)

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205289 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchResponse.js
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamDefaultController.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/bindings/js/WebCoreBuiltinNames.h