bool set_cache_override(JSContext *cx, HandleObject self, HandleValue cache_override_val) {
  MOZ_ASSERT(is_instance(self));
  if (!builtins::CacheOverride::is_instance(cache_override_val)) {
    JS_ReportErrorUTF8(cx, "Value passed in as cacheOverride must be an "
                           "instance of CacheOverride");
    return false;
  }

  RootedObject input(cx, &cache_override_val.toObject());
  JSObject *override = builtins::CacheOverride::clone(cx, input);
  if (!override) {
    return false;
  }

  JS::SetReservedSlot(self, Slots::CacheOverride, ObjectValue(*override));
  return true;
}
bool set_cache_override(JSContext *cx, HandleObject self, HandleValue cache_override_val) {
  MOZ_ASSERT(is_instance(self));
  if (!builtins::CacheOverride::is_instance(cache_override_val)) {
    JS_ReportErrorUTF8(cx, "Value passed in as cacheOverride must be an "
                           "instance of CacheOverride");
    return false;
  }

  RootedObject input(cx, &cache_override_val.toObject());
  JSObject *override = builtins::CacheOverride::clone(cx, input);
  if (!override) {
    return false;
  }

  JS::SetReservedSlot(self, Slots::CacheOverride, ObjectValue(*override));
  return true;
}