GNOME Bugzilla – Bug 316245
SessionSaver extension
Last modified: 2013-05-27 16:10:39 UTC
I remember seeing a couple of messages at #epiphany or epiphany@gnome.org asking about how one might be able use the session recovery feature after a clean exit. I decided to give it a try and write an extension that does just that. It required a few changes to Epiphany's shell startup code, so it's certainly not the cleanest design, but it's a start. As a side note: I thought about two other ways to implement the same feature. The first is a really ugly hack and I don't even have the guts to describe it, but at least it requires no changes to Ephy's code. I'll keep hidden in the dungeon for now. :-) The other would involve changing the "ephy_session_load" function and would probably be the cleanest solution, but since I definetly won't get it right on my first try, I thought I'd better post the patch as it is now and wait for chpe's input before going any further.
Created attachment 52193 [details] SessionSaver extension + patches to epiphany and epiphany-extensions modules Diff's taken with "cvs diff -u". Not sure this is the desired format. Please let me know if anything is broken.
A few questions: - Why did you need to change Epiphany's startup code? I wrote a similar extension (unpublished) which didn't need any changes to Epiphany (I'll attach it). - I gather you connect to the window's delete_cb because you want the window's contents to be saved if you're closing the last window. That's an inconsistent design: if I've got an Epiphany window open on Workspace 3 that I've forgotten about, and I close the Epiphany window on workspace 1 which has 10 tabs, I'll lose all those tabs. But if I closed the window on Workspace 3 and then closed the one on Workspace 1, I'd keep the 10 tabs. This seems rather arbitrary: since I'm going to have to stop and think before closing the window, why not just stick with the "Quit" menu option? - Check Epiphany's HACKING file for the correct coding convention.
Created attachment 52195 [details] Alternative "Quit" extension I wrote this extension a while ago, but I never published it because chpe and I couldn't find a single use case which justifies its existence. (chpe said it won't be going into epiphany-extensions CVS unless we can find a use case.) I never used it since I wrote it, so it may have bitrotted a bit. It could be replaced by a 10-line Python extension, too.
Hi Adam, The reason I had to mess up with Epiphany's startup code is to prevent an extra window (with the user's homepage) from opening. IMO, when you are recovering a saved session, you should get the exact same windows/tabs you had just before you quited. In fact, my first implementation looked a lot like yours, but I couldn't prevent the extra window from opening and ended up giving up and trying a different route. Later, I tried patching ephy_session_load but it didn't work too well either -- the best I got was to open an extra tab, instead of an extra window. It seems to me that changing EphyShell is unavoidable, but I'm not sure what's the best way to do so (new property? new priv attribute? something else?). Now, regarding the "window closing" behavior, I'll have to disagree with you. I believe that, if the user has the habit of using multiple windows, then he should use the "Quit" menu option to save the session. That's why the extra menu item was added, right?!. However, if the user is a "single window/multiple tabs" kind of user -- such as myself :-) -- shouldn't we save the session when he/she clicks the window's close button? It seems to me that such an user is subconsciously "quiting the application". This issue is certainly open to debate and I'm probably biased by my own usage patterns but I just thought I should point this out. If the consensus is that the session shouldn't be saved in this case, no problem, I'll just remove it. Finally, the problem of "finding a single use case". Well, I don't have the background to argue about "document-oriented" vs "application-oriented" navigation, etc etc etc, so I'll skip this one, but I thought I should mention Firefox's SessionSaver.2 extension (https://addons.mozilla.org/extensions/moreinfo.php?id=436) just in case you haven't heard of it. At the moment of this writing, the extension was downloaded 178801 times (11946 in the last week). That sounds like a lot of users to me; someone *must* have found a use case :-). And, personally, I find the extension pretty useful, specially when I'm experimenting/testing/debbuging Epiphany or another extension's code, 'cause I usually have to restart Epiphany over and over again. Anyway, I'll attach a new version, quite similar to yours, that doesn't require any changes to Epiphany, but suffers from the "extra window" issue.
Created attachment 52240 [details] SessionSaver extension No patches to Epiphany required in this version. It suffers from the "extra window" bug, mentioned in comment #4 though.
The code looks mostly fine to me, although I'm a bit surprised calling ephy_session_close from an extension actually works :) You could simply keep track of the windows opened before and after opening your session file; the diff is the unwanted window which you could just close? However, I agree with Adam that this feature isn't well-defined.
Created attachment 53489 [details] SessionSaver extension rev. 3 New revision, with some "voodoo" code to detect and destroy the initial window with the user's homepage.
*** Bug 321359 has been marked as a duplicate of this bug. ***
*** Bug 325486 has been marked as a duplicate of this bug. ***
*** Bug 325265 has been marked as a duplicate of this bug. ***
*** Bug 331129 has been marked as a duplicate of this bug. ***
*** Bug 337490 has been marked as a duplicate of this bug. ***
*** Bug 335331 has been marked as a duplicate of this bug. ***
Any reason this is implemented as an extension rather than just using Epiphany's native code for restoring tabs (i.e. what happens when you start it after killing it)?
I can't make the extension work, i get NULL library errors. Any idea?
yes, there's a typo in sessionsaver.ephy-extension.in.in. Change "library" to "Library" in [Loader] section. Should work like a charm ! Jean-François
Created attachment 69982 [details] SessionSaver Extension, rev. 4 It's about time I post an update to this extension. Since Epiphany 2.14, the shell startup code has changed quite a bit and it's now possible to have a clean implementation of the SessionSaver extension (no more "extra-windows", so no more hacks either. Yay! :-) ). I haven't been able to test it against the latest CVS version, though, only the 2.14 branch. If anyone is currently running HEAD and is willing to give it a try, let me know if it works, please.
Created attachment 70053 [details] [review] Adds the GTK_STOCK_QUIT icon to the Quit entry added by the extension. The extension was missing the Quit icon, this adds it.
How does one install this? i tried extracting it into my ~/.gnome2/epiphany/ directory but SessionSaver is not listed in extensions. Thanks.
Comment on attachment 69982 [details] SessionSaver Extension, rev. 4 Fixed the mime type to match tar.gz
I would really love a dialog asking me if I really want to quit if I have >1 tab open.
I found a huge problem while using this extension, basically my history stopped being used. If I visited planet.gnome.org and later I tipped 'planet' on the location bar, the already visited url wouldn't appear. I was using Ephy 2.14 at the moment, maybe it's gone now. Ideas of possible errors?
I found another problem (severe) with this plugin. 1. Visit a spam website that opens a popup window when you leave. 2. Close the window with <Alt><F4> 3. The popup appears (which is not good because all the other pages just have gone from the restore config).
Thanks much for this extension. I've added it to the Gentoo epiphany, and it finally make epiphany usable as my main browser. Some people, me included, don't always leave their browser open all the time. For example, sometimes I need to free up some RAM for a memory intensive operation, so I close my browser and evolution (which are usually open). Without sessionsaver, I can't restore my session by closing epiphany and restarting it later, only by logging out and logging back in, which I basically never do (I suspend instead). Of course, the added Exit entry on the menu is a huge bonus. I'd use this extension just for that. :)
Could this extension become part of the official epiphany-extensions release, if not already so ? it seems not te be included with Ubuntu's package.
There's still some problems that need to be addressed (like comment #23, #22, #21) Epiphany-extensions should be a package of reliable extensions for Ephy, if a extension isn't still ready it's the best to have it out of the package. Maybe a package called epiphany-extensions-unstable can be created (or maybe even a --enable-unstable in e-e configure). I don't know.
Diego Escalante Urrelo (dieguito) write in comment 26 > Maybe a package called epiphany-extensions-unstable can be created (or maybe > even a --enable-unstable in e-e configure). I don't know. This is pretty dangerous, as long as they are pushed into the tarballs too (because people won't care about "unstable" and use them anyways). Although it would be a lot easier to resolve the remaining issue within CVS. Dudes, instead of applying these unstable patches to your distribution, please just fix the remaining issue to make your users' live, your live, upstream's live, and the live of all the other users easier.
comment #21 is an enhancement request, and one that I would prefer not to ever see. I hate when programs ask me if I really meant to do something I did. So I won't add that, but someone else certainly can. comment #22 does not seem to be a problem with 2.16.0. I've been using this for a day or so, and my history is being updated correctly. I even specifically tested it with a site that I had not been to in epiphany (there was no history entry for it the first time I went), and it added it to my history. This one seems fixed. comment #23 doesn't seem to apply, as I have yet to see a single popup ever in epiphany. If I ever see one, I'll take a look at fixing the problem. In otherwords, it seems stable to me. (It's not in stable gentoo yet, it's not even unmasked in gentoo yet. But, there's no way to get this extension without building it in-tree, so I had to add it to be able to use it.) If people would really prefer that I not include this in Gentoo, I can back it out and go back to firefox. It's not a big deal for me. But this is, in my opinion, extremely important, make-or-break functionality in a browser. I would prefer to use ephiphany on a day-to-day basis, because I help support it in Gentoo, and I cannot use it without this. For the record, I've already had one user contact me in the day it's been available in Gentoo, thanking me for including it, so it seems people want it.
Daniel, thanks for your very well founded argumentation. Applying unstable patches to distrubution packages seems to tell me very much about your attitude about "stable" installations. Delivering this patch in a distribution will introduce these problems for you, us and the rest of the world: * people will notice that gentoo's epiphany extensions are different from Gnome's * people will notice the difference between the distributions * people will come across pages opening popups (I just reported comment 23 was reported just after I launched epiphany and was left with just an advertizing popup) and you're ging to break ephy in this case * people will report bugs to gentoo and to gnome although these bugs should not appear, because upstream considered this patch unstable So in the end this is lots of bad experience for the users and lots of additional (and avoidable) work for the developers. > so it seems people want it If there weren't people, this patch wouldn't have been written. > comment #23 doesn't seem to apply, as I have yet to see a single popup ever in > epiphany. If I ever see one, I'll take a look at fixing the problem. By claiming that your absolute power on the internet on enough to avoid fix this issue you don't bring the world forward. The unload event handler in javascript as well as flash do provide enough potential to introduce these popups and as long as epiphany doesn't stop interpreting javascript (ar at least opening new windows) there's no reason to consider this patch "stable".
You will notice, I specifically said that this is not in stable gentoo. I don't know if you know or care what "masked" means, but it specifically means "use at your own risk, may be broken." Gentoo uses this state some times to get further testing. However, based on your recommendations, I've removed this from Gentoo.
(In reply to comment #29) > > comment #23 doesn't seem to apply, as I have yet to see a single popup ever in > > epiphany. If I ever see one, I'll take a look at fixing the problem. > By claiming that your absolute power on the internet on enough to avoid fix > this issue you don't bring the world forward. The unload event handler in > javascript as well as flash do provide enough potential to introduce these > popups and as long as epiphany doesn't stop interpreting javascript (ar at > least opening new windows) there's no reason to consider this patch "stable". Could you post a link here so that others could reproduce this issue?
*** Bug 566992 has been marked as a duplicate of this bug. ***
According to its developer, epiphany-extensions is not under active development anymore. (For reference: https://mail.gnome.org/archives/gnome-i18n/2013-May/msg00035.html and bug 700924.) It is unlikely that there will be any further active development. Closing this report as WONTFIX as part of Bugzilla Housekeeping - Please feel free to reopen this bug report in the future if anyone takes the responsibility for active development again.