[Streams API] Construct a writable stream
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2015 08:34:41 +0000 (08:34 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2015 08:34:41 +0000 (08:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150360

Reviewed by Darin Adler.

Source/WebCore:

This patch initializes a writable stream according to the spec. To do it we need two internal functions, which
are syncWritableStreamStateWithQueue and errorWritableStream, which are also implemented as a quite direct
translation from the spec.

Current test set suffices, expectations are updated accordingly.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/WebCoreBuiltinNames.h:
* bindings/js/WebCoreJSBuiltinInternals.h:
* bindings/js/WebCoreJSBuiltins.cpp:
* bindings/js/WebCoreJSBuiltins.h: Build infrastructure.
* Modules/streams/WritableStream.js:
(initializeWritableStream): Function that acts as constructor of WritableStream.
* Modules/streams/WritableStreamInternals.js:
(syncWritableStreamStateWithQueue):
(errorWritableStream): As per spec.

LayoutTests:

Expectations for the writable stream initialization.

* streams/reference-implementation/bad-strategies-expected.txt:
* streams/reference-implementation/bad-underlying-sinks-expected.txt:
* streams/reference-implementation/brand-checks-expected.txt:
* streams/reference-implementation/byte-length-queuing-strategy-expected.txt:
* streams/reference-implementation/count-queuing-strategy-expected.txt:
* streams/reference-implementation/pipe-through-expected.txt:
* streams/reference-implementation/pipe-to-expected.txt:
* streams/reference-implementation/pipe-to-options-expected.txt:
* streams/reference-implementation/readable-stream-templated-expected.txt:
* streams/reference-implementation/writable-stream-abort-expected.txt:
* streams/reference-implementation/writable-stream-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191383 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
LayoutTests/ChangeLog
LayoutTests/streams/reference-implementation/bad-strategies-expected.txt
LayoutTests/streams/reference-implementation/bad-underlying-sinks-expected.txt
LayoutTests/streams/reference-implementation/brand-checks-expected.txt
LayoutTests/streams/reference-implementation/byte-length-queuing-strategy-expected.txt
LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt
LayoutTests/streams/reference-implementation/pipe-through-expected.txt
LayoutTests/streams/reference-implementation/pipe-to-expected.txt
LayoutTests/streams/reference-implementation/pipe-to-options-expected.txt
LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt
LayoutTests/streams/reference-implementation/writable-stream-abort-expected.txt
LayoutTests/streams/reference-implementation/writable-stream-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/streams/WritableStream.js
Source/WebCore/Modules/streams/WritableStreamInternals.js [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h
Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp
Source/WebCore/bindings/js/WebCoreJSBuiltins.h

index 922091e..87da79a 100644 (file)
@@ -1,3 +1,24 @@
+2015-10-21  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
+        [Streams API] Construct a writable stream
+        https://bugs.webkit.org/show_bug.cgi?id=150360
+
+        Reviewed by Darin Adler.
+
+        Expectations for the writable stream initialization.
+
+        * streams/reference-implementation/bad-strategies-expected.txt:
+        * streams/reference-implementation/bad-underlying-sinks-expected.txt:
+        * streams/reference-implementation/brand-checks-expected.txt:
+        * streams/reference-implementation/byte-length-queuing-strategy-expected.txt:
+        * streams/reference-implementation/count-queuing-strategy-expected.txt:
+        * streams/reference-implementation/pipe-through-expected.txt:
+        * streams/reference-implementation/pipe-to-expected.txt:
+        * streams/reference-implementation/pipe-to-options-expected.txt:
+        * streams/reference-implementation/readable-stream-templated-expected.txt:
+        * streams/reference-implementation/writable-stream-abort-expected.txt:
+        * streams/reference-implementation/writable-stream-expected.txt:
+
 2015-10-21  Frederic Wang  <fred.wang@free.fr>
 
         Unreviewed gardening. Test expectation for use-typo-metrics-1 on Mac and Windows should be "ImageOnlyFailure" not "Failure".
index 454b7a8..18df1ee 100644 (file)
@@ -4,15 +4,9 @@ PASS Readable stream: throwing strategy.size method
 PASS Readable stream: throwing strategy.highWaterMark getter 
 PASS Readable stream: invalid strategy.highWaterMark 
 PASS Readable stream: invalid strategy.size return value 
-FAIL Writable stream: throwing strategy.size getter assert_throws: construction should re-throw the error function "function () {
-        new WritableStream({}, {
-          ..." threw object "EvalError: WritableStream constructor not implemented" ("EvalError") expected object "Error: a unique string" ("Error")
-FAIL Writable stream: throwing strategy.size method WritableStream constructor not implemented
-FAIL Writable stream: invalid strategy.size return value WritableStream constructor not implemented
-FAIL Writable stream: throwing strategy.highWaterMark getter assert_throws: construction should re-throw the error function "function () {
-        new WritableStream({}, {
-          ..." threw object "EvalError: WritableStream constructor not implemented" ("EvalError") expected object "Error: a unique string" ("Error")
-FAIL Writable stream: invalid strategy.highWaterMark assert_throws: construction should throw a RangeError for -1 function "function () {
-            new WritableStream({}, {
-      ..." threw object "EvalError: WritableStream constructor not implemented" ("EvalError") expected object "RangeError" ("RangeError")
+PASS Writable stream: throwing strategy.size getter 
+FAIL Writable stream: throwing strategy.size method write not implemented
+FAIL Writable stream: invalid strategy.size return value write not implemented
+PASS Writable stream: throwing strategy.highWaterMark getter 
+PASS Writable stream: invalid strategy.highWaterMark 
 
index 550fde9..84adb51 100644 (file)
@@ -1,14 +1,10 @@
 
-FAIL Underlying sink: throwing start getter assert_throws: function "function () {
-        new WritableStream({
-            ge..." threw object "EvalError: WritableStream constructor not implemented" ("EvalError") expected object "Error: a unique string" ("Error")
-FAIL Underlying sink: throwing start method assert_throws: function "function () {
-        new WritableStream({
-            st..." threw object "EvalError: WritableStream constructor not implemented" ("EvalError") expected object "Error: a unique string" ("Error")
-FAIL Underlying sink: throwing write getter WritableStream constructor not implemented
-FAIL Underlying sink: throwing write method WritableStream constructor not implemented
-FAIL Underlying sink: throwing abort getter WritableStream constructor not implemented
-FAIL Underlying sink: throwing abort method WritableStream constructor not implemented
-FAIL Underlying sink: throwing close getter WritableStream constructor not implemented
-FAIL Underlying sink: throwing close method WritableStream constructor not implemented
+PASS Underlying sink: throwing start getter 
+PASS Underlying sink: throwing start method 
+FAIL Underlying sink: throwing write getter write not implemented
+FAIL Underlying sink: throwing write method write not implemented
+FAIL Underlying sink: throwing abort getter abort not implemented
+FAIL Underlying sink: throwing abort method abort not implemented
+FAIL Underlying sink: throwing close getter close not implemented
+FAIL Underlying sink: throwing close method close not implemented
 
index 6c17d2a..abc00e3 100644 (file)
@@ -1,11 +1,11 @@
 
 PASS Can get the ReadableStreamReader constructor indirectly 
 PASS Can get the ReadableStreamController constructor indirectly 
-FAIL ReadableStream.prototype.cancel enforces a brand check WritableStream constructor not implemented
-FAIL ReadableStream.prototype.getReader enforces a brand check WritableStream constructor not implemented
+PASS ReadableStream.prototype.cancel enforces a brand check 
+PASS ReadableStream.prototype.getReader enforces a brand check 
 PASS ReadableStream.prototype.pipeThrough works generically on its this and its arguments 
 FAIL ReadableStream.prototype.pipeTo works generically on its this and its arguments pipeTo is not implemented
-FAIL ReadableStream.prototype.tee enforces a brand check WritableStream constructor not implemented
+PASS ReadableStream.prototype.tee enforces a brand check 
 PASS ReadableStreamReader enforces a brand check on its argument 
 PASS ReadableStreamReader.prototype.closed enforces a brand check 
 PASS ReadableStreamReader.prototype.cancel enforces a brand check 
index b983040..5b29629 100644 (file)
@@ -4,5 +4,5 @@ PASS Can construct a ByteLengthQueuingStrategy with any value as its high water
 PASS ByteLengthQueuingStrategy constructor behaves as expected with wrong arguments 
 PASS ByteLengthQueuingStrategy size behaves as expected with wrong arguments 
 PASS ByteLengthQueuingStrategy instances have the correct properties 
-FAIL Closing a writable stream with in-flight writes below the high water mark delays the close call properly WritableStream constructor not implemented
+FAIL Closing a writable stream with in-flight writes below the high water mark delays the close call properly write not implemented
 
index a00e222..e23a509 100644 (file)
@@ -8,7 +8,7 @@ PASS Can construct a readable stream with a valid CountQueuingStrategy
 PASS Correctly governs the return value of a ReadableStream's enqueue function (HWM = 0) 
 PASS Correctly governs a ReadableStreamController's desiredSize property (HWM = 1) 
 PASS Correctly governs a ReadableStreamController's desiredSize property (HWM = 4) 
-FAIL Can construct a writable stream with a valid CountQueuingStrategy WritableStream constructor not implemented
-FAIL Correctly governs the value of a WritableStream's state property (HWM = 0) WritableStream constructor not implemented
-FAIL Correctly governs the value of a WritableStream's state property (HWM = 4) WritableStream constructor not implemented
+PASS Can construct a writable stream with a valid CountQueuingStrategy 
+FAIL Correctly governs the value of a WritableStream's state property (HWM = 0) state not implemented
+FAIL Correctly governs the value of a WritableStream's state property (HWM = 4) state not implemented
 
index 4e426f1..8ce898f 100644 (file)
@@ -1,4 +1,4 @@
 
-FAIL Piping through a duck-typed pass-through transform stream works WritableStream constructor not implemented
+FAIL Piping through a duck-typed pass-through transform stream works pipeTo is not implemented
 FAIL Piping through an identity transform stream will close the destination when the source closes Can't find variable: TransformStream
 
index 0336c2d..12e3115 100644 (file)
@@ -1,26 +1,26 @@
 
-FAIL Piping from a ReadableStream from which lots of data are readable synchronously WritableStream constructor not implemented
-FAIL Piping from a ReadableStream in readable state to a WritableStream in closing state WritableStream constructor not implemented
-FAIL Piping from a ReadableStream in readable state to a WritableStream in errored state WritableStream constructor not implemented
-FAIL Piping from a ReadableStream in the readable state which becomes closed after pipeTo call to a WritableStream in the writable state WritableStream constructor not implemented
-FAIL Piping from a ReadableStream in the readable state which becomes errored after pipeTo call to a WritableStream in the writable state WritableStream constructor not implemented
-FAIL Piping from an empty ReadableStream which becomes non-empty after pipeTo call to a WritableStream in the writable state WritableStream constructor not implemented
-FAIL Piping from an empty ReadableStream which becomes errored after pipeTo call to a WritableStream in the writable state WritableStream constructor not implemented
-FAIL Piping from an empty ReadableStream to a WritableStream in the writable state which becomes errored after a pipeTo call WritableStream constructor not implemented
-FAIL Piping from a non-empty ReadableStream to a WritableStream in the waiting state which becomes writable after a pipeTo call WritableStream constructor not implemented
-FAIL Piping from a non-empty ReadableStream to a WritableStream in waiting state which becomes errored after a pipeTo call WritableStream constructor not implemented
-FAIL Piping from a non-empty ReadableStream which becomes errored after pipeTo call to a WritableStream in the waiting state WritableStream constructor not implemented
-FAIL Piping from a non-empty ReadableStream to a WritableStream in the waiting state where both become ready after a pipeTo WritableStream constructor not implemented
-FAIL Piping from an empty ReadableStream to a WritableStream in the waiting state which becomes writable after a pipeTo call WritableStream constructor not implemented
-FAIL Piping from an empty ReadableStream which becomes closed after a pipeTo call to a WritableStream in the waiting state whose writes never complete WritableStream constructor not implemented
-FAIL Piping from an empty ReadableStream which becomes errored after a pipeTo call to a WritableStream in the waiting state WritableStream constructor not implemented
+FAIL Piping from a ReadableStream from which lots of data are readable synchronously state not implemented
+FAIL Piping from a ReadableStream in readable state to a WritableStream in closing state close not implemented
+FAIL Piping from a ReadableStream in readable state to a WritableStream in errored state write not implemented
+FAIL Piping from a ReadableStream in the readable state which becomes closed after pipeTo call to a WritableStream in the writable state pipeTo is not implemented
+FAIL Piping from a ReadableStream in the readable state which becomes errored after pipeTo call to a WritableStream in the writable state pipeTo is not implemented
+FAIL Piping from an empty ReadableStream which becomes non-empty after pipeTo call to a WritableStream in the writable state pipeTo is not implemented
+FAIL Piping from an empty ReadableStream which becomes errored after pipeTo call to a WritableStream in the writable state pipeTo is not implemented
+FAIL Piping from an empty ReadableStream to a WritableStream in the writable state which becomes errored after a pipeTo call state not implemented
+FAIL Piping from a non-empty ReadableStream to a WritableStream in the waiting state which becomes writable after a pipeTo call write not implemented
+FAIL Piping from a non-empty ReadableStream to a WritableStream in waiting state which becomes errored after a pipeTo call write not implemented
+FAIL Piping from a non-empty ReadableStream which becomes errored after pipeTo call to a WritableStream in the waiting state write not implemented
+FAIL Piping from a non-empty ReadableStream to a WritableStream in the waiting state where both become ready after a pipeTo write not implemented
+FAIL Piping from an empty ReadableStream to a WritableStream in the waiting state which becomes writable after a pipeTo call write not implemented
+FAIL Piping from an empty ReadableStream which becomes closed after a pipeTo call to a WritableStream in the waiting state whose writes never complete write not implemented
+FAIL Piping from an empty ReadableStream which becomes errored after a pipeTo call to a WritableStream in the waiting state write not implemented
 FAIL Piping to a duck-typed asynchronous "writable stream" works pipeTo is not implemented
-FAIL Piping to a stream that has been aborted passes through the error as the cancellation reason WritableStream constructor not implemented
-FAIL Piping to a stream and then aborting it passes through the error as the cancellation reason WritableStream constructor not implemented
-FAIL Piping to a stream that has been closed propagates a TypeError cancellation reason backward WritableStream constructor not implemented
-FAIL Piping to a stream and then closing it propagates a TypeError cancellation reason backward WritableStream constructor not implemented
-FAIL Piping to a stream that errors on write should pass through the error as the cancellation reason WritableStream constructor not implemented
-FAIL Piping to a stream that errors on write should not pass through the error if the stream is already closed WritableStream constructor not implemented
-FAIL Piping to a stream that errors soon after writing should pass through the error as the cancellation reason WritableStream constructor not implemented
-FAIL Piping to a writable stream that does not consume the writes fast enough exerts backpressure on the source WritableStream constructor not implemented
+FAIL Piping to a stream that has been aborted passes through the error as the cancellation reason abort not implemented
+FAIL Piping to a stream and then aborting it passes through the error as the cancellation reason pipeTo is not implemented
+FAIL Piping to a stream that has been closed propagates a TypeError cancellation reason backward close not implemented
+FAIL Piping to a stream and then closing it propagates a TypeError cancellation reason backward pipeTo is not implemented
+FAIL Piping to a stream that errors on write should pass through the error as the cancellation reason pipeTo is not implemented
+FAIL Piping to a stream that errors on write should not pass through the error if the stream is already closed pipeTo is not implemented
+FAIL Piping to a stream that errors soon after writing should pass through the error as the cancellation reason pipeTo is not implemented
+FAIL Piping to a writable stream that does not consume the writes fast enough exerts backpressure on the source pipeTo is not implemented
 
index 9e4c33d..3146665 100644 (file)
@@ -1,5 +1,5 @@
 
-FAIL Piping with no options and a destination error WritableStream constructor not implemented
-FAIL Piping with { preventCancel: false } and a destination error WritableStream constructor not implemented
-FAIL Piping with { preventCancel: true } and a destination error WritableStream constructor not implemented
+FAIL Piping with no options and a destination error pipeTo is not implemented
+FAIL Piping with { preventCancel: false } and a destination error pipeTo is not implemented
+FAIL Piping with { preventCancel: true } and a destination error pipeTo is not implemented
 
index 10f9716..5aaf03c 100644 (file)
@@ -18,8 +18,8 @@ PASS Running templatedRSClosed with ReadableStream (closed via call in start)
 PASS cancel() should return a distinct fulfilled promise each time 
 PASS locked should be false 
 PASS getReader() should be OK 
-FAIL piping to a WritableStream in the writable state should close the writable stream WritableStream constructor not implemented
-FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing WritableStream constructor not implemented
+FAIL piping to a WritableStream in the writable state should close the writable stream state not implemented
+FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing state not implemented
 PASS should be able to acquire multiple readers if they are released in succession 
 FAIL should not be able to acquire a second reader if we don't release the first one assert_throws: getting a second reader should throw function "function () { rs.getReader(); }" did not throw
 PASS Running templatedRSClosedReader with ReadableStream reader (closed before getting reader) 
@@ -40,8 +40,8 @@ PASS Running templatedRSClosed with ReadableStream (closed via cancel)
 PASS cancel() should return a distinct fulfilled promise each time 
 PASS locked should be false 
 PASS getReader() should be OK 
-FAIL piping to a WritableStream in the writable state should close the writable stream WritableStream constructor not implemented
-FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing WritableStream constructor not implemented
+FAIL piping to a WritableStream in the writable state should close the writable stream state not implemented
+FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing state not implemented
 PASS should be able to acquire multiple readers if they are released in succession 
 FAIL should not be able to acquire a second reader if we don't release the first one assert_throws: getting a second reader should throw function "function () { rs.getReader(); }" did not throw
 PASS Running templatedRSClosedReader with ReadableStream reader (closed via cancel after getting reader) 
@@ -52,7 +52,7 @@ PASS closed should fulfill with undefined
 FAIL releasing the lock should cause closed to reject and change identity assert_not_equals: the closed promise should change identity got disallowed value object "[object Promise]"
 PASS cancel() should return a distinct fulfilled promise each time 
 PASS Running templatedRSErrored with ReadableStream (errored via call in start) 
-FAIL piping to a WritableStream in the writable state should abort the writable stream WritableStream constructor not implemented
+FAIL piping to a WritableStream in the writable state should abort the writable stream state not implemented
 PASS getReader() should return a reader that acts errored 
 PASS read() twice should give the error each time 
 PASS locked should be false 
@@ -62,14 +62,14 @@ FAIL should not be able to obtain additional readers if we don't release the fir
 PASS cancel() should return a distinct rejected promise each time 
 PASS reader cancel() should return a distinct rejected promise each time 
 PASS Running templatedRSErrored with ReadableStream (errored via returning a rejected promise in start) 
-FAIL piping to a WritableStream in the writable state should abort the writable stream WritableStream constructor not implemented
+FAIL piping to a WritableStream in the writable state should abort the writable stream state not implemented
 PASS getReader() should return a reader that acts errored 
 PASS read() twice should give the error each time 
 PASS locked should be false 
 PASS Running templatedRSErroredAsyncOnly with ReadableStream (errored via returning a rejected promise in start) reader 
-FAIL piping with no options WritableStream constructor not implemented
-FAIL piping with { preventAbort: false } WritableStream constructor not implemented
-FAIL piping with { preventAbort: true } WritableStream constructor not implemented
+FAIL piping with no options pipeTo is not implemented
+FAIL piping with { preventAbort: false } pipeTo is not implemented
+FAIL piping with { preventAbort: true } pipeTo is not implemented
 PASS Running templatedRSErroredReader with ReadableStream (errored via returning a rejected promise in start) reader 
 PASS closed should reject with the error 
 FAIL releasing the lock should cause closed to reject and change identity assert_not_equals: the closed promise should change identity got disallowed value object "[object Promise]"
@@ -88,26 +88,26 @@ PASS calling read() twice with waiting will eventually give both chunks
 PASS read() should return distinct promises each time 
 PASS cancel() after a read() should still give that single read result 
 PASS Running templatedRSTwoChunksClosed with ReadableStream (two chunks enqueued, then closed) 
-FAIL piping with no options and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: false } and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: false } and a destination with that errors synchronously WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and a destination with that errors synchronously WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and a destination that errors on the last chunk WritableStream constructor not implemented
+FAIL piping with no options and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: false } and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: true } and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: false } and a destination with that errors synchronously pipeTo is not implemented
+FAIL piping with { preventClose: true } and a destination with that errors synchronously pipeTo is not implemented
+FAIL piping with { preventClose: true } and a destination that errors on the last chunk pipeTo is not implemented
 PASS Running templatedRSTwoChunksClosed with ReadableStream (two chunks enqueued async, then closed) 
-FAIL piping with no options and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: false } and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: false } and a destination with that errors synchronously WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and a destination with that errors synchronously WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and a destination that errors on the last chunk WritableStream constructor not implemented
+FAIL piping with no options and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: false } and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: true } and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: false } and a destination with that errors synchronously pipeTo is not implemented
+FAIL piping with { preventClose: true } and a destination with that errors synchronously pipeTo is not implemented
+FAIL piping with { preventClose: true } and a destination that errors on the last chunk pipeTo is not implemented
 PASS Running templatedRSTwoChunksClosed with ReadableStream (two chunks enqueued via pull, then closed) 
-FAIL piping with no options and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: false } and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and no destination errors WritableStream constructor not implemented
-FAIL piping with { preventClose: false } and a destination with that errors synchronously WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and a destination with that errors synchronously WritableStream constructor not implemented
-FAIL piping with { preventClose: true } and a destination that errors on the last chunk WritableStream constructor not implemented
+FAIL piping with no options and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: false } and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: true } and no destination errors pipeTo is not implemented
+FAIL piping with { preventClose: false } and a destination with that errors synchronously pipeTo is not implemented
+FAIL piping with { preventClose: true } and a destination with that errors synchronously pipeTo is not implemented
+FAIL piping with { preventClose: true } and a destination that errors on the last chunk pipeTo is not implemented
 PASS Running templatedRSTwoChunksClosedReader with ReadableStream (two chunks enqueued, then closed) reader 
 PASS third read(), without waiting, should give { value: undefined, done: true } 
 PASS third read, with waiting, should give { value: undefined, done: true } 
