Bug 1618483 - Have a test to ensure the behavior between QMS::ClearClient and localStorage; r=dom-workers-and-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D64550

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Tung 2020-02-27 12:28:13 +00:00
Родитель cb5aed4e04
Коммит b578ccf77b
3 изменённых файлов: 56 добавлений и 0 удалений

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

@ -215,6 +215,16 @@ function reset(callback) {
return request;
}
function resetClient(principal, client) {
let request = Services.qms.resetStoragesForPrincipal(
principal,
"default",
client
);
return request;
}
function persist(principal, callback) {
let request = SpecialPowers._getQuotaManager().persist(principal);
request.callback = callback;

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

@ -0,0 +1,45 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
async function testSteps() {
const principal = getPrincipal("https://example.com");
info("Setting prefs");
SpecialPowers.setBoolPref("dom.storage.next_gen", true);
Services.prefs.setBoolPref("dom.storage.client_validation", false);
info("Clearing");
let request = clear();
await requestFinished(request);
info("Creating simpledb");
let database = getSimpleDatabase(principal);
request = database.open("data");
await requestFinished(request);
info("Creating localStorage");
let storage = Services.domStorageManager.createStorage(
null,
principal,
principal,
""
);
storage.setItem("key", "value");
info("Clearing simpledb");
request = clearClient(principal, "default", "sdb");
await requestFinished(request);
info("Resetting localStorage");
request = resetClient(principal, "ls");
await requestFinished(request);
}

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

@ -33,6 +33,7 @@ support-files =
[test_initTemporaryStorage.js]
[test_listOrigins.js]
[test_originWithCaret.js]
[test_orpahnedQuotaObject.js]
[test_persist.js]
[test_persist_eviction.js]
[test_persist_globalLimit.js]