Commit Graph

65 Commits

Author SHA1 Message Date
João Neves b1b8f43859 Dont discard null Values from arrays (#2218)
* Don't discard arrays that contain null values
* Revert unintended change in this branch
* Added qunit test
* Code review and added new tests
2018-01-18 11:46:58 +10:00
amaitland 7a0b06ad0b JSB Add support for dynamic keyword (using ExpandoObject)
As ExpandoObject implements IDictionary we can use it interchangeable with only minor breaking changes.
Those expecting Dictionary<string, object> should change to IDictionary<string, object> or ExpandoObject for their param types
This will also impact anyone who has implemented their own custom IBinder
I'd suggest changing the type checking from explicitly checking Dictionary<string, object> to use Type.IsAssignableFrom or another method of comparison
DefaultBinder binder has been updated to accommodate ExpandoObject (now being returned by ObjectsSerialization.cpp)
Add new async binding for testing new assignment method
Rewrite some of the async bound object tests to use await and let - modernize them
2017-12-21 13:00:36 +10:00
ieremyashev f029a22f45 Fix return value serialization for async JS bindings (#2167) 2017-10-24 09:48:58 +11:00
João Neves 402b2b9980 Add BindingOptions.MethodInterceptor (#2015)
* Added managed methods interception mechanism
* Introduced requested changes (improved comments and namming)
2017-06-01 10:58:43 +10:00
João Neves bc83d6c247 Allow calling managed methods from objects bound with RegisterAsyncJsObject that return arrays of structs (#1981)
* Fixed problem when calling CefV8Value::CreateArray. Needs prior call to V8 context enter
* Call callback dispose in case of failure
* Support serialization of struct arrays to JS side
* Fixed formatting
2017-03-13 21:37:55 +10:00
Chris cd934267c6 Updated copyright year and made sure it used same format everywhere (#1966) 2017-03-06 08:44:37 +10:00
Alex Maitland d4feffb554 Feature - Add IBinder (#1749)
* Add basic ModelBinding which was imported from NancyFx framework - more can be stripped out that's unused

* Add IBinder as a param when registering an object for binding
Binding is disabled by default

* Add license and remove unused using statements

* Make bind method virtual to allow for overriding
Make methods protected

* Add very basic collection support - only primitive types supported for now.
Remove unused exceptions

* Support binding a list of sub objects

* Add null check for null params

* Add BindingOptions class - remove binder and CamelCaseJavascriptNames properties - allow for additional options in the future
Breaking change.

* Add support for List<object> binding type
2016-07-20 13:38:24 +10:00
amaitland c9944c981a Split paramArray and missing arg logic out into two if statements. Previously null was being replaced by Type.Missing.
Two seperate if statement branches allows for a method that has options params and a param array

Resolve #1673
2016-04-29 18:10:43 +10:00
Akash Jana d0e74f819f Fix Issue #1582, Use ToLowerInvariant while converting Function names to avoid culture specific conversion. 2016-04-17 19:17:09 -07:00
amaitland 4de3a1795d Remove DisposableResource - only class implementing it was JavascriptObjectRepository and it didn't override the InternalDispose method 2016-04-15 15:42:40 +10:00
amaitland 669404f74c Change new paramAray test methods in BindingTest.html to execute immediately (same as all the majority)
Revert changes to NuGet.config
Remove unused using statement from ScriptedMethodsBoundObject
Rename JavascriptMethod.Parameters to just JavascriptMethod.Parameters (it's in the context of the method so naming was redundant)
Pre compute HasParamArray for minor (very minor) performance improvement - relevant when executing method many times in a tight loop
2016-04-05 17:03:33 +10:00
Chris Bardsley d3d6907dac Refactored changes from build#1644 to account for discussed changes. 2016-04-04 21:44:22 -07:00
Chris Bardsley b628199ee9 Fix for C# paramArray and refactor on arguments mismatch 2016-03-23 21:17:47 -07:00
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
illfang aad399ba5f detailed exception string generation for exceptions in injected native functions / properties 2015-09-08 10:49:33 +09:00
cefsharp-ms 38fe85cf71 TargetInvocationException is converted properly in JavascriptObjectRepository.TryCallMethod 2015-09-04 13:31:23 +02:00
amaitland 65d44b3962 Only send register IPC message of there are is a bound object 2015-08-18 09:29:50 +10:00
amaitland 74d987a02d Switch to Interlocked.Increment for Id generation
Add missing xml comment
2015-08-03 10:59:31 +10:00
cefsharp-ms a99e020138 added option to register async js objects with only method bindings 2015-07-23 15:10:28 +02:00
Bill Tutt dcd56c27eb Add some descriptive comments about what some of the subprocess classes do. 2015-05-02 02:36:10 -04:00
rassilon 7128e40fd1 It's time for copyright updates again. Yay!
Throw in a couple of tab containing files for good measure.
Evil tabs, evil I say.
2015-04-25 02:45:21 -04:00
amaitland f12643ea47 Cherry picked changes from https://github.com/cefsharp/CefSharp/pull/972
Remove empty set from BoundObject example
Untabify BrowserProcessResponse
Make CamelCaseJavascriptNames (consistency, class should probably be made internal as a whole)
make JavascriptObjectRepository.CreateJavascriptObject private
Remove redundant using
2015-04-25 11:50:52 +10:00
Erguotou fa43ec9997 Pass down camelCaseJavascriptNames to subobjects
For consistency, pass down camelCaseJavascriptNames flag to
sub-objects so that naming remain the same.
2015-04-25 11:50:52 +10:00
amaitland 39c8194b49 rename lowerCaseJavascriptNames to camelCaseJavascriptNames - more accurate description of what's going on 2015-04-16 16:31:54 +10:00
amaitland e470bcf50c Rename LowercaseFirst tp GetJavascriptName - more descriptive naming 2015-04-07 20:42:26 +10:00
amaitland 64906605ce Pass lowerCaseJavascriptNames as param to LowercaseFirst method - reduces code duplication 2015-04-07 20:41:35 +10:00
amaitland ce12ff0a04 Remove unnecessary method overloads, the lowerCaseJavascriptNames param wasn't being propagated recursively.
Default TryCallMethod to using LowercaseFirst
2015-04-07 20:36:19 +10:00
Exinferis 8581c3f03b Added parameter for lowercasing JS functions (or not) 2015-04-02 15:37:12 +02:00
amaitland 953d917226 Add JSB support for Methods with optional params 2015-01-22 12:54:38 +10:00
amaitland bf4983b52d Resolve null pointer exception - Functions/Methods that return null or have no return value were through an exception 2015-01-19 11:45:24 +10:00
amaitland ff678b5ae2 Remove duplicate JavascriptObject analysis code - add additional params 2015-01-09 13:33:24 +10:00
amaitland 6f5730e5c8 Rename Analyse method to AnalyseObjectForBinding
Add additional comment about it's functionality
2015-01-09 12:26:27 +10:00
amaitland 224cbcda9f First step towards getting JSB functions to return complex types - uses JavascriptOjbect/JavascriptProperty classes to represent the metadata transferred over WCF
(Sending the complex type it's self is difficult as the type is not known by both client and server)
2015-01-09 12:18:56 +10:00
amaitland 901a70ac00 Automatically register function return types with WCF (only solves have the equation as the subprocess has no idea during deserialization) 2015-01-08 15:43:56 +10:00
amaitland 5a5dfbcc4a As per https://github.com/cefsharp/CefSharp/issues/567#issuecomment-62295487 revert LowercaseFirst for name of root object 2014-11-11 20:34:08 +10:00
amaitland 057e90d7f5 Ignore methods and properties marked with JavascriptIgnoreAttribute 2014-10-29 16:55:42 +10:00
amaitland 78ddea334a Only perform recursive Analysis if property is a Complex Type 2014-09-14 22:52:31 +10:00
amaitland a424d6775b Rename Value property to JsObject - more meaningful name 2014-09-14 22:50:31 +10:00
amaitland e33c7552dc Return false when an exception is thrown 2014-09-02 11:27:39 +10:00
amaitland 3e5a3ae0cb Catch and return Exception for TryCallMethod, TryGetProperty, TrySetProperty methods, passed back to the browsersubprocess though currently not displayed in the UI 2014-09-02 10:57:47 +10:00
amaitland f40c1d2f9f Fix bug where JavascriptName wasn't being set for Complex Property types
Added example called SubBoundObject can be tested from the WPF example using code like "bound.subObject.simpleProperty"
2014-08-29 16:50:16 +10:00
amaitland 0b4d80a460 Add License disclaimer 2014-08-29 12:39:53 +10:00
amaitland a18a64d70a Add basic ReadOnly property support 2014-08-28 22:43:56 +10:00
amaitland 44ad743355 For consistency always match on JavascriptName 2014-08-28 20:42:49 +10:00
amaitland da3412969d Revery name change for TryGetMethod - seems slightly inconsistent so will need to be fixed. 2014-08-28 19:40:01 +10:00
amaitland 2aa87c2034 Change to use JavascriptName instead of Managed name 2014-08-28 19:35:04 +10:00
amaitland 5caa457210 Start of restructure of JavascriptObject hierarchy 2014-08-28 14:47:11 +10:00
amaitland 1b1f40c99f Separate Methods and Properties into two distinct types (stored differently) 2014-08-28 13:45:23 +10:00
amaitland 0a7e264914 Create a basic RootMemberWrapper wrapper - still needs work 2014-08-28 13:28:52 +10:00
amaitland 68494b91b4 Move object analysis into JavascriptObjectRepository - start of converting JavascriptObject to more like a DTO 2014-08-28 13:01:45 +10:00