Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Able to autosave on tab discard, then close the discarded tab, then open the file saved by singlefile #703

Closed
rftw opened this issue Jun 23, 2021 · 11 comments

Comments

@rftw
Copy link

@rftw rftw commented Jun 23, 2021

Is your feature request related to a problem? Please describe.
Currently it is possible to autosave on tab loading or unloading. I wish to autosave on tab discarding.

Describe the solution you'd like

  • Autosave on tab discard
  • Close the discarded tab
  • Open the file saved by singlefile
  • Move the tab of the opened file to the same position of the closed discarded tab

Thank you!

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Jun 23, 2021

Well, this is a very specific feature request...

@rftw
Copy link
Author

@rftw rftw commented Jun 23, 2021

I am using Firefox. I am a heavy tab user and currently have around 300 tabs. The Auto Tab Discard extension greatly helped to reduce the cpu and ram consumption. However, a limitation of firefox tab discarding method is that whenever the discarded tab inadvertently gets focus, it is automatically reloaded. There is currently no way to prevent it which is very inconvenient. Related issue on bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1505960
Also when you want to visit the discarded tabs later, their reloading takes a lot of time and resources slowing down the browser.

Previously I used chrome with "The Great Suspender" extension. The extension provides an excellent feature in that before discarding a tab, it takes a snapshot of the whole page and displays it with scrollbar. The tab is reloaded only when the user clicks on the screenshot, thus preventing accidental reloads. I wish to imitate this behavior in firefox and so requested this feature.

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Jun 24, 2021

Thank you for the additional info. The use case is clearer for me :)

In the scenario you described, the main problem is that it's impossible, from a technical point of view, to open the saved file in a tab. Extensions can't open tabs with file:/// URIs.

However, I could implement the "autosave on tab discard", I think it makes sense anyway.

@rftw
Copy link
Author

@rftw rftw commented Jun 27, 2021

Thank you!

@rftw
Copy link
Author

@rftw rftw commented Jun 27, 2021

A suggestion:

Since opening local files in not possible, instead of autosaving files on tab discard, we can instead redirect the tab to the blob url created by the singlefile. I downloaded your repo and tested this approach and it worked.

After line 276 in download.js file, I added the line await browser.tabs.update({url: downloadInfo.url}); The downloadInfo.url contains the blob url which firefox sucessfully opened. This is much better than downloading. Therefore when implementing "Autosave on tab discard", can you please give us an option whether to download the file or just redirect to the blob url.

Thank you!

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Jul 4, 2021

@rftw The current version on github should fix your issue. SingleFile will still save pages though.

@rftw
Copy link
Author

@rftw rftw commented Jul 20, 2021

@rftw The current version on github should fix your issue. SingleFile will still save pages though.

Sorry for the late response. It is working as expected except that the original tab does not get closed. Screenshot of my settings:

ss

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Jul 30, 2021

I confirm the "remove on discard" feature does not work as expected.

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Aug 8, 2021

Everything should work fine in the version 1.18.91.

@rftw
Copy link
Author

@rftw rftw commented Aug 9, 2021

Everything should work fine in the version 1.18.91.

Working perfect!

A minor request: In line 195 of autosave.js, can you add windowId property to createTabProperties like:

const createTabProperties = { active: true, url: URL.createObjectURL(blob), windowId: tab.windowId};

This is because the tab.index is for within a window. It is not unique across all windows. If windowId is not specified and if the user is using multiple windows, all tabs are created in the first window.

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Aug 9, 2021

Thank you for the feedback and the suggestion. The fix will be available in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants