gecko-dev/toolkit/components/antitracking/test/browser/browser_storageAccessRemovalNavigateTopframe.js
Victor Porof 4a06c925ac Bug 1561435 - Format toolkit/components/, a=automatic-formatting
# ignore-this-changeset

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

--HG--
extra : source : b5be5b4f4b47c256e28a29f665dc754f6407ee7f
2019-07-05 11:14:05 +02:00

45 lines
1.3 KiB
JavaScript

/* import-globals-from antitracking_head.js */
AntiTracking.runTest(
"Storage Access is removed when topframe navigates",
// blocking callback
async _ => {
/* import-globals-from storageAccessAPIHelpers.js */
await noStorageAccessInitially();
},
// non-blocking callback
async _ => {
/* import-globals-from storageAccessAPIHelpers.js */
if (allowListed) {
await hasStorageAccessInitially();
} else {
await noStorageAccessInitially();
}
/* import-globals-from storageAccessAPIHelpers.js */
let [threw, rejected] = await callRequestStorageAccess();
ok(!threw, "requestStorageAccess should not throw");
ok(!rejected, "requestStorageAccess should be available");
},
// cleanup function
async _ => {
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
resolve()
);
});
},
null, // extra prefs
false, // no window open test
false, // no user-interaction test
0, // no blocking notifications
false, // run in normal window
null, // no iframe sandbox
"navigate-topframe", // access removal type
// after-removal callback
async _ => {
/* import-globals-from storageAccessAPIHelpers.js */
await noStorageAccessInitially();
}
);