bool append_header_value_to_map(JSContext *cx, HandleObject self, HandleValue normalized_name,
                                MutableHandleValue normalized_value) {
  RootedValue existing(cx);
  RootedObject map(cx, backing_map(self));
  if (!JS::MapGet(cx, map, normalized_name, &existing))
    return false;

  // Existing value must only be null if we're in the process if applying
  // header values from a handle.
  if (!existing.isNullOrUndefined()) {
    if (!comma.get()) {
      comma.init(cx, JS_NewStringCopyN(cx, ", ", 2));
      if (!comma)
        return false;
    }

    RootedString str(cx, existing.toString());
    str = JS_ConcatStrings(cx, str, comma);
    if (!str)
      return false;

    RootedString val_str(cx, normalized_value.toString());
    str = JS_ConcatStrings(cx, str, val_str);
    if (!str)
      return false;

    normalized_value.setString(str);
  }

  return JS::MapSet(cx, map, normalized_name, normalized_value);
}
bool append_header_value_to_map(JSContext *cx, HandleObject self, HandleValue normalized_name,
                                MutableHandleValue normalized_value) {
  RootedValue existing(cx);
  RootedObject map(cx, backing_map(self));
  if (!JS::MapGet(cx, map, normalized_name, &existing))
    return false;

   
   
  if (!existing.isNullOrUndefined()) {
    if (!comma.get()) {
      comma.init(cx, JS_NewStringCopyN(cx, ", ", 2));
      if (!comma)
        return false;
    }

    RootedString str(cx, existing.toString());
    str = JS_ConcatStrings(cx, str, comma);
    if (!str)
      return false;

    RootedString val_str(cx, normalized_value.toString());
    str = JS_ConcatStrings(cx, str, val_str);
    if (!str)
      return false;

    normalized_value.setString(str);
  }

  return JS::MapSet(cx, map, normalized_name, normalized_value);
}