index 4c098d3..97ba154 100644 (file)
@@ -1,14 +1,14 @@
 
-FAIL Aborting a WritableStream immediately prevents future writes WritableStream constructor not implemented
-FAIL Aborting a WritableStream prevents further writes after any that are in progress WritableStream constructor not implemented
-FAIL Fulfillment value of ws.abort() call must be undefined even if the underlying sink returns a non-undefined value WritableStream constructor not implemented
-FAIL WritableStream if sink's abort throws, the promise returned by ws.abort() rejects WritableStream constructor not implemented
-FAIL Aborting a WritableStream passes through the given reason WritableStream constructor not implemented
-FAIL Aborting a WritableStream puts it in an errored state, with stored error equal to the abort reason WritableStream constructor not implemented
-FAIL Aborting a WritableStream causes any outstanding ready promises to be fulfilled immediately WritableStream constructor not implemented
-FAIL Aborting a WritableStream causes any outstanding write() promises to be rejected with the abort reason WritableStream constructor not implemented
-FAIL Closing but then immediately aborting a WritableStream causes the stream to error WritableStream constructor not implemented
-FAIL Closing a WritableStream and aborting it while it closes causes the stream to error WritableStream constructor not implemented
-FAIL Aborting a WritableStream after it is closed is a no-op WritableStream constructor not implemented
-FAIL WritableStream should call underlying sink's close if no abort is supplied WritableStream constructor not implemented
+FAIL Aborting a WritableStream immediately prevents future writes abort not implemented
+FAIL Aborting a WritableStream prevents further writes after any that are in progress write not implemented
+FAIL Fulfillment value of ws.abort() call must be undefined even if the underlying sink returns a non-undefined value abort not implemented
+FAIL WritableStream if sink's abort throws, the promise returned by ws.abort() rejects abort not implemented
+FAIL Aborting a WritableStream passes through the given reason abort not implemented
+FAIL Aborting a WritableStream puts it in an errored state, with stored error equal to the abort reason abort not implemented
+FAIL Aborting a WritableStream causes any outstanding ready promises to be fulfilled immediately write not implemented
+FAIL Aborting a WritableStream causes any outstanding write() promises to be rejected with the abort reason write not implemented
+FAIL Closing but then immediately aborting a WritableStream causes the stream to error close not implemented
+FAIL Closing a WritableStream and aborting it while it closes causes the stream to error close not implemented
+FAIL Aborting a WritableStream after it is closed is a no-op close not implemented
+FAIL WritableStream should call underlying sink's close if no abort is supplied abort not implemented
 
