Don't allow for creation of CallbackHandle objects for anonymous closures (flutter/engine#6864)
* Don't allow for creation of CallbackHandle objects for anonymous closures. Fixes issue #22310
This commit is contained in:
@@ -318,12 +318,14 @@ static std::string GetFunctionName(Dart_Handle func) {
|
||||
}
|
||||
|
||||
void GetCallbackHandle(Dart_NativeArguments args) {
|
||||
const char* kAnonymousClosureName = "<anonymous closure>";
|
||||
Dart_Handle func = Dart_GetNativeArgument(args, 0);
|
||||
std::string name = GetFunctionName(func);
|
||||
std::string class_name = GetFunctionClassName(func);
|
||||
std::string library_path = GetFunctionLibraryUrl(func);
|
||||
|
||||
if (name.empty()) {
|
||||
// TODO(24394): check !Dart_IsTearOff(func) instead of string comparison.
|
||||
if (name.empty() || (name == kAnonymousClosureName)) {
|
||||
Dart_SetReturnValue(args, Dart_Null());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user