1
0
Fork 0
firefox/dom/quota/test/modules/system/Utils.sys.mjs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

38 lines
891 B
JavaScript

/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
import {
getCachedUsageForOrigin,
resetStorage,
} from "resource://testing-common/dom/quota/test/modules/StorageUtils.sys.mjs";
export const Utils = {
async getCachedOriginUsage() {
const principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(
Ci.nsIPrincipal
);
const result = await getCachedUsageForOrigin(principal);
return result;
},
async shrinkStorageSize(size) {
Services.prefs.setIntPref(
"dom.quotaManager.temporaryStorage.fixedLimit",
size
);
const result = await resetStorage();
return result;
},
async restoreStorageSize() {
Services.prefs.clearUserPref(
"dom.quotaManager.temporaryStorage.fixedLimit"
);
const result = await resetStorage();
return result;
},
};