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

Titles assigned to wrong windows after session restore #16

Closed
molexx opened this issue Sep 29, 2017 · 16 comments
Closed

Titles assigned to wrong windows after session restore #16

molexx opened this issue Sep 29, 2017 · 16 comments
Assignees
Labels

Comments

@molexx
Copy link

molexx commented Sep 29, 2017

For a clean test I created a new profile in FF Developer Edition 57.0b3 from aurora update channel.

Open three windows
In each window open a page you'll recognise - I just did google searches for 'window one', 'window two' and 'window three'
In each window open CrappyFireTab and set the title - I used 'win1', 'win2' and 'win3' - closing the plugin's config tab between each one otherwise pressing the toolbar button jumps to the already open one in the other window.
Quit Firefox.
Reopen firefox and press restore session. I've also tested by changing the settings to restore session by default.
The three windows appear, with their three google searches, but their CrappyFireTitle title seems to be randomly assigned.

@captnfab
Copy link
Owner

captnfab commented Oct 2, 2017

Thanks for your report, I'll investigate.

@captnfab
Copy link
Owner

captnfab commented Oct 2, 2017

Ok, I found the cause of the problem. When a session is restored, the windows are restored but their Id may change.
So, storing window's names / title patterns using window's id can't work.
Apparently, window.sessionId is the way to go, but those look empty…

@rsalmei
Copy link

rsalmei commented Nov 17, 2017

Hey! Thanks for the response in the mozilla review.
Just came here to vote for the issue. It should have a way to accomplish this... Good luck!

@captnfab captnfab modified the milestones: oli font, merdouille Nov 17, 2017
@Betlista
Copy link

FF 57.0 forced me to switch from FireTitle to Crappy and after FF restart (I have option "Show your windows and tabs from last time") all titles (except one) are gone :-(

@captnfab
Copy link
Owner

Yes. Windows naming on restore is broken. Any help is welcome.

@captnfab captnfab added the bug label Nov 23, 2017
@Betlista
Copy link

@captnfab Can you point me directly to part, in which it is storing/loading titles?

@captnfab
Copy link
Owner

captnfab commented Nov 24, 2017

Sure. The problem is actually pretty simple.

Loadding occurs here:

cur_win_name = result["win"+tab.windowId+"_name"] || result.def_win_name || default_options["win_name"];
window's Pattern/name are saved in the local storage as win+windowId+_name/pattern. Saving part occurs here:
browser.storage.local.set(prop_set);

Unfortunately, window's ids change upon restore. This means storing parameters that way can't work.
When I tried, the window.sessionId was a blank field, so it was unreliable too.

Hence, the problem is I don't know how to keep track of a window through session restoration…

@captnfab
Copy link
Owner

I think that the local storage is the wrong way to go.
Using sessions seems a much clearer approach: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/sessions

@captnfab
Copy link
Owner

Let me try to do something...

@captnfab captnfab self-assigned this Nov 24, 2017
@Betlista
Copy link

I do not see the problem with local storage... The problem is a unique identifier. I see few candidates in https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/Tab id or sessionId, can you try tab.sessionId instead of window.sessionId ? I know that you are doing it on window level, maybe you can do something like save id/sessionId of a first tab in every window...

@captnfab
Copy link
Owner

I've got it working. I'm doing some cleaning since I'm not really proud of the state of the code.
I'm also polishing the UI.
I'll try to push the new version today and upload it to mozilla addons website for review.

@eceprof
Copy link

eceprof commented Nov 25, 2017

Captnfab, you are fabulous. I just "upgraded" to Firefox Quantum and to my dismay lost the ability to use FireTitle, felt saved by Crappy FireTitle and then discovered the session restore problem!!! Imagine my relief when I opened this page and discovered at the end of it that you have found a solution the very day I looked for one. Thank you so much for being a lifesaver. FireTitle is second only to session restore to being my most needed and loved FireFox extension/capability.

@captnfab
Copy link
Owner

I've uploaded the new version to addons.mozilla.org and it is now pending review.

@captnfab
Copy link
Owner

@eceprof hehe, thanks!
The addons.mozilla.org version has been approved. Please tell me if it works well for you :)

@Betlista
Copy link

I'm also going to test immediately ;-)

@Betlista
Copy link

Tested with 24 windows and 236 tabs and worked as expected, thanks for fix!

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

No branches or pull requests

5 participants