mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Differential Revision: https://phabricator.services.mozilla.com/D24029 --HG-- rename : toolkit/components/antitracking/test/browser/head.js => toolkit/components/antitracking/test/browser/antitracking_head.js extra : moz-landing-system : lando
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
/* import-globals-from antitracking_head.js */
|
|
|
|
gFeatures = "noopener";
|
|
|
|
AntiTracking.runTest("Blocking in the case of noopener windows",
|
|
async _ => {
|
|
is(window.localStorage, null, "LocalStorage is null");
|
|
try {
|
|
localStorage.foo = 42;
|
|
ok(false, "LocalStorage cannot be used!");
|
|
} catch (e) {
|
|
ok(true, "LocalStorage cannot be used!");
|
|
is(e.name, "TypeError", "We want a type error message.");
|
|
}
|
|
},
|
|
async phase => {
|
|
switch (phase) {
|
|
case 1:
|
|
localStorage.foo = 42;
|
|
ok(true, "LocalStorage is allowed");
|
|
break;
|
|
case 2:
|
|
is(window.localStorage, null, "LocalStorage is null");
|
|
try {
|
|
localStorage.foo = 42;
|
|
ok(false, "LocalStorage cannot be used!");
|
|
} catch (e) {
|
|
ok(true, "LocalStorage cannot be used!");
|
|
is(e.name, "TypeError", "We want a type error message.");
|
|
}
|
|
break;
|
|
}
|
|
},
|
|
async _ => {
|
|
await new Promise(resolve => {
|
|
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
|
|
});
|
|
},
|
|
null, true, false);
|