Unable to restore tabs using nsiSessionStore

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Unable to restore tabs using nsiSessionStore

Unread post by moonbat » 2021-03-15, 13:31

I'm porting the Priv8 extension to implement containers as an overlay extension (original was restartless). Part of it uses the session store API to restore sandbox tabs after they are closed or after a browser restart. I've mostly followed the original code for this but it doesn't work. After calling nsiSessionStore's setTabValue() if I immediately call getTabValue(), I can see that the data was saved, but when I call it where I need it, i.e. when restoring a tab in the SSTabRestoring event handler, it returns a zero length string.
Session store is initialized as

Code: Select all

sessionStore : Cc["@mozilla.org/browser/sessionstore;1"].
	                       getService(Ci.nsISessionStore)
and later called this way.

Code: Select all

sessionStore.setTabValue(aTab, this.TAB_DATA_IDENTIFIER, JSON.stringify({ straitjacket: aId }));
In the SSTabRestoring handler however,

Code: Select all

restoreTab : function(aTab) {
	  let data = sessionStore.getTabValue(aTab, this.SJ_TAB_IDENTIFIER);
	 Console.log("restore data length is "+data.length);
data length is always returned as zero.
The only thing I can think of is that the tab being queried isn't the same as the one saved, somehow. Is there a way to verify that I am checking the correct tab? AFAIK the event target of the SSRestoring handler ought to return the correct tab.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
opus_27
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2020-06-16, 13:29

Re: Unable to restore tabs using nsiSessionStore

Unread post by opus_27 » 2021-03-15, 15:41

Are you sure the value of

Code: Select all

this.SJ_TAB_IDENTIFIER
in your getTabValue call is the same as the value of

Code: Select all

this.TAB_DATA_IDENTIFIER
in your setTabValue call?

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Unable to restore tabs using nsiSessionStore

Unread post by moonbat » 2021-03-15, 15:51

damn..I'll show myself out now :oops:

On the bright side, this is the last bit that was left for the extension to work and now I can start with the extra fittings.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

New Tobin Paradigm

Re: Unable to restore tabs using nsiSessionStore

Unread post by New Tobin Paradigm » 2021-03-15, 16:00

moonbat wrote:
2021-03-15, 15:51
damn..I'll show myself out now :oops:
STAY WHERE YOU ARE!
YOU WILL FINISH THE EX-TEN-SION IMMEDIATELY!

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Unable to restore tabs using nsiSessionStore

Unread post by moonbat » 2021-03-15, 23:32

Oh I will. It's going to be the greatest extension ever after I make Priv8 great again :mrgreen:
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

Locked