Title: [210060] trunk/Source/WebCore
Revision
210060
Author
[email protected]
Date
2016-12-21 09:37:14 -0800 (Wed, 21 Dec 2016)

Log Message

[Readable Streams API] Fix test in readableByteStreamCallPullIfNeeded
https://bugs.webkit.org/show_bug.cgi?id=166312

Reviewed by Youenn Fablet.

Add a new function to evaluate if calling a pull function is
required as per specification.

No new test required.

* Modules/streams/ReadableByteStreamInternals.js:
(readableByteStreamControllerShouldCallPull): Added.
(readableByteStreamControllerCallPullIfNeeded):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (210059 => 210060)


--- trunk/Source/WebCore/ChangeLog	2016-12-21 17:33:05 UTC (rev 210059)
+++ trunk/Source/WebCore/ChangeLog	2016-12-21 17:37:14 UTC (rev 210060)
@@ -1,3 +1,19 @@
+2016-12-21  Nael Ouedraogo  <[email protected]>
+
+        [Readable Streams API] Fix test in readableByteStreamCallPullIfNeeded
+        https://bugs.webkit.org/show_bug.cgi?id=166312
+
+        Reviewed by Youenn Fablet.
+
+        Add a new function to evaluate if calling a pull function is
+        required as per specification.
+
+        No new test required.
+
+        * Modules/streams/ReadableByteStreamInternals.js:
+        (readableByteStreamControllerShouldCallPull): Added.
+        (readableByteStreamControllerCallPullIfNeeded):
+
 2016-12-21  Simon Fraser  <[email protected]>
 
         Fixed bars are positioned incorrectly when there are header and footer banners

Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js (210059 => 210060)


--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2016-12-21 17:33:05 UTC (rev 210059)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2016-12-21 17:37:14 UTC (rev 210060)
@@ -169,7 +169,7 @@
     return stream.@reader !== @undefined && @isReadableStreamDefaultReader(stream.@reader);
 }
 
-function readableByteStreamControllerCallPullIfNeeded(controller)
+function readableByteStreamControllerShouldCallPull(controller)
 {
     "use strict";
 
@@ -176,17 +176,32 @@
     const stream = controller.@controlledReadableStream;
 
     if (stream.@state !== @streamReadable)
-        return;
+        return false;
     if (controller.@closeRequested)
+        return false;
+    if (!controller.@started)
+        return false;
+    if (@readableStreamHasDefaultReader(stream) && stream.@reader.@readRequests > 0)
+        return true;
+    if (@readableStreamHasBYOBReader(stream) && stream.@reader.@readIntoRequests > 0)
+        return true;
+    if (@readableByteStreamControllerGetDesiredSize(controller) > 0)
+        return true;
+    return false;
+}
+
+function readableByteStreamControllerCallPullIfNeeded(controller)
+{
+    "use strict";
+
+    if (!@readableByteStreamControllerShouldCallPull(controller))
         return;
-    if (!@readableStreamHasDefaultReader(stream) || stream.@reader.@readRequests <= 0)
-        if (!@readableStreamHasBYOBReader(stream) || stream.@reader.@readIntoRequests <= 0)
-            if (@readableByteStreamControllerGetDesiredSize(controller) <= 0)
-                return;
+
     if (controller.@pulling) {
         controller.@pullAgain = true;
         return;
     }
+
     @assert(!controller.@pullAgain);
     controller.@pulling = true;
     @promiseInvokeOrNoop(controller.@underlyingByteSource, "pull", [controller]).@then(() => {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to