Bug 1733107 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

`nsIQuotaManagerService::clearStoragesForPrincipal` has an option to set "clearAll". Clera all here means that an origin prefix will be used so a full repository traversal is needed in that case.

However, when we clear exact origin, we don't have to traverse entire repository.

I checked current callers in JS:
https://searchfox.org/mozilla-central/search?q=clearstoragesforprincipal%28&path=&case=false&regexp=false

SiteDataManager passes clearAll=true
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/browser/modules/SiteDataManager.jsm#448
but that shouldn't be used during shutdown

ClearDataService passes clearAll=false
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/toolkit/components/cleardata/ClearDataService.jsm#515

I believe the latter is used during shutdowm, so if we can avoid the repository traversal, it should help with reducing shutdown hangs.

I think we should split clearStoragesForPrincipal into two separate methods (and split also the op in the parent process which handles it), one for simple/exact origin clearing and another one for the prefix.
`nsIQuotaManagerService::clearStoragesForPrincipal` has an option to set "clearAll". Clear all here means that an origin prefix will be used, so a full repository traversal is needed in that case.

However, when we clear exact origin, we don't have to traverse entire repository.

I checked current callers in JS:
https://searchfox.org/mozilla-central/search?q=clearstoragesforprincipal%28&path=&case=false&regexp=false

SiteDataManager passes clearAll=true
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/browser/modules/SiteDataManager.jsm#448
but that shouldn't be used during shutdown

ClearDataService passes clearAll=false
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/toolkit/components/cleardata/ClearDataService.jsm#515

I believe the latter is used during shutdowm, so if we can avoid the repository traversal, it should help with reducing shutdown hangs.

I think we should split clearStoragesForPrincipal into two separate methods (and split also the op in the parent process which handles it), one for simple/exact origin clearing and another one for the prefix.
`nsIQuotaManagerService::clearStoragesForPrincipal` has an option to set "clearAll". Clear all here means that an origin prefix will be used, so a full repository traversal is needed in that case.

However, when we clear exact origin, we don't have to traverse entire repository.

I checked current callers in JS:
https://searchfox.org/mozilla-central/search?q=clearstoragesforprincipal%28&path=&case=false&regexp=false

SiteDataManager passes clearAll=true
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/browser/modules/SiteDataManager.jsm#448
but that shouldn't be used during shutdown

ClearDataService passes clearAll=false
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/toolkit/components/cleardata/ClearDataService.jsm#515

I believe the latter is used during shutdowm in some cases, so if we can avoid the repository traversal, it should help with reducing shutdown hangs.

I think we should split clearStoragesForPrincipal into two separate methods (and split also the op in the parent process which handles it), one for simple/exact origin clearing and another one for the prefix.
`nsIQuotaManagerService::clearStoragesForPrincipal` has an option to set "clearAll". Clear all here means that an origin prefix will be used, so a full repository traversal is needed in that case.

However, when we clear exact origin (clearAll=false), we don't have to traverse entire repository.

I checked current callers in JS:
https://searchfox.org/mozilla-central/search?q=clearstoragesforprincipal%28&path=&case=false&regexp=false

SiteDataManager passes clearAll=true
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/browser/modules/SiteDataManager.jsm#448
but that shouldn't be used during shutdown

ClearDataService passes clearAll=false
https://searchfox.org/mozilla-central/rev/79f93e7a8b9aa1903f1349f2dd46fb71596f2ae9/toolkit/components/cleardata/ClearDataService.jsm#515

I believe the latter is used during shutdown in some cases, so if we can avoid the repository traversal, it should help with reducing shutdown hangs (but not only that, some clear origin operations will be faster in general).

I think we should split clearStoragesForPrincipal into two separate methods (and split also the operation in the parent process which handles it), one for simple/exact origin clearing and another one for the clearing by prefix.

Back to Bug 1733107 Comment 0