MozillaZine

Extracting open URLs from sessionstore.js?

User Help for Mozilla Firefox
magoood

User avatar
 
Posts: 294
Joined: October 16th, 2007, 1:57 am

Post Posted February 19th, 2011, 2:53 am

I'm really lost in this thread and don't understand what to do

meemme
Guest
 

Post Posted April 1st, 2011, 11:53 am

dickvl wrote:Rename sessionstore.js to sessionstore.js.txt and open the file in Firefox (File > Open File).
Code: Select all
javascript:(function(){var E=document.getElementsByTagName('PRE')[0],T=E.innerHTML,i=0,t='';while(/[^:]\{"entries":\[\{("url":"[^"]*")(\,"title":"[^"]*"){0,1}/g.exec(T)){t+='['+(++i)+']:'+RegExp.$1+RegExp.$2+'<br>';}with(window.open().document){write(t);close();}})();


If you want the closed tabs then use:
Code: Select all
javascript:(function(){var E=document.getElementsByTagName('PRE')[0],T=E.innerHTML,i=0,t='';while(/"state":\{"entries":\[\{("url":"[^"]*")(\,"title":"[^"]*"){0,1}/g.exec(T)){t+='['+(++i)+']:'+RegExp.$1+RegExp.$2+'<br>';}with(window.open().document){write(t);close();}})();

See also http://en.wikipedia.org/wiki/Bookmarklet

(edited to make it work with Firefox 3.5 and later by adding quotes around field names)


Worked great for me just rename sessionstore.js open in firefox copy code and paste in address bar bingo a new window with my website urls
Someone get this man a shine :lol:

Peace

Azimech77
Guest
 

Post Posted May 2nd, 2011, 2:31 am

Well apparently these solutions don't work in version 4. I consider this "stuck in minimized" a VERY serious flaw and after 5 years of using Firefox I'm really considering a switch.
And just because memory is so cheap, that doesn't mean memory leaks don't need to get fixed (700 MB + 400 MB for plugin container - WTF).

End of rant.

therube

User avatar
 
Posts: 19678
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted May 4th, 2011, 2:42 pm

(Jumping in in the middle, end if it were ...)

Right, dickvl's does not work in FF4, but does in FF3.5 (that I tried).

> "stuck in minimized"

If by that you mean that windows open "minimized" (or as I call them "dead windows") then I was able to edit sessionstore.json (backup first, & after exiting your browser) to "fix" the way things opened.

I set all "screenX":"x" & "screenY":"x" to "0", & set all "sizemode":"xxx" to "maximized".

I think that's what I did, it's been a while. And after some time, things change - anyhow :|.
(I used Vim in a not so automated fashion, but got it done. Suppose other editors would work too. The original .json has no EOL marker. When you save the file with vim, it puts one there, but doesn't seem to hurt anything by doing so.)

(AFAIK) sizemode can take three parameters; normal, minimized, maximized. Not exactly sure what the differences are.
https://developer.mozilla.org/en/XUL/Attribute/sizemode

Then there is the $32,000 question which also may relate, Bug 433675 - Firefox main window moves to -32000/-32000 position when <ALT>+<TAB> -bing ?
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript

dickvl

User avatar
 
Posts: 52642
Joined: July 18th, 2005, 3:25 am

Post Posted May 4th, 2011, 6:57 pm

Try these in Firefox 4:
Code: Select all
javascript:(function(){var E=document.getElementsByTagName('PRE')[0],T=E.innerHTML,i=0,t='',R=/[^:]\{"entries":\[\{("url":"[^"]*")(\,"title":"[^"]*"){0,1}/g;while(R.exec(T)){t+='['+(++i)+']:'+RegExp.$1+RegExp.$2+'<br>';}with(window.open().document){write(t);close();}})();


Code: Select all
javascript:(function(){var E=document.getElementsByTagName('PRE')[0],T=E.innerHTML,i=0,t='',R=/"state":\{"entries":\[\{("url":"[^"]*")(\,"title":"[^"]*"){0,1}/g;while(R.exec(T)){t+='['+(++i)+']:'+RegExp.$1+RegExp.$2+'<br>';}with(window.open().document){write(t);close();}})();


Versions with clickable links:
Code: Select all
javascript:(function(){var D=document,H,i=j=0,P=D.getElementsByTagName('PRE'),t='',R=/[^:]\{"entries":\[\{("url":"([^"]*)")\,("title":"([^"]*)"){0,1}/g,T,U;for(j=0;E=P[j];j++){H=E.innerHTML;while(R.exec(H)){U=RegExp.$2;T=RegExp.$4;if(T.length==0){T=U;}t+='<b>['+(++i)+']</b> <a href='+U+'>'+T+' ('+U+')<\/a><br>';}}with(window.open().document){write(t);close()}})();


Code: Select all
javascript:(function(){var D=document,H,i=j=0,P=D.getElementsByTagName('PRE'),t='',R=/"state":\{"entries":\[\{("url":"([^"]*)")\,("title":"([^"]*)"){0,1}/g,T,U;for(j=0;E=P[j];j++){H=E.innerHTML;while(R.exec(H)){U=RegExp.$2;T=RegExp.$4;if(T.length==0){T=U;}t+='<b>['+(++i)+']</b> <a href='+U+'>'+T+' ('+U+')<\/a><br>';}}with(window.open().document){open();close();body.innerHTML=t;}})();
Last edited by dickvl on May 18th, 2011, 2:43 pm, edited 1 time in total.

therube

User avatar
 
Posts: 19678
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted May 5th, 2011, 4:33 pm

Like a charm :-).
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript

mspmspmsp
Guest
 

Post Posted June 7th, 2011, 3:14 am

dickvl, that code worked perfectly but i just wondered whether there's a way to recover past session restores that have been within other session restores?

dickvl

User avatar
 
Posts: 52642
Joined: July 18th, 2005, 3:25 am

Post Posted June 7th, 2011, 5:05 pm

No. Firefox keeps only one file sessionstore.js and if links are not in that file then they are lost. You can try the history if you haven't deleted that.

appreciative non-coder
Guest
 

Post Posted June 9th, 2011, 1:54 am

dickvl you are the man!

Oto
Guest
 

Post Posted September 21st, 2011, 6:47 am

Strange but the smae bookmarklet stopped working in Firefox 6. What is the problem?

ACLMB
Guest
 

Post Posted January 8th, 2012, 3:49 pm

Any update on this for Firefox 8, or another solution? I've had a few crashes with the sessionstore file always being fine, but now it seems to have corrupted and I was several 'restore sessions' deep...messy browsing habit, I know, but hard to resist!

When I open the restore session window I just get an empty box where the links usully are with the 'restore' button greyed out. My laptop was running quite a few programs when I reopened FF and it was very slow and stall-y about it, so think the corruption may have occurred at the opening rather than the shutdown? When I try to rename the js file to js.txt and open it manually I just get a line of code at the top of the browser, plus the bookmarklet previously doesn't do anything. Also tried renaming the sessionstore.bak file and using that, but no dice.

Any help? Sorry if I've missed something obvious!

dickvl

User avatar
 
Posts: 52642
Joined: July 18th, 2005, 3:25 am

Post Posted January 30th, 2012, 6:51 pm

The bookmarklets that I posted above should still work in current Firefox releases, but you need to create a bookmark with the code as the location to run the code.
You can't run JavaScript code via the location bar anymore and it also doesn't work via the Scratchpad or the command line of the Web Console.

therube

User avatar
 
Posts: 19678
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted January 31st, 2012, 6:44 pm

Error console say something of "Error: Security error = NS_ERROR_DOM_SECURITY_ERR ...".
Guess that's the bugger in the ointment.

---

This may have some relevance: JSONView, is a Firefox extension that helps you view JSON documents in the browser.

I only looked at it for a moment the other day.
It presents a (bit) more readable version of my sessionstore.json (in browser), which I then proceed to Save As 'text'.
(And that's as far as I got with it - so far. Suppose you could grep & fairly quickly get something useful? Though you could grep the .json directly too, just that it can be a bit of a pain.)

Took quite a bit of time to render my sessionstore.json (.js for you FF types) file of ~2 MB on my very modest computer, but eventually finished.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript

dickvl

User avatar
 
Posts: 52642
Joined: July 18th, 2005, 3:25 am

Post Posted February 1st, 2012, 5:22 am

That is what I wrote above: it also doesn't work via the Scratchpad or the command line of the Web Console

You need to create a bookmark with the code and run that bookmark. That works for me.

Frebu
Guest
 

Post Posted March 17th, 2012, 3:37 am

For the life of me I cant get these codes to do anything but pull up a single line of that directs me to about:sessionrestore. Im unsure of what exactly I am messing up but its driving me crazy as this seems to be the only option other then looking though the file section by section. I created the book mark, opened the sessionstore.js in firefox used the bookmarks, the first one pulls up the one line of that directs me to sessionrestore and the other one leaves me with a blank page. What exactly am I doing wrong? Or do these not work with the current version of firefox?

Return to Firefox Support


Who is online

Users browsing this forum: Bing [Bot] and 6 guests