Bug 1508255 - Reformat comments in js/src/Stream.cpp r=jorendorff
authorTed Campbell <tcampbell@mozilla.com>
Tue, 20 Nov 2018 15:21:06 +0000
changeset 506451 5219139e6d0f9fb6c9effc4df73244b8f9dd418c
parent 506450 32eadea53faa9aca578c11bf682fcbb9385f9ebf
child 506452 fa3eaa0d2cde35eb9435f6f8455148f9eec5ff4f
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1508255
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 1508255 - Reformat comments in js/src/Stream.cpp r=jorendorff This generates much better results for clang-format. Differential Revision: https://phabricator.services.mozilla.com/D12389
js/src/builtin/Stream.cpp
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -529,17 +529,18 @@ ReadableStream*
 ReadableStream::createStream(JSContext* cx, HandleObject proto /* = nullptr */)
 {
     Rooted<ReadableStream*> stream(cx, NewObjectWithClassProto<ReadableStream>(cx, proto));
     if (!stream) {
         return nullptr;
     }
 
     // Step 1: Set this.[[state]] to "readable".
-    // Step 2: Set this.[[reader]] and this.[[storedError]] to undefined (implicit).
+    // Step 2: Set this.[[reader]] and this.[[storedError]] to
+    //         undefined (implicit).
     // Step 3: Set this.[[disturbed]] to false (implicit).
     // Step 4: Set this.[[readableStreamController]] to undefined (implicit).
     stream->initStateBits(Readable);
 
     return stream;
 }
 
 static MOZ_MUST_USE ReadableStreamDefaultController*
