teardownDevtools releases what setupDevtools registered for the given
Document: its subscription, its window listener and its recording. Call it
when the Document is discarded — nothing else reaches those, and a page that
rebuilds Documents under one key accumulates them otherwise. It is a no-op
for a Document that has no devtools registration, and calling it twice is
harmless.
teardownDevtoolsreleases whatsetupDevtoolsregistered for the given Document: its subscription, its window listener and its recording. Call it when the Document is discarded — nothing else reaches those, and a page that rebuilds Documents under one key accumulates them otherwise. It is a no-op for a Document that has no devtools registration, and calling it twice is harmless.