Dormancy icon indicating copy to clipboard operation
Dormancy copied to clipboard

Tab activity accounting is wrong

Open sfleiter opened this issue 7 years ago • 1 comments

Dormancy today accounts a tab, that is not the current tab of the browser window, as active exactly at the point in time it was switched to. This time is remembered and compared to in tabIsOld(tabId). With a Dormancy timeout of 10 minutes today a tab that is active for 9 minutes and 59 seconds can, after a switch to another tab, be discarded the next second.

For me a tab is active from the activation time until another tab is activated. In the above example the tab would not be discarded earlier than 10 minutes after it was switched away from.

I see different ways of doing this (and have code already for this):

  • Use previousTabId added to tabs.onActivated in Firefox 65. Real documentation is still missing, see dev-doc-needed in https://bugzilla.mozilla.org/show_bug.cgi?id=1500479.
  • Use Tab.lastAccessed
  • Hand that part in extension code.

Depending on decission for issue #34 the optimal solution might be different, previousTabId and Tab.lastAccessed are Firefox specific.

sfleiter avatar Jan 02 '19 22:01 sfleiter

Forgot to mention: Solution 2 above (Tab.lastAccessed) would actually allow to remove the existing code for remembering last active time of tabs and the need to save that in sessionstore. This would automatically fix issue #36. Additionally Tab.lastAccessed has the semantics I proposed above, it includes the whole time until tab is left.

Only downside is that this is Firefox specific.

sfleiter avatar Jan 06 '19 13:01 sfleiter