Skip to content

Commit

Permalink
Fix step ordering in WritableStream constructor
Browse files Browse the repository at this point in the history
Closes #346. Thanks @msssk!
  • Loading branch information
domenic committed May 3, 2015
1 parent b52806e commit 661a638
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.bs
Expand Up @@ -1364,9 +1364,9 @@ Instances of <code>WritableStream</code> are created with the internal slots des
1. Set *this*@[[queue]] to a new empty List.
1. Set *this*@[[state]] to "writable".
1. Set *this*@[[started]] and *this*@[[writing]] to *false*.
1. Call-with-rethrow SyncWritableStreamStateWithQueue(*this*).
1. Let _normalizedStrategy_ be ValidateAndNormalizeQueuingStrategy(_size_, _highWaterMark_).
1. Set *this*@[[strategySize]] to _normalizedStrategy_.[[size]] and *this*@[[strategyHWM]] to _normalizedStrategy_.[[highWaterMark]].
1. Call-with-rethrow SyncWritableStreamStateWithQueue(*this*).
1. Let _error_ be a new <a><code>WritableStream</code> error function</a>.
1. Set _error_@[[stream]] to *this*.
1. Let _startResult_ be InvokeOrNoop(_underlyingSink_, "start", «_error_»).
Expand Down Expand Up @@ -2928,6 +2928,7 @@ Ed Hager,
Forbes Lindesay,
贺师俊 (hax),
Jens Nockert,
Mangala Sadhu Sangeet Singh Khalsa,
Marcos Caceres,
Michael Mior,
Tab Atkins,
Expand Down
4 changes: 2 additions & 2 deletions reference-implementation/lib/writable-stream.js
Expand Up @@ -26,11 +26,11 @@ export default class WritableStream {
this._strategySize = normalizedStrategy.size;
this._strategyHWM = normalizedStrategy.highWaterMark;

SyncWritableStreamStateWithQueue(this);

const error = closure_WritableStreamErrorFunction();
error._stream = this;

SyncWritableStreamStateWithQueue(this);

const startResult = InvokeOrNoop(underlyingSink, 'start', [error]);
this._startedPromise = Promise.resolve(startResult);
this._startedPromise.then(() => {
Expand Down

0 comments on commit 661a638

Please sign in to comment.