Bug 1506660 - Dispense with TODO comments about bytesWritten in ReadableStream implementation. r=till
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 16 Nov 2018 13:22:04 +0000
changeset 503189 8c5eaa1d4356ff8a4cd295f43d89f82d375bcc1b
parent 503188 ca8c304d9bd96bb24544fd9f0f22a40df2ff803b
child 503207 d6ac0dc85306b753c1d1d5f3084f73f0d1286b86
child 503214 79c527fa7f0f2c2ed645f59a30f2bc105e2868d4
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1506660
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1506660 - Dispense with TODO comments about bytesWritten in ReadableStream implementation. r=till The first comment appears in ReadableByteStreamControllerPullSteps. It's OK to delete it because we just asserted that there are no pending read requests (step 3.a.). The second comment appears in JS::ReadableStreamUpdateDataAvailableFromSource. It's OK to delete this one because it's in the hasDefaultReader branch. Default readers don't have read requests that care about the number of bytes available. Differential Revision: https://phabricator.services.mozilla.com/D12111
js/src/builtin/Stream.cpp
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -3365,17 +3365,16 @@ ReadableByteStreamControllerPullSteps(JS
                 AutoRealm ar(cx, unwrappedStream);
                 JS::AutoSuppressGCAnalysis suppressGC(cx);
                 JS::AutoCheckCannotGC noGC;
                 bool dummy;
                 void* buffer = JS_GetArrayBufferViewData(view, &dummy, noGC);
 
                 auto cb = cx->runtime()->readableStreamWriteIntoReadRequestCallback;
                 MOZ_ASSERT(cb);
-                // TODO: use bytesWritten to correctly update the request's state.
                 cb(cx, unwrappedStream, underlyingSource, unwrappedStream->embeddingFlags(),
                    buffer, queueTotalSize, &bytesWritten);
             }
 
             queueTotalSize = queueTotalSize - bytesWritten;
         } else {
             // Step 3.b: Let entry be the first element of this.[[queue]].
             // Step 3.c: Remove entry from this.[[queue]], shifting all other elements
@@ -4362,17 +4361,16 @@ JS::ReadableStreamUpdateDataAvailableFro
         {
             AutoRealm ar(cx, unwrappedStream);
             JS::AutoSuppressGCAnalysis suppressGC(cx);
             JS::AutoCheckCannotGC noGC;
             bool dummy;
             void* buffer = JS_GetArrayBufferViewData(transferredView, &dummy, noGC);
             auto cb = cx->runtime()->readableStreamWriteIntoReadRequestCallback;
             MOZ_ASSERT(cb);
-            // TODO: use bytesWritten to correctly update the request's state.
             cb(cx, unwrappedStream, underlyingSource, unwrappedStream->embeddingFlags(), buffer,
                availableData, &bytesWritten);
         }
 
         // Step iii: Perform ! ReadableStreamFulfillReadRequest(stream, transferredView, false).
         RootedValue chunk(cx, ObjectValue(*transferredView));
         if (!ReadableStreamFulfillReadOrReadIntoRequest(cx, unwrappedStream, chunk, false)) {
             return false;