mcp, agent: load external stylesheets by default

Merged
AR
1mo ago
+41-2

mcp and agent now load external stylesheets by default. Without them, anything an author class hides (closed menus, drawers, modals) reads as visible to tree, interactiveElements and the click checks.

Example

A page whose menu is hidden by a linked stylesheet (.menu[data-open=false] { display: none }), read with tree.

Before:

1 RootWebArea 'News'
 4 dialog 'Menu'
  5 [i] link 'World'
  6 [i] link 'Sport'
 7 alert
  8 'Session expires in 2 minutes'
 ...

After:

1 RootWebArea 'News'
 4 alert
  5 'Session expires in 2 minutes'
 ...

On live pages the semantic tree goes from 1591 to 767 lines on lemonde.fr, 1148 to 756 on theverge.com, and 1734 to 1572 on Wikipedia.

Cost

Release build, median of 5 alternating live runs:

pageoff (ms)on (ms)Δ
lemonde.fr421450+30
lobste.rs555625+70
wikipedia.org493527+35
github.com9591448+489
theverge.com16442406+762

The worst cases come from fetching sheets one at a time; fetching them in parallel would cut most of that.

CLI

  • --load-resources given explicitly replaces the mode default instead of adding to it.
  • New none value loads nothing.
  • fetch and serve keep loading nothing by default.