Skip to content

Honor configured regex timeouts in prepared scripts - #146

Merged
FlorianRappl merged 2 commits into
AngleSharp:develfrom
EvotecIT:fix/prepared-script-regex-timeout
Oct 30, 2026
Merged

FlorianRappl merged 2 commits into
AngleSharp:develfrom
EvotecIT:fix/prepared-script-regex-timeout

Conversation

@PrzemyslawKlys

Copy link
Copy Markdown
Contributor

Types of Changes

Prerequisites

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

An EngineCreator configured with a 37 ms regex timeout currently produces regular-expression literals whose MatchTimeout is ten seconds. ScriptCache prepares them with Jint's defaults instead of the configured timeout.

This passes the timeout into script preparation and includes it in the cache key. Engines with the same source and timeout still share a prepared script; engines with different timeouts keep their own policy. The existing cache capacity and syntax-error fallback are unchanged.

The regression tests cover inline and explicit scripts, both orders of two different engine timeouts, and reuse of the first timeout. All four new cases fail against unchanged devel. Temporarily removing the timeout from cache identity also makes both cross-engine cases fail.

Validation: 317 offline tests pass on .NET 10, and all ten engine-configuration tests pass on .NET Framework 4.6.2 and 4.7.2. All five library targets build with zero warnings. The network-dependent IntegrationTests and PageTests fixtures were not run locally.

Comment thread CHANGELOG.md Resolved

@FlorianRappl FlorianRappl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top!

@FlorianRappl
FlorianRappl merged commit a99bbba into AngleSharp:devel Oct 30, 2026
5 checks passed
@PrzemyslawKlys
PrzemyslawKlys deleted the fix/prepared-script-regex-timeout branch October 30, 2026 10:39
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.

2 participants