Skip to content

Create Jint engines through a configuration service - #142

Merged
FlorianRappl merged 7 commits into
AngleSharp:develfrom
EvotecIT:feature/script-execution-options
Oct 4, 2026
Merged

FlorianRappl merged 7 commits into
AngleSharp:develfrom
EvotecIT:feature/script-execution-options

Conversation

@PrzemyslawKlys

@PrzemyslawKlys PrzemyslawKlys commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Hosts cannot configure Jint options before the first inline script runs.

Add an EngineCreator configuration service, called from the EngineInstance constructor with the current window and existing DOM options. Keep instance fields readonly. Workers inherit the same service registrations, including context factories, and receive their own window.

HtmlTinkerX uses this hook to install execution limits before loading markup; its adoption follows an AngleSharp.Js release.

Validation: 308 net10.0 tests, 12 focused engine/worker tests on net472, and all shipping targets pass. Independent review covered the service and worker propagation; the window argument is verified in both paths.

@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.

I'd keep everything readonly. An instance, once created, stays that way.

What we can have is that there is an EngineCreator, which can be configured. The default just creates a new Engine object. This way, one can configure / create the Engine instance in whatever way. The creator will be called within the constructor of an EngineInstance.

@PrzemyslawKlys PrzemyslawKlys changed the title Allow hosts to configure Jint before page scripts run Allow hosts to create configured Jint engines before page scripts run Oct 4, 2026
Comment thread README.md Outdated
@PrzemyslawKlys PrzemyslawKlys changed the title Allow hosts to create configured Jint engines before page scripts run Create Jint engines through a configuration service Oct 4, 2026
Comment thread src/AngleSharp.Js/EngineCreator.cs Outdated

@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.

LGTM!

@FlorianRappl
FlorianRappl merged commit 0bc38a2 into AngleSharp:devel Oct 4, 2026
5 checks passed
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