Title: [191446] trunk
Revision
191446
Author
[email protected]
Date
2015-10-22 00:51:08 -0700 (Thu, 22 Oct 2015)

Log Message

[Streams API] Add writable stream attributes
https://bugs.webkit.org/show_bug.cgi?id=150389

Reviewed by Darin Adler.

Source/WebCore:

This patch adds the three writable stream attributes, which are closed, ready and state. They are implemented
according to the spec.

Current test set suffices, expectations were adjusted accordingly.

* Modules/streams/WritableStream.js:
(initializeWritableStream): Style fix.
(closed):
(ready):
(state): Implemented according to the spec.
* Modules/streams/WritableStreamInternals.js:
(isWritableStream): Implemented according to the spec.

LayoutTests:

Expectations for the implementation of writable stream attributes.

* streams/reference-implementation/brand-checks-expected.txt:
* streams/reference-implementation/count-queuing-strategy-expected.txt:
* streams/reference-implementation/pipe-to-expected.txt:
* streams/reference-implementation/readable-stream-templated-expected.txt:
* streams/reference-implementation/writable-stream-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191445 => 191446)


--- trunk/LayoutTests/ChangeLog	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/LayoutTests/ChangeLog	2015-10-22 07:51:08 UTC (rev 191446)
@@ -1,3 +1,18 @@
+2015-10-22  Xabier Rodriguez Calvar  <[email protected]>
+
+        [Streams API] Add writable stream attributes
+        https://bugs.webkit.org/show_bug.cgi?id=150389
+
+        Reviewed by Darin Adler.
+
+        Expectations for the implementation of writable stream attributes.
+
+        * streams/reference-implementation/brand-checks-expected.txt:
+        * streams/reference-implementation/count-queuing-strategy-expected.txt:
+        * streams/reference-implementation/pipe-to-expected.txt:
+        * streams/reference-implementation/readable-stream-templated-expected.txt:
+        * streams/reference-implementation/writable-stream-expected.txt:
+
 2015-10-22  Frederic Wang  <[email protected]>
 
         Rollout r190440 for the moment. It broke the build.

Modified: trunk/LayoutTests/streams/reference-implementation/brand-checks-expected.txt (191445 => 191446)


--- trunk/LayoutTests/streams/reference-implementation/brand-checks-expected.txt	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/LayoutTests/streams/reference-implementation/brand-checks-expected.txt	2015-10-22 07:51:08 UTC (rev 191446)
@@ -17,9 +17,9 @@
 PASS ReadableStreamController.prototype.close enforces a brand check 
 PASS ReadableStreamController.prototype.enqueue enforces a brand check 
 PASS ReadableStreamController.prototype.error enforces a brand check 
-FAIL WritableStream.prototype.closed enforces a brand check closed not implemented
-FAIL WritableStream.prototype.ready enforces a brand check ready not implemented
-FAIL WritableStream.prototype.state enforces a brand check assert_throws: state should throw a TypeError function "function () { getter.call(target); }" threw object "EvalError: state not implemented" ("EvalError") expected object "TypeError" ("TypeError")
+PASS WritableStream.prototype.closed enforces a brand check 
+PASS WritableStream.prototype.ready enforces a brand check 
+PASS WritableStream.prototype.state enforces a brand check 
 FAIL WritableStream.prototype.abort enforces a brand check abort not implemented
 FAIL WritableStream.prototype.write enforces a brand check write not implemented
 FAIL WritableStream.prototype.close enforces a brand check close not implemented

Modified: trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt (191445 => 191446)


--- trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt	2015-10-22 07:51:08 UTC (rev 191446)
@@ -9,6 +9,6 @@
 PASS Correctly governs a ReadableStreamController's desiredSize property (HWM = 1) 
 PASS Correctly governs a ReadableStreamController's desiredSize property (HWM = 4) 
 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
+FAIL Correctly governs the value of a WritableStream's state property (HWM = 0) write not implemented
+FAIL Correctly governs the value of a WritableStream's state property (HWM = 4) write not implemented
 

Modified: trunk/LayoutTests/streams/reference-implementation/pipe-to-expected.txt (191445 => 191446)


--- trunk/LayoutTests/streams/reference-implementation/pipe-to-expected.txt	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/LayoutTests/streams/reference-implementation/pipe-to-expected.txt	2015-10-22 07:51:08 UTC (rev 191446)
@@ -1,12 +1,12 @@
 
-FAIL Piping from a ReadableStream from which lots of data are readable synchronously state not implemented
+FAIL Piping from a ReadableStream from which lots of data are readable synchronously pipeTo is 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 an empty ReadableStream to a WritableStream in the writable state which becomes errored after a pipeTo call pipeTo is 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

Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt (191445 => 191446)


--- trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt	2015-10-22 07:51:08 UTC (rev 191446)
@@ -18,8 +18,8 @@
 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 state not implemented
-FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing state not implemented
+FAIL piping to a WritableStream in the writable state should close the writable stream pipeTo is not implemented
+FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing pipeTo is 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 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 state not implemented
-FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing state not implemented
+FAIL piping to a WritableStream in the writable state should close the writable stream pipeTo is not implemented
+FAIL piping to a WritableStream in the writable state with { preventClose: true } should do nothing pipeTo is 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 @@
 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 state not implemented
+FAIL piping to a WritableStream in the writable state should abort the writable stream pipeTo is 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,7 +62,7 @@
 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 state not implemented
+FAIL piping to a WritableStream in the writable state should abort the writable stream pipeTo is 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 

Modified: trunk/LayoutTests/streams/reference-implementation/writable-stream-expected.txt (191445 => 191446)


--- trunk/LayoutTests/streams/reference-implementation/writable-stream-expected.txt	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/LayoutTests/streams/reference-implementation/writable-stream-expected.txt	2015-10-22 07:51:08 UTC (rev 191446)
@@ -1,14 +1,14 @@
 
-FAIL error argument is given to start method state not implemented
+PASS error argument is given to start method 
 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
+PASS WritableStream instances have the correct methods and properties 
 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
+PASS WritableStream is writable and ready fulfills immediately if the strategy does not apply backpressure 
 FAIL Fulfillment value of ws.write() call must be undefined even if the underlying sink returns a non-undefined ovalue write not implemented
 

Modified: trunk/Source/WebCore/ChangeLog (191445 => 191446)


--- trunk/Source/WebCore/ChangeLog	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/Source/WebCore/ChangeLog	2015-10-22 07:51:08 UTC (rev 191446)
@@ -1,3 +1,23 @@
+2015-10-22  Xabier Rodriguez Calvar  <[email protected]>
+
+        [Streams API] Add writable stream attributes
+        https://bugs.webkit.org/show_bug.cgi?id=150389
+
+        Reviewed by Darin Adler.
+
+        This patch adds the three writable stream attributes, which are closed, ready and state. They are implemented
+        according to the spec.
+
+        Current test set suffices, expectations were adjusted accordingly.
+
+        * Modules/streams/WritableStream.js:
+        (initializeWritableStream): Style fix.
+        (closed):
+        (ready):
+        (state): Implemented according to the spec.
+        * Modules/streams/WritableStreamInternals.js:
+        (isWritableStream): Implemented according to the spec.
+
 2015-10-22  Frederic Wang  <[email protected]>
 
         Rollout r190440 for the moment. It broke the build.

Modified: trunk/Source/WebCore/Modules/streams/WritableStream.js (191445 => 191446)


--- trunk/Source/WebCore/Modules/streams/WritableStream.js	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/Source/WebCore/Modules/streams/WritableStream.js	2015-10-22 07:51:08 UTC (rev 191446)
@@ -59,9 +59,7 @@
     [email protected](function() {
         _this.@started = true;
         _this.@startedPromise = undefined;
-    }, function(r) {
-        error(r);
-    });
+    }, error);
 
     return this;
 }
@@ -91,19 +89,28 @@
 {
     "use strict";
 
-    throw new EvalError("closed not implemented");
+    if (!@isWritableStream(this))
+        return Promise.reject(new @TypeError("The WritableStream.closed getter can only be used on instances of WritableStream"));
+
+    return this.@closedPromise;
 }
 
 function ready()
 {
     "use strict";
 
-    throw new EvalError("ready not implemented");
+    if (!@isWritableStream(this))
+        return Promise.reject(new @TypeError("The WritableStream.ready getter can only be used on instances of WritableStream"));
+
+    return this.@readyPromise;
 }
 
 function state()
 {
     "use strict";
 
-    throw new EvalError("state not implemented");
+    if (!@isWritableStream(this))
+        throw new @TypeError("The WritableStream.state getter can only be used on instances of WritableStream");
+
+    return this.@state;
 }

Modified: trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js (191445 => 191446)


--- trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js	2015-10-22 07:17:20 UTC (rev 191445)
+++ trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js	2015-10-22 07:51:08 UTC (rev 191446)
@@ -27,6 +27,13 @@
 // @optional=STREAMS_API
 // @internals
 
+function isWritableStream(stream)
+{
+    "use strict";
+
+    return @isObject(stream) && !!stream.@underlyingSink;
+}
+
 function syncWritableStreamStateWithQueue(stream)
 {
     "use strict";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to