Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: browser/components/places/tests/unit/xpcshell.toml
/* Any copyright is dedicated to the Public Domain.
/**
* Tests that blocked sites are caught by InteractionsBlocklist.
*/
ChromeUtils.defineESModuleGetters(this, {
InteractionsBlocklist: "resource:///modules/InteractionsBlocklist.sys.mjs",
});
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(
"mochi.test is blocklisted."
);
InteractionsBlocklist.removeRegexFromBlocklist("^(https?:\\/\\/)?mochi.test");
Assert.ok(
"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.`
);
}
});