index 967731b..fb84263 100644 (file)
@@ -1,14 +1,14 @@
 
-FAIL error argument is given to start method WritableStream constructor not implemented
-FAIL Underlying sink's write won't be called until start finishes WritableStream constructor not implemented
-FAIL Underlying sink's close won't be called until start finishes WritableStream constructor not implemented
-FAIL Fulfillment value of ws.close() call must be undefined even if the underlying sink returns a non-undefined value WritableStream constructor not implemented
-FAIL Underlying sink's write or close are never invoked if start throws assert_equals: expected object "Error: horrible things" but got object "EvalError: WritableStream constructor not implemented"
-FAIL Underlying sink's write or close are never invoked if the promise returned by start is rejected WritableStream constructor not implemented
-FAIL WritableStream can be constructed with no arguments WritableStream constructor not implemented
-FAIL WritableStream instances have the correct methods and properties WritableStream constructor not implemented
-FAIL WritableStream with simple input, processed asynchronously WritableStream constructor not implemented
-FAIL WritableStream with simple input, processed synchronously WritableStream constructor not implemented
-FAIL WritableStream is writable and ready fulfills immediately if the strategy does not apply backpressure WritableStream constructor not implemented
-FAIL Fulfillment value of ws.write() call must be undefined even if the underlying sink returns a non-undefined ovalue WritableStream constructor not implemented
+FAIL error argument is given to start method state not implemented
+FAIL Underlying sink's write won't be called until start finishes write not implemented
+FAIL Underlying sink's close won't be called until start finishes close not implemented
+FAIL Fulfillment value of ws.close() call must be undefined even if the underlying sink returns a non-undefined value close not implemented
+PASS Underlying sink's write or close are never invoked if start throws 
+PASS Underlying sink's write or close are never invoked if the promise returned by start is rejected 
+PASS WritableStream can be constructed with no arguments 
+FAIL WritableStream instances have the correct methods and properties state not implemented
+FAIL WritableStream with simple input, processed asynchronously write not implemented
+FAIL WritableStream with simple input, processed synchronously write not implemented
+FAIL WritableStream is writable and ready fulfills immediately if the strategy does not apply backpressure state not implemented
+FAIL Fulfillment value of ws.write() call must be undefined even if the underlying sink returns a non-undefined ovalue write not implemented
 
