Permalink
Commits on Aug 6, 2018
  1. Meta: Export the "transform stream" concept

    ricea committed Aug 6, 2018
    The encoding standard needs to refer to the "transform stream" concept.
    Export it.
    
    Also export the "writable side" and "readable side" definitions.
Commits on Aug 2, 2018
  1. Make rejections from transformAlgorithm error the readable

    ricea committed Aug 2, 2018
    Currently rejections from transformAlgorithm error the writable side of
    a transform stream but don't error the readable side. This is an
    unexpected difference from the behaviour of transformer.transform.
    
    Make the behaviour consistent so a rejection from transformAlgorithm
    errors both sides.
    
    This only affects other standards which create TransformStream objects.
    The change is not visible to user JavaScript or web platform tests.
    
    Fixes #946.
Commits on Jul 31, 2018
  1. Clear [[strategySizeAlgorithm]] slot when no longer needed

    ricea committed Jul 31, 2018
    When clearing out the other algorithms, also clear out the
    [[strategySizeAlgorithm]] slot. It will not be called after the stream
    is errored or closed.
    
    Part of #932.
  2. ReadableStream: clear algorithms once they will no longer be used

    ricea committed Jul 31, 2018
    Clear the [[pullAlgorithm]] and [[cancelAlgorithm]] slots when they will
    no longer be called. This allows resources such as the underlying source
    to be freed.
    
    Part of #932.
Commits on Jul 17, 2018
  1. Add missing check for WritableStream...ClearAlgorithms

    ricea authored and domenic committed Jul 14, 2018
    When an underlying sink write is rejected but an abort is already in
    process, the underlying sink abort() method still needs to be called, so
    the algorithms cannot be cleared yet.
    
    This was correct in the reference implementation but the corresponding
    condition was missing from the standard text.
    
    Add the missing check.
    
    Thanks to @MattiasBuelens for pointing out the issue.
Commits on Jul 13, 2018
  1. WritableStream: clear algorithms once they will no longer be called

    ricea committed Jul 13, 2018
    Clear the [[writeAlgorithm]], [[closeAlgorithm]] and [[abortAlgorithm]]
    slots when they will no longer be called. This allows resources such as
    the underlying sink object to be freed.
Commits on Jul 12, 2018
  1. Don't create { value, done } objects with Object.prototype for intern…

    ricea committed Jul 12, 2018
    …al use
    
    An { value, done } object which inherits from Object.prototype can make
    calls to Promise.resolve observable to user code. This is inappropriate
    when the promise is being resolved internally, so make the behaviour be
    controlled by a parameter that defaults to false.
    
    Fixes #933.
Commits on Jul 11, 2018
  1. Set shuttingDown at the beginning of pipe shutdown

    ricea authored and domenic committed Jul 11, 2018
    In the implementation of pipeTo(), setting _shuttingDown_ after flushing
    unwritten reads makes it difficult for implementations to obey the
    requirement that "Shutdown must stop activity". Generally it means they
    have to track separately whether they've started to shutdown, making the
    _shuttingDown_ variable redundant. The exact behaviour while unwritten
    reads are being flushed may also be ambiguous.
    
    Change to set _shuttingDown_ at the beginning of the _Shutdown with an
    action_ and _Shutdown_ steps.
    
    No changes to reference implementation as it already works this way.
    
    Fixes #934.
Commits on Jul 3, 2018
  1. TransformStream: clear algorithms once they will no longer be called

    ricea committed Jul 3, 2018
    Clear the [[flushAlgorithm]] and [[transformAlgorithm]] slots when they
    will no longer be called. This allows resources such as the transformer
    object to be freed.
    
    The case where transformAlgorithm returns a rejection isn't currently
    handled because it can't be done efficiently as the moment. Once
    finally() is added to the WritableStream underlying sink interface this
    will be trivial.
    
    Part of #932.
Commits on Jul 2, 2018
  1. Editorial: add some missing exclamation marks

    ricea authored and domenic committed Jul 2, 2018
    Some invocations of abstract operations were missing the ! prefix to
    assert that they never return an abrupt completion. Add the missing !
    prefixes.
    
    No semantic changes.
