Bug 1506656 - Part 2: Silence a dead code warning. r=jwalden
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 16 Nov 2018 12:37:35 +0000
changeset 503182 ff90a2f2c6547e2a432ea50d0479184c3283fa8b
parent 503181 629234236ee4c8991f2170eca8df19297a9f583d
child 503183 cf16da2531eaa81dc0082da8d1ba9c45885428b2
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
bugs1506656
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 1506656 - Part 2: Silence a dead code warning. r=jwalden This renames the other CreateReadableByteStreamController signature, since the two seem different enough to warrant distinct names. Differential Revision: https://phabricator.services.mozilla.com/D11680
js/src/builtin/Stream.cpp
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -574,30 +574,30 @@ ReadableStream::createDefaultStream(JSCo
     if (!controller) {
         return nullptr;
     }
     stream->setController(controller);
     return stream;
 }
 
 static MOZ_MUST_USE ReadableByteStreamController*
-CreateReadableByteStreamController(JSContext* cx, Handle<ReadableStream*> stream,
-                                   void* underlyingSource);
+CreateExternalReadableByteStreamController(JSContext* cx, Handle<ReadableStream*> stream,
+                                           void* underlyingSource);
 
 ReadableStream*
 ReadableStream::createExternalSourceStream(JSContext* cx, void* underlyingSource,
                                            uint8_t flags, HandleObject proto /* = nullptr */)
 {
     Rooted<ReadableStream*> stream(cx, createStream(cx, proto));
     if (!stream) {
         return nullptr;
     }
 
     Rooted<ReadableStreamController*> controller(cx);
-    controller = CreateReadableByteStreamController(cx, stream, underlyingSource);
+    controller = CreateExternalReadableByteStreamController(cx, stream, underlyingSource);
     if (!controller) {
         return nullptr;
     }
 
     stream->setController(controller);
     controller->setEmbeddingFlags(flags);
 
     return stream;
@@ -3072,16 +3072,18 @@ ReadableStreamControllerGetDesiredSizeUn
 
     // Step 5: Return controller.[[strategyHWM]] − controller.[[queueTotalSize]].
     return controller->strategyHWM() - controller->queueTotalSize();
 }
 
 
 /*** 3.10. Class ReadableByteStreamController ****************************************************/
 
+#if 0 // disable user-defined byte streams
+
 /**
  * Streams spec, 3.10.3 new ReadableByteStreamController ( stream, underlyingSource,
  *                                                         highWaterMark )
  * Steps 3 - 16.
  *
  * Note: can NOT operate on unwrapped ReadableStream instances from
  * another compartment: ReadableStream controllers must be created in the same
  * compartment as the stream.
@@ -3184,33 +3186,35 @@ CreateReadableByteStreamController(JSCon
 
     if (!JS::AddPromiseReactions(cx, startPromise, onStartFulfilled, onStartRejected)) {
         return nullptr;
     }
 
     return controller;
 }
 
+#endif  // user-defined byte streams
+
 // Streams spec, 3.10.3.
 // new ReadableByteStreamController ( stream, underlyingByteSource,
 //                                    highWaterMark )
 bool
 ReadableByteStreamController::constructor(JSContext* cx, unsigned argc, Value* vp)
 {
     // Step 1: Throw a TypeError exception.
     JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                               JSMSG_BOGUS_CONSTRUCTOR, "ReadableByteStreamController");
     return false;
 }
 
 // Version of the ReadableByteStreamConstructor that's specialized for
 // handling external, embedding-provided, underlying sources.
 static MOZ_MUST_USE ReadableByteStreamController*
-CreateReadableByteStreamController(JSContext* cx, Handle<ReadableStream*> stream,
-                                   void* underlyingSource)
+CreateExternalReadableByteStreamController(JSContext* cx, Handle<ReadableStream*> stream,
+                                           void* underlyingSource)
 {
     Rooted<ReadableByteStreamController*> controller(cx);
     controller = NewBuiltinClassInstance<ReadableByteStreamController>(cx);
     if (!controller) {
         return nullptr;
     }
 
     // Step 3: Set this.[[controlledReadableStream]] to stream.