laiz I think the media wasn't playing at the time, but was paused🤔 It's not the most important aspect - if it works in your tests then I'm sure it works in general. I did a bit of digging into how the Auto Tab Discard plugin handles detection of (1) partially filled forms, (2) paused media, (3) when there is no internet connection and the tab is not cached
1. Unsaved Form Changes
The detection is a keystroke-based heuristic, not true dirty-form tracking.
A content script (watch.js) is injected into every page and frame at document_start. It defines a window.isReceivingFormInput getter and maintains an internal Set of elements plus a checked boolean. On every keydown event (capture phase), if the key code falls between 48–90 (digits and letters only — no backspace, arrows, or punctuation), and the target is an INPUT, TEXTAREA, FORM, or contentEditable element, the element is added to the set and checked is flipped to true. On a submit event, the set is cleared and checked resets to false — that's the "not yet submitted" part.
The getter is slightly smarter than a bare boolean: it returns false if every tracked element is either disconnected from the DOM or has an empty value/textContent, so manually clearing a field also un-protects the tab.
When an auto-discard cycle runs, the service worker injects a probe script (meta.js) into all frames via chrome.scripting.executeScript. It reads window.isReceivingFormInput per frame, and the worker OR's results across all frames with ms.some(o => o && o.forms). If the form pref is enabled and any frame reports true, the tab is skipped.
This means it will miss form changes made via paste (right-click or Ctrl+V without a qualifying keydown), autofill, mouse-driven inputs like <select>, programmatic updates, or backspace-only edits. It's a heuristic, not a diff of initial vs. current form values.
2. Paused Media Player
This is a pure DOM scan at probe time — no persistent listeners or state.
When a discard cycle reaches a tab, the injected meta.js runs in every frame and executes:
document.querySelectorAll('video,audio')
It flags a frame as having a paused player if any matched element satisfies e.paused && e.currentTime. The && e.currentTime clause is the key detail: currentTime is 0 (falsy) for a media element that has never been played, so a page full of un-started embeds won't be protected. Only a player that has been played and then paused qualifies.
Results are again OR'd across frames. If the paused pref is enabled and any frame reports a qualifying paused element, the tab is skipped.
From a limitations perspective this means only native <video> and <audio> elements visible to the DOM query are detected. WebAudio-based players, Flash, or custom player implementations that don't use native media elements are invisible. Shadow DOM is partially mitigated by the allFrames: true injection, but elements inside closed shadow roots would still be missed.
3. No Internet Connection / Tab Not Cached
The plugin claims to check if the tab is cached, but the "not cached" part is not implemented🙃 The entire check is a single global gate in the service worker:
if (prefs.online && navigator.onLine === false) {
return; // skip the entire discard cycle
}
When navigator.onLine is false, no tabs are discarded in that pass — regardless of whether any individual tab is or isn't in Chrome's HTTP cache. There is no per-tab cache probe, no Cache API lookup, and no network/cache status test for specific URLs anywhere in the codebase. I'm sure Orion could do this much better - obviously.
I'm guessing the "and the tab is not cached" portion of the option label is best understood as the plugin's rationale for the feature ("if you're offline, discarded tabs might fail to reload because they aren't cached, so let's be safe"), not as a description of actual behavior.
Also final note on this detection: navigator.onLine on Chrome only returns false when there is literally no network interface. A machine connected to a captive portal or broken Wi-Fi still reports true, so the check can both over-protect (blocking all discards when only one tab would fail to reload) and under-protect (not triggering when connectivity is effectively broken but a network interface is up). Again, connectivity detection can be done in a far superior way by Orion.