simulateWebError function
Test-only seam (ERH-009): routes a synthesized (error, stack) through the
chokepoint exactly as a real web-JS handler would, BYPASSING window, so a
VM unit test (which resolves this stub via the conditional import) can cover
the routing without a browser. The web library's copy does the same against a
real WebJsError. (Because it bypasses window, it cannot catch a defect in
the real window→WebJsError serialization — that needs an E2E smoke.)
Implementation
@visibleForTesting
void simulateWebError(Object error, StackTrace? stack) {
recordCapturedError(error, stack);
}