Skip to content

Commit 9f96333

Browse files
committed
Javascript Binding - CefSharp.BindObjectAsync() never raised the ResolveObject event
Resolves #3470
1 parent 25e8d9f commit 9f96333

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CefSharp.BrowserSubprocess.Core/BindObjectAsyncHandler.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ namespace CefSharp
134134
//If the number of cached objects matches the number of args
135135
//(we have a cached copy of all requested objects)
136136
//then we'll immediately bind the cached objects
137-
if (cachedObjects->Count == objectCount && ignoreCache == false)
137+
//If objectCount and cachedObject count are both 0 then we'll
138+
//send the kJavascriptRootObjectRequest message
139+
//https://github.com/cefsharp/CefSharp/issues/3470
140+
if (objectCount > 0 && cachedObjects->Count == objectCount && ignoreCache == false)
138141
{
139142
if (Object::ReferenceEquals(_browserWrapper, nullptr))
140143
{

CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public async Task CanCallCefSharpBindObjectAsyncWithoutParams()
173173
var evt = Assert.Raises<JavascriptBindingEventArgs>(
174174
x => browser.JavascriptObjectRepository.ResolveObject += x,
175175
y => browser.JavascriptObjectRepository.ResolveObject -= y,
176-
() => { browser.EvaluateScriptAsync("CefSharp.BindObjectAsync({ IgnoreCache: true });").GetAwaiter().GetResult(); });
176+
() => { browser.EvaluateScriptAsync("CefSharp.BindObjectAsync();").GetAwaiter().GetResult(); });
177177

178178
Assert.NotNull(evt);
179179

0 commit comments

Comments
 (0)