Documentation
¶
Overview ¶
Package scripts provides embedded JavaScript for the DevTool proxy instrumentation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the agnt version to inject into scripts. Set this before calling GetCombinedScript() for the first time.
Functions ¶
func GetAxeCore ¶ added in v0.12.8
func GetAxeCore() string
GetAxeCore returns the bundled axe-core JavaScript library.
func GetCombinedScript ¶
func GetCombinedScript() string
GetCombinedScript returns all JavaScript modules combined into a single script. The script is wrapped in appropriate tags and ordered for correct initialization. The result is cached after first call. Equivalent to GetCombinedScriptForRole(RoleFull).
func GetCombinedScriptForRole ¶ added in v0.13.31
GetCombinedScriptForRole returns the bundle flavour for the given frame role (RoleFull, RoleChrome, or RoleContent), built once and cached.
func GetHtml2Canvas ¶ added in v0.13.35
func GetHtml2Canvas() string
GetHtml2Canvas returns the bundled html2canvas-pro library, served on demand (not inlined into the always-injected bundle) from /__devtool_html2canvas.
func GetScriptNames ¶
func GetScriptNames() []string
GetScriptNames returns the list of embedded script names for debugging.
Types ¶
type Role ¶ added in v0.13.31
type Role string
Role identifies which per-frame bundle flavour to build. The proxy knows the frame role at injection time: the chrome-shell document is generated by BuildShellDocument (chrome), a wrapped content frame's request carries the frame marker (content), and everything else — unwrapped fallback, HTML fragments, passive embeds, legacy injection — gets the full bundle, which is byte-for-byte today's behaviour.
const ( // RoleFull is the complete bundle: every module (passive/legacy default). RoleFull Role = "" // RoleChrome is the shell bundle: shared + chrome-only modules, without // the content-only set. RoleChrome Role = "chrome" // RoleContent is the content-frame bundle: shared modules (including the // indicator-bridge / walkthrough-proxy forwarding stubs) + content-only // modules, without the chrome-only set. RoleContent Role = "content" // RolePublic is the HARD-ALLOWLISTED public bundle for the walkthrough-publish // plane (P4). Unlike RoleChrome/RoleContent — which are SUBTRACTIVE filters // over the full module set — RolePublic is built from an EXPLICIT ALLOWLIST // (rolePublicModules) and contains ONLY those members: the variant renderer, // the read-only walkthrough viewer, and the feedback client. It carries NONE // of the dev-control surface (no core WS/exec channel, no __devtool control // API, no audits/capture/inspection/design/indicator/authbreakout), ships no // html2canvas, and runs under `script-src 'self'` with no eval/inline. The // dependency-closure + forbidden-symbol tests in role_public_test.go fail the // build if a forbidden module ever enters this bundle. RolePublic Role = "public" )