index 07ec3c8..976d97b 100644 (file)
@@ -3371,6 +3371,7 @@ set(WEBCORE_JS_BUILTINS
     ${WEBCORE_DIR}/Modules/streams/ReadableStreamReader.js
     ${WEBCORE_DIR}/Modules/streams/StreamInternals.js
     ${WEBCORE_DIR}/Modules/streams/WritableStream.js
+    ${WEBCORE_DIR}/Modules/streams/WritableStreamInternals.js
 )
 
 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
index 26fc4b6..81c97da 100644 (file)
@@ -1,3 +1,30 @@
+2015-10-21  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
+        [Streams API] Construct a writable stream
+        https://bugs.webkit.org/show_bug.cgi?id=150360
+
+        Reviewed by Darin Adler.
+
+        This patch initializes a writable stream according to the spec. To do it we need two internal functions, which
+        are syncWritableStreamStateWithQueue and errorWritableStream, which are also implemented as a quite direct
+        translation from the spec.
+
+        Current test set suffices, expectations are updated accordingly.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMWindowBase.cpp:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * bindings/js/WebCoreJSBuiltinInternals.h:
+        * bindings/js/WebCoreJSBuiltins.cpp:
+        * bindings/js/WebCoreJSBuiltins.h: Build infrastructure.
+        * Modules/streams/WritableStream.js:
+        (initializeWritableStream): Function that acts as constructor of WritableStream.
+        * Modules/streams/WritableStreamInternals.js:
+        (syncWritableStreamStateWithQueue):
+        (errorWritableStream): As per spec.
+
 2015-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         NetworkProcess: DNS prefetch happens in the Web Process
