Opened 8 months ago

Last modified 4 months ago

#32624 new defect

localStorage is not shared between tabs

Reported by: nDe15o Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: ff78-esr-will-have, TorBrowserTeam202007
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Steps to reproduce:

  1. open some web site
  2. open the same page in another tab
  3. open Web Console in both tabs
  4. set localStorage['test']=1 in the first tab
  5. try to get the value of localStorage['test'] in the second tab.

Result:
The value is undefined.

Expected result:
The value is 1.

Tor Browser 9.0.1. Tested on onion sites with enabled js.

Please, please fix this, it is very important, I've developed an app that relies on this functionality and I didn't expect that there will such problems with localStorage. Please don't tell me that this behavior is intentional. It shouldn't be for the same origin.

Child Tickets

Change History (14)

comment:1 Changed 8 months ago by nDe15o

It's strange: if after step 5 I do localStorage['test']=2 in the second tab, the value also changes in the first tab to "2".

comment:2 Changed 8 months ago by nDe15o

But if I close the second tab and open the page in another tab again, there's again no value in this new tab.

comment:3 Changed 8 months ago by nDe15o

I've found this issue https://bugzilla.mozilla.org/show_bug.cgi?id=1453699
https://bugzilla.mozilla.org/show_bug.cgi?id=1453699#c11
I tried to set dom.storage.next_gen to true in about:config and restarted Tor Browser. Now everything is ok.
Please add this to the default config of Tor Browser.

comment:4 Changed 8 months ago by Thorin

This is not a TB only issue

Test page: use https://ghacksuserjs.github.io/TorZillaPrint/sanitizing.html

STR

  • test 1: new identity, open in two different tabs
  • test 2: new identity, open in one tab and hit F5 (refresh) .. and after that result hit F5 again ... etc
  • test 3: new identity, open in one tab and hit Ctrl-F5 (hard refresh) .. keep testing it
  • test 4: new identity, open in one tab and hit the re-run buttom

RESULTS

  • test 1: 2 tabs: localStorage key and value is not found
  • test 2: 1 tab + F5: intermittent results
  • test 3: 1 tab + ctrl-F5: intermittent results
  • test 4: 1 tab + re-rerun button: localStorage key and value is found

I had this issue with sanitizing (in Firefox, portable) that started in FF62 (from memory, but I never picked up on it until FF68) and tested FF62 thru to current, literally a thousand plus tests over time especially in FF68+ (and I still test every day when I flick open various FF versions for other tests), and had quite a bit of an email thread with Johann Hofmann about it.

long story short: localStorage is a bit wonky (async arbitrary timing), and the fix that solved it all was to move to LSNG (dom.storage.next_gen)

---

aaaaaand... just to confirm it... doing test 1 (2 tabs)

Firefox (nightly)

  • LSNG = false, new pb window, LS does not persist across tabs
  • LSNG = true (default), new pb window, LS does persist across tabs

TB

  • LSNG = false (default), new id, LS does not persist across tabs
  • LSNG = true, new id, LS does persist across tabs
  • don't forget to change LSNG back to default

The thing is next_gen was not flipped on until FF70, and then they flipped it back in 70.0.1 due to issues that AFAIK shouldn't affect TB since it doesn't have persistent data.

I don't think LSNG = true would necessarily be ready for ESR68, but might be perfectly fine given TB's setup (PB mode etc). I'll ping Johann

Last edited 8 months ago by Thorin (previous) (diff)

comment:5 Changed 8 months ago by Thorin

Priority: Very HighMedium
Severity: CriticalNormal

comment:6 Changed 8 months ago by Thorin

FYI: testing in TB 8.5.5, the same issue exists: i.e test 1 (2 tabs), and obviously next_gen doesn't exist in ESR60. It's not a regression, LSNG is an enhancement, and people have been living with this "bug" in TB and Firefox for a long, long time. IMO, the only question is when does TB get LSNG: next ESR or earlier? :)

comment:7 Changed 8 months ago by nDe15o

It would be really great to have it earlier :)
Thank you.

comment:8 Changed 8 months ago by pili

Keywords: ff78-esr-will-have added

comment:9 in reply to:  4 Changed 8 months ago by Thorin

Replying to Thorin:

The thing is next_gen was not flipped on until FF70, and then they flipped it back in 70.0.1 due to issues that AFAIK shouldn't affect TB since it doesn't have persistent data.

I don't think LSNG = true would necessarily be ready for ESR68, but might be perfectly fine given TB's setup (PB mode etc). I'll ping Johann

OK, so Johann has replied, and said "I don't think I have any input on [this tor] ticket, let me know if you need me to forward it to folks who are actually working on LSNG

So I'll leave it up to you guys if we just wait until the next ESR, or if you want me to ask Johann to ask the right folks to let us know if it's OK to flip in Tor Browser

comment:10 Changed 8 months ago by pili

Keywords: TorBrowserTeam202001 added

Let's discuss this in January next year

comment:11 Changed 7 months ago by sysrqb

Keywords: TorBrowserTeam202002 added; TorBrowserTeam202001 removed

After reading through 1453699, LSNG is only enabled in Beta and Nightly at this moment. Unfortunately, I am not optimistic about this being available in 68ESR. I doubt Mozilla will backport the stabilized version to the ESR. We may be able to audit the version of LSNG that exists in 68ESR, but I don't know when we'll be able to do that. We'll likely wait until Mozilla believe LSNG is stable, at least.

Thorin, thanks for investigating this!

comment:12 Changed 5 months ago by pili

Keywords: TorBrowserTeam202003 added; TorBrowserTeam202002 removed

We are no longer in February, moving tickets

comment:13 Changed 4 months ago by pili

Keywords: TorBrowserTeam202004 added; TorBrowserTeam202003 removed

We are no longer in March

comment:14 Changed 4 months ago by pili

Keywords: TorBrowserTeam202007 added; TorBrowserTeam202004 removed

Moving to July

Note: See TracTickets for help on using tickets.