Discarding Problems in Vivaldi

While testing a new Vivaldi function (which is not yet in the public builds at the time of writing), I have found a serious bug (not a real bug, but more of a serious annoyance) in connection with my Auto Discard extension:

The extension cannot recognize if tabs are tiled, i.e. 2 tabs are visible at the same time.
This is a pure Vivaldi problem because other browsers cannot tile tabs.

Example:
If I have entered something in e.g. a text field of Tab1 and set Tab2 to active, because I need to e.g. scroll Tab2 to look something up, and the extension hits while I am in Tab2, it discards the not focused Tab1.

Tab1 will be immediately reloaded (probably a Vivaldi hack to make tiling possible at all) but I lose all contents I have entered, because obviously the browser doesn’t store the full state the site is in including the entered text (which is a long standing and highly annoying chromium behavior)

There are 3 tab states:

  • active
  • passive
  • disabled

According to the tabs API I only can access active:[boolean].
(see chrome.tabs API description )

Ideally the API would return all 3 states, but that is not feasible because it would break every other extension that makes use of the activity status and expects true or false.

For me it would be fully sufficient if I could check the visibility status of the tab instead (as it is shown in vivaldi://discards ) and only hibernate hidden tabs, because the inactive tab has the status visible loaded passive, in opposition to hidden loaded hidden of normal tabs or visible loaded active of regular active tabs.

Using the Page Visibility API is no solution because
document !== tab
I know that I can see it for the document, but I can’t use it because I don’t want to inject stuff and message back to the extension.

is possible with a content script, but messaging from the background script to the content script and back again inside of chrome.tabs.query seems to be incredibly clumsy in my eyes.
Problem: AFAICS the content script acts only on the active tab …

edit:
partially solved by adding

if (tab.extData){
    let temp = JSON.parse(tab.extData);
    if ('tiling' in temp ) {
        return;		
    }
}

which excludes all tiled tabs from hibernation.
/edit


Please let me know in the comments, if you know a better way how this Vivaldi problem can be mitigated or circumvented.