Core - Add IAsyncMethodInterceptor
- Add IAsyncMethodInterceptor
Extension of IMethodInterceptor to allow for easier evaluation of async taskScheduler
- Add Additional unit tests
- Add JavascriptBindingSettings.AlwaysInterceptAsynchronously for cases where you'd like all method calls to use
IAsyncMethodInterceptor.InterceptAsync
Follow up to PR #3291
Co-authored-by: Andrew Sampson <andrew@rainway.com>
Co-authored-by: Emily Hudson <emily33901@gmail.com>
* Core - Move NameConverter to IJavascriptObjectRepository
- Move NameConverter property from BindingOptions to IJavascriptObjectRepository
- Remove BindingOptions.CamelCaseJavascriptNames
**Breaking Change**
Follow up to https://github.com/cefsharp/CefSharp/commit/898ca38e7a7261b3a42c33b2abf5eac6c022ddde
* Core - Javascript Binding Pluggable Naming Improvements
- Added some basic unit tests (more required)
- DefaultBinder now accepts a IJavascriptNameConverter passed into the constructor
to allow for conversion of names
* Core - Replace WeakReference with WeakReference<T>
- Make Wpf/WinForms/OffScreen projects target AnyCPU
Only the VC++ projects are platform specific now.
- Remove BrowserSubProcess project reference
Not needed as we now have a standalone exe
- Add OffScreen example
- Add WPF Example project
- Fix some compile errors for main solution
- Add BrowserSubProcess executable
- JavascriptObjectRepository remove isAsync param
Rather than throw exception remove the option
- BrowserSubprocess Exclude the WCF specific code from the netCore project
- Add some ifdef/ifndef to exclude the WCF specific implementation
- Move WCF implementation into separate namespace
* Add .NET Core 3.1 projects for CefSharp, CefSharp.Core, CefSharp.BrowserSubprocess.Core, CefSharp.WinForms, CefSharp.Wpf, CefSharp.OffScreen.
Contributes to CefSharp#2796
* - Remove dependencies to "opengl32.lib" and "glu32.lib" which aren't available for ARM64 and don't seem to be needed.
- Clean up project files.
* Switch project CefSharp.netcore.csproj to AnyCPU as it doesn't require different builds for each platform.
* Remove WindowsTargetPlatformVersion property as that is declared in CefSharp.props.
* Use "bin.netcore" and "obj.netcore" as [intermediate] output path for the .NET Core projects, to allow side-by-side builds with the .NET Framework projects.
* Output documentation files.
* Add CefSharp.Example.netcore and CefSharp.WinForms.Example.netcore.
* Follow-up: Remove properties from the example projects that are also not used in the corresponding .NET Framework projects.
- Allows for the user to provide their own IJavascriptNameConverter implementation
- Defaults to using the CamelCaseJavascriptNameConverter (which is exactly the same very basic
naming conversion used by default currently).
- If CamelCaseJavascriptNames is false then no conversion is used
Naming is now separate from the JavascriptObjectRepository and can be tested in isolation.
Previously it was global set using CefSharpSettings.LegacyJavascriptBindingEnabled
Now it's configured through IJavascriptObjectRepository.Settings.LegacyBindingEnabled
which defaults to CefSharpSettings.LegacyJavascriptBindingEnabled (until it's removed).
IJavascriptObjectRepository.ResolveObject is raised with LegacyObjects as the name
to allow for easier binding of objects.
Issue #2977
Previously only IDictionary<string, object>, IList<object> were passed, now all params are passed to allow for type conversion (Issue #2906)
Binding now occurs before missing params are added (they weren't passed to the binder previously, so this doesn't change the behaviour
This is a breaking change.
Resolves#2908
* Applied formatting
* Fixed file encoding + Updated copyright year
* Updated License
* Fixed more file encoding
* Copyright notice now shows the year the file was created
To support this use case added IJavascriptObjectRepository.ObjectsBoundInJavascript (called a single time with names of all objects bound)
Implements the idea put forward in #2362
CefSharp.BindObjectAsync can now take an optional config object as first param
Include additional information when binding complete
Add option for cefSharp.bindObjectAsync (starting with lowercase latters)
Add new syntax options - not entirely complete, no variant for the options object
Add ignore cache option
Bound object meta data is cached within a render process
CefSharp.IsObjectCached - JS method to test if object cached
CefSharp.RemoveObjectFromCache - JS method to remove object from cache
If a request is made for multiple objects with not all of them being cached then a IPC message is sent.
When all objects already bound return response object for consistency
FindBrowserWrapper signature change - it's really not safe to throw a managed exception in the middle of unmanaged code, changed to logging and null checking
JavascriptObjectRepository - Add All Constant - Used when All objects are requested for binding (objects can also be requested by name)
TODO: Add a JS library to improve user experience when dealing with cached objects
* JSB Rewrite - Add CefSharp.RegisterBoundObject javascript method
To get around the problem of IPC timing, I've reversed the communication, now it's the render process requesting
the bound objects, the implementation is incomplete at this stage, more just a basic proof of concept
Rewrite BindingTest.html using QUnit
One of the tests doesn't map correctly as it requires def user interaction
TODO:
- Get objects by name
- Rename Messages.h values that relate to this change so they are more descriptive
- Better error handling
- Caching of objects within a render process
- Investigate global context options, don't think it's possible to call an async method directly in the global context
# Conflicts:
# CefSharp.Example/Resources/BindingTest.html
* JSB Improve Request/Response message names
* BindingTest.html - Output stress test results
* Remove JavascriptRootObject was leftover from time we used WCF to transmit objects
* JavascriptObjectRepository - Objects are now sent in the same list with an IsAsync flag
Separation when sending over IPC with two unique lists isn't necessary
* JavascriptObjectRepository - Return objects by name or return all by default
Untabify CefAppUnmanagedWrapper.cpp
Add minor comment to CefBrowserWrapper for a reminder that we use Frame Identifier as dictionary key
* Add //TODO: JSB comments for work that's left to be done
Ideally within a render process we cache bound objects once they've been communicated,
It would also be nice to make multiple binding requests so objects can later be added dynamically
* JSB Allow multiple calls to CefSharp.RegisterBoundObject
Update BindingTest.html to name two distinct calls to different bound objects
* JSB - Add some notes about caching, no working implementation yet
* JSB - Dynamically Register object on Request
* JSB Add ability to unbind an object and rename RegisterBoundObject to BindObjectAsync
# Conflicts:
# CefSharp.Example/Resources/BindingTest.html
* JSB BindObjectAsync - if objects already bound then return false
* JSB - Ignore Indexer properties
Were previously throwing an exception
* JSB - Add LegacyJavascriptBindingEnabled option so preserve existing behaviour
This is only useful for SPA application and those that only navigate to pages
hosting within a single domain. Any sort of cross-site navigation and a new
render process will be spawned and objects won't be bound automatically
(You can use the new methods to request they're bound yourself, at least in theory,
more testing required on this)
* Add LegacyBindingTest.html
Current disabled by default. To enable uncomment CefSharpSettings.LegacyJavascriptBindingEnabled = true;
in CefExample.cs
* RegisterJsObject and RegisterAsyncJsObject can now only be used when CefSharpSettings.LegacyJavascriptBindingEnabled = true
See https://github.com/cefsharp/CefSharp/issues/2246 for details
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
* 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
* 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
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
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