Skip to content

Add RequestContext.ClearHttpCache() and DownloadItem.IsPaused from CEF SDK 144#5259

Merged
amaitland merged 2 commits into
cefsharp:masterfrom
jozefizso:cef_sdk_144_api
Jun 3, 2026
Merged

Add RequestContext.ClearHttpCache() and DownloadItem.IsPaused from CEF SDK 144#5259
amaitland merged 2 commits into
cefsharp:masterfrom
jozefizso:cef_sdk_144_api

Conversation

@jozefizso
Copy link
Copy Markdown
Contributor

@jozefizso jozefizso commented Jun 1, 2026

Summary:

  • IRequestContext.ClearHttpCache() wraps the CefRequestContext::ClearHttpCache() method, allowing callers to clear the HTTP cache for a given request context.
  • DownloadItem.IsPaused exposes the pause state of the downloaded item via CefDownloadItem::IsPaused()

Changes:

  • Add the DownloadItem.IsPause property
  • Add the RequestContext.ClearHttpCache(callback) method

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Updated documentation

Checklist:

  • Tested the code(if applicable)
  • Commented my code
  • Changed the documentation(if applicable)
  • New files have a license disclaimer
  • The formatting is consistent with the project (project supports .editorconfig)

Summary by CodeRabbit

  • New Features
    • Added HTTP cache clearing capability to RequestContext with optional completion callback support for asynchronous operations.
    • Added pause state indicator property to DownloadItem to check download status.

This wraps the `CefDownloadItem::IsPaused()` from CEF 144 release.
See the `cef.sdk\cef\include\cef_download_item.h` file.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b148c825-618e-4572-b741-8e9e47fd254d

📥 Commits

Reviewing files that changed from the base of the PR and between f8ac2d9 and 5b5132a.

📒 Files selected for processing (7)
  • CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs
  • CefSharp.Core.Runtime/Internals/TypeConversion.h
  • CefSharp.Core.Runtime/RequestContext.cpp
  • CefSharp.Core.Runtime/RequestContext.h
  • CefSharp.Core/RequestContext.cs
  • CefSharp/DownloadItem.cs
  • CefSharp/IRequestContext.cs

📝 Walkthrough

Walkthrough

CefSharp adds two capabilities: an asynchronous ClearHttpCache API on RequestContext that accepts an optional completion callback, and download pause state tracking via a new IsPaused property on DownloadItem. The implementation spans managed C#, C++/CLI bindings, and native CEF integration.

Changes

HTTP Cache Clearing and Download State

Layer / File(s) Summary
ClearHttpCache API Contract and Managed Implementation
CefSharp/IRequestContext.cs, CefSharp.Core/RequestContext.cs
IRequestContext interface declares ClearHttpCache with optional ICompletionCallback parameter; managed RequestContext.cs provides a public wrapper that delegates to the underlying C++/CLI implementation.
ClearHttpCache C++/CLI Binding and Ref Assembly
CefSharp.Core.Runtime/RequestContext.h, CefSharp.Core.Runtime/RequestContext.cpp, CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs
RequestContext.h declares the native method with XML documentation; RequestContext.cpp implements disposal validation, optional CefCompletionCallbackAdapter wrapping, and delegation to the native _requestContext; the ref assembly adds the corresponding public virtual method signature.
Download Pause State Tracking
CefSharp/DownloadItem.cs, CefSharp.Core.Runtime/Internals/TypeConversion.h
DownloadItem gains an IsPaused boolean property with documentation; TypeConversion.h maps the native download pause state via downloadItem->IsPaused() into the managed item->IsPaused field during type conversion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A cache most clear, now swiftly swept,
And downloads paused, their states all kept,
Through C# down to CEF's domain,
The bindings dance in binding's chain,
With callbacks kind, completion's grace,
We've cleared the way at lightning's pace!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main changes: adding RequestContext.ClearHttpCache() and DownloadItem.IsPaused from CEF SDK 144.
Description check ✅ Passed The description covers the summary and changes well but lacks detailed testing information and has incomplete checklist items, though it follows the template structure mostly.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

This exposes the `CefRequestContext::ClearHttpCache(callback)` from CEF 144 release.
See the `cef.sdk\cef\include\cef_request_context.h` file.
@jozefizso jozefizso marked this pull request as ready for review June 1, 2026 11:37
@AppVeyorBot
Copy link
Copy Markdown

@amaitland amaitland merged commit e4991c2 into cefsharp:master Jun 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants