refactor: return-braced-init-list pt 2 of 2 (#44890)

* refactor: more return-braced-init-list, this time for v8 and gin objects

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: more return-braced-init-list, this time for v8, gin, std, and base objects

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-11-30 06:53:07 -06:00 committed by GitHub
parent 90890e20c0
commit 73e791475b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 64 additions and 64 deletions

View file

@ -152,7 +152,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
"Electron contextBridge recursion depth exceeded. "
"Nested objects "
"deeper than 1000 are not supported.")));
return v8::MaybeLocal<v8::Value>();
return {};
}
// Certain primitives always use the current contexts prototype and we can
@ -209,7 +209,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
if (!v8::Function::New(destination_context, ProxyFunctionWrapper, state)
.ToLocal(&proxy_func))
return v8::MaybeLocal<v8::Value>();
return {};
SetPrivate(destination_context, proxy_func.As<v8::Object>(),
context_bridge::kOriginalFunctionPrivateKey, func);
object_cache->CacheProxiedObject(value, proxy_func);
@ -372,11 +372,11 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
arr->Get(source_context, i).ToLocalChecked(), value, object_cache,
support_dynamic_properties, recursion_depth + 1, error_target);
if (value_for_array.IsEmpty())
return v8::MaybeLocal<v8::Value>();
return {};
if (!IsTrue(cloned_arr->Set(destination_context, static_cast<int>(i),
value_for_array.ToLocalChecked()))) {
return v8::MaybeLocal<v8::Value>();
return {};
}
}
object_cache->CacheProxiedObject(value, cloned_arr);
@ -408,7 +408,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
object_value, source_context, destination_context, object_cache,
support_dynamic_properties, recursion_depth + 1, error_target);
if (passed_value.IsEmpty())
return v8::MaybeLocal<v8::Value>();
return {};
return v8::MaybeLocal<v8::Value>(passed_value.ToLocalChecked());
}
@ -421,7 +421,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
v8::Context::Scope error_scope(error_context);
// V8 serializer will throw an error if required
if (!gin::ConvertFromV8(error_context->GetIsolate(), value, &ret)) {
return v8::MaybeLocal<v8::Value>();
return {};
}
}
@ -651,7 +651,7 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
object_cache, support_dynamic_properties, recursion_depth + 1,
error_target);
if (passed_value.IsEmpty())
return v8::MaybeLocal<v8::Object>();
return {};
proxy.Set(key, passed_value.ToLocalChecked());
}