Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Oct 21, 2024
1 parent 90769f0 commit c89cc95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions runtime/fastly/builtins/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,9 @@ JSObject *Backend::create(JSContext *cx, JS::HandleObject request) {
if (!name_js_str) {
return nullptr;
}
JS::RootedValue name(cx, JS::StringValue(name_js_str));
std::string name_str((char *)slice.data, slice.len);
JS::SetReservedSlot(request, static_cast<uint32_t>(Request::Slots::Backend), name);

// Check if we already constructed an implicit dynamic backend for this host.
bool found;
Expand All @@ -1707,6 +1709,7 @@ JSObject *Backend::create(JSContext *cx, JS::HandleObject request) {
return nullptr;
}
JS::RootedObject backend(cx, &already_built_backend.toObject());

return backend;
}

Expand All @@ -1722,8 +1725,6 @@ JSObject *Backend::create(JSContext *cx, JS::HandleObject request) {

host_api::BackendConfig backend_config = default_backend_config.clone();

JS::RootedValue name(cx, JS::StringValue(name_js_str));
JS::SetReservedSlot(request, static_cast<uint32_t>(Request::Slots::Backend), name);
auto host_backend = set_backend(cx, backend, name);
if (!host_backend) {
return nullptr;
Expand Down

0 comments on commit c89cc95

Please sign in to comment.