Commit Graph

83 Commits

Author SHA1 Message Date
campersau aab6f9f80e Core - JavascriptCallbackProxy: don't dereference a released CefBrowser in the finalizer
The browser can be disposed on another thread between the IsDisposed check and
reading CefBrowserWrapper::Browser, which then returns a null CefRefPtr. The
finalizer dereferenced it and the NullReferenceException on the finalizer
thread terminated the process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 06:27:28 +10:00
John Hodnik f2b87feac3 Core - OnSelectClientCertificate own the copied certificate vector (#5281)
* Fix deferred client certificate selection reading freed memory

CefCertificateCallbackWrapper held the offered certificate list as
`const X509CertificateList&`, bound to a stack local built in
ClientAdapter::OnSelectClientCertificate. Once that handler returned the
list was destroyed, so calling Select() at any later point walked freed
memory and threw inside the thumbprint-matching loop, taking the host
process down with it.

CEF explicitly permits answering later. cef_request_handler.h says to
return true and call Select "either in this method or at a later time",
so a wrapper that outlives the handler has to own the list it selects
from. It now holds a heap-allocated copy, freed in the finalizer. A ref
class cannot contain a std::vector by value, hence the pointer. Copying
the vector copies the reference-counted CefX509Certificate pointers, and
those references are what keep the certificates alive.

This is the remaining half of #2948. The comment above the caller reads
"Create a copy of the vector in an attempt to fix #2948", and the copy is
indeed made - but it is then bound by reference, so it dies at the same
instant the original would have.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Remove the redundant certificate vector copy in ClientAdapter

The wrapper takes its own copy in its constructor, so the local copy added
by a51cdd37 in ClientAdapter::OnSelectClientCertificate is now pure
redundancy - two copies where one is needed. Pass `certificates` straight
through instead.

Also refreshes the comment on _certificateList, which described the caller's
stack local that this removes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: John Hodnik <jhodnik@activu.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 12:54:32 +10:00
Schuyler Tan 732afb1f66 Core - Add AddPreferenceObserver support. (#5279)
* Core - Add `AddPreferenceObserver` support.
2026-08-29 10:44:25 +10:00
campersau 7af206edbb Update cef references from bitbucket to github (#5278)
* Update reference from https://bitbucket.org/chromiumembedded/cef to  https://github.com/chromiumembedded/cef

* Apply suggestion from @campersau
2026-08-08 07:32:32 +10:00
Schuyler Tan 9f3be65def Core - Expose IsInterrupted and InterruptReason to DownloadItem. (#5266)
* Core -  Expose `IsInterrupted` and `InterruptReason` to DownloadItem.
2026-06-25 19:41:41 +10:00
Schuyler Tan 95d20a8265 Core - Support Chrome command execution. (#5257)
* Core - Support Chrome command execution.

- Add `Cef.MapChromeCommandNameToId`.
- Add `IBrowserHost.CanExecuteChromeCommand`
- Add `IBrowserHost.ExecuteChromeCommand`
2026-06-13 07:09:27 +10:00
Jozef Izso 5d48d8d909 Add the DownloadItem.IsPaused property
This wraps the `CefDownloadItem::IsPaused()` from CEF 144 release.
See the `cef.sdk\cef\include\cef_download_item.h` file.
2026-06-03 17:34:47 +10:00
Schuyler Tan b5fef3bb4b Core - Automatically merge enable-features/disable-features command-line arguments with existing values (#5245)
* Core - Automatically merge `enable-features/disable-features` command-line arguments with existing values
2026-05-18 20:34:14 +10:00
Alex Maitland 7b9e24db55 Core - Upgrade to stdcpp20 (#5215)
* Core - Upgrade to stdcpp20

- Set NOMINMAX
- Change compiler options
- Fix compiler errors

---------

Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
2026-02-21 14:48:13 +10:00
crnzgm 7245885570 Determine selected client certificate via thumbprint (#5187)
* Core - Determine certificate via thumbprint

Resolves #5185

* Remove obsolete TODO comment
2025-10-24 20:24:53 +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
amaitland 2ebad4d768 Upgrade to 131.2.3+g023a05b+chromium-131.0.6778.70 / Chromium 131.0.6778.70
- Add popupId to OnBeforePopup (API not mapped yet)
2024-11-18 06:12:35 +10:00
Mitch Capper (they, them) 3c23b4bdb1 SerializeV8SimpleObject support for ExpandoObjects (#4959)
fixes #4958
2024-10-26 10:15:53 +10:00
amaitland ab34cf161b Remove Alloy Bootstrap (M128) (continued)
- Fix netcore lib

Resolves #4795
2024-09-19 19:03:26 +10:00
amaitland 19739abd9c Remove Alloy Bootstrap (M128)
- Remove ChromeRuntime option
- Remove Extension Handling and related methods (no longer supported)
- Remove PackLoadingDisabled (no longer supported)
- Remove PersistUserPreferences (always on)

Resolves #4795
2024-09-18 17:53:17 +10:00
Alex Maitland ed6a98389f Upgrade to 126.1.14+g2be337f+chromium-126.0.6478.57 / Chromium 126.0.6478.57
- IDialogHandler.OnFileDialog add new extensions and descriptions arguments (Breaking Change)

Resolves #4838
2024-06-16 08:32:50 +10:00
Alex Maitland dc3ec6b382 Core - Basic ArrayBuffer support for EvaluateScriptAsync (#4632) 2024-05-09 11:23:26 +10:00
Scalibq f21a973671 Implement AcceleratedPaintInfo (#4796)
* Implement AcceleratedPaintInfo so the shared texture can be used for accelerated rendering in a custom IRenderHandler.

* Make AcceleratedPaintInfo members get-only properties, set via constructor.
Add XML comments, based on CEF.

---------

Co-authored-by: Dennis de Bruijn <d.de.bruijn@tss.nl>
2024-05-08 11:28:23 +10:00
Alex Maitland 0ab5d1a08b IDownloadHandler.OnBeforeDownload now returns boolean
Return true and execute callback either
asynchronously or in this method to continue or cancel the download.
Return false to proceed with default handling (cancel with Alloy style,
download shelf with Chrome style).
2024-05-06 10:28:35 +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 d3e7040ff5 Add IBrowser.GetAllFrames 2024-03-12 06:32:54 +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
Alex Maitland e329cdc1fb Core - Add IBrowserProcessHandler.OnAlreadyRunningAppRelaunch
Issue #4668
2024-01-13 13:28:32 +10:00
Alex Maitland 42c150406b Core - EvaluateScriptAsync no longer returns meaningful error messages
Resolves #4629
2023-11-25 06:17:50 +10:00
Alex Maitland d318c9b91a Upgrade to 115.3.7+ga8d552a+chromium-115.0.5790.40 / Chromium 115.0.5790.40 2023-07-16 11:29:18 +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 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 1460dee5a1 Core - ClientAdapter improve HasParent checks (#4443)
* Core - Improve ClientAdapter::GetBrowserWrapper logic

Simplify the logic

- For non popup return immediately (most common scenario)
- Check for IBrowser instance for matching popup
- Check for HasParent and return the browser Instance
- Return nullptr if no matching IBrowser wrapper found

* Core - ClientAdapter::OnFrameCreated called before OnAfterCreated

- The very first call to ClientAdapter::OnFrameCreated happens
  before OnAfterCreated leaving us with a IBrowser instance that's null
  Create an IBrowser instance that's scoped to the method call

* Core - ClientAdapter improve HasParent checks

- HasParent check has now been replaced with IsHostedBrowser
  which has additional check to make sure the internal
  IWebBrowser.Set* methods are only called for a IBrowser
  instance that's directly associated with a ChromiumWebBrowser instance
  This resolves issues with DevTools being opened for a popup hosted
  in a ChromiumWebBrowser instance.

Related discussion https://github.com/cefsharp/CefSharp/discussions/4438
2023-04-01 18:58:27 +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 17173587fe Core - Improve IBrowser.MainFrame and IBrowser.FocusedFrame null handling
- When CEF added CefFrameManager support the lifespan of a frame changed, it's now possible for MainFrame/FocusedFrame
  to be null when the browser is closed.

Issue #4368
2023-01-24 10:55:02 +10:00
Alex Maitland a51cdd3723 Core - OnSelectClientCertificate copy certificate vector
- Attempt to fix AccessViolationException by making a copy of
  the vector

Issue #2948
2023-01-17 10:22:59 +10:00
Alex Maitland c2edd111eb Core - Remove IRequestHandler.OnQuotaRequest
persistent quota is no longer supported (see https://crbug.com/1208141)

Resolves #4357
2023-01-08 11:53:54 +10:00
Alex Maitland 2e7dbef9ef Core - Update PdfPrintSettings
Resolves #4311
2022-11-21 15:10:19 +10:00
Alex Maitland 766ebbc8f6 Core - IFrame.IsMain remove ThrowIfFrameInvalid guard
- Calling IsMain on an invalid frame is allowable
2022-11-03 11:14:12 +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 a395b5d234 Core - Convert CefTime to CefBaseTime
- Interim step before replacing CefTime with CefBaseTime.

Issue #4234
2022-09-06 11:09:42 +10:00
Alex Maitland e064878d0a Core - CefValueWrapper add DebuggerDisplay 2022-08-19 11:07:05 +10:00
Alex Maitland 1ae9e01b41 Core - PermissionHandler followup
- Rename enums (remove cef prefix)
- Fix typos
- Slightly improve docs
2022-08-08 14:18:54 +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 30f9d8db2c Core - CefRunContextMenuCallbackWrapper use cef_event_flags_t as typedef was removed
- Change to use cef_event_flags_t
- Fix some xml doc

https://github.com/chromiumembedded/cef/commit/d9b764860aa0c1dfad58b123474bc133c4e43d39
2022-08-02 13:33:52 +10:00
Alex Maitland f8530064b1 Core - Add Cef.PostAction and Cef.PostDelayedAction 2022-06-22 10:52:17 +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 6c18e0e863 Update IDialogHandler.OnFileDialog method declaration
CEF is now using Chrome file dialogs on all platforms and runtimes, this brings a number of fixes and also some API changes.

- The selectedAcceptFilter filter arg has now been removed
- The CefFileDialogFlags enum has been removed as CEF no longer supports these options

This is a breaking change.

Issue #4110
2022-05-17 19:51:08 +10:00
Alex Maitland b4c4913b35 Core - Add IDownloadHandler.CanDownload
- Add IDownloadHandler.CanDownload
- Add to Fluent implementation
- Update examples

https://bitbucket.org/chromiumembedded/cef/commits/6d7a6801871cd4fcceb174dfa99a5b46da6253c1

Resolves #4090
2022-05-05 12:40:33 +10:00
Alex Maitland 0ac43cf69f Core - Remove Remaining Plugin APIs
- Remove plugin references
- Update xml doc comments
- Update ref assembly (netcore)
- Update examples

Issue #4045
2022-03-21 10:01:26 +10:00