Page MenuHomePhabricator

Enable ResourceLoader module storage on Firefox 69+
Open, NormalPublic

Description

In most browsers Resource Loader caches modules in LocalStorage in order to not rerequest the same modules on every page-load. However, this is not the case for Firefox, as Firefox used to apply the allowed storage quota per domain, not per origin. Thus, the use of LocalStorage was disabled for Firefox in T66721: mw.loader.store should not occupy all of localStorage.

However, with Firefox 69 this quota should now be per origin: https://bugzilla.mozilla.org/show_bug.cgi?id=1064466#c18. So it should be possible to reenable the use LocalStorage again for users with a current Firefox.

I'll provide a patch as basis for discussion.

Details

Related Gerrit Patches:

Event Timeline

Michael created this task.Oct 18 2019, 12:07 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 18 2019, 12:07 PM

Change 544183 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[mediawiki/core@master] Enable LocalStorage for Firefox >= 69

https://gerrit.wikimedia.org/r/544183

Even though the bug mentioned above indicates that the new LocalStorage should be available in Firefox 69, I would feel better if we were able to actually verify that.
However, I'm not sure how to do so. Any ideas?

Aklapper renamed this task from Enable LocalStorage for FireFox 69.0+ to Enable LocalStorage for Firefox 69.0+.Oct 19 2019, 12:54 PM

@Michael You could try something like the following:

localStorage.clear();
localStorage.setItem('mykey-a', '1234567890'.repeat(1e5));
localStorage.setItem('mykey-b', '1234567890'.repeat(1e5));
localStorage.setItem('mykey-c', '1234567890'.repeat(1e5));
// … etc.

from the console on https://www.wikipedia.org in Firefox 68 and see how far you can get before it throws with "Storage quota exceeded". I expect it to be full after around 6 or 7 such keys being stored. Then navigate to "English" / https://en.wikipedia.org and repeat the same.

If the storage quota is shared (like it used to) then you will not be able to store even 1 such key after localStorage.clear() on en.wikipedia.org, the same way it was denied from www.wikipedia.org.

On the newer Firefox versions, you will be able to store roughly the same number of keys on both independently. You could use something like https://browserstack.com to access the older browser versions (various open-source orgs have been given accounts there, don't know about WMDE).

Krinkle renamed this task from Enable LocalStorage for Firefox 69.0+ to Enable ResourceLoader module storage on Firefox 69+.Sat, Oct 19, 7:34 PM
Krinkle assigned this task to Michael.
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle moved this task from Inbox to Blocked or Needs-CR on the Performance-Team board.
Restricted Application added a project: User-Michael. · View Herald TranscriptSat, Oct 19, 7:35 PM
Krinkle triaged this task as Normal priority.Sat, Oct 19, 7:35 PM
Krinkle added a subscriber: aaron.Mon, Oct 21, 7:50 PM
Schnark added a subscriber: Schnark.Sat, Nov 2, 9:00 AM

If I understand https://bugzilla.mozilla.org/show_bug.cgi?id=1592136 correctly, this has been reverted temporarily in FF 70.0.1.

Yeah, I later noticed that this config option seemed to be only active by default in the 69 beta, not in the actual release and wanted to investigate further, but didn't get around to it so far.
At least now we have enough time to get the implementation right without "loosing time" to Wikipedia being less performative than it could be on Firefox.