Commit Graph

543 Commits

Author SHA1 Message Date
amaitland 11338dda42 Add more xunit tests 2025-10-11 11:39:34 +10:00
Alex Maitland d613e2c232 Apply suggestions from code review
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
2025-10-11 11:39:34 +10:00
Alex Maitland 34a5fb50a9 JSB - Add optional command line cache config 2025-10-11 11:39:34 +10:00
Alex Maitland f964bbc08e Legacy and PerBrowser implementations 2025-10-11 11:39:34 +10:00
campersau 331ee6a305 Core - Cancel pending tasks when browser crashed or v8 context gets released (#5145)
* Core - Cancel pending tasks when browser crashed or v8 context gets released

* Use TrySetCanceled to cancel pending tasks

* Adjust test to use chrome://crash for simulating a crash

* Add tests for javascript callbacks

* Rename tests and add tests for calling Execute multiple times

* Move FramePendingTaskRepository to its own file

* Rename test to ShouldCancelAfterV8ContextChange

* Fix compile error on .NET Framework

* adjust ShouldTimeoutIfNavigationOccurs test which now throws a TaskCanceledException on navigation
2025-08-22 12:14:38 +10:00
Alex Maitland 3a749c0bf2 Javascript Binding - Add Url to JavascriptBindingEventArgs (#5021)
Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
2025-02-01 06:47:42 +10:00
campersau 4757ee6f6c Avoid ObjectDisposedException when host got disposed (#5003) 2024-12-22 13:28:18 +10:00
Alex Maitland 57f8cd344f Core - Change Cef.IsInitialized from bool to bool? (#4869)
Resolves #4867
2024-08-14 17:19:34 +10:00
Alex Maitland 635eedb58f Upgrade to 124.3.1+g6d871a1+chromium-124.0.6367.60 / Chromium 124.0.6367.60 2024-05-03 18:45:50 +10:00
Alex Maitland 8d7a169590 Change Frame identifier from Int64 to String (#4740)
* Change Frame identifier from Int64 to String

Issue https://github.com/cefsharp/CefSharp/issues/4737

* Fix SetCanExecuteJavascriptOnMainFrame frameId parsing

* Add tests

* NetCore Tests - Install missing packages
2024-03-09 06:55:27 +10:00
campersau 56c9f3cd28 Start timer after initialization (#4654) 2023-12-16 10:58:43 +10:00
Alex Maitland 1def8a7937 Upgrade to .Net 4.6.2 (#4482)
* Upgrade minimum .Net version to 4.6.2

#4433

* Use TaskCreationOptions.RunContinuationsAsynchronously

- Now that min version is .Net 4.6.2 we can use RunContinuationsAsynchronously
- Remove some unused code
2023-06-10 07:33:20 +10:00
Alex Maitland 3ce76eb191 CEF Issue Tracker moved to GitHub
- Update some of the internal links

Issue #4430
2023-03-24 10:52:58 +10:00
Alex Maitland fb779a5b46 Core - Move DevTools Client from CefSharp.dll to CefSharp.Core.dll
- Moves the Dependency of System.Text.Json from CefSharp.dll
  BrowserSubProcess as a result no longer has a reference
  where wasn't required for it's operation.

Resolves #4428 #4427
2023-03-14 14:05:48 +10:00
Alex Maitland a4db645e5b Core - Xml Doc fixes 2023-03-12 11:09:48 +10:00
Alex Maitland 0f99d4f945 Core - Migrate from CefTime to CefBaseTime (Support dates less than Windows Epoch)
- DateTime won't work for anything less than Windows Epoch so we have to manually
  handle those dates.

Issues #4234
2022-10-16 13:29:19 +10:00
Alex Maitland 9db6bec21b Core - Migrate from CefTime to CefBaseTime (Add custom conversion support)
- Add new IBaseTimeConverter interface to allow for custom conversion of DateTime to/from CefBaseTime
- Add some CefTimeUtils tests

Issues #4234 #4272
2022-10-16 11:51:04 +10:00
Alex Maitland 9dc158693d Core - Migrate from CefTime to CefBaseTime (MaxValue handling)
- Validate large dates and return DateTime.MaxValue if greater than allowable DateTime

Issue #4272
2022-10-14 11:57:50 +10:00
Alex Maitland f84f3986cf Test - Tweaks to browser ref count logging 2022-10-04 14:17:36 +10:00
Alex Maitland a12023a449 Test - Add additional logging to hopefully find the test that's keeping a browser ref count alive 2022-09-21 10:45:17 +10:00
Alex Maitland b150993d67 CefSharp.Dom - Don't Dispose DevToolsContext
Disposing of the DevToolsContext is causing problems currently as sending the DevTools protocol messages
to the browser is happening after the CefBrowserHost instance has been Disposed.

A separate method of disposing of the DevToolsContext will need to be added that does a cleanup
without sending the commands.

Issue https://github.com/cefsharp/CefSharp.Dom/issues/41
2022-09-12 11:03:09 +10:00
Alex Maitland beca2863a8 Core - Migrate from CefTime to CefBaseTime (CookieManger Tests)
- Add basic xUnit test
- Don't set Creation/LastAccess on cookie creation, these are set internally in Chromium
  and are left uninitialized until the cookie is read back from the browser

I haven't tested though I suspect Cookie.Expiry was incorrectly set when Local/Unspecified DateTime was used
cookies are always in GMT

Issue #4234
2022-09-07 10:56:29 +10:00
Alex Maitland 416ed308c2 Core - Migrate from CefTime to CefBaseTime (Execution/Binding)
- Convert more of the methods used by JavaScript binding/execution
- Fix naming of FromDateTimeToBaseTime

Issue #4234
2022-09-06 19:39:43 +10:00
Alex Maitland 1a8c7cf09e Core - Migrate from CefTime to CefBaseTime (CefCookie)
- Add new method for conversion from DateTime to CefBaseTime
- Change Cookie.SetCreationDate and Cookie.SetLastAccessDate to take Long

Issue #4234
2022-09-06 15:03:36 +10:00
Alex Maitland 5f73ce568b Core - Migrate from CefTime to CefBaseTime (CefNavigationEntry)
- Add new method to convert from CefBaseTime to DateTime

Issue #4234
2022-09-06 14:21:11 +10:00
Alex Maitland 4d78c70793 Core - Migrate from CefTime to CefBaseTime (CefDownloadItem)
- Add new method to convert from CefBaseTime to nullable DateTime

Issue #4234
2022-09-06 14:11:45 +10:00
Alex Maitland b97dae0b61 Core - Merge DateTimeUtils into CefTimeUtils
Issue #4234
2022-09-06 13:50:25 +10:00
Alex Maitland 2ead423380 Core - Improve JavascriptObjectRepository.TryCallMethod Object Not Found error message
- Add method name and param count

Resolves #4209
2022-08-21 13:44:34 +10:00
Алексей f92687b7cc Core - Add support PermissonHandler
https://bitbucket.org/chromiumembedded/cef/issues/3352/add-cefpermissionhandler-callback-for-the
2022-08-08 13:59:32 +10:00
Alex Maitland ad464d34b2 Core - CefThread better error handling for queued execution 2022-06-23 10:21:38 +10:00
Alex Maitland 88762cbe33 Core - Add CefThread.ExecuteOnUiThread(Action action)
- DevToolsClient now uses this overload
2022-06-22 11:01:46 +10:00
Alex Maitland fdec627537 Core - Xml doc fixes 2022-06-20 16:28:04 +10:00
Alex Maitland 15cb6d4754 Core - BrowserRefCount add some basic logging
Logs some basic information so we can see what type of ChromiumWebBrowser hasn't been closed
within as part of the xUnit tests.

* Meant for internal use and might be subject to change.
2022-05-31 15:43:34 +10:00
Alex Maitland cbbd57e435 Core - Fix some exception messages 2022-05-31 11:05:03 +10:00
Alex Maitland b8b27f6885 WPF/OffScreen - Add WaitForRenderIdleAsync (#4080)
* WPF/OffScreen - Add WaitForRenderIdleAsync

- Task resolves when render has been idle for the specified time
- Make TaskTimeoutExtensions public (they're not extension methods as this was expected)
2022-05-30 19:11:17 +10:00
Alex Maitland 83c8e009d9 DevTools - Add IWebBrowserInternal.DevToolsContext
- For use with next version of CefSharp.Puppeteer
2022-05-30 14:20:22 +10:00
Alex Maitland f201c694c6 WinForms - Add CaptureScreenshotAsync
- Simplification of calling the DevTools method
- Moved GetContentSizeAsync from OffScreen into partial class (now accessible from WinForms/WPF/OffScreen).
- Added menu option

Resolves #4081
2022-05-03 11:29:11 +10:00
Alex Maitland 59e0b1afdc Enhancement - Add WaitForNavigationAsync
- Add new WaitForNavigationAsync method
- Change LoadUrlAsync to return CefErrorCode.Failed for HttpStatusCode = -1 (better represents there was an error)

Example:
var navigationTask = browser.WaitForNavigationAsync();
var evaluateTask = browser.EvaluateScriptAsync($"window.location.href = '{expected}';");
await Task.WhenAll(navigationTask, evaluateTask);
var navigationResponse = navigationTask.Result;

Resolves #4073
2022-04-27 11:02:45 +10:00
Alex Maitland 3d39238a93 Core - Code cleanup
- Make more classes sealed
- Add xml doc
- Add serializable constructor
2022-02-22 11:33:18 +10:00
Santosh M Ghanti 9e0236876c Sync Javascript Binding - Add support for property interception (#3935)
* Core - added support for property interceptor

* Incorporated the review comments

* Incorporated the review comments 2

* Review comments exclude trygetproperty and trysetproperty for .netcore app

* Added the unit test cases for trygetproperty and trysetproperty

* Fixed .net core app build failure

* Added the separate test case for property interceptor

Co-authored-by: sghanti <santosh_ghanti@intuit.com>
2022-02-14 13:58:35 +10:00
Alex Maitland 3b1c46aab9 Code Cleanup - Minor code cleanup
- Add Microsoft.CodeAnalysis.NetAnalyzers package
- Make some classes sealed
- Fix/Add xml doc
2022-02-01 14:07:01 +10:00
Alex Maitland cd225bc169 Async JavascriptBinding - Return null instead of empty object for async Task methods
Resolves #3980
2022-01-27 17:37:49 +10:00
Alex Maitland 8b247a6a37 Javascript Binding - IJavascriptCallbackProxy.ExecuteAsync correctly creates pending task using callback Id
- Previously a new PendingTask(TaskCompletionSource) was created using a new Id which worked when the Ids matched
  between the browser and render process. If you skipped executing a callback then the Ids would get out of sync.

Issue #3979
2022-01-27 16:03:22 +10:00
Alex Maitland d0c9adcf9d Core - Add TryGetBrowserCoreById
- Can be used to obtain an IBrowser reference by Browser Identifier (Id).
- Added a couple of basic unit tests.
2022-01-05 10:47:48 +10:00
Alex Maitland b72d41353e WinForms - Improve hosting of popups using ChromiumHostControl
- Add IChromiumWebBrowserBase which is can be used for ChromiumWebBrowser instances and ChromiumHostControl
- Reduce code duplication for extensions methods
- Update WinForms Example
2021-11-30 13:47:42 +10:00
Alex Maitland a7aea1821e Core - WaitForInitialLoadAsync set to Cancelled if control is Disposed 2021-11-01 13:27:09 +10:00
Alex Maitland 4112340e48 Core - LoadUrlAsync require url and remove SyncContext param
- Remove url optional null, a Url is now required and an exception will be
  thrown if null or empty. If the browser wasn't loading an null was passed
  in then the task would have never resolved. This provides a predictable behaviour.
  A new WaitForInitialLoadAsync method was added to simplify waiting for initial
  browser load.
- Remove SynchronizationContext param, best to let the framework handle

Issue #3842
2021-10-28 10:51:18 +10:00
Alex Maitland 4a07af26e9 Core - Rename WaitForBrowserInitialLoadAsync to WaitForInitialLoadAsync and simplify
- Initial intention was to have a reusable method that could be used CefSharp.Wpf.HwndHost,
  upon further deliberation I've decided to build the functionality into the ChromiumWebBrowser.Partial.cs
  and will need to duplicate the functionality in CefSharp.Wpf.HwndHost. This guarantees that the
  Task will be resolved in all cases. The previous implementation there was a theoretical change we'd
  miss subscribing to the relevant events
- Remove CancellationToken as it's not possible to cancel

Issue #3842
2021-10-28 10:31:03 +10:00
Alex Maitland 91b7514a1c WinForms/WPF/OffScreen - Add WaitForBrowserInitialLoadAsync
Second attempt at WaitForBrowserInitialLoadAsync, includes optional
CancellationToken param.

Issue #3842
2021-10-27 13:58:57 +10:00
Alex Maitland 9993aa78e0 OffScreen - Create Browser when Global CefRequestContext initialized.
- GlobalContextInitialized wraps a TaskCompletionSource which is resolved
  when the Global CefRequestContext has been created
- Reduce code duplication

If successful we can apply the same changes to WinForms/WPF though they're less likely to have
issues than the OffScreen implementation as the CreateBrowser doesn't happen until much later

Issue #3850 #3634
2021-10-26 14:31:10 +10:00