17 Commits

Author SHA1 Message Date
Alex Maitland 44fdfa94c8 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 11:33:09 +10:00
amaitland 0067d02360 Add UnicodeExamples one equal to 32kb (the default buffer size) and one slightly greater.
Change CefSharpSchemeHandlerFactory to always include a BOM (premable) to the front of the response data
2017-05-05 13:06:26 +10:00
amaitland 6ded700373 Add Recaptcha test - https://cefsharp.com/Recaptcha.html 2017-03-30 07:55:47 +10:00
amaitland 760d81dc23 Change PostDataAjaxTest.html to use https scheme and add CrossOriginWhilstList entry (AJAX post data for custom schemes stopped working ages ago, this just works around the problem). 2017-03-06 08:55:08 +10:00
amaitland d3e5249b9f Move most of the logic from CefSharpSchemeHandler into CefSharpSchemeHandlerFactory and use the ResourceHandler.FromStream/FromString methods instead
People keep implement IResourceHandler directly, so update the examples in hopes they use the build in methods
2017-03-06 08:55:08 +10:00
Chris cd934267c6 Updated copyright year and made sure it used same format everywhere (#1966) 2017-03-06 08:44:37 +10:00
amaitland 04d2a8ede8 Add ResourceHandler.FromFilePath method that takes in a MimeType
Make ResourceHandler.FromFileName obsolete
2016-06-16 15:16:30 +10:00
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
amaitland ad9f7c70ac Add IPluginHandler.OnBeforePluginLoad
Can now be used through the RequestContext
Add Example to WPF application
2015-10-12 15:32:10 +10:00
amaitland 561b50b2cd Register the same scheme twice to confirm parsing of command line arguments
Fix up some urls in the custom scheme popup test
Add PopupTest.html to WPF example menu
2015-09-16 09:05:52 +10:00
amaitland 7498c65741 Add copyright to CefSharp.Example 2015-08-03 10:41:29 +10:00
amaitland 1d197795ab Using debug.log turns out to be an infinite loop, so change to using CefSharp.Core.xml as an example 2015-07-29 20:59:34 +10:00
amaitland abb06171b6 Add basic example of reading the Debug.log file from disk and add option to use ResourceHandler in a SchemeHandlerFactory
(Means that ISchemeHandler had to be removed - which is an unfortunate breaking change, better to be done now though)
2015-07-29 20:55:28 +10:00
amaitland bbaa58faed Expand ISchemeHandlerFactory to pass in browser, frame, schemeName and request 2015-06-05 13:40:27 +10:00
Per Lundberg f299441e00 Whitespace fix. 2013-10-27 10:54:20 +02:00
Per Lundberg 352467dbdc Changed the name of the custom scheme to "custom" again, in an attempt to put something useful in the "host" portion of the URI. 2013-10-27 10:53:59 +02:00
Per Lundberg 7d2854d9c3 Renamed the scheme handler classes to be a slightly better example of class naming... 2013-09-18 22:05:30 +03:00