JSObject *create(JSContext *cx, HandleObject self, Mode mode, HandleObject owner,
                 HandleValue initv) {
  RootedObject headers(cx, create(cx, self, mode, owner));
  if (!headers)
    return nullptr;

  bool consumed = false;
  if (!maybe_consume_sequence_or_record<detail::append_header_value>(cx, initv, headers, &consumed,
                                                                     "Headers")) {
    return nullptr;
  }

  if (!consumed) {
    report_sequence_or_record_arg_error(cx, "Headers", "");
    return nullptr;
  }

  return headers;
}
JSObject *create(JSContext *cx, HandleObject self, Mode mode, HandleObject owner,
                 HandleValue initv) {
  RootedObject headers(cx, create(cx, self, mode, owner));
  if (!headers)
    return nullptr;

  bool consumed = false;
  if (!maybe_consume_sequence_or_record<detail::append_header_value>(cx, initv, headers, &consumed,
                                                                     "Headers")) {
    return nullptr;
  }

  if (!consumed) {
    report_sequence_or_record_arg_error(cx, "Headers", "");
    return nullptr;
  }

  return headers;
}