Commit Graph

124 Commits

Author SHA1 Message Date
amaitland c724e3da65 LegacyJavascriptBinding - Enabled field was overwritten when a popup was opened
Popups don't transmit their own bound object information, _legacyBindingEnabled was being set to false
2019-08-11 18:29:40 +10:00
amaitland 85a01973af CefAppUnmanagedWrapper - Minor refactor in kJavascriptRootObjectResponse and kJavascriptAsyncMethodCallResponse
kJavascriptRootObjectResponse - delete the callback when not used
kJavascriptAsyncMethodCallResponse - Only execute if we have a valid frame
2019-07-20 18:28:36 +10:00
amaitland f6edbd5ad8 CefSharp.BindObjectAsync - Split out into it's own Handler
- Add BindObjectAsyncHandler
- Remove unneeded params from RegisterBoundObjectHandler
2019-07-08 20:14:52 +10:00
amaitland e0268a3e2a Network Service - Register custom scheme in all process types
The network services requires that custom schemes be registered, previously we only registered them in render processes.

Add SubProcessApp to handle scheme registration
CefAppUnmanagedWrapper inherits SubProcessApp now

#2743
2019-07-04 20:47:42 +10:00
amaitland 088c3d02f4 ISchemeRegistrar - Change AddCustomScheme to use SchemeOptions enum
- Add new SchemeOptions enum
- Change AddCustomScheme to use new enum (replaces all the bool params)
- Simplify command line arg processing, now sends scheme name and int (options)
- Add CefCustomScheme.IsFetchEnabled

Resolves #2690

Breaking Change
2019-07-02 20:50:09 +10:00
amaitland ff87529a49 Javascript Legacy Binding - Pass objects on CefBrowserHost::CreateBrowser
Previously objects were sent in OnRenderViewReady, which is only called once for a browser instance, not for process switches
Now objects are passed when the browser is created, still need to check for popup handling
2019-06-25 19:24:57 +10:00
amaitland 0542c5138b SendProcessMessage - Remove frame/browserid from messages
Not complete or tested yet
2019-06-25 19:24:57 +10:00
amaitland 73a156fdc5 Initial version 75 upgrade and NetworkService changes
Compiles, that's about it at this point, there are major CEF breaking changes, and lots to be addressed.

Browser Process (main process)
- Removed IResourceHandlerFactory as it no longer fits with the structure that CEF provides
- New IResourceRequestHandler interface added, not plumbed in yet
- CefSettings - Add RootCachePath and ApplicationClientIdForFileScanning

BrowserSubprocess (render process)
- SendProcessMessage was moved from CefBrowser to CefFrame
- OnBrowserCreated added extraInfo param