index c37167e..6c144bf 100644 (file)
@@ -1266,6 +1266,7 @@ WEBCORE_JS_BUILTINS = \
     $(WebCore)/Modules/streams/ReadableStreamReader.js \
     $(WebCore)/Modules/streams/StreamInternals.js \
     $(WebCore)/Modules/streams/WritableStream.js \
+    $(WebCore)/Modules/streams/WritableStreamInternals.js \
 #
 
 all : $(WEBCORE_JS_BUILTINS:%.js=%Builtins.cpp)
index aa66098..da7758f 100644 (file)
@@ -30,7 +30,38 @@ function initializeWritableStream(underlyingSink, strategy)
 {
     "use strict";
 
-    throw new EvalError("WritableStream constructor not implemented");
+    if (typeof underlyingSink === "undefined")
+        underlyingSink = { };
+    if (typeof strategy === "undefined")
+        strategy = { highWaterMark: 0, size: function() { return 1; } };
+
+    if (!@isObject(underlyingSink))
+        throw new @TypeError("WritableStream constructor takes an object as first argument");
+
+    if (!@isObject(strategy))
+        throw new @TypeError("WritableStream constructor takes an object as second argument, if any");
+
+    this.@underlyingSink = underlyingSink;
+    this.@closedPromise = @createNewStreamsPromise();
+    this.@readyPromise = Promise.resolve(undefined);
+    this.@queue = @newQueue();
+    this.@started = false;
+    this.@writing = false;
+
+    this.@strategy = @validateAndNormalizeQueuingStrategy(strategy.size, strategy.highWaterMark);
+
+    @syncWritableStreamStateWithQueue(this);
+
+    var error = @errorWritableStream.bind(this);
+    var startResult = @invokeOrNoop(underlyingSink, "start", [error]);
+    this.@startedPromise = Promise.resolve(startResult);
+    var _this = this;
+    this.@startedPromise.then(function() {
+        _this.@started = true;
+        _this.@startedPromise = undefined;
+    }, function(r) {
+        error(r);
+    });
 
     return this;
 }
