Skip to main content

Module determinism

Module determinism 

Source
Expand description

The determinism preamble.

Injected via Page.addScriptToEvaluateOnNewDocument, so it runs before any page script on every document — including ones created by navigation.

Why this exists: store screenshot sets rot because they are taken by hand at different moments. One shot says 3:47, the next says 9:12; a list reshuffles; “2 hours ago” becomes “3 days ago”. Freezing the clock and seeding the PRNG makes a rerun reproduce the entire set byte for byte, so the only diffs are the ones you meant to make.

Validated empirically before this code existed: with the preamble, two independent browser launches produced identical PNG hashes across five device sizes; with it disabled, the same page produced different bytes. The negative control is the part that makes that evidence rather than a green check.

Structs§

Determinism
Knobs for the injected preamble.