From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../rs-blocklist/test_blocklist_addonBlockURL.js | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_addonBlockURL.js (limited to 'toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_addonBlockURL.js') diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_addonBlockURL.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_addonBlockURL.js new file mode 100644 index 0000000000..b11d1329cd --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_addonBlockURL.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + * https://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// useMLBF=true case is covered by test_blocklist_mlbf.js +enable_blocklist_v2_instead_of_useMLBF(); + +const BLOCKLIST_DATA = [ + { + id: "foo", + guid: "myfoo", + versionRange: [ + { + severity: "3", + }, + ], + }, + { + blockID: "bar", + // we'll get a uuid as an `id` property from loadBlocklistRawData + guid: "mybar", + versionRange: [ + { + severity: "3", + }, + ], + }, +]; + +const BASE_BLOCKLIST_INFOURL = Services.prefs.getStringPref( + "extensions.blocklist.detailsURL" +); + +/* + * Check that add-on blocklist URLs are correctly exposed + * based on either blockID or id properties on the entries + * in remote settings. + */ +add_task(async function blocklistURL_check() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); + await promiseStartupManager(); + await AddonTestUtils.loadBlocklistRawData({ extensions: BLOCKLIST_DATA }); + + let entry = await Blocklist.getAddonBlocklistEntry({ + id: "myfoo", + version: "1.0", + }); + Assert.equal(entry.url, BASE_BLOCKLIST_INFOURL + "foo.html"); + + entry = await Blocklist.getAddonBlocklistEntry({ + id: "mybar", + version: "1.0", + }); + Assert.equal(entry.url, BASE_BLOCKLIST_INFOURL + "bar.html"); +}); -- cgit v1.2.3