Commits on Jun 12, 2018
  1. Update web-platform-tests submodule URL

    foolip authored and ricea committed Jun 12, 2018
    The location of the web-platform-tests repository has changed. Update the submodule URL to match.
Commits on Jun 8, 2018
  1. Add a text encoding step to example 8.9

    MattiasBuelens authored and ricea committed Jun 8, 2018
    In #924, a text decoding step was added to example 8.9 so it could run in the browser. However, the reverse needs to happen in order to construct a valid Response with the transformed stream. Specifically, in step 3 of "read all bytes from a ReadableStream" from the Fetch specification, the stream must produce Uint8Array objects for it to be consumed correctly.
Commits on May 29, 2018
  1. Meta: Review Draft infrastructure

    annevk authored and domenic committed May 29, 2018
    See whatwg/whatwg.org#197 and whatwg/meta#92 for details.
    
    This also makes various updates to align more with other WHATWG standards, notably in the README and in the addition of a Makefile.
Commits on May 24, 2018
  1. Editorial: add some missing exclamation marks

    ricea authored and domenic committed May 24, 2018
    Some invocations of abstract operations were missing the ! prefix to assert that they never return an abrupt completion. Add the missing ! prefixes.
Commits on May 23, 2018
  1. ShouldCallPull: Assert desiredSize is not null

    ricea committed May 23, 2018
    ReadableStreamDefaultControllerShouldCallPull implicitly assumes that
    desiredSize is not null when it compares it to 0. This is guaranteed by
    the check of
    ReadableStreamDefaultControllerCanCloseOrEnqueue(controller), but it's
    not obvious. Add an assert to make it explicit.
    
    Also do the same for ReadableByteStreamControllerShouldCallPull.
    
    No functional changes.
    
    Also, ReadableStreamDefaultControllerShouldCallPull was missing an exclamation
    mark before ReadableStreamDefaultControllerGetDesiredSize. Fix it.
