Skip to content

Core - Cancel pending tasks when browser crashed or v8 context gets released#5145

Merged
amaitland merged 9 commits into
cefsharp:masterfrom
campersau:cancelpendingtasksoncrashmaster
Aug 22, 2025
Merged

Core - Cancel pending tasks when browser crashed or v8 context gets released#5145
amaitland merged 9 commits into
cefsharp:masterfrom
campersau:cancelpendingtasksoncrashmaster

Conversation

@campersau

@campersau campersau commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

Fixes: #5144

Summary:

  • Pending tasks from EvaluateScriptAsync are now being canceled when the V8Context gets released / the browser crashes / the browser gets disposed.

Changes:

  • Storing pending tasks per frame (e.g. V8Context) instead of just globally, this makes it possible to cancel them

How Has This Been Tested?
Unittest

Screenshots (if appropriate):

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

  • Bug Fixes

    • Script evaluations now surface clear exceptions when the browser/host or frame is unavailable; pending evaluations are reliably canceled on crashes, disposals, navigation, or context changes.
  • New Features

    • Pending JavaScript tasks are scoped per frame, allowing targeted cancellation and improved isolation.
  • Tests

    • New tests for evaluation/callback cancellation on context changes and crashes, plus repeated callback execution.
  • Refactor

    • Internal task management reorganized for frame-based storage and more robust timeout/cancellation handling.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants