Title: [226005] trunk
Revision
226005
Author
romain.belless...@crf.canon.fr
Date
2017-12-16 10:59:29 -0800 (Sat, 16 Dec 2017)

Log Message

[Readable Streams API] Fix filling of descriptor from queue
https://bugs.webkit.org/show_bug.cgi?id=172717

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Updated test expectations.

* web-platform-tests/streams/readable-byte-streams/detached-buffers-expected.txt: Updated.
* web-platform-tests/streams/readable-byte-streams/detached-buffers.dedicatedworker-expected.txt: Updated.
* web-platform-tests/streams/readable-byte-streams/general-expected.txt: Updated.
* web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt: Updated.

Source/WebCore:

Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
spec comprised a bug and code was not reachable. Spec has now been fixed and code can
now be reached.

[1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue

No new tests (covered by WPT tests, whose expectations have been updated).

* Modules/streams/ReadableByteStreamInternals.js:
(readableByteStreamControllerFillDescriptorFromQueue): Updated.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (226004 => 226005)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-12-16 18:59:29 UTC (rev 226005)
@@ -1,3 +1,17 @@
+2017-12-16  Romain Bellessort  <romain.belless...@crf.canon.fr>
+
+        [Readable Streams API] Fix filling of descriptor from queue
+        https://bugs.webkit.org/show_bug.cgi?id=172717
+
+        Reviewed by Youenn Fablet.
+
+        Updated test expectations.
+
+        * web-platform-tests/streams/readable-byte-streams/detached-buffers-expected.txt: Updated.
+        * web-platform-tests/streams/readable-byte-streams/detached-buffers.dedicatedworker-expected.txt: Updated.
+        * web-platform-tests/streams/readable-byte-streams/general-expected.txt: Updated.
+        * web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt: Updated.
+
 2017-12-16  Youenn Fablet  <you...@apple.com>
 
         Skip SharedWorker and NavigationPreload service worker tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers-expected.txt (226004 => 226005)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers-expected.txt	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers-expected.txt	2017-12-16 18:59:29 UTC (rev 226005)
@@ -2,7 +2,7 @@
 Harness Error (TIMEOUT), message = null
 
 FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer assert_not_equals: a different ArrayBuffer must underlie the value got disallowed value object "[object ArrayBuffer]"
-FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer assert_array_equals: The value read must be the enqueued Uint8Array, not the original values property 0, expected 1 but got 4
+FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer assert_not_equals: a different ArrayBuffer must underlie the value got disallowed value object "[object ArrayBuffer]"
 FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws assert_throws: enqueuing an already-detached buffer must throw function "() => c.enqueue(view)" did not throw
 TIMEOUT ReadableStream with byte source: reading into an already-detached buffer rejects Test timed out
 FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) assert_throws: respond() must throw if the corresponding view has become detached function "() => c.byobRequest.respond(1)" did not throw

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers.dedicatedworker-expected.txt (226004 => 226005)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers.dedicatedworker-expected.txt	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers.dedicatedworker-expected.txt	2017-12-16 18:59:29 UTC (rev 226005)
@@ -2,7 +2,7 @@
 Harness Error (TIMEOUT), message = null
 
 FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer assert_not_equals: a different ArrayBuffer must underlie the value got disallowed value object "[object ArrayBuffer]"
-FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer assert_array_equals: The value read must be the enqueued Uint8Array, not the original values property 0, expected 1 but got 4
+FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer assert_not_equals: a different ArrayBuffer must underlie the value got disallowed value object "[object ArrayBuffer]"
 FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws assert_throws: enqueuing an already-detached buffer must throw function "() => c.enqueue(view)" did not throw
 TIMEOUT ReadableStream with byte source: reading into an already-detached buffer rejects Test timed out
 FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) assert_throws: respond() must throw if the corresponding view has become detached function "() => c.byobRequest.respond(1)" did not throw

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt (226004 => 226005)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt	2017-12-16 18:59:29 UTC (rev 226005)
@@ -24,7 +24,7 @@
 PASS ReadableStream with byte source: read(), but pull() function is not callable 
 PASS ReadableStream with byte source: read(view), but pull() function is not callable 
 PASS ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() 
-FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() assert_equals: expected 1 but got 0
+PASS ReadableStream with byte source: enqueue(), read(view) partially, then read() 
 PASS ReadableStream with byte source: getReader(), enqueue(), close(), then read() 
 PASS ReadableStream with byte source: enqueue(), close(), getReader(), then read() 
 PASS ReadableStream with byte source: Respond to pull() by enqueue() 
@@ -32,18 +32,18 @@
 PASS ReadableStream with byte source: read(view), then respond() 
 PASS ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer 
 PASS ReadableStream with byte source: read(view), then respond() with too big value 
-FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder assert_equals: expected 3 but got 0
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) assert_equals: expected 1 but got 0
+PASS ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder 
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) 
 PASS ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) 
 PASS ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) 
 PASS ReadableStream with byte source: getReader(), read(view), then cancel() 
 PASS ReadableStream with byte source: cancel() with partially filled pending pull() request 
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view assert_equals: expected 1 but got 0
-FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) assert_equals: Contents are set from the first chunk expected 123 but got 0
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view assert_equals: expected 1 but got 0
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views assert_equals: expected 1 but got 0
-FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array assert_equals: expected 43775 but got 43520
-FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array assert_equals: Contents are set expected 1 but got 0
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view 
+PASS ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) 
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view 
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views 
+PASS ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array 
+PASS ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array 
 PASS ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail 
 PASS ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array 
 PASS ReadableStream with byte source: Throw if close()-ed more than once 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt (226004 => 226005)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt	2017-12-16 18:59:29 UTC (rev 226005)
@@ -24,7 +24,7 @@
 PASS ReadableStream with byte source: read(), but pull() function is not callable 
 PASS ReadableStream with byte source: read(view), but pull() function is not callable 
 PASS ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() 
-FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() assert_equals: expected 1 but got 0
+PASS ReadableStream with byte source: enqueue(), read(view) partially, then read() 
 PASS ReadableStream with byte source: getReader(), enqueue(), close(), then read() 
 PASS ReadableStream with byte source: enqueue(), close(), getReader(), then read() 
 PASS ReadableStream with byte source: Respond to pull() by enqueue() 
@@ -32,18 +32,18 @@
 PASS ReadableStream with byte source: read(view), then respond() 
 PASS ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer 
 PASS ReadableStream with byte source: read(view), then respond() with too big value 
-FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder assert_equals: expected 3 but got 0
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) assert_equals: expected 1 but got 0
+PASS ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder 
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) 
 PASS ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) 
 PASS ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) 
 PASS ReadableStream with byte source: getReader(), read(view), then cancel() 
 PASS ReadableStream with byte source: cancel() with partially filled pending pull() request 
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view assert_equals: expected 1 but got 0
-FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) assert_equals: Contents are set from the first chunk expected 123 but got 0
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view assert_equals: expected 1 but got 0
-FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views assert_equals: expected 1 but got 0
-FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array assert_equals: expected 43775 but got 43520
-FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array assert_equals: Contents are set expected 1 but got 0
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view 
+PASS ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) 
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view 
+PASS ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views 
+PASS ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array 
+PASS ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array 
 PASS ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail 
 PASS ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array 
 PASS ReadableStream with byte source: Throw if close()-ed more than once 

Modified: trunk/Source/WebCore/ChangeLog (226004 => 226005)


--- trunk/Source/WebCore/ChangeLog	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/Source/WebCore/ChangeLog	2017-12-16 18:59:29 UTC (rev 226005)
@@ -1,3 +1,21 @@
+2017-12-16  Romain Bellessort  <romain.belless...@crf.canon.fr>
+
+        [Readable Streams API] Fix filling of descriptor from queue
+        https://bugs.webkit.org/show_bug.cgi?id=172717
+
+        Reviewed by Youenn Fablet.
+
+        Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
+        spec comprised a bug and code was not reachable. Spec has now been fixed and code can
+        now be reached.
+
+        [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue
+
+        No new tests (covered by WPT tests, whose expectations have been updated).
+
+        * Modules/streams/ReadableByteStreamInternals.js:
+        (readableByteStreamControllerFillDescriptorFromQueue): Updated.
+
 2017-12-16  Brady Eidson  <beid...@apple.com>
 
         Implement getting ServiceWorker registrations for the WKWebsiteDataStore API

Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js (226004 => 226005)


--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2017-12-16 18:57:21 UTC (rev 226004)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2017-12-16 18:59:29 UTC (rev 226005)
@@ -503,15 +503,10 @@
         // Copy appropriate part of pullIntoDescriptor.buffer to headOfQueue.buffer.
         // Remark: this implementation is not completely aligned on the definition of CopyDataBlockBytes
         // operation of ECMAScript (the case of Shared Data Block is not considered here, but it doesn't seem to be an issue).
-        let fromIndex = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
-        let count = bytesToCopy;
-        let toIndex = headOfQueue.byteOffset;
-        while (count > 0) {
-            headOfQueue.buffer[toIndex] = pullIntoDescriptor.buffer[fromIndex];
-            toIndex++;
-            fromIndex++;
-            count--;
-        }
+        const destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
+        // FIXME: As indicated in comments of bug 172717, access to set is not safe. However, using prototype.@set.@call does
+        // not work (@set is undefined). A safe way to do that is needed.
+        new @Uint8Array(pullIntoDescriptor.buffer).set(new @Uint8Array(headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy), destStart);
 
         if (headOfQueue.byteLength === bytesToCopy)
             controller.@queue.content.@shift();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to