mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 09:37:03 +00:00
Core - Improve JavascriptObjectRepository.TryCallMethod Object Not Found error message
- Add method name and param count Resolves #4209
This commit is contained in:
@@ -49,6 +49,16 @@ namespace CefSharp.Test.JavascriptBinding
|
||||
Assert.Equal("ok", result.ReturnValue.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShouldReturnErrorMessageForObjectInvalidId()
|
||||
{
|
||||
IJavascriptObjectRepositoryInternal javascriptObjectRepository = new JavascriptObjectRepository();
|
||||
|
||||
var result = javascriptObjectRepository.TryCallMethod(100, "getExampleString", new object[0]);
|
||||
Assert.False(result.Success);
|
||||
Assert.StartsWith("Object Not Found Matching Id", result.Exception);
|
||||
}
|
||||
|
||||
#if !NETCOREAPP
|
||||
[Fact]
|
||||
public void CanRegisterJavascriptObjectPropertyBindWhenNamespaceIsNull()
|
||||
|
||||
@@ -293,7 +293,9 @@ namespace CefSharp.Internals
|
||||
|
||||
if (!objects.TryGetValue(objectId, out obj))
|
||||
{
|
||||
return new TryCallMethodResult(false, result, "Object Not Found Matching Id:" + objectId);
|
||||
var paramCount = parameters == null ? 0 : parameters.Length;
|
||||
|
||||
return new TryCallMethodResult(false, result, $"Object Not Found Matching Id:{objectId}, MethodName:{name}, ParamCount:{paramCount}");
|
||||
}
|
||||
|
||||
var method = obj.Methods.FirstOrDefault(p => p.JavascriptName == name);
|
||||
|
||||
Reference in New Issue
Block a user