Commits on May 16, 2018
  1. Changes to Example 8.9: Fix code issue, add const, add text decode st…

    ksm2 authored and ricea committed May 16, 2018
    …ep (#924)
    
    In a real world scenario, the response body is encoded as a Uint8Array.
    As the LipFuzzTransformer requires string chunks in order to work,
    the Uint8Array chunks need to be decoded to strings first. To clear up
    any ambiguity for the reader, a text decoding step is added before the
    LipFuzzTransformer is applied so the example works in browsers.
Commits on May 14, 2018
  1. Remove preconditions from ReadableStreamDefaultControllerError

    ricea authored and domenic committed May 14, 2018
    ReadableStreamDefaultControllerError had a note that specifications should
    respect the preconditions (listed as asserts). However, it doesn't have any
    asserts. Remove mention of preconditions.
    
    Fixes #920.
Commits on May 1, 2018
  1. Add two demos using streams for PNG manipulation

    ksm2 authored and ricea committed May 1, 2018
    Add links to demos "Grayscale a PNG" and "Unpack chunks of a PNG". The demos are hosted at MDN.
Commits on Apr 24, 2018
  1. Fix internal links for class ReadableStreamBYOBRequest

    ricea authored and domenic committed Apr 24, 2018
    The ECMASCRIPT-style class description for ReadableStreamBYOBRequest had broken
    links. Fix them.
  2. Revise property access order (#922)

    ricea committed Apr 24, 2018
    Make the order that properties are accessed on the underlying
    source, underlying sink, transformer and strategy objects more
    consistent. Also make the order that properties are validated more
    consistent.
    
    The general order of lookups is now size, highWaterMark, type,
    methods. In general values are validated immediately after lookup, but
    size and highWaterMark are exceptions. They are always looked up, but
    the validation needed depends on the value of "type", so lookup and
    validation are separated. This applies even to WritableStream and
    TransformStream, to allow for the addition of byte types to those in
    future.
    
    The order of lookups in the reference implementation now matches the
    standard.
    
    Also convert autoAllocateChunkSize to a number before checking whether
    it is integer, for consistency with the way other numeric input is
    handled.
    
    Fixes: #917, #921
Commits on Apr 9, 2018
Commits on Apr 2, 2018
  1. Fix a reference to [[queueSize]]

    ricea authored and domenic committed Apr 2, 2018
    The SetUpReadableStreamDefaultController operation referenced the [[queueSize]]
    internal slot. It should be [[queueTotalSize]]. Fix it.
  2. Fix ReadableStream constructor variable typo

    ricea authored and domenic committed Apr 2, 2018
    The name of the ReadableStream constructor parameter is strategy, but
    it was referenced as readableStrategy in the algorithm steps. Check it
    to strategy to match the constructor.
    
    Also change InitializeReadableStream() from "throws" to "nothrow" as it cannot
    throw.
Commits on Mar 29, 2018
  1. Fix closed getter note

    surma authored and ricea committed Mar 29, 2018
    The closed getter note for Readers implied the wrong behaviour when the reader was detached. Fixed.
    
    Fixes #912.
Commits on Mar 23, 2018
  1. Fix a typo and a clumsily-worded sentence.

    dbaron authored and ricea committed Mar 23, 2018
    Change "used enqueue" to "used to enqueue" and "by virtue of taking" to "because it takes".
Commits on Mar 22, 2018
  1. Readable byte stream must call pull if needed after receiving new chunk

    MattiasBuelens authored and ricea committed Mar 22, 2018
    After a readable byte stream receives a new chunk from the underlying source, the stream must call pull() (if needed). Otherwise, the stream may get stuck.
    
    Add calls to ReadableByteStreamControllerCallPullIfNeeded at the end of ReadableByteStreamControllerEnqueue and ReadableByteStreamControllerRespondInternal to ensure this.
    
    Fixes #877.
Commits on Mar 16, 2018
Commits on Mar 14, 2018
  1. Fix typo in WritableStream constructor

    ricea authored and domenic committed Mar 13, 2018
    "_readableStrategy_" should have been just "_strategy_".
Commits on Mar 9, 2018
  1. Clarify that objects created during pipeTo() are not observable

    domenic committed Mar 9, 2018
    Closes #845. Although, in the process of writing this we discovered #905. This commit also modifies the spec to highlight that issue, in the nearby text.
  2. Store the error passed to WS's abort()

    ricea authored and domenic committed Mar 9, 2018
    Previously, calling abort(reason) on a WritableStream would set the
    stored error to a TypeError, meaning that future operations on that
    WritableStream would reject with a TypeError. This resulted in losing
    the original reason when an error happened in a pipe. Instead, retain
    the abort reason in the stored error slot.
    
    Similarly, aborting the writable side of a TransformStream would set the
    stored error on the readable side to a TypeError. Make it use the reason
    as well to reflect the new behavior of the writable side.
    
    Closes #896.
Commits on Mar 8, 2018
  1. Have WS's abort() fulfill, instead of reject, under error conditions

    domenic authored and ricea committed Mar 8, 2018
    * If the stream is errored, abort() now returns a promise resolved with undefined, instead of returning a promise rejected with the stored error.
    * If the stream has a pending abort, abort() now returns that pending abort's promise (which will eventually resolve with undefined, unless aborting fails), instead of returning a promise rejected with a TypeError.
    
    Fixes #900.
  2. Do not throw when calling RS's controller.error()

    domenic committed Mar 8, 2018
    Previously, we would throw an exception when calling controller.error() for a readable stream that was not readable. As noted in #821, this is inconsistent with the behavior introduced for writable and transform streams. The fact that the spec is constantly checking whether it's in the right state, e.g. via ReadableStreamDefaultControllerErrorIfNeeded, is also a strong indicator that we should not throw.
    
    This simplifies various abstract operations by centralizing state checks and removing ReadableStreamDefaultControllerErrorIfNeeded.
    
    Closes #821.
  3. Fix rethrowAssertionErrorRejection (#898)

    MattiasBuelens authored and ricea committed Mar 8, 2018
    Fix rethrowAssertionErrorRejection to correctly re-throw AssertionError rejections.
    Use instanceof to check for assertion errors.
  4. Add missing controller argument in UnderlyingSink.write (#897)

    surma authored and ricea committed Mar 8, 2018
    The documentation for underlying sink write() was missing the controller argument. Fix it.