Utils.sys.mjs (891B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 import { 7 getCachedUsageForOrigin, 8 resetStorage, 9 } from "resource://testing-common/dom/quota/test/modules/StorageUtils.sys.mjs"; 10 11 export const Utils = { 12 async getCachedOriginUsage() { 13 const principal = Cc["@mozilla.org/systemprincipal;1"].createInstance( 14 Ci.nsIPrincipal 15 ); 16 const result = await getCachedUsageForOrigin(principal); 17 return result; 18 }, 19 20 async shrinkStorageSize(size) { 21 Services.prefs.setIntPref( 22 "dom.quotaManager.temporaryStorage.fixedLimit", 23 size 24 ); 25 26 const result = await resetStorage(); 27 return result; 28 }, 29 30 async restoreStorageSize() { 31 Services.prefs.clearUserPref( 32 "dom.quotaManager.temporaryStorage.fixedLimit" 33 ); 34 35 const result = await resetStorage(); 36 return result; 37 }, 38 };