[wptrunner] Reland "Implement --leak-check
for Blink-based browsers" (#47903)
This PR relands #47850 with two fixes:
- Introduce
ProtocolPart.after_connect()
, then fetch the initial leak
counters there after thebase
protocol part is initialized. This
avoids requiringbase
to besetup()
beforeleak
, which was true
by happenstance. - Tolerate
ExecutorBrowser
withoutleak_check
, since some browsers
that don't inherit fromChromeBrowser
still use
ChromeDriverProtocol
sometimes (e.g., print-reftests for Chrome on
Android).ChromeDriverProtocol
still excludes itsleak
part
altogether ifleak_check=False
to avoid runningafter_connect()
.