Repository navigation
Branded Browsers
Role. Capture Blink browsers that ship their own blocking, Brave (Shields) and Edge (tracking prevention), as users run them, and explain their differences from Chrome by the requests they blocked. Module branded, package internal/branded.
A fresh Brave profile has no filter lists yet and behaves like Chrome. To capture Brave as shipped, the profile must have downloaded its lists first: that is what a warmed template is.
- In: a discovered Blink browser and the Omnisnap cache; at analysis time, the failed requests each capture recorded.
-
Out: a template profile in the cache; per result, the blocked hosts on each side; per cause,
blockedBy(the blocked hosts its element's resources come from).
omnisnap warm <browser> runs Warm (internal/cli/warm.go):
- Launch the browser headless with a fresh profile.
- Visit the neutral
WarmPages(example.com,wikipedia.org), waiting for network idle and then a fixed settle (8 s per page by default) so the blocking components download their lists. - Copy the profile into
<cache>/templates/<browser>-<version>/(TemplateDir).
A template is fresh while the browser's major version is the same and it is younger than 7 days (Fresh, TemplateMaxAge). When the CLI launches a Blink browser and a fresh template exists for it, the browser starts from a copy of the template (startBlink, StartBlinkTemplate); otherwise from a fresh profile. The copy skips lock and socket files, and the template never accumulates state.
Capture records every failed request; those failing with ERR_BLOCKED_BY_CLIENT are blocked by the browser itself (Capture pipeline). In the analysis (internal/pipeline/diff.go):
-
BlockedHostslists the distinct hosts the engine blocked. - For every cause, the resources (
src/hrefkeys) of its element and its descendants are matched against them withMatches; a subdomain matches its parent's blocked host. - A match goes into
cause.blockedBy, and the result lists the blocked hosts per side.
A branded browser's cause with no blocked request behind it is not expected: it is reported normally.
A warm page that fails to load is logged and the warm goes on with the next page. A missing or stale template is not an error: the browser starts fresh.
-
blocked_test.go:TestBlockedHosts,TestHostOf,TestMatches,TestTemplateFreshness. -
warm_browsers_test.go(browserstag):TestWarmTemplateBlocksTrackers(a warmed Brave blocks the trackers ontestdata/branded/trackers.htmlwhere a fresh one does not) andTestEdgeTrackingPrevention.
-
--neutralonly labels the result. The spec says--neutrallaunches fresh profiles with Brave Shields and Edge tracking prevention turned off by switches or prefs. In the code, the flag setsjob.neutral, and the only effect isprofile: neutralin the results andhost.json(bundle.go). The launch is unchanged: a branded browser with a fresh template still starts from it, with its blocking on. -
No automatic warm. The spec warms a template "automatically on first use, with a progress message". The code warms only on
omnisnap warm; without a template the browser starts fresh, like Chrome. -
Fixed settle, not component readiness. The spec waits "until the blocking components report ready" (Brave's adblock component and list versions, Edge's Trust Protection Lists).
Warmwaits for network idle and a fixed settle per page. -
Filter-list and component versions are not recorded in
host.jsonorsummary.json, as the spec asks. The template's version line is printed byomnisnap warmonly. -
Edge. The spec's own open question: Edge's tracking prevention blocked nothing under headless automation or headed on Linux in the spike, so Edge is not claimed for
blockedByattribution.
-
internal/cli/warm.go:omnisnap warm -
internal/branded/blocked.go: the hosts a branded browser blocked -
internal/branded/templates.go: warmed templates and whether they are stale -
internal/branded/warm.go:Warm: build a template profile -
internal/process/template.go: launching from a template profile
This wiki is published from docs/internals/ on main. Edits made here are overwritten on the next publish: change the pages there, in a pull request. The specs are normative; where a page and a spec disagree, the page says what the code does.
Start
Contracts
Capture side
Analysis side
Output
Quality