mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1584479 - Part 2: Update socialtracking test. r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D51444 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
2164478f1e
commit
7f0b6eecd8
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -175,6 +175,7 @@ http://fingerprinting.example.com:80
|
|||||||
http://not-tracking.example.com:80
|
http://not-tracking.example.com:80
|
||||||
http://tracking.example.org:80
|
http://tracking.example.org:80
|
||||||
http://another-tracking.example.net:80
|
http://another-tracking.example.net:80
|
||||||
|
http://social-tracking.example.org:80
|
||||||
http://itisatracker.org:80
|
http://itisatracker.org:80
|
||||||
https://itisatracker.org:443
|
https://itisatracker.org:443
|
||||||
http://trackertest.org:80
|
http://trackertest.org:80
|
||||||
@ -192,6 +193,7 @@ https://fingerprinting.example.com:443
|
|||||||
https://not-tracking.example.com:443
|
https://not-tracking.example.com:443
|
||||||
https://tracking.example.org:443
|
https://tracking.example.org:443
|
||||||
https://another-tracking.example.net:443
|
https://another-tracking.example.net:443
|
||||||
|
https://social-tracking.example.org:443
|
||||||
|
|
||||||
#
|
#
|
||||||
# Used while testing flash blocking (Bug 1307604)
|
# Used while testing flash blocking (Bug 1307604)
|
||||||
|
@ -140,4 +140,5 @@ support-files = matchAll.js
|
|||||||
skip-if = fission
|
skip-if = fission
|
||||||
support-files = sharedWorker.js partitionedSharedWorker.js
|
support-files = sharedWorker.js partitionedSharedWorker.js
|
||||||
[browser_socialtracking.js]
|
[browser_socialtracking.js]
|
||||||
|
skip-if = fission
|
||||||
[browser_urlDecorationStripping.js]
|
[browser_urlDecorationStripping.js]
|
||||||
|
@ -11,8 +11,6 @@ function runTest(obj) {
|
|||||||
["privacy.trackingprotection.pbmode.enabled", false],
|
["privacy.trackingprotection.pbmode.enabled", false],
|
||||||
["privacy.trackingprotection.annotate_channels", true],
|
["privacy.trackingprotection.annotate_channels", true],
|
||||||
["privacy.storagePrincipal.enabledForTrackers", false],
|
["privacy.storagePrincipal.enabledForTrackers", false],
|
||||||
["urlclassifier.features.socialtracking.annotate.blacklistHosts", "not-tracking.example.com"],
|
|
||||||
["urlclassifier.features.socialtracking.blacklistHosts", "not-tracking.example.com"],
|
|
||||||
["privacy.trackingprotection.socialtracking.enabled", obj.protectionEnabled],
|
["privacy.trackingprotection.socialtracking.enabled", obj.protectionEnabled],
|
||||||
["privacy.socialtracking.block_cookies.enabled", obj.cookieBlocking],
|
["privacy.socialtracking.block_cookies.enabled", obj.cookieBlocking],
|
||||||
],
|
],
|
||||||
@ -29,8 +27,8 @@ function runTest(obj) {
|
|||||||
await ContentTask.spawn(
|
await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
{
|
{
|
||||||
page: TEST_4TH_PARTY_DOMAIN + TEST_PATH + "localStorage.html",
|
page: TEST_3RD_PARTY_DOMAIN_STP + TEST_PATH + "localStorage.html",
|
||||||
image: TEST_4TH_PARTY_DOMAIN + TEST_PATH + "raptor.jpg",
|
image: TEST_3RD_PARTY_DOMAIN_STP + TEST_PATH + "raptor.jpg",
|
||||||
loading: obj.loading,
|
loading: obj.loading,
|
||||||
result: obj.result,
|
result: obj.result,
|
||||||
},
|
},
|
||||||
@ -70,6 +68,21 @@ function runTest(obj) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
info("Checking content blocking log.");
|
||||||
|
let contentBlockingLog = JSON.parse(await browser.getContentBlockingLog());
|
||||||
|
for (let origin of Object.keys(contentBlockingLog)) {
|
||||||
|
is(
|
||||||
|
origin + "/",
|
||||||
|
TEST_3RD_PARTY_DOMAIN_STP,
|
||||||
|
"Correct tracker origin must be reported"
|
||||||
|
);
|
||||||
|
Assert.deepEqual(
|
||||||
|
contentBlockingLog[origin],
|
||||||
|
obj.expectedLogItems,
|
||||||
|
"Content blocking log should be as expected"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
BrowserTestUtils.removeTab(tab);
|
BrowserTestUtils.removeTab(tab);
|
||||||
|
|
||||||
UrlClassifierTestUtils.cleanupTestTrackers();
|
UrlClassifierTestUtils.cleanupTestTrackers();
|
||||||
@ -82,6 +95,10 @@ runTest({
|
|||||||
loading: true,
|
loading: true,
|
||||||
cookieBlocking: false,
|
cookieBlocking: false,
|
||||||
result: true,
|
result: true,
|
||||||
|
expectedLogItems: [
|
||||||
|
[Ci.nsIWebProgressListener.STATE_COOKIES_LOADED, true, 1],
|
||||||
|
[Ci.nsIWebProgressListener.STATE_COOKIES_LOADED_SOCIALTRACKER, true, 1]
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
runTest({
|
runTest({
|
||||||
@ -90,6 +107,12 @@ runTest({
|
|||||||
loading: true,
|
loading: true,
|
||||||
cookieBlocking: true,
|
cookieBlocking: true,
|
||||||
result: false,
|
result: false,
|
||||||
|
expectedLogItems: [
|
||||||
|
[Ci.nsIWebProgressListener.STATE_COOKIES_LOADED, true, 1],
|
||||||
|
[Ci.nsIWebProgressListener.STATE_COOKIES_LOADED_SOCIALTRACKER, true, 1],
|
||||||
|
[Ci.nsIWebProgressListener.STATE_LOADED_SOCIALTRACKING_CONTENT, true, 2],
|
||||||
|
[Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_SOCIALTRACKER, true, 2]
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
runTest({
|
runTest({
|
||||||
@ -98,4 +121,7 @@ runTest({
|
|||||||
loading: false,
|
loading: false,
|
||||||
cookieBlocking: true,
|
cookieBlocking: true,
|
||||||
result: false,
|
result: false,
|
||||||
|
expectedLogItems: [
|
||||||
|
[Ci.nsIWebProgressListener.STATE_BLOCKED_SOCIALTRACKING_CONTENT, true, 1]
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
@ -14,6 +14,7 @@ const TEST_DOMAIN_6 = "http://mochi.test:8888/";
|
|||||||
const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org/";
|
const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org/";
|
||||||
const TEST_3RD_PARTY_DOMAIN_HTTP = "http://tracking.example.org/";
|
const TEST_3RD_PARTY_DOMAIN_HTTP = "http://tracking.example.org/";
|
||||||
const TEST_3RD_PARTY_DOMAIN_TP = "https://tracking.example.com/";
|
const TEST_3RD_PARTY_DOMAIN_TP = "https://tracking.example.com/";
|
||||||
|
const TEST_3RD_PARTY_DOMAIN_STP = "https://social-tracking.example.org/";
|
||||||
const TEST_4TH_PARTY_DOMAIN = "http://not-tracking.example.com/";
|
const TEST_4TH_PARTY_DOMAIN = "http://not-tracking.example.com/";
|
||||||
const TEST_ANOTHER_3RD_PARTY_DOMAIN = "https://another-tracking.example.net/";
|
const TEST_ANOTHER_3RD_PARTY_DOMAIN = "https://another-tracking.example.net/";
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@ const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
|
|||||||
const WHITELIST_TABLE_NAME = "mochitest2-trackwhite-simple";
|
const WHITELIST_TABLE_NAME = "mochitest2-trackwhite-simple";
|
||||||
const WHITELIST_TABLE_PREF = "urlclassifier.trackingWhitelistTable";
|
const WHITELIST_TABLE_PREF = "urlclassifier.trackingWhitelistTable";
|
||||||
|
|
||||||
|
const SOCIAL_ANNOTATION_TABLE_NAME = "mochitest3-track-simple";
|
||||||
|
const SOCIAL_ANNOTATION_TABLE_PREF =
|
||||||
|
"urlclassifier.features.socialtracking.annotate.blacklistTables";
|
||||||
|
const SOCIAL_TRACKING_TABLE_NAME = "mochitest4-track-simple";
|
||||||
|
const SOCIAL_TRACKING_TABLE_PREF =
|
||||||
|
"urlclassifier.features.socialtracking.blacklistTables";
|
||||||
|
|
||||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
@ -30,11 +37,12 @@ var UrlClassifierTestUtils = {
|
|||||||
let trackingURL2 = "itisatracker.org/";
|
let trackingURL2 = "itisatracker.org/";
|
||||||
let trackingURL3 = "trackertest.org/";
|
let trackingURL3 = "trackertest.org/";
|
||||||
let whitelistedURL = "itisatrap.org/?resource=itisatracker.org";
|
let whitelistedURL = "itisatrap.org/?resource=itisatracker.org";
|
||||||
|
let socialTrackingURL = "social-tracking.example.org/";
|
||||||
|
|
||||||
let annotationUpdate =
|
let annotationUpdate =
|
||||||
"n:1000\ni:" +
|
"n:1000\ni:" +
|
||||||
ANNOTATION_TABLE_NAME +
|
ANNOTATION_TABLE_NAME +
|
||||||
"\nad:4\n" +
|
"\nad:5\n" +
|
||||||
"a:1:32:" +
|
"a:1:32:" +
|
||||||
annotationURL1.length +
|
annotationURL1.length +
|
||||||
"\n" +
|
"\n" +
|
||||||
@ -60,6 +68,15 @@ var UrlClassifierTestUtils = {
|
|||||||
"\n" +
|
"\n" +
|
||||||
annotationURL5 +
|
annotationURL5 +
|
||||||
"\n";
|
"\n";
|
||||||
|
let socialAnnotationUpdate =
|
||||||
|
"n:1000\ni:" +
|
||||||
|
SOCIAL_ANNOTATION_TABLE_NAME +
|
||||||
|
"\nad:1\n" +
|
||||||
|
"a:1:32:" +
|
||||||
|
socialTrackingURL.length +
|
||||||
|
"\n" +
|
||||||
|
socialTrackingURL +
|
||||||
|
"\n";
|
||||||
let annotationWhitelistUpdate =
|
let annotationWhitelistUpdate =
|
||||||
"n:1000\ni:" +
|
"n:1000\ni:" +
|
||||||
ANNOTATION_WHITELIST_TABLE_NAME +
|
ANNOTATION_WHITELIST_TABLE_NAME +
|
||||||
@ -88,6 +105,15 @@ var UrlClassifierTestUtils = {
|
|||||||
"\n" +
|
"\n" +
|
||||||
trackingURL3 +
|
trackingURL3 +
|
||||||
"\n";
|
"\n";
|
||||||
|
let socialTrackingUpdate =
|
||||||
|
"n:1000\ni:" +
|
||||||
|
SOCIAL_TRACKING_TABLE_NAME +
|
||||||
|
"\nad:1\n" +
|
||||||
|
"a:1:32:" +
|
||||||
|
socialTrackingURL.length +
|
||||||
|
"\n" +
|
||||||
|
socialTrackingURL +
|
||||||
|
"\n";
|
||||||
let whitelistUpdate =
|
let whitelistUpdate =
|
||||||
"n:1000\ni:" +
|
"n:1000\ni:" +
|
||||||
WHITELIST_TABLE_NAME +
|
WHITELIST_TABLE_NAME +
|
||||||
@ -104,6 +130,11 @@ var UrlClassifierTestUtils = {
|
|||||||
name: ANNOTATION_TABLE_NAME,
|
name: ANNOTATION_TABLE_NAME,
|
||||||
update: annotationUpdate,
|
update: annotationUpdate,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
pref: SOCIAL_ANNOTATION_TABLE_PREF,
|
||||||
|
name: SOCIAL_ANNOTATION_TABLE_NAME,
|
||||||
|
update: socialAnnotationUpdate,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
pref: ANNOTATION_WHITELIST_TABLE_PREF,
|
pref: ANNOTATION_WHITELIST_TABLE_PREF,
|
||||||
name: ANNOTATION_WHITELIST_TABLE_NAME,
|
name: ANNOTATION_WHITELIST_TABLE_NAME,
|
||||||
@ -114,6 +145,11 @@ var UrlClassifierTestUtils = {
|
|||||||
name: TRACKING_TABLE_NAME,
|
name: TRACKING_TABLE_NAME,
|
||||||
update: trackingUpdate,
|
update: trackingUpdate,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
pref: SOCIAL_TRACKING_TABLE_PREF,
|
||||||
|
name: SOCIAL_TRACKING_TABLE_NAME,
|
||||||
|
update: socialTrackingUpdate,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
pref: WHITELIST_TABLE_PREF,
|
pref: WHITELIST_TABLE_PREF,
|
||||||
name: WHITELIST_TABLE_NAME,
|
name: WHITELIST_TABLE_NAME,
|
||||||
@ -145,8 +181,10 @@ var UrlClassifierTestUtils = {
|
|||||||
|
|
||||||
cleanupTestTrackers() {
|
cleanupTestTrackers() {
|
||||||
Services.prefs.clearUserPref(ANNOTATION_TABLE_PREF);
|
Services.prefs.clearUserPref(ANNOTATION_TABLE_PREF);
|
||||||
|
Services.prefs.clearUserPref(SOCIAL_ANNOTATION_TABLE_PREF);
|
||||||
Services.prefs.clearUserPref(ANNOTATION_WHITELIST_TABLE_PREF);
|
Services.prefs.clearUserPref(ANNOTATION_WHITELIST_TABLE_PREF);
|
||||||
Services.prefs.clearUserPref(TRACKING_TABLE_PREF);
|
Services.prefs.clearUserPref(TRACKING_TABLE_PREF);
|
||||||
|
Services.prefs.clearUserPref(SOCIAL_TRACKING_TABLE_PREF);
|
||||||
Services.prefs.clearUserPref(WHITELIST_TABLE_PREF);
|
Services.prefs.clearUserPref(WHITELIST_TABLE_PREF);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user