Bug 1505152 - Sprinkle curly braces in Stream.cpp. r=jwalden
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 09 Nov 2018 22:16:44 +0000
changeset 501927 e9ff3fec51d3
parent 501926 26e744726767
child 501928 4efd19ac0762
child 501929 82fd3cf1ecb0
child 502213 33aae61e50b0
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)
reviewersjwalden
bugs1505152
milestone65.0a1
first release with
nightly linux32
e9ff3fec51d3 / 65.0a1 / 20181110100119 / files
nightly linux64
e9ff3fec51d3 / 65.0a1 / 20181110100119 / files
nightly mac
e9ff3fec51d3 / 65.0a1 / 20181110100119 / files
nightly win32
e9ff3fec51d3 / 65.0a1 / 20181110100119 / files
nightly win64
e9ff3fec51d3 / 65.0a1 / 20181110100119 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1505152 - Sprinkle curly braces in Stream.cpp. r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D11100
js/src/builtin/Stream.cpp
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -4154,18 +4154,19 @@ JS::NewReadableDefaultStreamObject(JSCon
 {
     MOZ_ASSERT(!cx->zone()->isAtomsZone());
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     RootedObject source(cx, underlyingSource);
     if (!source) {
         source = NewBuiltinClassInstance<PlainObject>(cx);
-        if (!source)
+        if (!source) {
             return nullptr;
+        }
     }
     RootedValue sourceVal(cx, ObjectValue(*source));
     RootedValue sizeVal(cx, size ? ObjectValue(*size) : UndefinedValue());
     RootedValue highWaterMarkVal(cx, NumberValue(highWaterMark));
     return ReadableStream::createDefaultStream(cx, sourceVal, sizeVal, highWaterMarkVal, proto);
 }
 
 JS_PUBLIC_API(JSObject*)
@@ -4216,105 +4217,113 @@ APIToUnwrapped(JSContext* cx, JSObject* 
     cx->check(obj);
     return ToUnwrapped<T>(cx, obj);
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamIsReadable(JSContext* cx, HandleObject streamObj, bool* result)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     *result = stream->readable();
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamIsLocked(JSContext* cx, HandleObject streamObj, bool* result)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     *result = stream->locked();
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamIsDisturbed(JSContext* cx, HandleObject streamObj, bool* result)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     *result = stream->disturbed();
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamGetEmbeddingFlags(JSContext* cx, HandleObject streamObj, uint8_t* flags)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     *flags = stream->embeddingFlags();
     return true;
 }
 
 JS_PUBLIC_API(JSObject*)
 JS::ReadableStreamCancel(JSContext* cx, HandleObject streamObj, HandleValue reason)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(reason);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return nullptr;
+    }
 
     return ::ReadableStreamCancel(cx, stream, reason);
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamGetMode(JSContext* cx, HandleObject streamObj, JS::ReadableStreamMode* mode)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     *mode = stream->mode();
     return true;
 }
 
 JS_PUBLIC_API(JSObject*)
 JS::ReadableStreamGetReader(JSContext* cx, HandleObject streamObj, ReadableStreamReaderMode mode)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return nullptr;
+    }
 
     JSObject* result = CreateReadableStreamDefaultReader(cx, stream);
     MOZ_ASSERT_IF(result, IsObjectInContextCompartment(result, cx));
     return result;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamGetExternalUnderlyingSource(JSContext* cx, HandleObject streamObj, void** source)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     MOZ_ASSERT(stream->mode() == JS::ReadableStreamMode::ExternalSource);
     if (stream->locked()) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_READABLESTREAM_LOCKED);
         return false;
     }
     if (!stream->readable()) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
@@ -4328,36 +4337,38 @@ JS::ReadableStreamGetExternalUnderlyingS
     *source = controller->underlyingSource().toPrivate();
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamReleaseExternalUnderlyingSource(JSContext* cx, HandleObject streamObj)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     MOZ_ASSERT(stream->mode() == JS::ReadableStreamMode::ExternalSource);
     MOZ_ASSERT(stream->locked());
     MOZ_ASSERT(stream->controller()->sourceLocked());
     stream->controller()->clearSourceLocked();
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamUpdateDataAvailableFromSource(JSContext* cx, JS::HandleObject streamObj,
                                                 uint32_t availableData)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     // This is based on Streams spec 3.10.4.4. enqueue(chunk) steps 1-3 and
     // 3.12.9. ReadableByteStreamControllerEnqueue(controller, chunk) steps
     // 8-9.
     //
     // Adapted to handling updates signaled by the embedding for streams with
     // external underlying sources.
     //
