Closed
Bug 1495687
Opened 6 years ago
Closed 6 years ago
Have a method in nsIQuotaManagerService to initialize temporary storage
Categories
(Core :: Storage: Quota Manager, enhancement, P2)
Core
Storage: Quota Manager
Tracking
()
RESOLVED
FIXED
mozilla64
Tracking | Status | |
---|---|---|
firefox64 | --- | fixed |
People
(Reporter: tt, Assigned: tt)
References
Details
Attachments
(1 file, 5 obsolete files)
Add a new method to nsIQuotaManagerService called initTemporaryStorage() per bug 389378 comment#c24
Assignee | ||
Comment 1•6 years ago
|
||
(In reply to Tom Tung [:tt] from comment #0) > Add a new method to nsIQuotaManagerService called initTemporaryStorage() per > bug 389378 comment#c24 bug 1389378 comment#24
Assignee | ||
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Comment on attachment 9013611 [details] [diff] [review] bug1495678.patch Review of attachment 9013611 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/quota/ActorsParent.cpp @@ +7437,5 @@ > +{ > + AssertIsOnIOThread(); > + > + AUTO_PROFILER_LABEL("InitTemporaryStorageOp::DoDirectoryWork", OTHER); > + I would also call this: aQuotaManager->AssertStorageIsInitialized(); ::: dom/quota/test/unit/test_initTemporaryStorage.js @@ +3,5 @@ > + * http://creativecommons.org/publicdomain/zero/1.0/ > + */ > + > +async function testSteps() > +{ I have to think about this test a bit.
Attachment #9013611 -
Flags: feedback+
Assignee | ||
Comment 4•6 years ago
|
||
Addressed feedback and modifying comments in the test. Probably need to modifying the test as well. I guess it probably needs to be verified the usage and limits are checked if it's possible or some behaviors in InitializeRepository()?
Attachment #9013611 -
Attachment is obsolete: true
Comment 5•6 years ago
|
||
Comment on attachment 9013692 [details] [diff] [review] bug1495687-v2.patch Review of attachment 9013692 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/quota/ActorsParent.cpp @@ +7440,5 @@ > + AUTO_PROFILER_LABEL("InitTemporaryStorageOp::DoDirectoryWork", OTHER); > + > + aQuotaManager->AssertStorageIsInitialized(); > + > + aQuotaManager->EnsureTemporaryStorageIsInitialized(); The rv should be checked: if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } ::: dom/quota/test/unit/test_initTemporaryStorage.js @@ +5,5 @@ > + > +async function testSteps() > +{ > + const principal = getPrincipal("https://foo.example.com"); > + const metadataDir = "storage/default/https+++foo.example.com/.metadata-v2"; What about this: const originDirPath = "storage/default/https+++foo.example.com"; const metadataFileName = ".metadata-v2"; then after the clearing, just create the origin directory: let originDir = getRelativeFile(originPath); originDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8)); now call initTemporaryStorage() and check the metadata: let metadataFile = originDir.clone(); metadataFile.append(metadataFileName); exists = metadataFile.exists(); ...
Assignee | ||
Comment 6•6 years ago
|
||
(In reply to Jan Varga [:janv] from comment #5) Thanks for the feedback! > > + aQuotaManager->EnsureTemporaryStorageIsInitialized(); > > The rv should be checked: > if (NS_WARN_IF(NS_FAILED(rv))) { > return rv; > } Ah, I forgot that. Will do. > ::: dom/quota/test/unit/test_initTemporaryStorage.js > @@ +5,5 @@ > > + > > +async function testSteps() > > +{ > > + const principal = getPrincipal("https://foo.example.com"); > > + const metadataDir = "storage/default/https+++foo.example.com/.metadata-v2"; > > What about this: > const originDirPath = "storage/default/https+++foo.example.com"; > const metadataFileName = ".metadata-v2"; > > then after the clearing, just create the origin directory: > let originDir = getRelativeFile(originPath); > originDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8)); > > now call initTemporaryStorage() and check the metadata: > let metadataFile = originDir.clone(); > metadataFile.append(metadataFileName); > exists = metadataFile.exists(); > ... I see. So that it's much faster (reducing IPC round-trip time) and I can remove the quirky code for creating an empty directory.
Comment 7•6 years ago
|
||
Comment on attachment 9013692 [details] [diff] [review] bug1495687-v2.patch Review of attachment 9013692 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/quota/test/unit/test_initTemporaryStorage.js @@ +9,5 @@ > + const metadataDir = "storage/default/https+++foo.example.com/.metadata-v2"; > + > + info("Clearing"); > + > + let request = clear(); Actually, the clearing is not needed here I think.
Assignee | ||
Comment 8•6 years ago
|
||
Addressed comments and revised the test
Attachment #9013692 -
Attachment is obsolete: true
Assignee | ||
Comment 9•6 years ago
|
||
Modified comments in the test
Attachment #9014306 -
Attachment is obsolete: true
Assignee | ||
Comment 10•6 years ago
|
||
Added an empty line back for the test
Attachment #9014308 -
Attachment is obsolete: true
Assignee | ||
Updated•6 years ago
|
Attachment #9014309 -
Flags: review?(jvarga)
Comment 11•6 years ago
|
||
Comment on attachment 9014309 [details] [diff] [review] bug1495687-v4.1.patch Review of attachment 9014309 [details] [diff] [review]: ----------------------------------------------------------------- Nice, thanks! ::: dom/quota/test/unit/test_initTemporaryStorage.js @@ +4,5 @@ > + */ > + > +/** > + * This test is mainly to verify initTemporaryStorage() does call > + * QuotaManager::EnsureTemporaryStorageIsInitialized() which restore the s/restore/restores Actually, we might want to test other aspects of EnsureTemporaryStorageIsInitialized() in future, so I would rephrase this as: This test is mainly to verify initTemporaryStorage() does call QuotaManager::EnsureTemporaryStorageIsInitialized() which does various things, for example, it restores the directory metadata if it's broken or missing.
Attachment #9014309 -
Flags: review?(jvarga) → review+
Assignee | ||
Comment 12•6 years ago
|
||
Thanks for the reviews! try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=5a4d9cdfad1c9112dd148e71bbb806a45a216bcc
Attachment #9014309 -
Attachment is obsolete: true
Attachment #9014326 -
Flags: review+
Comment 13•6 years ago
|
||
Pushed by shes050117@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/75a2cc138641 Introduce initTemporaryStorage to nsIQuotaManagerService for testing; r=janv
Comment 14•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/75a2cc138641
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•