[Ext] SessionSaver .2d: new (rewrite)

Announce and Discuss the Latest Theme and Extension Releases.
Locked
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

Xanager:
Those pref-options are correct. The dialog is a holdover from the prior version -- autosave is now permanently enabled.
.
You have to restart once before an extension becomes active. Since SessionSaver can only restore sessions it's been active for, that means your second restart is where you'd finally see it.
.
So, to summarize: you've replaced the app, started a new profile, installed the extension. If your script-console shows no errors, it should be working.
Xanager
Posts: 23
Joined: January 23rd, 2004, 4:38 pm

Post by Xanager »

Rue,

Thanks so much for your help. I did everything again, and I found something interesting. At first I was discouraged because it still didn't work. However, for some odd reason, I decided to close down once by going to File, and down to Exit. Lo and behold, it worked perfectly. I mainly wanted to update to 0.2d for the scroll-state retention. I tested this with the File, Exit and it works great. Unfortunately, it still doesn't work when I hit the X in the top right corner (btw, I'm running XP Pro). It also doesn't work when I Alt-F4 or when I right-click and close on the toolbar.

I checked for Javascript errors using all four closure methods but receive none. I don't know if this is a bug or what because I'm sure it isn't happening to everyone's system. I can just close using Alt-F-X for awhile I suppose. Would it make a difference if I installed it in the browser directory instead of in the profile? Thanks again.
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

Actually, I'd be interested if this is happening to anyone else, also.
.
I'm on the mac-platform, so I don't have quicklaunch. I'm wondering if quicklaunch retains the DOM hidden-window. If so, I can have it flag when the last browser-window closes (non-shutdown), restoring the next opened.
Xanager
Posts: 23
Joined: January 23rd, 2004, 4:38 pm

Post by Xanager »

I don't know what quicklaunch or DOM is, but if you ever post a new build and need it tested, just post here and I'll be glad to give it a whirl.
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

Xanager:
Try this: open 3 browser windows. Hit the [X] or Alt-F4 to close them all. Then, open 1 new browser and paste this into its script-console:
    rue wrote:var appShell = Components.classes["@mozilla.org/appshell/appShellService;1"].getService(Components.interfaces.nsIAppShellService); var hiddenWnd = appShell.hiddenDOMWindow; alert(hiddenWnd.SessionSaverObserver.counter);
If the hidden-window persisted, the number will be greater than 1.
Xanager
Posts: 23
Joined: January 23rd, 2004, 4:38 pm

Post by Xanager »

I don't know what all that means, but that fixes it.

I did just what you said, and when I evaluated the code in the console it returned a "1".

Now, it works great, no matter how you close. Thanks a lot rue!

edit: well, I was wrong. It was working consistently for a bit, but now it doesn't anymore. Don't know what I did to make it stop.
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

Xanager:
To be perfectly honest: it shouldn't have fixed anything. It was just an alert.
.
Try this: Exit and Restart your browser. Run the test again, but this time, after you close the multiple-windows, open your prefs.js file in a text-editor. Look for "sessionsaver.settings.shutdown", and note how it's set. Then finish the test, close that browser [X] and console, and check the shutdown-pref again.
.
Post the pref's setting for each occassion.
SteveRzx
Posts: 6
Joined: January 26th, 2004, 1:30 pm

Post by SteveRzx »

I'm having the EXACT same problems/symptoms as Xanager.

I tried what you said. After closing multiple browsers the settings.shutdown was false.

I opened a new browser, put that check in and got a "1". Closed that window and the setting was still false.

It only seems to works with file/exit for me as well.

btw, I'm running XP... Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

Steve:
Thanks- now we're getting somewhere. Try this: with just 1 Browser open, paste this into its script-console, then close [X] both:
    rue wrote:var appShell = Components.classes["@mozilla.org/appshell/appShellService;1"].getService(Components.interfaces.nsIAppShellService); var hiddenWnd = appShell.hiddenDOMWindow; hiddenWnd.setTimeout("function ssHiddenUnload() { alert('Excellent- we can insert proper unloading here'); } window.addEventListener('unload', ssHiddenUnload, true);");
You should see an alert after closing the windows.
SteveRzx
Posts: 6
Joined: January 26th, 2004, 1:30 pm

Post by SteveRzx »

rue, genius.

I got the alert "Eccellent... etc" when I closed it with the X.

I assume that means it did what you thought it would.
Xanager
Posts: 23
Joined: January 23rd, 2004, 4:38 pm

Post by Xanager »

Okay, I repeated the old tests with the prefs. After I shut down the multiple windows I had this:

user_pref("sessionsaver.settings.autoload", true);
user_pref("sessionsaver.settings.autosave", true);
user_pref("sessionsaver.settings.shutdown", false);

The after shutting down the new window and console I had this:

user_pref("sessionsaver.settings.autoload", true);
user_pref("sessionsaver.settings.autosave", true);
user_pref("sessionsaver.settings.shutdown", false);
user_pref("sessionsaver.windows.session0", "savedsession0 1160 842 -4 -4 111111 0 1 0||0,0|http://www.msnbc.msn.com/Default.aspx?id=4058843&p1=0");


Well, it started to work again. So, I decided to try the test again. The next time I got this both times:

user_pref("sessionsaver.settings.autoload", true);
user_pref("sessionsaver.settings.autosave", true);
user_pref("sessionsaver.settings.shutdown", false);

I tried the test a few more times but could never get it to remember the session again. It is strange.

Nonetheless, I posted the most recent code in the console, and when I exited I received the alert "Excellent- we can insert proper unloading here" as is in the code.
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

Xanager or Steve:
One last test: open 3 Browsers, and then prefs.js. Post all SessionSaver prefs.
Xanager
Posts: 23
Joined: January 23rd, 2004, 4:38 pm

Post by Xanager »

Here ya go. Something interesting though that may help you out, is that see in "savedsession0" it has www.msnbc.msn.com or whatever. That is my startup homepage. The page I was on www.dvdtalk.com. savedsession0 is also the first open window. The other two windows are right. Now that I'm typing this, I think I figured out why it was "working" for me earlier. I didn't close out the three windows in the opposite order they were opened. If I closed out the middle one last, it would work the next time I opened up the browser.


user_pref("sessionsaver.settings.autoload", true);
user_pref("sessionsaver.settings.autosave", true);
user_pref("sessionsaver.settings.shutdown", false);
user_pref("sessionsaver.windows.session0", "savedsession0 1160 842 -4 -4 111111 0 1 5||-2147483647,2|http://www.msnbc.msn.com/Default.aspx?p1=0||0,0|http://view.atdmt.com/
user_pref("sessionsaver.windows.session1", "savedsession1 1160 842 -4 -4 111111 0 1 0||0,0|http://forums.mozillazine.org/viewtopic.php?t=47184&postdays=0&postorder=asc&start=30");
user_pref("sessionsaver.windows.session2", "savedsession2 1160 842 -4 -4 111111 0 1 0||0,0|http://www.newzbin.com/?sid=834874698d6e8bab94755553584b2179");

edit: sorry about that
Last edited by Xanager on January 26th, 2004, 5:07 pm, edited 2 times in total.
rue
Posts: 673
Joined: June 10th, 2003, 2:20 pm

Post by rue »

d1 nightly 3 is posted: <a href="http://adblock.mozdev.org/sessionsaver/sessionsaver-02-dev.xpi">Installer</a>, and <a href="http://adblock.mozdev.org/sessionsaver/sessionsaver.jar">jar-file</a>.
    observer-object is copied local to the hidden-window
--
Xanager:
Your window-ordering observation was spot-on. The problem was pretty simple: the observer was being copied with the new Object() command -- which created the object local to its destination on my mac, but kept it local to source (your first browser) under XP. It now calls a hidden-window eval() to make the copy locally.
.
(btw, just clip the url-portions of those pref-sessions to keep the thread readable.)
Xanager
Posts: 23
Joined: January 23rd, 2004, 4:38 pm

Post by Xanager »

Hmm, still doesn't work for me. I started a new profile, and SS is the only extension installed. It's pretty much the same problem. When I open up a browser window it keeps track of the surfing, i.e.:

user_pref("sessionsaver.settings.autoload", true);
user_pref("sessionsaver.settings.autosave", true);
user_pref("sessionsaver.settings.shutdown", false);
user_pref("sessionsaver.windows.session0", "savedsession0 1160 842 -4 -4 111111 0 1 3||0,0|http://www.mozilla.org/products/firebird/||7077996,6750254|http://www.dvdtalk.com/||0,0|
http://forums.mozillazine.org/viewtopic ... t=30||0,0|
http://forums.mozillazine.org/posting.p ... 4efa7df235");


However, when I shut down, only the top three lines remain in the prefs file.

btw, rue, if it's a hassle for you working on this, don't worry about it. I have no problem closing through the file menu.
Locked