inappwebview_script_guard 0.1.1
inappwebview_script_guard: ^0.1.1 copied to clipboard
Detect silently-failed JavaScript injection in flutter_inappwebview: canary-verified script loading plus commit-time AST linting of embedded JS.
0.1.1 - 2026-08-01 #
Docs-only release — no API or behavior changes.
Changed #
missingverdict guidance corrected. The docs sent everymissingto "investigate the JS"; that is a dead end for the second cause class, a navigation wipe — the page navigated between the script running and the read-back (redirect, or a WebView session-restore committing its real document after an earlyonLoadStop), so the flag was written into a world the read-back never sees. Easy to hit with inject-at-onLoadStopwhen no second LoadStop follows. New README section documents both cause classes, their opposite corrective actions, and a bounded re-inject-once recovery recipe (generation guard incl. teardown, script-signals guard,missing-only, one attempt,contentWorldthreaded through both calls). Allmissing-verdict doc surfaces aligned: verdict table, "The problem" failure classes, Quick-start switch comment, "When something fails", barrel-library summary,JsScriptverdict list, andCanaryVerdict.missing/MissingResultdartdoc (the navigation cause is no longer labelled "script-side").
0.1.0 - 2026-07-29 #
Initial release.
Added #
JsScript— wrapper for literal JavaScript with a content-addressed load canary.withCanarypreserves the script's bridge return value and writes a per-version flag iff the source ran to completion (the write is deliberately NOT in afinally— a bridge-swallowed throw must read back asmissing, notloaded). Constructor-validatedname,source(rejects whitespace/semicolon-only payloads), and configurablecanaryPrefix;canaryFlagNameis the single source of truth for the flag both sides use.verifyCanary/injectAndVerifyCanary— read-back helpers returning the sealedCanaryResulthierarchy:loaded/missing(script-side) /injectThrew(bridge-side, exception + stack preserved, includes eval timeouts) /stale(cached older version) /malformed(flag clobbered). ConfigurableevalTimeout(default 10 s) bounds every bridge await;contentWorldthreads to both inject and read-back.package:inappwebview_script_guard/invariants.dart— commit-time AST linting (checkSource): the four rejected constructs (non-raw multi-line, multi-line interpolation, adjacent literals, literal+concatenation) plus theCHECK_JS_INVARIANTS_SKIP_FILEdirective parser.- Executables —
dart run inappwebview_script_guard:check_js_invariants(with--root <dir>for a configurable scripts root) anddart run inappwebview_script_guard:extract_js(raw-literal extraction fornode --check). example/hooks/— copy-inpre-commit/check_js.sh/pre-pushscripts implementing the proof-of-work gate (deliberately examples, not package API).