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
888 stars 76 forks source link

Tabs only discarded after testing in developer mode #297

Open kirkre opened 2 years ago

kirkre commented 2 years ago

I've tried installing auto tab discard multiple times on chrome, in both clean and existing chrome profiles, and in every case no tabs were discarded until I turned on developer mode and looked at what was happening through the dev console. Once developer mode is turned on, there are no errors in the dev console. The tabs that are overdue to be discarded are immediately discarded and from then on everything works great. When developer mode is turned back off, auto tab discard then continues to work. I waited until a profile had been completely inactive for at least 12 hours before moving on to the next test, and I used the default settings for the tests.

No complaints from me, I am grateful this is working, but I thought I should report this strange behavior, and I am curious why this is happening.

Thanks,

Kirk

kirkre commented 1 year ago

Update, 10 days later one of my profiles with auto tab discard stopped discarding tabs. I turned on developer mode, went to extensions/auto tab discard/details/inspect views. v2.html had (inactive) listed, although I do not know if that is significant. I selected v2.html, turned on dev tools, and refreshed v2.html with Ctrl R. The (inactive) label of v2.html was cleared, and the tabs started discarding as normal. Again this is in Chrome.

rNeomy commented 1 year ago

This extension uses a non-persistent background page, so the inactive label means that the background is not active at that point. It has a built-in timer to wake the extension up when it is supposed to check for discarding. In your case, the alarm does not work properly.

To debug you can use these two functions:

// Get alll installed alarms
chrome.alarms.getAll(a => console.log(a))
// Fires when the alarm is called
chrome.alarms.onAlarm.addListener(o => console.log('new alarm call', o));