Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
/**
* Tests that blocked sites are caught by InteractionsBlocklist.
*/
ChromeUtils.defineESModuleGetters(this, {
});
let BLOCKED_URLS = [
];
let ALLOWED_URLS = [
];
// Tests that initializing InteractionsBlocklist loads the regexes from the
// customBlocklist pref on initialization. This subtest should always be the
// first one in this file.
add_task(async function blockedOnInit() {
Services.prefs.setStringPref(
"places.interactions.customBlocklist",
'["^(https?:\\\\/\\\\/)?mochi.test"]'
);
Assert.ok(
InteractionsBlocklist.isUrlBlocklisted("https://mochi.test"),
"mochi.test is blocklisted."
);
InteractionsBlocklist.removeRegexFromBlocklist("^(https?:\\/\\/)?mochi.test");
Assert.ok(
!InteractionsBlocklist.isUrlBlocklisted("https://mochi.test"),
"mochi.test is not blocklisted."
);
});
add_task(async function test() {
for (let url of BLOCKED_URLS) {
Assert.ok(
InteractionsBlocklist.isUrlBlocklisted(url),
`${url} is blocklisted.`
);
}
for (let url of ALLOWED_URLS) {
Assert.ok(
!InteractionsBlocklist.isUrlBlocklisted(url),
`${url} is not blocklisted.`
);
}
});