Commit Graph

39 Commits

Author SHA1 Message Date
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00
Alex Maitland 9b01b69d2f Implement Javascript Binding v2 (#2247)
* 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
2018-01-22 10:24:25 +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 c8f6017fa5 Change TestCallbackFromObject to use new DynamicDictionary helper class 2016-07-06 11:06:00 +10:00
tuxan 6a2ee2cd5b Overload of ConvertFromCef method removed and do some formatting corrections. 2016-07-01 11:00:57 -04:00
tuxan 2f89c530ba Added support to use object parameters with anonymous function callback inside as parameter of bound functions. 2016-06-30 18:17:39 -04: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
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
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
amaitland 3f15b53ab7 Resolves #1407
More the DeserializeV8Object call to within the context->Enter so a V8Object can be created
Change callback to use a struct as it's return type to demo the solution to this bug
Add missing list->SetDictionary call in V8Serialization.cpp
2015-11-18 09:17:16 +10:00
illfang 81c545cf39 added test html logging exception log messages: ExceptionTest.html
custom://cefsharp/ExceptionTest.html
2015-09-08 11:20:31 +09:00
amaitland 7498c65741 Add copyright to CefSharp.Example 2015-08-03 10:41:29 +10: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 35db8ce87d Added a few KnownTypes to support value type arrays 2015-04-25 11:50:52 +10:00
amaitland 0f48c637db Execute jsb callback in a Task 2015-03-12 11:48:42 +10:00
amaitland a5688b4510 Revert "Remove WCF Surrogate and inject browser host"
This reverts commit 746e51432a.
2015-03-12 11:08:01 +10:00
amaitland 746e51432a Remove WCF Surrogate and inject browser host 2015-03-11 14:46:36 +10:00
David Serfozo 609b13a758 few tests for js callback 2015-03-08 16:23:49 +01:00
amaitland 953d917226 Add JSB support for Methods with optional params 2015-01-22 12:54:38 +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 be5d3db546 Add ComplexParamObject method to BoundObject - test for passing a complex object from javascript (which is converted into a dictionary)
Example usage
bound.complexParamObject({ 'color': 'purple' });
2015-01-06 20:47:30 +10:00
amaitland 40f3328b5b Add simple JSON example to BindingTest.html 2014-12-16 21:44:13 +10:00
amaitland b305793cb5 Add ignored methods to BoundObject 2014-10-29 16:55:43 +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 547bed0c6c Make BoundObject public and register in BrowserTabView 2014-08-27 14:59:27 +10:00
amaitland 0c535b1423 Now invokes TryGetProperty as expected, still got some problems and this doesn't allow for a tree hierarchy, so it's rather limited at the moment. 2014-07-11 17:00:17 +10:00
Per Lundberg 1ae5bf8d30 Trivial adjustments. Let's try to get property assignment working, shall we not! 2014-06-12 02:41:59 +03:00
JanEggers 36ed4dbdc0 implemented Property Getter / Setter 2014-06-07 09:52:45 +02:00
Per Lundberg 608af903c6 Added test case for the method casing & updated existing tests (since the method names are now camelCased). 2013-06-05 14:15:37 +03:00
Per Lundberg 35dfcebe1a Let's make this internal instead. 2013-06-05 11:28:11 +03:00
Per Lundberg 11092e383c Added unconvertible property, just to be able to test it. 2013-06-05 11:28:11 +03:00
Per Lundberg 3e4119d742 Added a couple of properties, and made them (= special methods) be exempt from the methods bound to Javascript. Next set is to to try and bind them as Javascript properties. 2013-06-05 11:28:09 +03:00
anthony taranto 0079dd4501 move test logic into CefSharp.Example, run all example tests in wpf 2012-02-24 17:03:55 -08:00
anthony taranto 04be2df6e6 rename CefSharp.Example to CefSharp.WinFormsExample 2012-02-17 14:12:07 -08:00
fddima 94a99f2a0c Commit before merge. 2010-12-15 18:21:25 +02:00
fddima 0150d09a37 - Added ScriptException exception class.
- Fix ConvertToCef while method returns void.
- Add exception handling while converting arguments from cef.
- Add some tests, but it is not complete!
2010-12-15 15:33:23 +02:00
chillitom 24983d67ab rename CefTest directory to CefSharp.Example 2010-12-14 10:02:57 +00:00