Commit Graph

43 Commits

Author SHA1 Message Date
Alex Maitland d78d01a2c4 Core - Rewrite RenderProcess to avoid using OnBrowserDestroyed for JS eval (#5197)
- JavascriptCallbackRegistry - Get BrowserId From V8Context
- Render Process - Rewrite to store root object wrapper by frame instead of per browser
-  Don't store JavascriptRootObjectWrapper in the browserWrapper as CEF is calling destroyed more than it should.
-  Revert "Tests - Simplify ShouldFailWhenIsObjectCachedCalledWithInvalidObjectName"

This reverts commit f8a81acf7a.

---------

Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
2025-12-03 19:00:12 +10:00
Alex Maitland 2a9b50640f Core - Change from cef type defs to C++11 defs
https://bitbucket.org/chromiumembedded/cef/commits/5042d7140822cd13b80990f61ce2d3865864a3d8
2023-07-16 09:31:55 +10:00
Alex Maitland e3e4c3fe35 BrowserSubprocess - Namespace cleanup
Possibly a few cases that were missed, this should be the bulk of the rename

Resolves #3253
2021-02-27 14:40:16 +10:00
amaitland e8cf336bf3 Net Core - Support for compiling with .Net Core 3.1
- 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
2020-07-23 15:23:45 +10:00
amaitland 7da18cae4c JavascriptRootObjectWrapper/RegisterBoundObjectRegistry - Make last callback Id static
We make it static so it's unique across the process so long running callbacks

Issue #2792
2019-06-01 09:00: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
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
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
illfang 0ddfd1cb21 added a flag indicating if the root object has already been bound 2015-10-28 20:32:12 +09:00
amaitland b9ee476e8e Fix up some of the vc++ include mess that we had going
Cleanup using namespace statements as well
2015-09-29 16:26:06 +10:00
amaitland b236d7711c Restructure code so JavascriptRootObject's are stored and can be used across multiple CefBrowserWrapper instances (popups in this context)
Code is now very much dependant on using --process-per-tab for this structure to work
2015-09-24 18:44:30 +10:00
amaitland fc58a7db32 Cleanup some compiler warnings by making classes private
Remove unused using statements
2015-08-07 13:21:09 +10:00
amaitland 52f5ac5302 Formatting, make class private 2015-08-03 10:37:09 +10:00
cefsharp-ms 0b300d5dda Merged master 2015-07-31 17:41:00 +02:00
cefsharp-ms 0333437917 fixed tabs again 2015-07-31 17:30:07 +02:00
cefsharp-ms c395f03ba2 jscallbackregistry lifecycle is managed by javascriptrootobjectwrapper, async methods too bound by javascriptrootobjectwrapper 2015-07-31 17:26:59 +02:00
amaitland 3d19b3a587 Cleanup Binding, rather than keep references to the V8 objects, just use them and then let them be released
Code should be a little easier to debug now.
2015-07-28 22:22:30 +10:00
amaitland a695cc9801 Explicitly Delete(dispose) CallbackRegistry so that it's unmanaged resources are freed ASAP 2015-07-16 13:44:03 +10:00
amaitland 7b49b479d0 Remove TODO - the field is still used 2015-07-09 11:02:59 +10:00
amaitland 1f74357e40 Going forward constructors/destructors/finalizers all go in the headers 2015-07-09 10:55:12 +10:00
rassilon 431cb511c3 * Move unmanged objects into finalizer and call finalizer from Dispose.
* Remove DisposableResources from ManagedCefBrowserAdapter
* Improve disposing of CefRequestWrapper
* Have callbacks dispose themselves.
* Allow the Application exit handler shutdown CEF from the Winforms example application.
2015-06-13 10:42:33 -04:00
Bill Tutt dcd56c27eb Add some descriptive comments about what some of the subprocess classes do. 2015-05-02 02:36:10 -04:00
rassilon 7128e40fd1 It's time for copyright updates again. Yay!
Throw in a couple of tab containing files for good measure.
Evil tabs, evil I say.
2015-04-25 02:45:21 -04:00
David Serfozo bb4fe467b8 added JavascriptCallbackRegistry and wired up 2015-03-08 13:11:09 +01:00
David Serfozo 75d8a206e6 moved JavascriptRootObjectWrapper impl to separate cpp 2015-03-08 12:57:51 +01:00
BinSys 5af020afcc change c++ file copyright symbol (©) from 0xa9(cp1252) to 0xc2 0xa9(cp65001 with bom) ,
now work on non-english system().
2015-01-10 02:40:23 +08:00
BinSys 3f954dfb0b Revert "change c++ file copyright symbol (©) from 0xa9(cp1252) to 0xc2 0xa9(cp65001 without bom) ,"
This reverts commit defd040dcc.
2015-01-10 02:22:19 +08:00
BinSys defd040dcc change c++ file copyright symbol (©) from 0xa9(cp1252) to 0xc2 0xa9(cp65001 without bom) ,
now work on non-english system().
2015-01-06 22:23:30 +08:00
amaitland b893d9ad00 Merge branch 'memleak' of https://github.com/Octopus-ITSM/CefSharp into fix/jsb-memoryleak 2014-12-04 13:34:53 +10:00
amaitland ab79aa8ca6 Remove redundant #include statements
Fix incorrect #include statements
2014-11-27 23:24:00 +10:00
Sylvain Hamel fe63ff340e memleak : show problem 2014-11-25 09:34:15 -05:00
Sylvain Hamel 678f45835c CefRenderProcess process creates too many channels (and does not close them) 2014-11-11 09:06:52 -05:00
amaitland d90cf0af3f Continue to implement object cleanup 2014-09-16 16:34:07 +10:00
amaitland 00b6fc683b Pass a delegate to Create the WCF proxy through the layers of JS binding objects 2014-09-16 13:21:04 +10:00
amaitland c5176d1bd1 Move creation of V8Object from JavascriptRootObjectWrapper to JavascriptObjectWrapper
Not working yet as having some c++ include issues
2014-08-28 20:19:13 +10:00
amaitland e6b26a07ac Create a property for each member object 2014-08-28 19:22:06 +10:00
amaitland ff1c849559 Create missing root v8object 2014-08-28 19:02:03 +10:00
amaitland 27c5af40d6 Set V8Value (was having managed point problems before) 2014-08-28 18:30:28 +10:00
amaitland 3137911ed2 Add in NotImplementedException's as place holders for next stage of work 2014-08-28 17:19:37 +10:00
amaitland 95dd79d778 Still having issues getting to compile - this is a WIP checking to help troubleshoot 2014-08-28 16:01:28 +10:00
amaitland 0130fa427d Make wrapper objects contain references to the Properties/Methods they represent 2014-08-28 15:48:16 +10:00
amaitland d0dc5d9409 Create JavascriptRootObjectWrapper class to simplify back end binding 2014-08-28 14:57:08 +10:00