@@ -782,17 +783,18 @@ ReadableStream_getReader(JSContext* cx, 
         reader = CreateReadableStreamDefaultReader(cx, unwrappedStream, ForAuthorCodeBool::Yes);
     } else {
         // Step 3: Set mode to ? ToString(mode) (implicit).
         RootedString mode(cx, ToString<CanGC>(cx, modeVal));
         if (!mode) {
             return false;
         }
 
-        // Step 4: If mode is "byob", return ? AcquireReadableStreamBYOBReader(this).
+        // Step 4: If mode is "byob",
+        //         return ? AcquireReadableStreamBYOBReader(this).
         int32_t notByob;
         if (!CompareStrings(cx, mode, cx->names().byob, &notByob)) {
             return false;
         }
         if (notByob) {
             JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                       JSMSG_READABLESTREAM_INVALID_READER_MODE);
             // Step 5: Throw a RangeError exception.
@@ -806,20 +808,24 @@ ReadableStream_getReader(JSContext* cx, 
     // Reordered second part of steps 2 and 4.
     if (!reader) {
         return false;
     }
     args.rval().setObject(*reader);
     return true;
 }
 
-// Streams spec, 3.2.5.4. pipeThrough({ writable, readable }, options)
+// Streams spec, 3.2.5.4.
+//      pipeThrough({ writable, readable }, options)
+//
 // Not implemented.
 
-// Streams spec, 3.2.5.5. pipeTo(dest, { preventClose, preventAbort, preventCancel } = {})
+// Streams spec, 3.2.5.5.
+//      pipeTo(dest, { preventClose, preventAbort, preventCancel } = {})
+//
 // Not implemented.
 
 static MOZ_MUST_USE bool
 ReadableStreamTee(JSContext* cx, Handle<ReadableStream*> unwrappedStream, bool cloneForBranch2,
                   MutableHandle<ReadableStream*> branch1, MutableHandle<ReadableStream*> branch2);
 
 /**
  * Streams spec, 3.2.5.6. tee()
@@ -874,20 +880,24 @@ CLASS_SPEC(ReadableStream, 0, SlotCount,
 /*** 3.3. General readable stream abstract operations ***********************/
 
 // Streams spec, 3.3.1. AcquireReadableStreamBYOBReader ( stream )
 // Always inlined.
 
 // Streams spec, 3.3.2. AcquireReadableStreamDefaultReader ( stream )
 // Always inlined. See CreateReadableStreamDefaultReader.
 
-// Streams spec, 3.3.3. CreateReadableStream ( startAlgorithm, pullAlgorithm, cancelAlgorithm [, highWaterMark [, sizeAlgorithm ] ] )
+// Streams spec, 3.3.3. CreateReadableStream (
+//                          startAlgorithm, pullAlgorithm, cancelAlgorithm
+//                          [, highWaterMark [, sizeAlgorithm ] ] )
 // Not implemented.
 
-// Streams spec, 3.3.4. CreateReadableByteStream ( startAlgorithm, pullAlgorithm, cancelAlgorithm [, highWaterMark [, autoAllocateChunkSize ] ] )
+// Streams spec, 3.3.4. CreateReadableByteStream (
+//                          startAlgorithm, pullAlgorithm, cancelAlgorithm
+//                          [, highWaterMark [, autoAllocateChunkSize ] ] )
 // Not implemented.
 
 // Streams spec, 3.3.5. InitializeReadableStream ( stream )
 // Not implemented.
 
 // Streams spec, 3.3.6. IsReadableStream ( x )
 // Using is<T> instead.
 
@@ -1186,24 +1196,24 @@ TeeReaderClosedHandler(JSContext* cx, un
     // Step a: If closedOrErrored is false, then:
     if (!teeState->closedOrErrored()) {
         // Step a.iii: Set closedOrErrored to true.
         // Reordered to ensure that internal errors in the other steps don't
         // leave the teeState in an undefined state.
         teeState->setClosedOrErrored();
 
         // Step a.i: Perform ! ReadableStreamDefaultControllerErrorIfNeeded(
-        //           branch1.[[readableStreamController]], r).
+        //                          branch1.[[readableStreamController]], r).
         Rooted<ReadableStreamDefaultController*> branch1(cx, teeState->branch1());
         if (!ReadableStreamDefaultControllerErrorIfNeeded(cx, branch1, reason)) {
             return false;
         }
 
         // Step a.ii: Perform ! ReadableStreamDefaultControllerErrorIfNeeded(
-        //            branch2.[[readableStreamController]], r).
+        //                          branch2.[[readableStreamController]], r).
         Rooted<ReadableStreamDefaultController*> branch2(cx, teeState->branch2());
         if (!ReadableStreamDefaultControllerErrorIfNeeded(cx, branch2, reason)) {
             return false;
         }
     }
 
     args.rval().setUndefined();
     return true;
@@ -1650,18 +1660,20 @@ ReadableStreamErrorInternal(JSContext* c
                                                      unwrappedStream->embeddingFlags(),
                                                      error);
     }
 
     return true;
 }
 
 /**
- * Streams spec, 3.4.7. ReadableStreamFulfillReadIntoRequest( stream, chunk, done )
- * Streams spec, 3.4.8. ReadableStreamFulfillReadRequest ( stream, chunk, done )
+ * Streams spec, 3.4.7.
+ *      ReadableStreamFulfillReadIntoRequest( stream, chunk, done )
+ * Streams spec, 3.4.8.
+ *      ReadableStreamFulfillReadRequest ( stream, chunk, done )
  * These two spec functions are identical in our implementation.
  */
 static MOZ_MUST_USE bool
 ReadableStreamFulfillReadOrReadIntoRequest(JSContext* cx,
                                            Handle<ReadableStream*> unwrappedStream,
                                            HandleValue chunk,
                                            bool done)
 {
@@ -1798,17 +1810,18 @@ bool
 ReadableStreamDefaultReader::constructor(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (!ThrowIfNotConstructing(cx, args, "ReadableStreamDefaultReader")) {
         return false;
     }
 
-    // Step 1: If ! IsReadableStream(stream) is false, throw a TypeError exception.
+    // Step 1: If ! IsReadableStream(stream) is false, throw a TypeError
+    //         exception.
     Rooted<ReadableStream*> unwrappedStream(cx,
         UnwrapAndTypeCheckArgument<ReadableStream>(cx,
                                                    args,
                                                    "ReadableStreamDefaultReader constructor",
                                                    0));
     if (!unwrappedStream) {
         return false;
     }
@@ -2008,17 +2021,18 @@ ReadableStreamReaderGenericCancel(JSCont
         return nullptr;
     }
 
     // Step 3: Return ! ReadableStreamCancel(stream, reason).
     return ::ReadableStreamCancel(cx, unwrappedStream, reason);
 }
 
 /**
- * Streams spec, 3.7.4. ReadableStreamReaderGenericInitialize ( reader, stream )
+ * Streams spec, 3.7.4.
+ *      ReadableStreamReaderGenericInitialize ( reader, stream )
  */
 static MOZ_MUST_USE bool
 ReadableStreamReaderGenericInitialize(JSContext* cx,
                                       Handle<ReadableStreamReader*> reader,
                                       Handle<ReadableStream*> unwrappedStream,
                                       ForAuthorCodeBool forAuthorCode)
 {
     cx->check(reader);
@@ -2119,18 +2133,18 @@ ReadableStreamReaderGenericRelease(JSCon
         AutoRealm ar(cx, closedPromise);
         if (!cx->compartment()->wrap(cx, &exn)) {
             return false;
         }
         if (!PromiseObject::reject(cx, closedPromise, exn)) {
             return false;
         }
     } else {
-        // Step 4: Otherwise, set reader.[[closedPromise]] to a new promise rejected
-        //         with a TypeError exception.
+        // Step 4: Otherwise, set reader.[[closedPromise]] to a new promise
+        //         rejected with a TypeError exception.
         RootedObject closedPromise(cx, PromiseObject::unforgeableReject(cx, exn));
         if (!closedPromise) {
             return false;
         }
 
         AutoRealm ar(cx, unwrappedReader);
         if (!cx->compartment()->wrap(cx, &closedPromise)) {
             return false;
@@ -2178,18 +2192,18 @@ ReadableStreamDefaultReaderRead(JSContex
                                            unwrappedReader->forAuthorCode()));
         if (!iterResult) {
             return nullptr;
         }
         RootedValue iterResultVal(cx, ObjectValue(*iterResult));
         return PromiseObject::unforgeableResolve(cx, iterResultVal);
     }
 
-    // Step 6: If stream.[[state]] is "errored", return a new promise rejected with
-    //         stream.[[storedError]].
+    // Step 6: If stream.[[state]] is "errored", return a new promise rejected
+    //         with stream.[[storedError]].
     if (unwrappedStream->errored()) {
         RootedValue storedError(cx, unwrappedStream->storedError());
         if (!cx->compartment()->wrap(cx, &storedError)) {
             return nullptr;
         }
         return PromiseObject::unforgeableReject(cx, storedError);
     }
 
@@ -2224,19 +2238,21 @@ ControllerStartHandler(JSContext* cx, un
     controller->setStarted();
 
     // Step ii: Assert: controller.[[pulling]] is false.
     MOZ_ASSERT(!controller->pulling());
 
     // Step iii: Assert: controller.[[pullAgain]] is false.
     MOZ_ASSERT(!controller->pullAgain());
 
-    // Step iv: Perform ! ReadableStreamDefaultControllerCallPullIfNeeded(controller).
+    // Step iv: Perform
+    //          ! ReadableStreamDefaultControllerCallPullIfNeeded(controller).
     // or
-    // Step iv: Perform ! ReadableByteStreamControllerCallPullIfNeeded((controller).
+    // Step iv: Perform
+    //          ! ReadableByteStreamControllerCallPullIfNeeded((controller).
     if (!ReadableStreamControllerCallPullIfNeeded(cx, controller)) {
         return false;
     }
     args.rval().setUndefined();
     return true;
 }
 
 static MOZ_MUST_USE bool
@@ -2283,18 +2299,19 @@ ValidateAndNormalizeHighWaterMark(JSCont
 
 static MOZ_MUST_USE bool
 ValidateAndNormalizeQueuingStrategy(JSContext* cx,
                                     HandleValue size,
                                     HandleValue highWaterMarkVal,
                                     double* highWaterMark);
 
 /**
- * Streams spec, 3.8.3 new ReadableStreamDefaultController ( stream, underlyingSource,
- *                                                           size, highWaterMark )
+ * Streams spec, 3.8.3
+ *      new ReadableStreamDefaultController ( stream, underlyingSource,
+ *                                            size, highWaterMark )
  * Steps 3 - 11.
  *
  * Note: All arguments must be same-compartment with cx. ReadableStream
  * controllers are always created in the same compartment as the stream.
  */
 static MOZ_MUST_USE ReadableStreamDefaultController*
 CreateReadableStreamDefaultController(JSContext* cx,
                                       Handle<ReadableStream*> stream,
@@ -2569,18 +2586,18 @@ static const JSFunctionSpec ReadableStre
 const Class ReadableStreamController::class_ = {
     "ReadableStreamController"
 };
 
 CLASS_SPEC(ReadableStreamDefaultController, 4, SlotCount, ClassSpec::DontDefineConstructor, 0,
            JS_NULL_CLASS_OPS);
 
 /**
- * Unified implementation of ReadableStream controllers' [[CancelSteps]] internal
- * methods.
+ * Unified implementation of ReadableStream controllers' [[CancelSteps]]
+ * internal methods.
  * Streams spec, 3.8.5.1. [[CancelSteps]] ( reason )
  * and
  * Streams spec, 3.10.5.1. [[CancelSteps]] ( reason )
  */
 static MOZ_MUST_USE JSObject*
 ReadableStreamControllerCancelSteps(JSContext* cx,
                                     Handle<ReadableStreamController*> unwrappedController,
                                     HandleValue reason)
@@ -2698,17 +2715,18 @@ ReadableStreamDefaultControllerPullSteps
         if (unwrappedController->closeRequested() &&
             unwrappedQueue->getDenseInitializedLength() == 0)
         {
             if (!ReadableStreamCloseInternal(cx, unwrappedStream)) {
                 return nullptr;
             }
         }
 
-        // Step c: Otherwise, perform ! ReadableStreamDefaultControllerCallPullIfNeeded(this).
+        // Step c: Otherwise, perform
+        //         ! ReadableStreamDefaultControllerCallPullIfNeeded(this).
         else {
             if (!ReadableStreamControllerCallPullIfNeeded(cx, unwrappedController)) {
                 return nullptr;
             }
         }
 
         // Step d: Return a promise resolved with
         //         ! ReadableStreamCreateReadResult(chunk, false, forAuthorCode).
@@ -2766,17 +2784,18 @@ ControllerPullHandler(JSContext* cx, uns
     bool pullAgain = controller->pullAgain();
 
     // Step a: Set controller.[[pulling]] to false.
     // Step b.i: Set controller.[[pullAgain]] to false.
     controller->clearPullFlags();
 
     // Step b: If controller.[[pullAgain]] is true,
     if (pullAgain) {
-        // Step ii: Perform ! ReadableByteStreamControllerCallPullIfNeeded(controller).
+        // Step ii: Perform
+        //          ! ReadableByteStreamControllerCallPullIfNeeded(controller).
         if (!ReadableStreamControllerCallPullIfNeeded(cx, controller)) {
             return false;
         }
     }
 
     args.rval().setUndefined();
     return true;
 }
@@ -2811,18 +2830,20 @@ ControllerPullFailedHandler(JSContext* c
 
 static bool
 ReadableStreamControllerShouldCallPull(ReadableStreamController* unwrappedController);
 
 static MOZ_MUST_USE double
 ReadableStreamControllerGetDesiredSizeUnchecked(ReadableStreamController* unwrappedController);
 
 /**
- * Streams spec, 3.9.2 ReadableStreamDefaultControllerCallPullIfNeeded ( controller )
- * Streams spec, 3.12.3. ReadableByteStreamControllerCallPullIfNeeded ( controller )
+ * Streams spec, 3.9.2
+ *      ReadableStreamDefaultControllerCallPullIfNeeded ( controller )
+ * Streams spec, 3.12.3.
+ *      ReadableByteStreamControllerCallPullIfNeeded ( controller )
  */
 inline static MOZ_MUST_USE bool
 ReadableStreamControllerCallPullIfNeeded(JSContext* cx,
                                          Handle<ReadableStreamController*> unwrappedController)
 {
     // Step 1: Let shouldPull be
     //         ! ReadableByteStreamControllerShouldCallPull(controller).
     bool shouldPull = ReadableStreamControllerShouldCallPull(unwrappedController);
@@ -2843,17 +2864,18 @@ ReadableStreamControllerCallPullIfNeeded
 
     // Step 4: Assert: controller.[[pullAgain]] is false.
     MOZ_ASSERT(!unwrappedController->pullAgain());
 
     // Step 5: Set controller.[[pulling]] to true.
     unwrappedController->setPulling();
 
     // Step 6: Let pullPromise be
-    //         ! PromiseInvokeOrNoop(controller.[[underlyingByteSource]], "pull", controller).
+    //         ! PromiseInvokeOrNoop(controller.[[underlyingByteSource]],
+    //                               "pull", controller).
     RootedObject wrappedController(cx, unwrappedController);
     if (!cx->compartment()->wrap(cx, &wrappedController)) {
         return false;
     }
     RootedValue controllerVal(cx, ObjectValue(*wrappedController));
     RootedValue unwrappedUnderlyingSource(cx, unwrappedController->underlyingSource());
     RootedObject pullPromise(cx);
 
@@ -2898,18 +2920,20 @@ ReadableStreamControllerCallPullIfNeeded
     }
 
     return JS::AddPromiseReactions(cx, pullPromise, onPullFulfilled, onPullRejected);
 
     // Steps 7-8 implemented in functions above.
 }
 
 /**
- * Streams spec, 3.9.3. ReadableStreamDefaultControllerShouldCallPull ( controller )
- * Streams spec, 3.12.25. ReadableByteStreamControllerShouldCallPull ( controller )
+ * Streams spec, 3.9.3.
+ *      ReadableStreamDefaultControllerShouldCallPull ( controller )
+ * Streams spec, 3.12.25.
+ *      ReadableByteStreamControllerShouldCallPull ( controller )
  */
 static bool
 ReadableStreamControllerShouldCallPull(ReadableStreamController* unwrappedController)
 {
     // Step 1: Let stream be controller.[[controlledReadableStream]].
     ReadableStream* unwrappedStream = unwrappedController->stream();
 
     // Step 2: If stream.[[state]] is "closed" or stream.[[state]] is "errored",
@@ -2932,17 +2956,18 @@ ReadableStreamControllerShouldCallPull(R
 
     // Step 5: If ! IsReadableStreamLocked(stream) is true and
     //         ! ReadableStreamGetNumReadRequests(stream) > 0, return true.
     // Steps 5-6 of 3.12.24 are equivalent in our implementation.
     if (unwrappedStream->locked() && ReadableStreamGetNumReadRequests(unwrappedStream) > 0) {
         return true;
     }
 
-    // Step 6: Let desiredSize be ReadableStreamDefaultControllerGetDesiredSize(controller).
+    // Step 6: Let desiredSize be
+    //         ReadableStreamDefaultControllerGetDesiredSize(controller).
     double desiredSize = ReadableStreamControllerGetDesiredSizeUnchecked(unwrappedController);
 
     // Step 7: If desiredSize > 0, return true.
     // Step 8: Return false.
     // Steps 7-8 of 3.12.24 are equivalent in our implementation.
     return desiredSize > 0;
 }
 
@@ -2960,33 +2985,35 @@ ReadableStreamDefaultControllerClose(JSC
     MOZ_ASSERT(!unwrappedController->closeRequested());
 
     // Step 3: Assert: stream.[[state]] is "readable".
     MOZ_ASSERT(unwrappedStream->readable());
 
     // Step 4: Set controller.[[closeRequested]] to true.
     unwrappedController->setCloseRequested();
 
-    // Step 5: If controller.[[queue]] is empty, perform ! ReadableStreamClose(stream).
+    // Step 5: If controller.[[queue]] is empty, perform
+    //         ! ReadableStreamClose(stream).
     RootedNativeObject unwrappedQueue(cx, unwrappedController->queue());
     if (unwrappedQueue->getDenseInitializedLength() == 0) {
         return ReadableStreamCloseInternal(cx, unwrappedStream);
     }
 
     return true;
 }
 
 static MOZ_MUST_USE bool
 EnqueueValueWithSize(JSContext* cx,
                      Handle<ReadableStreamController*> unwrappedContainer,
                      HandleValue value,
                      HandleValue sizeVal);
 
 /**
- * Streams spec, 3.9.6. ReadableStreamDefaultControllerEnqueue ( controller, chunk )
+ * Streams spec, 3.9.6.
+ *      ReadableStreamDefaultControllerEnqueue ( controller, chunk )
  */
 static MOZ_MUST_USE bool
 ReadableStreamDefaultControllerEnqueue(JSContext* cx,
                                        Handle<ReadableStreamDefaultController*> unwrappedController,
                                        HandleValue chunk)
 {
     AssertSameCompartment(cx, chunk);
 
@@ -3010,17 +3037,18 @@ ReadableStreamDefaultControllerEnqueue(J
         // Step 5: Otherwise,
         // Step a: Let chunkSize be 1.
         RootedValue chunkSize(cx, NumberValue(1));
         bool success = true;
 
         // Step b: If controller.[[strategySize]] is not undefined,
         RootedValue strategySize(cx, unwrappedController->strategySize());
         if (!strategySize.isUndefined()) {
-            // Step i: Set chunkSize to Call(stream.[[strategySize]], undefined, chunk).
+            // Step i: Set chunkSize to
+            //         Call(stream.[[strategySize]], undefined, chunk).
             if (!cx->compartment()->wrap(cx, &strategySize)) {
                 return false;
             }
             success = Call(cx, strategySize, UndefinedHandleValue, chunk, &chunkSize);
         }
 
         // Step c: Let enqueueResult be
         //         EnqueueValueWithSize(controller, chunk, chunkSize).
@@ -3035,29 +3063,30 @@ ReadableStreamDefaultControllerEnqueue(J
             RootedValue exn(cx);
             if (!cx->isExceptionPending() || !GetAndClearException(cx, &exn)) {
                 // Uncatchable error. Die immediately without erroring the
                 // stream.
                 return false;
             }
 
             // Step b.ii.1: Perform
-            //         ! ReadableStreamDefaultControllerErrorIfNeeded(controller,
-            //                                                        chunkSize.[[Value]]).
+            //              ! ReadableStreamDefaultControllerErrorIfNeeded(
+            //                  controller, chunkSize.[[Value]]).
             if (!ReadableStreamDefaultControllerErrorIfNeeded(cx, unwrappedController, exn)) {
                 return false;
             }
 
             // Step b.ii.2: Return chunkSize.
             cx->setPendingException(exn);
             return false;
         }
     }
 
-    // Step 6: Perform ! ReadableStreamDefaultControllerCallPullIfNeeded(controller).
+    // Step 6: Perform
+    //         ! ReadableStreamDefaultControllerCallPullIfNeeded(controller).
     // Step 7: Return.
     return ReadableStreamControllerCallPullIfNeeded(cx, unwrappedController);
 }
 
 static MOZ_MUST_USE bool
 ReadableByteStreamControllerClearPendingPullIntos(JSContext* cx,
                                                   Handle<ReadableByteStreamController*> unwrappedController);
 
@@ -3094,17 +3123,18 @@ ReadableStreamControllerError(JSContext*
         return false;
     }
 
     // Step 4 (or 5): Perform ! ReadableStreamError(stream, e).
     return ReadableStreamErrorInternal(cx, unwrappedStream, e);
 }
 
 /**
- * Streams spec, 3.9.7. ReadableStreamDefaultControllerErrorIfNeeded ( controller, e ) nothrow
+ * Streams spec, 3.9.7.
+ *      ReadableStreamDefaultControllerErrorIfNeeded ( controller, e ) nothrow
  */
 static MOZ_MUST_USE bool
 ReadableStreamDefaultControllerErrorIfNeeded(JSContext* cx,
                                              Handle<ReadableStreamDefaultController*> unwrappedController,
                                              HandleValue e)
 {
     MOZ_ASSERT(!cx->isExceptionPending());
 
@@ -3112,18 +3142,20 @@ ReadableStreamDefaultControllerErrorIfNe
     //         perform ! ReadableStreamDefaultControllerError(controller, e).
     if (unwrappedController->stream()->readable()) {
         return ReadableStreamControllerError(cx, unwrappedController, e);
     }
     return true;
 }
 
 /**
- * Streams spec, 3.9.8. ReadableStreamDefaultControllerGetDesiredSize ( controller )
- * Streams spec 3.12.14. ReadableByteStreamControllerGetDesiredSize ( controller )
+ * Streams spec, 3.9.8.
+ *      ReadableStreamDefaultControllerGetDesiredSize ( controller )
+ * Streams spec 3.12.14.
+ *      ReadableByteStreamControllerGetDesiredSize ( controller )
  */
 static MOZ_MUST_USE double
 ReadableStreamControllerGetDesiredSizeUnchecked(ReadableStreamController* controller)
 {
     // Steps 1-4 done at callsites, so only assert that they have been done.
 #if DEBUG
     ReadableStream* stream = controller->stream();
     MOZ_ASSERT(!(stream->errored() || stream->closed()));
@@ -3134,18 +3166,19 @@ ReadableStreamControllerGetDesiredSizeUn
 }
 
 
 /*** 3.10. Class ReadableByteStreamController *******************************/
 
 #if 0 // disable user-defined byte streams
 
 /**
- * Streams spec, 3.10.3 new ReadableByteStreamController ( stream, underlyingSource,
- *                                                         highWaterMark )
+ * Streams spec, 3.10.3
+ *      new ReadableByteStreamController ( stream, underlyingSource,
+ *                                         highWaterMark )
  * Steps 3 - 16.
  *
  * Note: All arguments must be same-compartment with cx. ReadableStream
  * controllers are always created in the same compartment as the stream.
  */
 static MOZ_MUST_USE ReadableByteStreamController*
 CreateReadableByteStreamController(JSContext* cx,
                                    Handle<ReadableStream*> stream,
@@ -3441,29 +3474,32 @@ ReadableByteStreamControllerPullSteps(JS
                 MOZ_ASSERT(cb);
                 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
-            //           downward (so that the second becomes the first, and so on).
+            // Step 3.c: Remove entry from this.[[queue]], shifting all other
+            //           elements downward (so that the second becomes the
+            //           first, and so on).
             RootedNativeObject unwrappedQueue(cx, unwrappedController->queue());
             Rooted<ByteStreamChunk*> unwrappedEntry(cx,
                 ToUnwrapped<ByteStreamChunk>(cx, ShiftFromList<JSObject>(cx, unwrappedQueue)));
             if (!unwrappedEntry) {
                 return nullptr;
             }
 
             queueTotalSize = queueTotalSize - unwrappedEntry->byteLength();
 
-            // Step 3.f: Let view be ! Construct(%Uint8Array%, « entry.[[buffer]],
-            //                                   entry.[[byteOffset]], entry.[[byteLength]] »).
+            // Step 3.f: Let view be ! Construct(%Uint8Array%,
+            //                                   « entry.[[buffer]],
+            //                                     entry.[[byteOffset]],
+            //                                     entry.[[byteLength]] »).
             // (reordered)
             RootedObject buffer(cx, unwrappedEntry->buffer());
             if (!cx->compartment()->wrap(cx, &buffer)) {
                 return nullptr;
             }
 
             uint32_t byteOffset = unwrappedEntry->byteOffset();
             view = JS_NewUint8ArrayWithBuffer(cx, buffer, byteOffset, unwrappedEntry->byteLength());
@@ -3502,43 +3538,46 @@ ReadableByteStreamControllerPullSteps(JS
 
     // Step 4: Let autoAllocateChunkSize be this.[[autoAllocateChunkSize]].
     val = unwrappedController->autoAllocateChunkSize();
 
     // Step 5: If autoAllocateChunkSize is not undefined,
     if (!val.isUndefined()) {
         double autoAllocateChunkSize = val.toNumber();
 
-        // Step 5.a: Let buffer be Construct(%ArrayBuffer%, « autoAllocateChunkSize »).
+        // Step 5.a: Let buffer be
+        //           Construct(%ArrayBuffer%, « autoAllocateChunkSize »).
         JSObject* bufferObj = JS_NewArrayBuffer(cx, autoAllocateChunkSize);
 
         // Step 5.b: If buffer is an abrupt completion,
         //           return a promise rejected with buffer.[[Value]].
         if (!bufferObj) {
             return PromiseRejectedWithPendingError(cx);
         }
 
         RootedArrayBufferObject buffer(cx, &bufferObj->as<ArrayBufferObject>());
 
-        // Step 5.c: Let pullIntoDescriptor be Record {[[buffer]]: buffer.[[Value]],
-        //                                             [[byteOffset]]: 0,
-        //                                             [[byteLength]]: autoAllocateChunkSize,
-        //                                             [[bytesFilled]]: 0, [[elementSize]]: 1,
-        //                                             [[ctor]]: %Uint8Array%,
-        //                                             [[readerType]]: `"default"`}.
+        // Step 5.c: Let pullIntoDescriptor be
+        //           Record {[[buffer]]: buffer.[[Value]],
+        //                   [[byteOffset]]: 0,
+        //                   [[byteLength]]: autoAllocateChunkSize,
+        //                   [[bytesFilled]]: 0, [[elementSize]]: 1,
+        //                   [[ctor]]: %Uint8Array%,
+        //                   [[readerType]]: `"default"`}.
         RootedObject pullIntoDescriptor(cx,
             PullIntoDescriptor::create(cx, buffer, 0,
                                        autoAllocateChunkSize, 0, 1,
                                        nullptr,
                                        ReaderType_Default));
         if (!pullIntoDescriptor) {
             return PromiseRejectedWithPendingError(cx);
         }
 
-        // Step 5.d: Append pullIntoDescriptor as the last element of this.[[pendingPullIntos]].
+        // Step 5.d: Append pullIntoDescriptor as the last element of
+        //           this.[[pendingPullIntos]].
         if (!AppendToListAtSlot(cx,
                                 unwrappedController,
                                 ReadableByteStreamController::Slot_PendingPullIntos,
                                 pullIntoDescriptor))
         {
             return nullptr;
         }
     }
@@ -3583,31 +3622,34 @@ ReadableStreamControllerPullSteps(JSCont
 /*** 3.12. Readable stream BYOB controller abstract operations **************/
 
 // Streams spec, 3.12.1. IsReadableStreamBYOBRequest ( x )
 // Implemented via is<ReadableStreamBYOBRequest>()
 
 // Streams spec, 3.12.2. IsReadableByteStreamController ( x )
 // Implemented via is<ReadableByteStreamController>()
 
-// Streams spec, 3.12.3. ReadableByteStreamControllerCallPullIfNeeded ( controller )
+// Streams spec, 3.12.3.
+//      ReadableByteStreamControllerCallPullIfNeeded ( controller )
 // Unified with 3.9.2 above.
 
 static MOZ_MUST_USE bool
 ReadableByteStreamControllerInvalidateBYOBRequest(JSContext* cx,
                                                   Handle<ReadableByteStreamController*> unwrappedController);
 
 /**
- * Streams spec, 3.12.5. ReadableByteStreamControllerClearPendingPullIntos ( controller )
+ * Streams spec, 3.12.5.
+ *      ReadableByteStreamControllerClearPendingPullIntos ( controller )
  */
 static MOZ_MUST_USE bool
 ReadableByteStreamControllerClearPendingPullIntos(JSContext* cx,
                                                   Handle<ReadableByteStreamController*> unwrappedController)
 {
-    // Step 1: Perform ! ReadableByteStreamControllerInvalidateBYOBRequest(controller).
+    // Step 1: Perform
+    //         ! ReadableByteStreamControllerInvalidateBYOBRequest(controller).
     if (!ReadableByteStreamControllerInvalidateBYOBRequest(cx, unwrappedController)) {
         return false;
     }
 
     // Step 2: Set controller.[[pendingPullIntos]] to a new empty List.
     return SetNewList(cx, unwrappedController, ReadableByteStreamController::Slot_PendingPullIntos);
 }
 
@@ -3672,52 +3714,57 @@ ReadableByteStreamControllerClose(JSCont
 
     // Step 6: Perform ! ReadableStreamClose(stream).
     return ReadableStreamCloseInternal(cx, unwrappedStream);
 }
 
 // Streams spec, 3.12.11. ReadableByteStreamControllerError ( controller, e )
 // Unified with 3.9.7 above.
 
-// Streams spec 3.12.14. ReadableByteStreamControllerGetDesiredSize ( controller )
+// Streams spec 3.12.14.
+//      ReadableByteStreamControllerGetDesiredSize ( controller )
 // Unified with 3.9.8 above.
 
 /**
- * Streams spec, 3.12.15. ReadableByteStreamControllerHandleQueueDrain ( controller )
+ * Streams spec, 3.12.15.
+ *      ReadableByteStreamControllerHandleQueueDrain ( controller )
  */
 static MOZ_MUST_USE bool
 ReadableByteStreamControllerHandleQueueDrain(JSContext* cx,
                                              Handle<ReadableStreamController*> unwrappedController)
 {
     MOZ_ASSERT(unwrappedController->is<ReadableByteStreamController>());
 
-    // Step 1: Assert: controller.[[controlledReadableStream]].[[state]] is "readable".
+    // Step 1: Assert: controller.[[controlledReadableStream]].[[state]]
+    //                 is "readable".
     Rooted<ReadableStream*> unwrappedStream(cx, unwrappedController->stream());
     MOZ_ASSERT(unwrappedStream->readable());
 
     // Step 2: If controller.[[queueTotalSize]] is 0 and
     //         controller.[[closeRequested]] is true,
     if (unwrappedController->queueTotalSize() == 0 && unwrappedController->closeRequested()) {
-        // Step a: Perform ! ReadableStreamClose(controller.[[controlledReadableStream]]).
+        // Step a: Perform
+        //         ! ReadableStreamClose(controller.[[controlledReadableStream]]).
         return ReadableStreamCloseInternal(cx, unwrappedStream);
     }
 
     // Step 3: Otherwise,
     // Step a: Perform ! ReadableByteStreamControllerCallPullIfNeeded(controller).
     return ReadableStreamControllerCallPullIfNeeded(cx, unwrappedController);
 }
 
 enum BYOBRequestSlots {
     BYOBRequestSlot_Controller,
     BYOBRequestSlot_View,
     BYOBRequestSlotCount
 };
 
 /**
- * Streams spec 3.12.16. ReadableByteStreamControllerInvalidateBYOBRequest ( controller )
+ * Streams spec 3.12.16.
+ *      ReadableByteStreamControllerInvalidateBYOBRequest ( controller )
  */
 static MOZ_MUST_USE bool
 ReadableByteStreamControllerInvalidateBYOBRequest(JSContext* cx,
                                                   Handle<ReadableByteStreamController*> unwrappedController)
 {
     // Step 1: If controller.[[byobRequest]] is undefined, return.
     RootedValue unwrappedBYOBRequestVal(cx, unwrappedController->byobRequest());
     if (unwrappedBYOBRequestVal.isUndefined()) {
@@ -3725,30 +3772,32 @@ ReadableByteStreamControllerInvalidateBY
     }
 
     RootedNativeObject unwrappedBYOBRequest(cx,
         ToUnwrapped<NativeObject>(cx, unwrappedBYOBRequestVal));
     if (!unwrappedBYOBRequest) {
         return false;
     }
 
-    // Step 2: Set controller.[[byobRequest]].[[associatedReadableByteStreamController]]
+    // Step 2: Set controller.[[byobRequest]]
+    //                       .[[associatedReadableByteStreamController]]
     //         to undefined.
     unwrappedBYOBRequest->setFixedSlot(BYOBRequestSlot_Controller, UndefinedValue());
 
     // Step 3: Set controller.[[byobRequest]].[[view]] to undefined.
     unwrappedBYOBRequest->setFixedSlot(BYOBRequestSlot_View, UndefinedValue());
 
     // Step 4: Set controller.[[byobRequest]] to undefined.
     unwrappedController->clearBYOBRequest();
 
     return true;
 }
 
-// Streams spec, 3.12.25. ReadableByteStreamControllerShouldCallPull ( controller )
+// Streams spec, 3.12.25.
+//      ReadableByteStreamControllerShouldCallPull ( controller )
 // Unified with 3.9.3 above.
 
 
 /*** 6.1. Queuing strategies ************************************************/
 
 // Streams spec, 6.1.2.2. new ByteLengthQueuingStrategy({ highWaterMark })
 bool
 js::ByteLengthQueuingStrategy::constructor(JSContext* cx, unsigned argc, Value* vp)
@@ -3918,18 +3967,18 @@ EnqueueValueWithSize(JSContext* cx,
     // Step 3: If ! IsFiniteNonNegativeNumber(size) is false, throw a RangeError
     //         exception.
     if (size < 0 || mozilla::IsNaN(size) || mozilla::IsInfinite(size)) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                   JSMSG_NUMBER_MUST_BE_FINITE_NON_NEGATIVE, "size");
         return false;
     }
 
-    // Step 4: Append Record {[[value]]: value, [[size]]: size} as the last element
-    //         of container.[[queue]].
+    // Step 4: Append Record {[[value]]: value, [[size]]: size} as the last
+    //         element of container.[[queue]].
     {
         AutoRealm ar(cx, unwrappedContainer);
         RootedNativeObject queue(cx, unwrappedContainer->queue());
         RootedValue wrappedVal(cx, value);
         if (!cx->compartment()->wrap(cx, &wrappedVal)) {
             return false;
         }
 
@@ -4064,30 +4113,32 @@ ValidateAndNormalizeHighWaterMark(JSCont
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_STREAM_INVALID_HIGHWATERMARK);
         return false;
     }
 
     // Step 4: Return highWaterMark.
     return true;
 }
 
-// Streams spec, obsolete (previously 6.4.6) ValidateAndNormalizeQueuingStrategy ( size, highWaterMark )
+// Streams spec, obsolete (previously 6.4.6)
+//      ValidateAndNormalizeQueuingStrategy ( size, highWaterMark )
 static MOZ_MUST_USE bool
 ValidateAndNormalizeQueuingStrategy(JSContext* cx, HandleValue size,
                                     HandleValue highWaterMarkVal, double* highWaterMark)
 {
     // Step 1: If size is not undefined and ! IsCallable(size) is false, throw a
     //         TypeError exception.
     if (!size.isUndefined() && !IsCallable(size)) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION,
                                   "ReadableStream argument options.size");
         return false;
     }
 
-    // Step 2: Let highWaterMark be ? ValidateAndNormalizeHighWaterMark(highWaterMark).
+    // Step 2: Let highWaterMark be
+    //         ? ValidateAndNormalizeHighWaterMark(highWaterMark).
     if (!ValidateAndNormalizeHighWaterMark(cx, highWaterMarkVal, highWaterMark)) {
         return false;
     }
 
     // Step 3: Return Record {[[size]]: size, [[highWaterMark]]: highWaterMark}.
     return true;
 }
 
@@ -4415,17 +4466,18 @@ JS::ReadableStreamUpdateDataAvailableFro
         return false;
     }
     if (hasDefaultReader) {
         // Step b: Otherwise,
         // Step i: Assert: controller.[[queue]] is empty.
         MOZ_ASSERT(oldAvailableData == 0);
 
         // Step ii: Let transferredView be
-        //          ! Construct(%Uint8Array%, transferredBuffer, byteOffset, byteLength).
+        //          ! Construct(%Uint8Array%, transferredBuffer,
+        //                      byteOffset, byteLength).
         JSObject* viewObj = JS_NewUint8Array(cx, availableData);
         if (!viewObj) {
             return false;
         }
         Rooted<ArrayBufferViewObject*> transferredView(cx, &viewObj->as<ArrayBufferViewObject>());
         if (!transferredView) {
             return false;
         }
@@ -4440,33 +4492,32 @@ JS::ReadableStreamUpdateDataAvailableFro
             bool dummy;
             void* buffer = JS_GetArrayBufferViewData(transferredView, &dummy, noGC);
             auto cb = cx->runtime()->readableStreamWriteIntoReadRequestCallback;
             MOZ_ASSERT(cb);
             cb(cx, unwrappedStream, underlyingSource, unwrappedStream->embeddingFlags(), buffer,
                availableData, &bytesWritten);
         }
 
-        // Step iii: Perform ! ReadableStreamFulfillReadRequest(stream, transferredView, false).
+        // Step iii: Perform ! ReadableStreamFulfillReadRequest(stream,
+        //                                                      transferredView,
+        //                                                      false).
         RootedValue chunk(cx, ObjectValue(*transferredView));
         if (!ReadableStreamFulfillReadOrReadIntoRequest(cx, unwrappedStream, chunk, false)) {
             return false;
         }
 
         unwrappedController->setQueueTotalSize(availableData - bytesWritten);
     } else {
         // Step b: Otherwise,
         // Step i: Assert: ! IsReadableStreamLocked(stream) is false.
         MOZ_ASSERT(!unwrappedStream->locked());
 
-        // Step ii: Perform
-        //          ! ReadableByteStreamControllerEnqueueChunkToQueue(controller,
-        //                                                            transferredBuffer,
-        //                                                            byteOffset,
-        //                                                            byteLength).
+        // Step ii: Perform ! ReadableByteStreamControllerEnqueueChunkToQueue(
+        //              controller, transferredBuffer, byteOffset, byteLength).
         // (Not needed for external underlying sources.)
     }
 
     return true;
 }
 
 JS_PUBLIC_API bool
 JS::ReadableStreamTee(JSContext* cx, HandleObject streamObj,