Commit Graph

29 Commits

Author SHA1 Message Date
amaitland ae41e10d71 Core - Javascript Binding Configure Property Name
- Rename settings object to JavascriptBindingSettings
- Validate JavascriptBindingSettings.JsBindingGlobalObjectName in setter to provide immediate
  feedback
- Add FreezableBase which throws exception when frozen (we can reuse this for some other settings classes)
- Add some basic Unit Tests (More would be better)

Follow on from #3126
2020-05-30 19:28:50 +10:00
amaitland 2b47cf56ce Core - Make ResourceHandler.GetMimeType obsolete
Instead use Cef.GetMimeType to use the Chromium MimeType Mappings

Rather than maintain our own mapping (which is out of date) we'll defer to Chromium.

Make ResourceHandler.FromString(string, string) and ResourceHandler.GetMimeType obsolete, they will be removed at some point
ResourceHandler.FromString uses ResourceHandler.GetMimeType internally, Replacing with ResourceHandler.FromString(resource, mimeType: Cef.GetMimeType(extension));
uses a different overload.

Issue #3041
2020-03-26 08:50:08 +10:00
amaitland 344a9297dd Examples - Update ResourceHandler.GetMimeType to Cef.GetMimeType
Transition away from our incomplete implementation to using the Chromium mapping

Issue #3041
2020-03-26 08:50:07 +10:00
amaitland 6da0e9ca74 Example - Demo loading Png
https://cefsharp.example/logo.png
2019-09-20 20:38:06 +10:00
Alex Maitland fe98124c9b Async JavascriptBinding - Add support for returning Task (#2771)
* Async JavascriptBinding - Add support for returning Task

Remove Parallel Task execution code from MethodRunnerQueue
Add ParallelMethodRunnerQueue
  - For the new code path the Func is executed, if the Result is a generic Task we wait for it's completion
  - If the task is not generic then we return immediately

This is only enabled when CefSharpSettings.ConcurrentTaskExecution = true;
* MethodRunnerQueue - Display error message when method returns Task
* ParallelMethodRunnerQueue - Rename to ConcurrentMethodRunnerQueue
* MethodRunnerQueue - Improve formatting of error message when method returns Task
* Async JavascriptBinding Return Task - Add Basic xUnit Test

Very quick test, needs to be refined a little. The basics are working as expected.

* Add Binding Test Async Task Example to the WPF Example menu

* Async JSB Task - Add additional tests and improve error messaging
2019-06-08 17:21:49 +10:00
Alex Maitland 1a2c8ffcb6 Add CefSharp.PostMessage (#2799)
- JavascriptMessageReceived event added to ChromiumWebBrowser/IWebBrowser
- CefSharp.PostMessage and cefSharp.postMessage added to V8Context on creation for use in Javascript
- Add PostMessageTest.html
2019-06-03 21:08:03 +10:00
amaitland 335c884b08 Javascript Callback - Add additional tests
Add Basic tests, still need some more work.
Test changes added in #2748
2019-04-26 14:17:58 +10:00
João Neves 6692749728 WPF - Implement UpdateDragCursor (#2691)
* Close cefsharp subprocess if main process dies

* Implemented UpdateDragCursor

* Fixed braces position

* Added license header

* Fixed cursor flickering

* Added test

* Fixed build

* Fixed move cursor

* Fixed braces

* Simplified solution

* Fixed dropping Link effect

* Fixed encoding + Removed leftovers
2019-04-05 11:58:27 +10:00
Chris 30ee538ce0 Added EditorConfig (#2514) 2018-09-17 00:46:21 +02:00
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
amaitland 7f3a31b758 CefSharpSchemeHandlerFactory - Add example of new ResourceHandler.FromFilePath autoDisposeStream param 2018-05-17 16:51:57 +10:00
amaitland 4b4e568f7d Add BindingTestSingle.html
Simple test page that can be used to test cases in isolation (useful for debugging purposes)
2018-03-05 14:02:59 +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
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