From 1402e1d75e0abf22f7c4eecb4a02b1fb6e172af1 Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Fri, 9 Nov 2018 22:09:59 +0000 Subject: [PATCH] Bug 1505604 - Remove enum class ReaderMode from Stream.cpp. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D11256 --HG-- extra : moz-landing-system : lando --- js/src/builtin/Stream.cpp | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/js/src/builtin/Stream.cpp b/js/src/builtin/Stream.cpp index cf06ca74c57c..580846815ec5 100644 --- a/js/src/builtin/Stream.cpp +++ b/js/src/builtin/Stream.cpp @@ -1643,13 +1643,6 @@ ReadableStreamGetNumReadRequests(ReadableStream* stream) return reader->requests()->getDenseInitializedLength(); } -enum class ReaderMode -{ - None, - Default, -}; - -#if DEBUG // Streams spec 3.4.12. ReadableStreamHasDefaultReader ( stream ) static MOZ_MUST_USE bool ReadableStreamHasDefaultReader(JSContext* cx, Handle stream, bool* result) @@ -1671,25 +1664,6 @@ ReadableStreamHasDefaultReader(JSContext* cx, Handle stream, bo *result = reader->is(); return true; } -#endif // DEBUG - -static MOZ_MUST_USE bool -ReadableStreamGetReaderMode(JSContext* cx, Handle stream, ReaderMode* mode) -{ - if (!stream->hasReader()) { - *mode = ReaderMode::None; - return true; - } - - Rooted reader(cx); - if (!UnwrapReaderFromStream(cx, stream, &reader)) { - return false; - } - - *mode = ReaderMode::Default; - - return true; -} /*** 3.5. Class ReadableStreamDefaultReader ******************************************************/ @@ -4424,12 +4398,11 @@ JS::ReadableStreamUpdateDataAvailableFromSource(JSContext* cx, JS::HandleObject } // Step 8: If ! ReadableStreamHasDefaultReader(stream) is true - ReaderMode readerMode; - if (!ReadableStreamGetReaderMode(cx, stream, &readerMode)) { + bool hasDefaultReader; + if (!ReadableStreamHasDefaultReader(cx, stream, &hasDefaultReader)) { return false; } - - if (readerMode == ReaderMode::Default) { + if (hasDefaultReader) { // Step b: Otherwise, // Step i: Assert: controller.[[queue]] is empty. MOZ_ASSERT(oldAvailableData == 0);