fix: crash when drag-dropping some files (#46311)

* fix: crash when drag-dropping some files

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* fix: extra destination context scope

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-03-26 22:23:24 -05:00 committed by GitHub
parent 39cbd0c27c
commit 2b4716253d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -687,17 +687,26 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
continue; continue;
} }
} }
v8::Local<v8::Value> value;
if (!api.Get(key, &value))
continue;
auto passed_value = PassValueToOtherContextInner( {
source_context, source_execution_context, destination_context, value, v8::Context::Scope source_context_scope(source_context);
api.GetHandle(), object_cache, support_dynamic_properties, v8::Local<v8::Value> value;
recursion_depth + 1, error_target); if (!api.Get(key, &value))
if (passed_value.IsEmpty()) continue;
return {};
proxy.Set(key, passed_value.ToLocalChecked()); auto passed_value = PassValueToOtherContextInner(
source_context, source_execution_context, destination_context,
value, api.GetHandle(), object_cache, support_dynamic_properties,
recursion_depth + 1, error_target);
if (passed_value.IsEmpty())
return {};
{
v8::Context::Scope inner_destination_context_scope(
destination_context);
proxy.Set(key, passed_value.ToLocalChecked());
}
}
} }
return proxy.GetHandle(); return proxy.GetHandle();