function log(msg) { if (loggingEnabled) {
info(msg);
}
}
function is(a, b, msg) { Assert.equal(a, b, msg);
}
function ok(cond, msg) { Assert.ok(!!cond, msg);
}
function todo(cond, msg) {
todo_check_true(cond);
}
function run_test() {
runTest();
}
if (!this.runTest) { this.runTest = function () {
do_get_profile();
enableStorageTesting();
enableTesting();
// In order to support converting tests to using async functions from using // generator functions, we detect async functions by checking the name of // function's constructor. Assert.strictEqual( typeof testSteps, "function", "There should be a testSteps function"
); if (testSteps.constructor.name === "AsyncFunction") { // Do run our existing cleanup function that would normally be called by // the generator's call to finishTest().
registerCleanupFunction(function () {
resetStorageTesting();
resetTesting();
});
add_task(testSteps);
// Since we defined run_test, we must invoke run_next_test() to start the // async test.
run_next_test();
} else { Assert.strictEqual(
testSteps.constructor.name, "GeneratorFunction", "Unsupported function type"
);
function grabArgAndContinueHandler(arg) {
testGenerator.next(arg);
}
function continueToNextStep() {
executeSoon(function () {
testGenerator.next();
});
}
function continueToNextStepSync() {
testGenerator.next();
}
function enableTesting() {
SpecialPowers.setBoolPref( "dom.storage.enable_unsupported_legacy_implementation", false
);
}
function resetTesting() {
SpecialPowers.clearUserPref( "dom.storage.enable_unsupported_legacy_implementation"
);
}
function setGlobalLimit(globalLimit) {
SpecialPowers.setIntPref( "dom.quotaManager.temporaryStorage.fixedLimit",
globalLimit
);
}
function resetGlobalLimit() {
SpecialPowers.clearUserPref("dom.quotaManager.temporaryStorage.fixedLimit");
}
function storageInitialized(callback) {
let request = SpecialPowers._getQuotaManager().storageInitialized();
request.callback = callback;
return request;
}
function persistentStorageInitialized(callback) {
let request = SpecialPowers._getQuotaManager().persistentStorageInitialized();
request.callback = callback;
return request;
}
function temporaryStorageInitialized(callback) {
let request = SpecialPowers._getQuotaManager().temporaryStorageInitialized();
request.callback = callback;
return request;
}
function persistentOriginInitialized(principal, callback) {
let request =
SpecialPowers._getQuotaManager().persistentOriginInitialized(principal);
request.callback = callback;
return request;
}
function temporaryOriginInitialized(persistence, principal, callback) {
let request = SpecialPowers._getQuotaManager().temporaryOriginInitialized(
persistence,
principal
);
request.callback = callback;
return request;
}
function init(callback) {
let request = SpecialPowers._getQuotaManager().init();
request.callback = callback;
return request;
}
function initializePersistentStorage(callback) {
let request = SpecialPowers._getQuotaManager().initializePersistentStorage();
request.callback = callback;
return request;
}
function initTemporaryStorage(callback) {
let request = SpecialPowers._getQuotaManager().initTemporaryStorage();
request.callback = callback;
return request;
}
function initPersistentOrigin(principal, callback) {
let request =
SpecialPowers._getQuotaManager().initializePersistentOrigin(principal);
request.callback = callback;
function getFullOriginMetadata(persistence, principal, callback) { const request = SpecialPowers._getQuotaManager().getFullOriginMetadata(
persistence,
principal
);
request.callback = callback;
return request;
}
function clearClient(principal, client, persistence, callback) {
let request = SpecialPowers._getQuotaManager().clearStoragesForClient(
principal,
client,
persistence
);
request.callback = callback;
return request;
}
function clearOrigin(principal, persistence, callback) {
let request = SpecialPowers._getQuotaManager().clearStoragesForPrincipal(
principal,
persistence
);
request.callback = callback;
return request;
}
function clearOriginsByPrefix(principal, persistence, callback) {
let request = SpecialPowers._getQuotaManager().clearStoragesForOriginPrefix(
principal,
persistence
);
request.callback = callback;
return request;
}
function clearPrivateBrowsing(callback) {
let request =
SpecialPowers._getQuotaManager().clearStoragesForPrivateBrowsing();
request.callback = callback;
return request;
}
function resetClient(principal, client) {
let request = Services.qms.resetStoragesForClient(
principal,
client, "default"
);
return request;
}
function persist(principal, callback) {
let request = SpecialPowers._getQuotaManager().persist(principal);
request.callback = callback;
return request;
}
function persisted(principal, callback) {
let request = SpecialPowers._getQuotaManager().persisted(principal);
request.callback = callback;
return request;
}
function estimateOrigin(principal, callback) {
let request = SpecialPowers._getQuotaManager().estimate(principal);
request.callback = callback;
return request;
}
function listOrigins(callback) {
let request = SpecialPowers._getQuotaManager().listOrigins(callback);
request.callback = callback;
return request;
}
function getPersistedFromMetadata(readBuffer) { const persistedPosition = 8; // Persisted state is stored in the 9th byte
let view =
readBuffer instanceof Uint8Array ? readBuffer : new Uint8Array(readBuffer);
return !!view[persistedPosition];
}
function grabResultAndContinueHandler(request) {
testGenerator.next(request.result);
}
function grabUsageAndContinueHandler(request) {
testGenerator.next(request.result.usage);
}
function getUsage(usageHandler, getAll) {
let request = SpecialPowers._getQuotaManager().getUsage(usageHandler, getAll);
return request;
}
function getOriginUsage(principal) {
let request = Services.qms.getUsageForPrincipal(principal, function () {});
return request;
}
function getCachedOriginUsage(principal) {
let request = Services.qms.getCachedUsageForPrincipal(
principal, function () {}
);
return request;
}
function getCachedOriginUsage(principal) {
let request = Services.qms.getCachedUsageForPrincipal(principal);
return request;
}
function getCurrentUsage(usageHandler) {
let principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(
Ci.nsIPrincipal
);
let request = SpecialPowers._getQuotaManager().getUsageForPrincipal(
principal,
usageHandler
);
return request;
}
function getPrincipal(url, attr = {}) {
let uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(url);
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
Ci.nsIScriptSecurityManager
); return ssm.createContentPrincipal(uri, attr);
}
var SpecialPowers = {
getBoolPref(prefName) { returnthis._getPrefs().getBoolPref(prefName);
},
function installPackages(packageRelativePaths) { if (packageRelativePaths.length != 2) { thrownew Error("Unsupported number of package relative paths");
}
for (const packageRelativePath of packageRelativePaths) {
installPackage(packageRelativePath);
}
}
// Take current storage structure on disk and compare it with the expected // structure. The expected structure is defined in JSON and consists of a per // test package definition and a shared package definition. The shared package // definition should contain unknown stuff which needs to be properly handled // in all situations. function verifyStorage(packageDefinitionRelativePaths, key, sharedKey) { if (packageDefinitionRelativePaths.length != 2) { thrownew Error("Unsupported number of package definition relative paths");
}
function verifyEntries(entries, name, indent = "") {
log(`${indent}Verifying ${name} entries`);
indent += " ";
for (const entry of entries) { const maybeName = entry.name;
log(`${indent}Verifying entry ${maybeName}`);
let hasName = false;
let hasDir = false;
let hasEntries = false;
for (const property in entry) { switch (property) { case"note": case"todo": break;
ok(
!(!storageIsInitialized && persistentStorageIsInitialized), "Initialization status is consistent"
);
ok(
!(!storageIsInitialized && temporaryStorageIsInitialized), "Initialization status is consistent"
);
if (expectStorageIsInitialized) {
ok(storageIsInitialized, "Storage is initialized");
} else {
ok(!storageIsInitialized, "Storage is not initialized");
}
if (expectPersistentStorageIsInitialized) {
ok(persistentStorageIsInitialized, "Persistent storage is initialized");
} else {
ok(
!persistentStorageIsInitialized, "Persistent storage is not initialized"
);
}
if (expectTemporaryStorageIsInitialized) {
ok(temporaryStorageIsInitialized, "Temporary storage is initialized");
} else {
ok(!temporaryStorageIsInitialized, "Temporary storage is not initialized");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.