@@ -66,7 +66,11 @@ public bool IsBound(string name)
6666
6767 public List < JavascriptObject > GetObjects ( List < string > names = null )
6868 {
69- if ( names == null || names . Count == 0 )
69+ //If there are no objects names or the count is 0 then we will raise
70+ //the resolve event then return all objects that are registered,
71+ //we'll only perform checking if object(s) of specific name is requested.
72+ var getAllObjects = names == null || names . Count == 0 ;
73+ if ( getAllObjects )
7074 {
7175 //TODO: JSB Declare Constant for All
7276 RaiseResolveObjectEvent ( "All" ) ;
@@ -81,8 +85,12 @@ public List<JavascriptObject> GetObjects(List<string> names = null)
8185 RaiseResolveObjectEvent ( name ) ;
8286 }
8387 }
84-
85- return objects . Values . Where ( x => names . Contains ( x . JavascriptName ) ) . ToList ( ) ;
88+
89+ var objectsByName = objects . Values . Where ( x => names . Contains ( x . JavascriptName ) ) . ToList ( ) ;
90+
91+ //TODO: JSB Add another event that signals when no object matching a name
92+ //in the list was provided.
93+ return objectsByName ;
8694 }
8795
8896
@@ -122,7 +130,7 @@ public void Register(string name, object value, bool isAsync, BindingOptions opt
122130 {
123131 //Enable WCF if not already enabled - can only be done before the browser has been initliazed
124132 //if done after the subprocess won't be WCF enabled it we'll have to throw an exception
125- if ( ! IsBrowserInitialized )
133+ if ( ! IsBrowserInitialized && ! isAsync )
126134 {
127135 CefSharpSettings . WcfEnabled = true ;
128136 }
@@ -148,7 +156,7 @@ public void Register(string name, object value, bool isAsync, BindingOptions opt
148156 jsObject . Binder = options == null ? null : options . Binder ;
149157 jsObject . MethodInterceptor = options == null ? null : options . MethodInterceptor ;
150158
151- AnalyseObjectForBinding ( jsObject , analyseMethods : true , analyseProperties : isAsync , readPropertyValue : false , camelCaseJavascriptNames : camelCaseJavascriptNames ) ;
159+ AnalyseObjectForBinding ( jsObject , analyseMethods : true , analyseProperties : ! isAsync , readPropertyValue : false , camelCaseJavascriptNames : camelCaseJavascriptNames ) ;
152160 }
153161
154162 public bool TryCallMethod ( long objectId , string name , object [ ] parameters , out object result , out string exception )
@@ -349,10 +357,10 @@ public bool TrySetProperty(long objectId, string name, object value, out string
349357 /// </summary>
350358 /// <param name="obj">Javascript object</param>
351359 /// <param name="analyseMethods">Analyse methods for inclusion in metadata model</param>
360+ /// <param name="analyseProperties">Analyse properties for inclusion in metadata model</param>
352361 /// <param name="readPropertyValue">When analysis is done on a property, if true then get it's value for transmission over WCF</param>
353362 /// <param name="camelCaseJavascriptNames">camel case the javascript names of properties/methods</param>
354- /// <param name="analyseProperties">Analyse properties for binding</param>
355- private void AnalyseObjectForBinding ( JavascriptObject obj , bool analyseMethods , bool readPropertyValue , bool camelCaseJavascriptNames , bool analyseProperties )
363+ private void AnalyseObjectForBinding ( JavascriptObject obj , bool analyseMethods , bool analyseProperties , bool readPropertyValue , bool camelCaseJavascriptNames )
356364 {
357365 if ( obj . Value == null )
358366 {
@@ -403,7 +411,7 @@ private void AnalyseObjectForBinding(JavascriptObject obj, bool analyseMethods,
403411 jsObject . Value = jsProperty . GetValue ( obj . Value ) ;
404412 jsProperty . JsObject = jsObject ;
405413
406- AnalyseObjectForBinding ( jsProperty . JsObject , analyseMethods , readPropertyValue , camelCaseJavascriptNames , true ) ;
414+ AnalyseObjectForBinding ( jsProperty . JsObject , analyseMethods , analyseProperties : true , readPropertyValue : readPropertyValue , camelCaseJavascriptNames : camelCaseJavascriptNames ) ;
407415 }
408416 else if ( readPropertyValue )
409417 {
0 commit comments