diff --git a/Source/WebCore/Modules/streams/WritableStreamInternals.js b/Source/WebCore/Modules/streams/WritableStreamInternals.js
new file mode 100644 (file)
index 0000000..45da2c3
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 Canon Inc.
+ * Copyright (C) 2015 Igalia
+ *
+ * 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 INC. ``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 INC. OR
+ * 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.
+ */
+
+// @optional=STREAMS_API
+// @internals
+
+function syncWritableStreamStateWithQueue(stream)
+{
+    "use strict";
+
+    if (stream.@state === "closing")
+        return undefined;
+
+    // TODO
+    // assert(stream.@state === "writable" || stream.@state === "waiting" || stream.@state === undefined);
+
+    if (stream.@queue.size > stream.@strategy.highWaterMark) {
+        stream.@state = "waiting";
+        stream.@readyPromise = @createNewStreamsPromise();
+    } else {
+        stream.@state = "writable";
+        @resolveStreamsPromise(stream.@readyPromise, undefined);
+    }
+
+    return undefined;
+}
+
+function errorWritableStream(e)
+{
+    "use strict";
+
+    if (this.@state === "closed" || this.@state === "errored")
+        return undefined;
+    while (this.@queue.content.length > 0) {
+        var writeRecord = @dequeueValue(this.@queue);
+        if (writeRecord !== "close" && writeRecord.promise)
+            @rejectStreamsPromise(writeRecord.promise, e);
+    }
+    this.@storedError = e;
+    if (this.@state === "waiting")
+        @resolveStreamsPromise(this.@readyPromise, undefined);
+    @rejectStreamsPromise(this.@closedPromise, e);
+    this.@state = "errored";
+    return undefined;
+}
index c7ab5c0..54c48ed 100644 (file)
                416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FEA1BBD1684000A6044 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               416E6FE81BBD12DF000A6053 /* WritableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764E9 /* WritableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE91BBD12E5000A6053 /* WritableStreamBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               416E6FEA1BBD1684000A6054 /* WritableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764EA /* WritableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
                417253AA1354BBBC00360F2A /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417253A81354BBBC00360F2A /* MediaControlElements.cpp */; };
                417253AB1354BBBC00360F2A /* MediaControlElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 417253A91354BBBC00360F2A /* MediaControlElements.h */; };
                417DA6D913734E6E007C57FB /* Internals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417DA4CF13734326007C57FB /* Internals.cpp */; };
                9908B0F11BCACF9100ED0F65 /* ReadableStreamInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ReadableStreamInternals.js; sourceTree = "<group>"; };
                9908B0F21BCACF9100ED0F65 /* ReadableStreamReader.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ReadableStreamReader.js; sourceTree = "<group>"; };
                9908B0EF1BCACF9100ED0F75 /* WritableStream.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = WritableStream.js; sourceTree = "<group>"; };
+               9908B0F11BCACF9100ED0F75 /* WritableStreamInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = WritableStreamInternals.js; sourceTree = "<group>"; };
                9908B0F31BCACFFE00ED0F65 /* ByteLengthQueuingStrategyBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ByteLengthQueuingStrategyBuiltins.cpp; sourceTree = "<group>"; };
                9908B0F41BCACFFE00ED0F65 /* ByteLengthQueuingStrategyBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteLengthQueuingStrategyBuiltinsWrapper.h; sourceTree = "<group>"; };
                9908B0F51BCAD07D00ED0F65 /* ByteLengthQueuingStrategyBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteLengthQueuingStrategyBuiltins.h; sourceTree = "<group>"; };
                9908B0FF1BCAD07D00ED0F65 /* ReadableStreamReaderBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamReaderBuiltins.h; sourceTree = "<group>"; };
                9908B1001BCAD07D00ED0F65 /* ReadableStreamReaderBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamReaderBuiltinsWrapper.h; sourceTree = "<group>"; };
                9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableStreamBuiltins.cpp; sourceTree = "<group>"; };
+               9908B0FD1BCAD07D00ED0F75 /* WritableStreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableStreamInternalsBuiltins.cpp; sourceTree = "<group>"; };
                9920398018B95BC600B39AF9 /* UserInputBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserInputBridge.cpp; sourceTree = "<group>"; };
                9920398118B95BC600B39AF9 /* UserInputBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInputBridge.h; sourceTree = "<group>"; };
                99C7CCB218C663E40032E413 /* MemoizedDOMResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoizedDOMResult.h; sourceTree = "<group>"; };
                9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltinsWrapper.h; sourceTree = "<group>"; };
                9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
                9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritableStreamBuiltins.h; sourceTree = "<group>"; };
+               9B03D8061BB3110D00B764E9 /* WritableStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritableStreamInternalsBuiltins.h; sourceTree = "<group>"; };
                9B03D8071BB3110D00B764E8 /* WritableStreamBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritableStreamBuiltinsWrapper.h; sourceTree = "<group>"; };
+               9B03D8071BB3110D00B764EA /* WritableStreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritableStreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
                9B19B67E1B964E5200348745 /* ShadowRoot.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRoot.idl; sourceTree = "<group>"; };
                9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLFormControlsCollection.idl; sourceTree = "<group>"; };
                9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollectionCustom.cpp; sourceTree = "<group>"; };
                                9908B0F11BCACF9100ED0F55 /* StreamInternals.js */,
                                41A023ED1A39DB7900F722DF /* WritableStream.idl */,
                                9908B0EF1BCACF9100ED0F75 /* WritableStream.js */,
