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:
Ben Konyi
2018-11-15 10:00:51 -08:00
committed by GitHub
parent 366503ca2d
commit 67f3bc1d14

View File

@@ -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;
}