Bug 1504464 - Part 11: Remaining random changes. r=jwalden
authorJason Orendorff <jorendorff@mozilla.com>
Mon, 14 Jan 2019 20:36:08 +0000
changeset 510925 60668e84331f40ff3185d658a33d91ae89fa2dad
parent 510924 956a058f383c93234f7bb01656afbb67a077386a
child 510926 d945f4dd088b236c7cd44a54b443954952e41f27
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1504464
milestone66.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 1504464 - Part 11: Remaining random changes. r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D14509
js/src/builtin/Stream.cpp
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -1338,18 +1338,21 @@ static MOZ_MUST_USE JSObject* ReadableSt
   // Step 1: Assert: ! IsReadableStream{BYOB,Default}Reader(stream.[[reader]])
   //         is true.
   // (Only default readers exist so far.)
   Rooted<ReadableStreamReader*> unwrappedReader(
       cx, UnwrapReaderFromStream(cx, unwrappedStream));
   if (!unwrappedReader) {
     return nullptr;
   }
-
+  MOZ_ASSERT(unwrappedReader->is<ReadableStreamDefaultReader>());
+
+  // Step 2 of 3.4.1: Assert: stream.[[state]] is "readable" or "closed".
   // Step 2 of 3.4.2: Assert: stream.[[state]] is "readable".
+  MOZ_ASSERT(unwrappedStream->readable() || unwrappedStream->closed());
   MOZ_ASSERT_IF(unwrappedReader->is<ReadableStreamDefaultReader>(),
                 unwrappedStream->readable());
 
   // Step 3: Let promise be a new promise.
   RootedObject promise(cx, PromiseObject::createSkippingExecutor(cx));
   if (!promise) {
     return nullptr;
   }
@@ -2119,18 +2122,17 @@ static MOZ_MUST_USE bool ReadableStreamR
     // reader.[[closedPromise]].
     return false;
   }
 
   // Step 3: If reader.[[ownerReadableStream]].[[state]] is "readable", reject
   //         reader.[[closedPromise]] with a TypeError exception.
   Rooted<PromiseObject*> unwrappedClosedPromise(cx);
   if (unwrappedStream->readable()) {
-    unwrappedClosedPromise = 
-      UnwrapInternalSlot<PromiseObject>(
+    unwrappedClosedPromise = UnwrapInternalSlot<PromiseObject>(
         cx, unwrappedReader, ReadableStreamReader::Slot_ClosedPromise);
     if (!unwrappedClosedPromise) {
       return false;
     }
 
     AutoRealm ar(cx, unwrappedClosedPromise);
     if (!cx->compartment()->wrap(cx, &exn)) {
       return false;
@@ -4287,30 +4289,33 @@ static MOZ_MUST_USE bool CreateAlgorithm
  * As it happens, all callers pass exactly one argument.
  */
 inline static MOZ_MUST_USE bool InvokeOrNoop(JSContext* cx, HandleValue O,
                                              HandlePropertyName P,
                                              HandleValue arg,
                                              MutableHandleValue rval) {
   cx->check(O, P, arg);
 
-  // Step 1: Assert: P is a valid property key (omitted).
-  // Step 2: If args was not passed, let args be a new empty List (omitted).
-  // Step 3: Let method be ? GetV(O, P).
+  // Step 1: Assert: O is not undefined.
+  MOZ_ASSERT(!O.isUndefined());
+
+  // Step 2: Assert: ! IsPropertyKey(P) is true (implicit).
+  // Step 3: Assert: args is a List (implicit).
+  // Step 4: Let method be ? GetV(O, P).
   RootedValue method(cx);
   if (!GetProperty(cx, O, P, &method)) {
     return false;
   }
 
-  // Step 4: If method is undefined, return.
+  // Step 5: If method is undefined, return.
   if (method.isUndefined()) {
     return true;
   }
 
-  // Step 5: Return ? Call(method, O, args).
+  // Step 6: Return ? Call(method, O, args).
   return Call(cx, method, O, arg, rval);
 }
 
 /**
  * Streams spec, 6.3.5. PromiseCall ( F, V, args )
  * As it happens, all callers pass exactly one argument.
  */
 static MOZ_MUST_USE JSObject* PromiseCall(JSContext* cx, HandleValue F,