@@ -4458,38 +4469,39 @@ JS::ReadableStreamUpdateDataAvailableFro
 JS_PUBLIC_API(bool)
 JS::ReadableStreamTee(JSContext* cx, HandleObject streamObj,
                       MutableHandleObject branch1Obj, MutableHandleObject branch2Obj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     Rooted<ReadableStream*> branch1Stream(cx);
     Rooted<ReadableStream*> branch2Stream(cx);
-
     if (!ReadableStreamTee(cx, stream, false, &branch1Stream, &branch2Stream)) {
         return false;
     }
 
     branch1Obj.set(branch1Stream);
     branch2Obj.set(branch2Stream);
 
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamGetDesiredSize(JSContext* cx, JSObject* streamObj, bool* hasValue, double* value)
 {
     ReadableStream* stream = APIToUnwrapped<ReadableStream>(cx, streamObj);
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     if (stream->errored()) {
         *hasValue = false;
         return true;
     }
 
     *hasValue = true;
 
@@ -4504,18 +4516,19 @@ JS::ReadableStreamGetDesiredSize(JSConte
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamClose(JSContext* cx, HandleObject streamObj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     Rooted<ReadableStreamController*> controllerObj(cx, stream->controller());
     if (!VerifyControllerStateForClosing(cx, controllerObj)) {
         return false;
     }
 
     if (controllerObj->is<ReadableStreamDefaultController>()) {
         Rooted<ReadableStreamDefaultController*> controller(cx);
@@ -4531,18 +4544,19 @@ JS::ReadableStreamClose(JSContext* cx, H
 JS_PUBLIC_API(bool)
 JS::ReadableStreamEnqueue(JSContext* cx, HandleObject streamObj, HandleValue chunk)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(chunk);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     if (stream->mode() != JS::ReadableStreamMode::Default) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                   JSMSG_READABLESTREAM_NOT_DEFAULT_CONTROLLER,
                                   "JS::ReadableStreamEnqueue");
         return false;
     }
 
@@ -4558,18 +4572,19 @@ JS::ReadableStreamEnqueue(JSContext* cx,
 JS_PUBLIC_API(bool)
 JS::ReadableStreamError(JSContext* cx, HandleObject streamObj, HandleValue error)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(error);
 
     Rooted<ReadableStream*> stream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
-    if (!stream)
+    if (!stream) {
         return false;
+    }
 
     // Step 3: If stream.[[state]] is not "readable", throw a TypeError exception.
     if (!stream->readable()) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                   JSMSG_READABLESTREAMCONTROLLER_NOT_READABLE, "error");
         return false;
     }
 
@@ -4577,46 +4592,49 @@ JS::ReadableStreamError(JSContext* cx, H
     Rooted<ReadableStreamController*> controller(cx, stream->controller());
     return ReadableStreamControllerError(cx, controller, error);
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamReaderIsClosed(JSContext* cx, HandleObject readerObj, bool* result)
 {
     Rooted<ReadableStreamReader*> reader(cx, APIToUnwrapped<ReadableStreamReader>(cx, readerObj));
-    if (!reader)
+    if (!reader) {
         return false;
+    }
 
     *result = reader->isClosed();
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamReaderCancel(JSContext* cx, HandleObject readerObj, HandleValue reason)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(reason);
 
     Rooted<ReadableStreamReader*> reader(cx, APIToUnwrapped<ReadableStreamReader>(cx, readerObj));
-    if (!reader)
+    if (!reader) {
         return false;
+    }
 
     return ReadableStreamReaderGenericCancel(cx, reader, reason);
 }
 
 JS_PUBLIC_API(bool)
 JS::ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject readerObj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStreamReader*> reader(cx, APIToUnwrapped<ReadableStreamReader>(cx, readerObj));
-    if (!reader)
+    if (!reader) {
         return false;
+    }
 
 #ifdef DEBUG
     Rooted<ReadableStream*> stream(cx);
     if (!UnwrapStreamFromReader(cx, reader, &stream)) {
         return false;
     }
     MOZ_ASSERT(ReadableStreamGetNumReadRequests(stream) == 0);
 #endif // DEBUG
@@ -4627,13 +4645,14 @@ JS::ReadableStreamReaderReleaseLock(JSCo
 JS_PUBLIC_API(JSObject*)
 JS::ReadableStreamDefaultReaderRead(JSContext* cx, HandleObject readerObj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStreamDefaultReader*> reader(cx);
     reader = APIToUnwrapped<ReadableStreamDefaultReader>(cx, readerObj);
-    if (!reader)
+    if (!reader) {
         return nullptr;
+    }
 
     return ::ReadableStreamDefaultReaderRead(cx, reader);
 }