bool mark_body_used(JSContext *cx, HandleObject obj) {
  MOZ_ASSERT(!body_used(obj));
  JS::SetReservedSlot(obj, Slots::BodyUsed, JS::BooleanValue(true));

  RootedObject stream(cx, body_stream(obj));
  if (stream && builtins::NativeStreamSource::stream_is_body(cx, stream)) {
    if (!builtins::NativeStreamSource::lock_stream(cx, stream)) {
      // The only reason why marking the body as used could fail here is that
      // it's a disturbed ReadableStream. To improve error reporting, we clear
      // the current exception and throw a better one.
      JS_ClearPendingException(cx);
      JS_ReportErrorLatin1(cx, "The ReadableStream body is already locked and can't be consumed");
      return false;
    }
  }

  return true;
}
bool mark_body_used(JSContext *cx, HandleObject obj) {
  MOZ_ASSERT(!body_used(obj));
  JS::SetReservedSlot(obj, Slots::BodyUsed, JS::BooleanValue(true));

  RootedObject stream(cx, body_stream(obj));
  if (stream && builtins::NativeStreamSource::stream_is_body(cx, stream)) {
    if (!builtins::NativeStreamSource::lock_stream(cx, stream)) {
       
       
       
      JS_ClearPendingException(cx);
      JS_ReportErrorLatin1(cx, "The ReadableStream body is already locked and can't be consumed");
      return false;
    }
  }

  return true;
}