Bug 1817680 - Repeat GC when needed; r=dom-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D188561
This commit is contained in:
Jan Varga 2023-09-21 16:08:12 +00:00
Родитель 84fe257012
Коммит c39c786d05
2 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -313,7 +313,11 @@ function scheduleGC() {
function* assertEventuallyWithGC(conditionFunctor, message) {
const maxGC = 100;
for (let i = 0; i < maxGC; ++i) {
if (conditionFunctor()) {
let result =
conditionFunctor.constructor.name === "GeneratorFunction"
? yield* conditionFunctor()
: conditionFunctor();
if (result) {
ok(true, message + " (after " + i + " garbage collections)");
return;
}

Просмотреть файл

@ -93,10 +93,15 @@
// Flush pending file deletions before checking usage.
flushPendingFileDeletions();
getCurrentUsage(grabFileUsageAndContinueHandler);
let endUsage = yield undefined;
yield* assertEventuallyWithGC(
function* () {
getCurrentUsage(grabFileUsageAndContinueHandler);
let endUsage = yield undefined;
is(endUsage, startUsage, "OS files deleted");
return endUsage == startUsage;
},
"OS files deleted"
);
finishTest();
}