Swallowed-exception diagnostics, checkpoint wiring, and Jint toString() fix - #70
Merged
Merged
Conversation
V8's error.stack begins with the message line, but Jint's stack is frames only, so reporting stack-or-message dropped the message entirely under Jint — and the message is the one datum that identifies the failure (e.g. a runtime TypeError, or a framework's minified error number). Emit the message first, then the stack only when it doesn't already repeat it. This surfaced a pre-existing engine gap invisible until now: two live Next.js App Router RSC sites that render fully on V8 fail on Jint with "Cannot convert undefined or null to object" thrown from React's Flight deserialization — an expression that is a valid object on V8 is null on Jint, so an ordinary destructure/spread of it throws only there. V8 is the default engine and renders both sites correctly; the guard protects the fallback. Also remove the RSC feasibility investigation doc. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
As of 4.11 the shim that used to patch an issue with the Map-iterator is no longer needed, the shims prelude is therefore removed.
AbstractCrawler already supported checkpoint/resume, but the concrete AngleSharp, JS (Jint/V8), Playwright, and Puppeteer constructors never forwarded an ICheckpointStore parameter, so DI could only supply one to the default static backend. --checkpoint now works regardless of backend. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Console.CancelKeyPress cancelled the crawl token but left e.Cancel false, so .NET terminated the process right after the handler returned -- racing the in-flight checkpoint write. The handler now sets e.Cancel = true on the first Ctrl+C, lets the crawl unwind and persist its checkpoint, and logs what's happening; a second Ctrl+C falls through to the default (immediate) termination. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Frameworks grab a form-control ref and call setCustomValidity / checkValidity / reportValidity during render, and some touch a file input's FileList; neither existed on HTMLElement, so hydration threw. Both are no-ops that report an always-valid/empty state, since no user interaction happens in a single-pass crawl. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Jint 4.11 defaults toString() to a hardcoded "function name() { [native
code] }" stub for every ordinary script function, unlike V8/real
browsers which print real source. That made bundle-authored functions
indistinguishable from the host DOM methods browser/native.ts
deliberately marks as native for jQuery/Sizzle's native-code sniff,
failing JsMode_HostMethodsReportNativeCode_UserFunctionsDoNot on Jint.
Prepared scripts/modules are now tagged with their source text at parse
time (JintFunctionSourceTagger), and Options.Host.FunctionToStringHandler
slices the real text back out for any node without a marked-native
override. The source lives in a ConditionalWeakTable keyed by node
reference, not Node.UserData -- that slot is Jint's own internal
block-scope cache, and writing to it corrupted unrelated script
execution engine-wide.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
error.stackis frames-only), routed through an unconditional__crawlerDiagnosticchannel atDebuglevel.Map.keys()/values()iterator compat shim — Jint 4.11 fixed the underlying "Collection was modified" bug it patched.ICheckpointStorethrough every crawler backend (AngleSharp, JS/Jint/V8, Playwright, Puppeteer) —--checkpointpreviously only worked with the default static backend.Ctrl+Cnow waits for in-flight requests to finish and the checkpoint to persist before the process exits, instead of racing process termination.FileListglobal to the JS DOM, fixing hydration crashes on frameworks that touch form-control validation or file inputs.Function.prototype.toString()gap: Jint 4.11 defaults every ordinary script function'stoString()to a hardcoded"[native code]"stub (unlike V8/real browsers), which made bundle-authored functions indistinguishable from the host DOM methods deliberately marked native for jQuery/Sizzle's native-code sniff. Scripts/modules are now tagged with their source text at parse time (JintFunctionSourceTagger, an externalConditionalWeakTableside table — notNode.UserData, which turned out to be Jint's own internal block-scope cache slot) soOptions.Host.FunctionToStringHandlercan return real source for everything else.Not related to this PR: 3.0.0 is separately blocked on sebastienros/jint#2607 (a labeled-break-escaping-a-labeled-switch fix), which is required for full RSC rendering on the Jint backend. That PR is still open upstream as of this writing.
Test plan
dotnet build— clean, 0 warnings/errorsdotnet run --project tests/SimpleCrawler.Tests -c Release— full suite green: 252 total, 0 failed, 4 pre-existing unrelated skipsdotnet run --project tests/SimpleCrawler.Tests -c Release -- -filter "/*/*/JsDomRendererTests/*"— 90/90 green, including the previously-failingJsMode_HostMethodsReportNativeCode_UserFunctionsDoNoton both Jint and V8Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com