rNeomy / auto-tab-discard

Use native tab discarding method to automatically reduce memory usage of inactive tabs
https://webextension.org/listing/tab-discard.html
Mozilla Public License 2.0
906 stars 79 forks source link

[Feature Request]: Save "Keep This Tab for This Session" state for tabs between restarts for Firefox #269

Closed Lej77 closed 2 years ago

Lej77 commented 2 years ago

Short description

It would be nice if the Keep This Tab for This Session toggle was saved and remembered if a session is restored after a restart.

It is possible to use the sessions.setTabValue, sessions.getTabValue and sessions.removeTabValue API methods to store this information safely. One problem is that these methods require the sessions permission but since it can be an optional permission it isn't that bad. Another problem is that those APIs are only available on Firefox so this feature would only work there but since there is already some Firefox specific behavior then maybe this can be okay as well.

I imagine that there would be a checkbox in the options page that enabled this "saving" feature and requested the sessions permission when checked and removed the permission when unchecked.

Steps to reproduce

  1. Start Firefox with clean profile.
  2. Install Auto Tab Discard.
  3. Open Firefox's Option page.
  4. Under the Startup header at the very top of the page there is a Restore previous session checkbox, enable that.
  5. Go to a tab you want to keep loaded.
  6. Click on the Auto Tab Discard toolbar button to open the popup.
  7. Ensure the Keep This Tab for This Session toggle is checked.
  8. Quit the browser.
    • Open the Firefox menu at the top right and click on Quit.
    • Or use the Ctrl+Shift+Q keybinding (at least on Windows).
  9. Open Firefox again.
  10. Click on the Auto Tab Discard toolbar button to open the popup.

Expected result

The Keep This Tab for This Session toggle should still be checked.

Actual result

The Keep This Tab for This Session toggle will no longer be checked.

Environment

rNeomy commented 2 years ago

Thank you for the descriptive bug report, however, I am not comfortable implementing features that are based on a specific browser. We need to find something that works on all browsers.

p.s. (1): If you Shift + Click on the "Keep Tabs for This Site" option, it generates a regexp to match the exact URL. As of the next release, you can simply remove the rule from the popup interface as well. So I guess having an easy option to whitelist a URL is close to what you need.

p.s. (2): We are moving to manifest v3. So I need to make sure all APIs are compatible with m3.

Lej77 commented 2 years ago

I can definitively understand the reluctance to implement features that only work in some browsers. Also thank you for the tip about Shift + Click, that will be very helpful.

Regarding the problem that made me open this issue in the first place, I solved that by writing a RegEx that matches a YouTube playlist URL. So in my case an exact match wasn't what was needed but RegEx is very powerful and should be enough to solve most issues that would need this feature.

Anyways I am going to close this issue now, thank you for your time!