summaryrefslogtreecommitdiffstats
path: root/toolkit/components/cleardata
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/cleardata')
-rw-r--r--toolkit/components/cleardata/SiteDataTestUtils.sys.mjs9
-rw-r--r--toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js70
-rw-r--r--toolkit/components/cleardata/tests/unit/xpcshell.toml1
3 files changed, 69 insertions, 11 deletions
diff --git a/toolkit/components/cleardata/SiteDataTestUtils.sys.mjs b/toolkit/components/cleardata/SiteDataTestUtils.sys.mjs
index 99bd1f72b0..f38f3aff4b 100644
--- a/toolkit/components/cleardata/SiteDataTestUtils.sys.mjs
+++ b/toolkit/components/cleardata/SiteDataTestUtils.sys.mjs
@@ -114,7 +114,11 @@ export var SiteDataTestUtils = {
},
/**
- * Adds a new localStorage entry for the specified origin, with the specified contents.
+ * Adds a new localStorage entry for the specified origin, with the specified
+ * contents.
+ *
+ * This method requires the pref dom.storage.client_validation=false in order
+ * to access LS without a window.
*
* @param {String} origin - the origin of the site to add test data for
* @param {String} [key] - the localStorage key
@@ -139,6 +143,9 @@ export var SiteDataTestUtils = {
* @param {{key: String, value: String}[]} [testEntries] - An array of entries
* to test for.
*
+ * This method requires the pref dom.storage.client_validation=false in order
+ * to access LS without a window.
+ *
* @returns {Boolean} whether the origin has localStorage data
*/
hasLocalStorage(origin, testEntries) {
diff --git a/toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js b/toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js
index ac0eb40fd9..a54d92eab1 100644
--- a/toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js
+++ b/toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js
@@ -139,6 +139,7 @@ async function runDeleteBySiteHostTest(clearDataServiceFn) {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-normal-browsing.com",
@@ -147,7 +148,10 @@ async function runDeleteBySiteHostTest(clearDataServiceFn) {
"Should have deleted only 'common-bounce-tracker.com' for default OA."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_DEFAULT).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-normal-browsing.com",
@@ -159,6 +163,7 @@ async function runDeleteBySiteHostTest(clearDataServiceFn) {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-private-browsing.com",
@@ -169,6 +174,7 @@ async function runDeleteBySiteHostTest(clearDataServiceFn) {
Assert.deepEqual(
bounceTrackingProtection
.testGetUserActivationHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"common-user-activation.com",
@@ -181,13 +187,17 @@ async function runDeleteBySiteHostTest(clearDataServiceFn) {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
.sort(),
["bounce-tracker-container.com", "bounce-tracker-container2.com"],
"Should have deleted only 'common-bounce-tracker.com' for container."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_CONTAINER).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-container.com",
@@ -280,6 +290,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-normal-browsing.com",
@@ -288,7 +299,10 @@ add_task(async function test_deleteByPrincipal() {
"Should have deleted only 'common-bounce-tracker.com' for default OA."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_DEFAULT).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-normal-browsing.com",
@@ -300,6 +314,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-private-browsing.com",
@@ -311,6 +326,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetUserActivationHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"common-user-activation.com",
@@ -323,6 +339,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-container.com",
@@ -332,7 +349,10 @@ add_task(async function test_deleteByPrincipal() {
"Should not have deleted 'common-bounce-tracker.com' for container."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_CONTAINER).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-container.com",
@@ -362,6 +382,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-normal-browsing.com",
@@ -370,7 +391,10 @@ add_task(async function test_deleteByPrincipal() {
"Should not have deleted any bounce tracker candidates for default OA."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_DEFAULT).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-normal-browsing.com",
@@ -382,6 +406,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-private-browsing.com",
@@ -393,6 +418,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetUserActivationHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"common-user-activation.com",
@@ -405,6 +431,7 @@ add_task(async function test_deleteByPrincipal() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-container.com",
@@ -414,7 +441,10 @@ add_task(async function test_deleteByPrincipal() {
"Should not have deleted any bounce tracker candidates for container."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_CONTAINER).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
+ .sort(),
["user-activation-container.com", "user-activation-container2.com"],
"Should have deleted 'common-user-activation.com' for private browsing.."
);
@@ -450,12 +480,16 @@ add_task(async function test_deleteByRange() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
.sort(),
["common-bounce-tracker.com"],
"Should have only kept 'common-bounce-tracker.com' for default OA."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_DEFAULT).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
+ .sort(),
[],
"Should not have kept any user activations for default OA."
);
@@ -463,6 +497,7 @@ add_task(async function test_deleteByRange() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[],
"Should not have kept any bounces for private browsing."
@@ -470,6 +505,7 @@ add_task(async function test_deleteByRange() {
Assert.deepEqual(
bounceTrackingProtection
.testGetUserActivationHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[],
"Should not have kept any user activations for private browsing."
@@ -478,12 +514,16 @@ add_task(async function test_deleteByRange() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
.sort(),
["bounce-tracker-container.com", "bounce-tracker-container2.com"],
"Should have only kept some bouncer trackers for container."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_CONTAINER).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-container.com",
@@ -517,6 +557,7 @@ add_task(async function test_deleteByOriginAttributes() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-normal-browsing.com",
@@ -526,7 +567,10 @@ add_task(async function test_deleteByOriginAttributes() {
"Should not have deleted any bounce tracker candidates for default OA."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_DEFAULT).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_DEFAULT)
+ .map(entry => entry.siteHost)
+ .sort(),
[
"common-user-activation.com",
"user-activation-normal-browsing.com",
@@ -538,6 +582,7 @@ add_task(async function test_deleteByOriginAttributes() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"bounce-tracker-private-browsing.com",
@@ -549,6 +594,7 @@ add_task(async function test_deleteByOriginAttributes() {
Assert.deepEqual(
bounceTrackingProtection
.testGetUserActivationHosts(OA_PRIVATE_BROWSING)
+ .map(entry => entry.siteHost)
.sort(),
[
"common-user-activation.com",
@@ -561,12 +607,16 @@ add_task(async function test_deleteByOriginAttributes() {
Assert.deepEqual(
bounceTrackingProtection
.testGetBounceTrackerCandidateHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
.sort(),
[],
"Should have deleted all bounce tracker candidates for container."
);
Assert.deepEqual(
- bounceTrackingProtection.testGetUserActivationHosts(OA_CONTAINER).sort(),
+ bounceTrackingProtection
+ .testGetUserActivationHosts(OA_CONTAINER)
+ .map(entry => entry.siteHost)
+ .sort(),
[],
"Should have deleted all user activations for container."
);
diff --git a/toolkit/components/cleardata/tests/unit/xpcshell.toml b/toolkit/components/cleardata/tests/unit/xpcshell.toml
index bf2813a401..3a1386836e 100644
--- a/toolkit/components/cleardata/tests/unit/xpcshell.toml
+++ b/toolkit/components/cleardata/tests/unit/xpcshell.toml
@@ -13,6 +13,7 @@ prefs = [
["test_basic.js"]
["test_bounce_tracking_protection.js"]
+skip-if = ["condprof"] # Bug 1893058
["test_certs.js"]