Open Bug 1924680 Opened 1 year ago Updated 1 year ago

Handle unexpected origin directory in QuotaManager::EnsureTemporaryOriginIsInitializedInternal

Categories

(Core :: Storage: Quota Manager, defect, P2)

defect

Tracking

()

People

(Reporter: janv, Assigned: janv)

Details

QuotaManager::EnsureTemporaryOriginIsInitializedInternal currently assumes that if the origin directory already exists, it must have been noticed by temporary storage initialization, so an OriginInfo must have been created for it. It turns out, that's not always true and we can end up without initialized origin after calling the method. We learned about it in bug 1924658.

In theory, it's possible that an origin directory is manually copied into the repository, but that's not very likely.

However, it's possible that a clear operation failed to remove an origin directory, while the corresponding origin info has been destroyed:
https://searchfox.org/mozilla-central/rev/754074e05178e017ef6c3d8e30428ffa8f1b794d/dom/quota/OriginOperations.cpp#2507
So cached information about the origin won't be stored in the quota cache during shutdown.

After next startup, when quota information is loaded only from the database (not generated by scanning all origin directories), the origin won't get initialized as part of the temporary storage initialization, but when the origin is accessed for first time, QuotaManager::EnsureTemporaryOriginIsInitializedInternal will see there's already an origin directory and will assume it's been initialized already.

(In reply to Jan Varga [:janv] from comment #1)

However, it's possible that a clear operation failed to remove an origin directory, while the corresponding origin info has been destroyed:

https://treeherder.mozilla.org/jobs?repo=try&revision=76547374592488b0cc3ecec3b3281860d9a153c4

You need to log in before you can comment on or make changes to this bug.