+                               9908B0F11BCACF9100ED0F75 /* WritableStreamInternals.js */,
 
                        );
                        path = streams;
                                9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */,
                                9B03D8071BB3110D00B764E8 /* WritableStreamBuiltinsWrapper.h */,
                                9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */,
+                               9908B0FD1BCAD07D00ED0F75 /* WritableStreamInternalsBuiltins.cpp */,
+                               9B03D8061BB3110D00B764E9 /* WritableStreamInternalsBuiltins.h */,
+                               9B03D8071BB3110D00B764EA /* WritableStreamInternalsBuiltinsWrapper.h */,
                                656581EA09D1508D000E61D7 /* XLinkNames.cpp */,
                                656581EB09D1508D000E61D7 /* XLinkNames.h */,
                                A833C80A0A2CF25600D57664 /* XMLNames.cpp */,
                                97AABD2D14FA09D5007457AE /* WorkerThreadableWebSocketChannel.h in Headers */,
                                93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */,
                                416E6FE91BBD12E5000A6053 /* WritableStreamBuiltins.h in Headers */,
+                               416E6FE81BBD12DF000A6053 /* WritableStreamInternalsBuiltins.h in Headers */,
+                               416E6FEA1BBD1684000A6054 /* WritableStreamInternalsBuiltinsWrapper.h in Headers */,
                                9BAF3B2412C1A39800014BF1 /* WritingDirection.h in Headers */,
                                14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */,
                                6565820209D1508D000E61D7 /* XLinkNames.h in Headers */,
index fa2a309..17e27bc 100644 (file)
@@ -51,6 +51,7 @@
 #include "JSReadableStreamPrivateConstructors.h"
 #include "ReadableStreamInternalsBuiltins.h"
 #include "StreamInternalsBuiltins.h"
+#include "WritableStreamInternalsBuiltins.h"
 #endif
 
 using namespace JSC;
@@ -103,6 +104,12 @@ void JSDOMWindowBase::finishCreation(VM& vm, JSDOMWindowShell* shell)
             m_privateFunctions.streamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
         WEBCORESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
 #undef DECLARE_GLOBAL_STATIC
+#define DECLARE_GLOBAL_STATIC(name)\
+        GlobalPropertyInfo(\
+            static_cast<JSVMClientData*>(vm.clientData)->builtinFunctions().writableStreamInternalsBuiltins().name##PrivateName(), \
+            m_privateFunctions.writableStreamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
+        WEBCOREWRITABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
+#undef DECLARE_GLOBAL_STATIC
 #endif
     };
 