The BrowserSubprocess changes for this upgrade should be complete
2019-06-25 19:24:57 +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 78fe342988 Javascript CallbackRegistry FindWrapper - Improve error message when no wrapper found 2019-04-26 12:03:32 +10:00
Alex Maitland 70de3a6d9c Add Initial IRenderProcessHandler.OnContextCreated/Released implementation (#2697)
* WinForms/WPF - Dispose of IFrame after calling LoadUrl

* BrowserProcess - Add initial implementation of IRenderProcessHandler.OnContextCreated/OnContextReleased

- IV8Context.Execute is the only method to be implemented so far (execute script without returning a result)
- Wrappers for CefFrame and CefBrowser have yet to be imported yet, still need to determine if they should be included individually or reference to CefSharp.Core added

* BrowserProcess - Add wrappers for Browser and Frame

Ultimately we should probably remove the CefSharp.BrowserSubprocess.Core project and move all the code into a folder/namespace within CefSharp.Core
This would allow us to share the a lot of existing code, major refactor required

* CefSharp.Common.props - Add CefSharpBrowserProcessCore32/64 properties

Make creating your own custom browser process easier

* BrowserProcess - Remove example and add comments about creating your own custom version
2019-03-20 20:33:10 +10:00
amaitland 111439c98e CefSchemeRegistrar->AddCustomScheme - signature changed
https://bitbucket.org/chromiumembedded/cef/commits/cbcbd02638e5b4ccc26bab4a4b45b527c687068b?at=3683

Temp workaround until #2690 is implemented
2019-03-15 21:13:21 +10:00
amaitland 11a8371e19 Rename CefExtension to V8Extension
Resolves #2612
2018-12-27 15:47:29 +10:00
amaitland 19a56bd7f9 CefAppUnmanagedWrapper::OnContextCreated - Fixed up merge mistake
IPC message was only sent for main frame

Follow up #2373
2018-10-28 16:52:21 +10:00
Alex Sukhovy 304a300b0c Call OnContextCreated and OnContextReleased for each frame (#2373)
* ContextEvents for each frame

* set CanExecuteJavascriptOnMainFrame

* example and comments

* whitespace fix

* comments

* whitespace

* update comments
2018-10-28 16:48:50 +10: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 7450d0d51b JSB - Remove use of CefRegisterExtension and change Promise creator to an anon function
Use CefV8Context::Eval to create the promise using an anonymous function

Attempt to resolve #2432 (though it actually seems upgrading to a newer version resolves the underlying problem)
2018-08-27 13:12:55 +10:00
amaitland 38bc2d8365 CefAppUnmanagedWrapper::OnContextCreated - Send OnContextCreated message after Objects created
Message is now sent once the CefSharp.BindObjectAsync and helper functions are created and Legacy objects
are bound.

It should now be reliable to call CefSharp.BindObjectAsync in OnContextCreated
2018-08-05 19:56:41 +10:00
amaitland ddb2fdcbbc CefAppUnmanagedWrapper - Add comment about mapping layer so code isn't duplicated to handle camel casing of object names 2018-05-15 15:52:31 +10:00
amaitland 8f7692ae6e JSB - Add JavascriptBindingCompleteEventArgs and config options to CefSharp.BindObjectAsync
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
2018-04-27 16:40:39 +10:00
amaitland f6e58283a6 LegacyBinding - Remove objects from cache if key already exists
Temp fix for #2301 Will be resolved properly in #2306
2018-04-20 10:45:52 +10:00
João Neves 5a713fdf7d Support uncaught exception handling (#2244)
* Added support for uncaught javascript exception in Render Process Message Handler
* Fixed typo
* Added stack frame column numbers
* Code review
* Code review
* Update JavascriptException.cs
2018-03-07 10:21:31 +10:00
amaitland 1b00c277b8 JSB Add Caching
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
2018-01-30 10:16:28 +10:00
amaitland 934cd70ed6 JSB BindObjectAsync return response object
Can now return additional properties, still need better error handling
2018-01-29 09:45:24 +10:00
amaitland fd64b079a2 IJavascriptObjectRepository.ObjectBoundInJavascript - Fix bug and add example 2018-01-22 12:19:51 +10:00
amaitland 7c699e3ec6 IJavascriptObjectRepositry - Add ObjectBoundInJavascript event
Executed on the thread pool when objects are bound in JS
2018-01-22 12:19:43 +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 7e2594d2e3 Added CefCustomScheme.IsCspBypassing
Resolves #2038
2017-08-29 18:00:36 +02:00
amaitland 5b472f7258 Upgrade version numbers to 58 - this is for development purposes only, there is no planned 58 version, next version is 59
Upgrade to CEF 3.3029.1611.g44e39a8 / Chromium 58.0.3029.81
2017-05-05 10:46:54 +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
amaitland e5ecfde20f Upgrade version number to 57.0.0
Upgrade to cef.redist.x86.3.2987.1591
CefSchemeRegistrar::AddCustomScheme has new params - IsSecure and IsCorsEnabled
Also new CefRawPtr type is used for Scheme registra
2017-03-13 10:58:03 +10:00
amaitland 5d459a5d32 Add IRenderProcessMessageHandler.OnContextReleased - native IPC message sent from render process 2017-03-07 09:23:10 +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 f2050a0861 Add scriptUrl and startLine to EvaluateScriptAsync 2016-12-02 06:10:40 +10:00
amaitland 80d6a023df Upgrade to 3.2883.1539 2016-12-01 22:56:06 +10:00
amaitland bdb37881c5 Check extraInfo list for null in OnRenderThreadCreated - one of the suggestions from #1801 (no way to reproduce the problem) 2016-09-25 20:47:23 +10:00
amaitland 4059c76bcf Add cef_logging.h include as CI server seems to be having a problem after upgrading to newer version of CEF 2016-05-30 08:59:13 +10:00
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
Rich McNeary a27a097df6 Change from EnableFocusedNodeChanged to FocusedNodeChangedEnabled to match the existing WindowlessRenderingEnabled setting property. 2016-01-05 07:30:23 -05:00
amaitland c18f951a97 Move OnContextCreated from IRequestHandler to IRenderProcessMessageHandler
Manually resolve some merge conflicts
2015-12-09 11:32:24 +10:00
amaitland af02212217 Merge branch 'feature/oncontextcreated' of https://github.com/amaitland/CefSharp 2015-12-09 11:26:07 +10:00
Rich McNeary 443804084e Changed to specifically request FocusNodeChanged messages. 2015-12-08 09:04:22 -05:00
Rich McNeary 1fb54241f7 Add the OptionalMessages property to CefSettings. 2015-12-07 16:27:17 -05:00
Rich McNeary 5323818d7b Fix comment. 2015-12-07 10:54:20 -05:00
Rich McNeary ae49a5385b Fix: tabs to spaces, if and for braces, use frame ID. 2015-12-07 09:48:57 -05:00
Rich McNeary 1ecf2d57b0 Initial implementation complete.
Add support for when an element node in the DOM gets focus. Also invoked
when focus passes from an element node to an non-element node or
nothing.
2015-12-04 16:01:26 -05:00
Rich McNeary ce79f71275 When OnFocusedNodeChanged data is passed from render to browser process. 2015-12-03 15:59:27 -05:00
amaitland 8cd491562d Reorder params for SetInt64, SetJsCallback and SetCefTime - they're not in a logical order 2015-12-02 19:20:54 +10:00
amaitland 6f272833fb Add IRequestHandler.OnContextCreated handler
Send an IPC message when OnContextCreated is called in the render process
Currently only called for the main frame
Should be possible to hook the DOMContentLoaded event
2015-12-02 19:04:19 +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