index 0fef220..52fc75a 100644 (file)
@@ -46,11 +46,15 @@ namespace WebCore {
     macro(readableStreamReadable) \
     macro(reader) \
     macro(readRequests) \
+    macro(readyPromise) \
     macro(state) \
     macro(started) \
+    macro(startedPromise) \
     macro(storedError) \
     macro(strategy) \
+    macro(underlyingSink) \
     macro(underlyingSource) \
+    macro(writing) \
     macro(ReadableStreamReader) \
     macro(ReadableStreamController) \
 
index e29f1ef..ba82898 100644 (file)
@@ -30,6 +30,7 @@
 #if ENABLE(STREAMS_API)
 #include "ReadableStreamInternalsBuiltinsWrapper.h"
 #include "StreamInternalsBuiltinsWrapper.h"
+#include "WritableStreamInternalsBuiltinsWrapper.h"
 #endif
 
 namespace WebCore {
@@ -41,17 +42,20 @@ explicit JSBuiltinInternalFunctions(JSC::VM& v)
 #if ENABLE(STREAMS_API)
         , m_readableStreamInternalsFunctions(vm)
         , m_streamInternalsFunctions(vm)
+        , m_writableStreamInternalsFunctions(vm)
 #endif
     { }
 
 #if ENABLE(STREAMS_API)
     ReadableStreamInternalsBuiltinFunctions readableStreamInternals() { return m_readableStreamInternalsFunctions; }
     StreamInternalsBuiltinFunctions streamInternals() { return m_streamInternalsFunctions; }
+    WritableStreamInternalsBuiltinFunctions writableStreamInternals() { return m_writableStreamInternalsFunctions; }
 #endif
     void visit(JSC::SlotVisitor& visitor) {
 #if ENABLE(STREAMS_API)
         m_readableStreamInternalsFunctions.visit(visitor);
         m_streamInternalsFunctions.visit(visitor);
+        m_writableStreamInternalsFunctions.visit(visitor);
 #else
         UNUSED_PARAM(visitor);
 #endif
@@ -60,6 +64,7 @@ explicit JSBuiltinInternalFunctions(JSC::VM& v)
 #if ENABLE(STREAMS_API)
         m_readableStreamInternalsFunctions.init(globalObject);
         m_streamInternalsFunctions.init(globalObject);
+        m_writableStreamInternalsFunctions.init(globalObject);
 #else
         UNUSED_PARAM(globalObject);
 #endif
@@ -70,6 +75,7 @@ private:
 #if ENABLE(STREAMS_API)
     ReadableStreamInternalsBuiltinFunctions m_readableStreamInternalsFunctions;
     StreamInternalsBuiltinFunctions m_streamInternalsFunctions;
+    WritableStreamInternalsBuiltinFunctions m_writableStreamInternalsFunctions;
 #endif
 
 };
index 3460db3..adf10e8 100644 (file)
@@ -39,4 +39,5 @@
 #include "ReadableStreamReaderBuiltins.cpp"
 #include "StreamInternalsBuiltins.cpp"
 #include "WritableStreamBuiltins.cpp"
+#include "WritableStreamInternalsBuiltins.cpp"
 #endif
index b4055c9..63774e1 100644 (file)
@@ -40,6 +40,7 @@
 #include "ReadableStreamReaderBuiltinsWrapper.h"
 #include "StreamInternalsBuiltinsWrapper.h"
 #include "WritableStreamBuiltinsWrapper.h"
+#include "WritableStreamInternalsBuiltinsWrapper.h"
 #endif
 
 #include <runtime/VM.h>
@@ -59,6 +60,7 @@ public:
         , m_readableStreamReaderBuiltins(&vm)
         , m_streamInternalsBuiltins(&vm)
         , m_writableStreamBuiltins(&vm)
+        , m_writableStreamInternalsBuiltins(&vm)
 #endif
 #if ENABLE(MEDIA_STREAM)
         , m_mediaDevicesBuiltins(&vm)
@@ -67,6 +69,7 @@ public:
 #if ENABLE(STREAMS_API)
         m_readableStreamInternalsBuiltins.exportNames();
         m_streamInternalsBuiltins.exportNames();
+        m_writableStreamInternalsBuiltins.exportNames();
 #endif
     }
 #if ENABLE(STREAMS_API)
@@ -78,6 +81,7 @@ public:
     ReadableStreamReaderBuiltinsWrapper& readableStreamReaderBuiltins() { return m_readableStreamReaderBuiltins; }
     StreamInternalsBuiltinsWrapper& streamInternalsBuiltins() { return m_streamInternalsBuiltins; }
     WritableStreamBuiltinsWrapper& writableStreamBuiltins() { return m_writableStreamBuiltins; }
+    WritableStreamInternalsBuiltinsWrapper& writableStreamInternalsBuiltins() { return m_writableStreamInternalsBuiltins;}
 #endif
 #if ENABLE(MEDIA_STREAM)
     MediaDevicesBuiltinsWrapper& mediaDevicesBuiltins() { return m_mediaDevicesBuiltins; }
@@ -94,6 +98,7 @@ private:
     ReadableStreamReaderBuiltinsWrapper m_readableStreamReaderBuiltins;
     StreamInternalsBuiltinsWrapper m_streamInternalsBuiltins;
     WritableStreamBuiltinsWrapper m_writableStreamBuiltins;
+    WritableStreamInternalsBuiltinsWrapper m_writableStreamInternalsBuiltins;
 #endif
 #if ENABLE(MEDIA_STREAM)
     MediaDevicesBuiltinsWrapper m_mediaDevicesBuiltins;