Bug 1564801 - Consolidate b/b/c/test/trackingUI and b/b/c/test/siteProtections into b/b/c/test/protectionsUI. r=nhnt11

Differential Revision: https://phabricator.services.mozilla.com/D68073
This commit is contained in:
alexuwa
2020-03-31 08:05:22 +00:00
parent ceffd86897
commit e5d9527bdc
44 changed files with 194 additions and 213 deletions

View File

@@ -100,7 +100,7 @@ with Files("test/tabs/**"):
with Files("test/touch/**"):
BUG_COMPONENT = ("Firefox", "General")
with Files("test/trackingUI/**"):
with Files("test/protectionsUI/**"):
BUG_COMPONENT = ("Firefox", "Protections UI")
with Files("test/webextensions/**"):

View File

@@ -0,0 +1,39 @@
[DEFAULT]
tags = trackingprotection
support-files =
head.js
benignPage.html
containerPage.html
cookiePage.html
cookieSetterPage.html
cookieServer.sjs
embeddedPage.html
trackingAPI.js
trackingPage.html
[browser_protectionsUI.js]
[browser_protectionsUI_3.js]
[browser_protectionsUI_animation.js]
[browser_protectionsUI_animation_2.js]
[browser_protectionsUI_background_tabs.js]
[browser_protectionsUI_categories.js]
[browser_protectionsUI_cookies_subview.js]
[browser_protectionsUI_cryptominers.js]
[browser_protectionsUI_fetch.js]
support-files =
file_protectionsUI_fetch.html
file_protectionsUI_fetch.js
file_protectionsUI_fetch.js^headers^
[browser_protectionsUI_fingerprinters.js]
[browser_protectionsUI_milestones.js]
[browser_protectionsUI_open_preferences.js]
[browser_protectionsUI_pbmode_exceptions.js]
[browser_protectionsUI_report_breakage.js]
skip-if = debug || asan # Bug 1546797
[browser_protectionsUI_socialtracking.js]
skip-if = fission # Bug 1614350
[browser_protectionsUI_shield_visibility.js]
[browser_protectionsUI_state.js]
[browser_protectionsUI_state_reset.js]
[browser_protectionsUI_telemetry.js]
[browser_protectionsUI_trackers_subview.js]

View File

@@ -6,7 +6,7 @@
"use strict";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
ChromeUtils.defineModuleGetter(
this,

View File

@@ -4,9 +4,9 @@
"use strict";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const TP_PREF = "privacy.trackingprotection.enabled";
const ANIMATIONS_PREF = "toolkit.cosmeticAnimations.enabled";
const DTSCBN_PREF = "dom.testing.sync-content-blocking-notifications";

View File

@@ -9,11 +9,11 @@ const TP_PREF = "privacy.trackingprotection.enabled";
const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled";
const NCB_PREF = "network.cookie.cookieBehavior";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const COOKIE_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/cookiePage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/cookiePage.html";
const DTSCBN_PREF = "dom.testing.sync-content-blocking-notifications";
requestLongerTimeout(2);

View File

@@ -4,9 +4,9 @@
"use strict";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const TP_PREF = "privacy.trackingprotection.enabled";

View File

@@ -6,9 +6,9 @@
"use strict";
const COOKIE_PAGE =
"http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
"http://not-tracking.example.com/browser/browser/base/content/test/protectionsUI/cookiePage.html";
const CONTAINER_PAGE =
"http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/containerPage.html";
"http://not-tracking.example.com/browser/browser/base/content/test/protectionsUI/containerPage.html";
const TPC_PREF = "network.cookie.cookieBehavior";
@@ -60,7 +60,7 @@ async function assertSitesListed(testCase) {
]);
let browser = tab.linkedBrowser;
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-cookies"
@@ -296,7 +296,7 @@ add_task(async function testCookiesSubViewAllowed() {
});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(3)]);
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-cookies"
@@ -399,7 +399,7 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
await new Promise(resolve => waitForFocus(resolve, popup));
await new Promise(resolve => waitForFocus(resolve, window));
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-cookies"
@@ -469,7 +469,7 @@ add_task(async function testCookiesSubViewBlockedDoublyNested() {
});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(3)]);
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-cookies"

View File

@@ -4,7 +4,7 @@
"use strict";
const TRACKING_PAGE =
"http://example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const CM_PROTECTION_PREF = "privacy.trackingprotection.cryptomining.enabled";
let cmHistogram;
@@ -123,7 +123,7 @@ async function testSubview(hasException) {
});
await promise;
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-cryptominers"

View File

@@ -1,5 +1,5 @@
const URL =
"http://mochi.test:8888/browser/browser/base/content/test/trackingUI/file_trackingUI_fetch.html";
"http://mochi.test:8888/browser/browser/base/content/test/protectionsUI/file_protectionsUI_fetch.html";
add_task(async function test_fetch() {
await SpecialPowers.pushPrefEnv({

View File

@@ -4,7 +4,7 @@
"use strict";
const TRACKING_PAGE =
"http://example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const FP_PROTECTION_PREF = "privacy.trackingprotection.fingerprinting.enabled";
let fpHistogram;
@@ -194,7 +194,7 @@ async function testSubview(hasException) {
});
await promise;
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-fingerprinters"

View File

@@ -6,9 +6,9 @@
const TP_PREF = "privacy.trackingprotection.enabled";
const TPC_PREF = "network.cookie.cookieBehavior";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const COOKIE_PAGE =
"http://tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
"http://tracking.example.com/browser/browser/base/content/test/protectionsUI/cookiePage.html";
async function waitAndAssertPreferencesShown(_spotlight, identityPopup) {
await BrowserTestUtils.waitForEvent(
@@ -66,7 +66,7 @@ add_task(async function testOpenPreferencesFromTrackersSubview() {
// Wait for 2 content blocking events - one for the load and one for the tracker.
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(2)]);
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-tracking-protection"
@@ -118,7 +118,7 @@ add_task(async function testOpenPreferencesFromCookiesSubview() {
// Wait for 2 content blocking events - one for the load and one for the tracker.
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(2)]);
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-cookies"

View File

@@ -6,7 +6,7 @@
const TP_PB_PREF = "privacy.trackingprotection.enabled";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const DTSCBN_PREF = "dom.testing.sync-content-blocking-notifications";
var TrackingProtection = null;
var gProtectionsHandler = null;

View File

@@ -4,11 +4,11 @@
"use strict";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const COOKIE_PAGE =
"http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
"http://not-tracking.example.com/browser/browser/base/content/test/protectionsUI/cookiePage.html";
const CM_PREF = "privacy.trackingprotection.cryptomining.enabled";
const FP_PREF = "privacy.trackingprotection.fingerprinting.enabled";
@@ -67,7 +67,7 @@ add_task(async function testReportBreakageCancel() {
await TestUtils.waitForCondition(() =>
gProtectionsHandler._protectionsPopup.hasAttribute("blocking")
);
await openProtectionsPopup();
await openProtectionsPanel();
let siteNotWorkingButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"
@@ -121,7 +121,7 @@ add_task(async function testReportBreakageSiteException() {
gProtectionsHandler.disableForCurrentPage();
await loaded;
await openProtectionsPopup();
await openProtectionsPanel();
let siteFixedButton = document.getElementById(
"protections-popup-tp-switch-breakage-fixed-link"
@@ -155,7 +155,7 @@ add_task(async function testReportBreakageSiteException() {
add_task(async function testNoTracking() {
await BrowserTestUtils.withNewTab(BENIGN_PAGE, async function() {
await openProtectionsPopup();
await openProtectionsPanel();
let siteNotWorkingButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"
@@ -242,7 +242,7 @@ add_task(async function testCM() {
});
async function openAndTestReportBreakage(url, tags, error = false) {
await openProtectionsPopup();
await openProtectionsPanel();
let siteNotWorkingButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"

View File

@@ -4,7 +4,7 @@
"use strict";
const TRACKING_PAGE =
"http://example.com/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://example.com/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const ST_PROTECTION_PREF = "privacy.trackingprotection.socialtracking.enabled";
const ST_BLOCK_COOKIES_PREF = "privacy.socialtracking.block_cookies.enabled";
@@ -123,7 +123,7 @@ async function testSubview(hasException) {
});
await promise;
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-socialblock"
@@ -199,7 +199,7 @@ async function testCategoryItem(blockLoads) {
});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent()]);
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-socialblock"
@@ -249,7 +249,7 @@ async function testCategoryItem(blockLoads) {
});
[tab] = await Promise.all([promise, waitForContentBlockingEvent()]);
await openProtectionsPopup();
await openProtectionsPanel();
ok(!categoryItem.hasAttribute("uidisabled"), "Item shouldn't be uidisabled");

View File

@@ -19,11 +19,11 @@ const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled";
const TPC_PREF = "network.cookie.cookieBehavior";
const DTSCBN_PREF = "dom.testing.sync-content-blocking-notifications";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const COOKIE_PAGE =
"http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
"http://not-tracking.example.com/browser/browser/base/content/test/protectionsUI/cookiePage.html";
var gProtectionsHandler = null;
var TrackingProtection = null;
var ThirdPartyCookies = null;

View File

@@ -3,9 +3,9 @@
const TP_PREF = "privacy.trackingprotection.enabled";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const ABOUT_PAGE = "about:preferences";
/* This asserts that the content blocking event state is correctly reset

View File

@@ -5,9 +5,9 @@
const PREF = "privacy.trackingprotection.enabled";
const DTSCBN_PREF = "dom.testing.sync-content-blocking-notifications";
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
/**
* Enable local telemetry recording for the duration of the tests.

View File

@@ -9,7 +9,7 @@ const { PermissionTestUtils } = ChromeUtils.import(
);
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
const TP_PREF = "privacy.trackingprotection.enabled";
@@ -30,7 +30,7 @@ async function assertSitesListed(blocked) {
// Wait for 2 content blocking events - one for the load and one for the tracker.
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(2)]);
await openProtectionsPopup();
await openProtectionsPanel();
let categoryItem = document.getElementById(
"protections-popup-category-tracking-protection"

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<iframe src="http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/embeddedPage.html"></iframe>
<iframe src="http://not-tracking.example.com/browser/browser/base/content/test/protectionsUI/embeddedPage.html"></iframe>
</body>
</html>

View File

@@ -8,6 +8,6 @@
<script src="trackingAPI.js" type="text/javascript"></script>
</head>
<body>
<iframe src="http://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs"></iframe>
<iframe src="http://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"></iframe>
</body>
</html>

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<iframe src="http://trackertest.org/browser/browser/base/content/test/trackingUI/cookieSetterPage.html"></iframe>
<iframe src="http://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieSetterPage.html"></iframe>
</body>
</html>

View File

@@ -8,7 +8,7 @@
<p>Hello there!</p>
<script type="application/javascript">
function test_fetch() {
let url = "http://trackertest.org/browser/browser/base/content/test/trackingUI/file_trackingUI_fetch.js";
let url = "http://trackertest.org/browser/browser/base/content/test/protectionsUI/file_protectionsUI_fetch.js";
return fetch(url);
}
</script>

View File

@@ -14,6 +14,15 @@ XPCOMUtils.defineLazyGetter(this, "TRACK_DB_PATH", function() {
return OS.Path.join(OS.Constants.Path.profileDir, "protections.sqlite");
});
ChromeUtils.defineModuleGetter(
this,
"ContentBlockingAllowList",
"resource://gre/modules/ContentBlockingAllowList.jsm"
);
var { UrlClassifierTestUtils } = ChromeUtils.import(
"resource://testing-common/UrlClassifierTestUtils.jsm"
);
var protectionsPopup = document.getElementById("protections-popup");
var protectionsPopupMainView = document.getElementById(
"protections-popup-mainView"
@@ -120,3 +129,86 @@ async function waitForAboutProtectionsTab() {
return tab;
}
/**
* Waits for a load (or custom) event to finish in a given tab. If provided
* load an uri into the tab.
*
* @param tab
* The tab to load into.
* @param [optional] url
* The url to load, or the current url.
* @return {Promise} resolved when the event is handled.
* @resolves to the received event
* @rejects if a valid load event is not received within a meaningful interval
*/
function promiseTabLoadEvent(tab, url) {
info("Wait tab event: load");
function handle(loadedUrl) {
if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
info(`Skipping spurious load event for ${loadedUrl}`);
return false;
}
info("Tab event received: load");
return true;
}
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
if (url) {
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
}
return loaded;
}
function openIdentityPopup() {
let mainView = document.getElementById("identity-popup-mainView");
let viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
gIdentityHandler._identityBox.click();
return viewShown;
}
function waitForSecurityChange(numChanges = 1, win = null) {
if (!win) {
win = window;
}
return new Promise(resolve => {
let n = 0;
let listener = {
onSecurityChange() {
n = n + 1;
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {
win.gBrowser.removeProgressListener(listener);
resolve(n);
}
},
};
win.gBrowser.addProgressListener(listener);
});
}
function waitForContentBlockingEvent(numChanges = 1, win = null) {
if (!win) {
win = window;
}
return new Promise(resolve => {
let n = 0;
let listener = {
onContentBlockingEvent(webProgress, request, event) {
n = n + 1;
info(
`Received onContentBlockingEvent event: ${event} (${n} of ${numChanges})`
);
if (n >= numChanges) {
win.gBrowser.removeProgressListener(listener);
resolve(n);
}
},
};
win.gBrowser.addProgressListener(listener);
});
}

View File

@@ -20,7 +20,7 @@ onmessage = event => {
break;
case "socialtracking":
createIframe(
"https://social-tracking.example.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs"
"https://social-tracking.example.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "cryptomining":
@@ -34,7 +34,7 @@ onmessage = event => {
break;
case "cookie":
createIframe(
"https://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs"
"https://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "first-party-cookie":
@@ -42,22 +42,22 @@ onmessage = event => {
// top-level cookies right now, we just create an iframe with the
// first party domain...
createIframe(
"http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookieServer.sjs"
"http://not-tracking.example.com/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "third-party-cookie":
createIframe(
"https://test1.example.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs"
"https://test1.example.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "image":
createImage(
"http://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs?type=image-no-cookie"
"http://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs?type=image-no-cookie"
);
break;
case "window-open":
window.win = window.open(
"http://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs",
"http://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs",
"_blank",
"width=100,height=100"
);

View File

@@ -1,7 +0,0 @@
[DEFAULT]
support-files =
head.js
!/browser/base/content/test/trackingUI/trackingPage.html
[browser_protections_UI.js]
[browser_protections_UI_milestones.js]

View File

@@ -1,5 +0,0 @@
"use strict";
module.exports = {
extends: ["plugin:mozilla/browser-test"],
};

View File

@@ -1,37 +0,0 @@
[DEFAULT]
tags = trackingprotection
support-files =
head.js
benignPage.html
containerPage.html
cookiePage.html
cookieSetterPage.html
cookieServer.sjs
embeddedPage.html
trackingAPI.js
trackingPage.html
[browser_trackingUI_3.js]
[browser_trackingUI_animation.js]
[browser_trackingUI_animation_2.js]
[browser_trackingUI_background_tabs.js]
[browser_trackingUI_categories.js]
[browser_trackingUI_cookies_subview.js]
[browser_trackingUI_cryptominers.js]
[browser_trackingUI_fetch.js]
support-files =
file_trackingUI_fetch.html
file_trackingUI_fetch.js
file_trackingUI_fetch.js^headers^
[browser_trackingUI_fingerprinters.js]
[browser_trackingUI_open_preferences.js]
[browser_trackingUI_pbmode_exceptions.js]
[browser_trackingUI_report_breakage.js]
skip-if = debug || asan # Bug 1546797
[browser_trackingUI_socialtracking.js]
skip-if = fission # Bug 1614350
[browser_trackingUI_shield_visibility.js]
[browser_trackingUI_state.js]
[browser_trackingUI_state_reset.js]
[browser_trackingUI_telemetry.js]
[browser_trackingUI_trackers_subview.js]

View File

@@ -1,99 +0,0 @@
var { UrlClassifierTestUtils } = ChromeUtils.import(
"resource://testing-common/UrlClassifierTestUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"ContentBlockingAllowList",
"resource://gre/modules/ContentBlockingAllowList.jsm"
);
/**
* Waits for a load (or custom) event to finish in a given tab. If provided
* load an uri into the tab.
*
* @param tab
* The tab to load into.
* @param [optional] url
* The url to load, or the current url.
* @return {Promise} resolved when the event is handled.
* @resolves to the received event
* @rejects if a valid load event is not received within a meaningful interval
*/
function promiseTabLoadEvent(tab, url) {
info("Wait tab event: load");
function handle(loadedUrl) {
if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
info(`Skipping spurious load event for ${loadedUrl}`);
return false;
}
info("Tab event received: load");
return true;
}
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
if (url) {
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
}
return loaded;
}
function openIdentityPopup() {
let mainView = document.getElementById("identity-popup-mainView");
let viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
gIdentityHandler._identityBox.click();
return viewShown;
}
function openProtectionsPopup() {
let mainView = document.getElementById("protections-popup-mainView");
let viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
gProtectionsHandler._trackingProtectionIconContainer.click();
return viewShown;
}
function waitForSecurityChange(numChanges = 1, win = null) {
if (!win) {
win = window;
}
return new Promise(resolve => {
let n = 0;
let listener = {
onSecurityChange() {
n = n + 1;
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {
win.gBrowser.removeProgressListener(listener);
resolve(n);
}
},
};
win.gBrowser.addProgressListener(listener);
});
}
function waitForContentBlockingEvent(numChanges = 1, win = null) {
if (!win) {
win = window;
}
return new Promise(resolve => {
let n = 0;
let listener = {
onContentBlockingEvent(webProgress, request, event) {
n = n + 1;
info(
`Received onContentBlockingEvent event: ${event} (${n} of ${numChanges})`
);
if (n >= numChanges) {
win.gBrowser.removeProgressListener(listener);
resolve(n);
}
},
};
win.gBrowser.addProgressListener(listener);
});
}

View File

@@ -42,11 +42,11 @@ BROWSER_CHROME_MANIFESTS += [
'content/test/plugins/browser.ini',
'content/test/popupNotifications/browser.ini',
'content/test/popups/browser.ini',
'content/test/protectionsUI/browser.ini',
'content/test/referrer/browser.ini',
'content/test/sanitize/browser.ini',
'content/test/sidebar/browser.ini',
'content/test/siteIdentity/browser.ini',
'content/test/siteProtections/browser.ini',
'content/test/static/browser.ini',
'content/test/statuspanel/browser.ini',
'content/test/sync/browser.ini',
@@ -54,7 +54,6 @@ BROWSER_CHROME_MANIFESTS += [
'content/test/tabPrompts/browser.ini',
'content/test/tabs/browser.ini',
'content/test/touch/browser.ini',
'content/test/trackingUI/browser.ini',
'content/test/webextensions/browser.ini',
'content/test/webrtc/browser.ini',
'content/test/zoom/browser.ini',

View File

@@ -1,7 +1,7 @@
[DEFAULT]
support-files =
head.js
!/browser/base/content/test/trackingUI/trackingPage.html
!/browser/base/content/test/protectionsUI/trackingPage.html
[browser_protections_lockwise.js]
[browser_protections_monitor.js]

View File

@@ -63,18 +63,17 @@
"browser/base/content/test/plugins/browser.ini": 59.59,
"browser/base/content/test/popupNotifications/browser.ini": 35.82,
"browser/base/content/test/popups/browser.ini": 11.64,
"browser/base/content/test/protectionsUI/browser.ini": 149.1,
"browser/base/content/test/referrer/browser.ini": 175.27,
"browser/base/content/test/sanitize/browser.ini": 17.72,
"browser/base/content/test/sidebar/browser.ini": 5.77,
"browser/base/content/test/siteIdentity/browser.ini": 167.96,
"browser/base/content/test/siteProtections/browser.ini": 34.67,
"browser/base/content/test/static/browser.ini": 33.02,
"browser/base/content/test/statuspanel/browser.ini": 2.76,
"browser/base/content/test/sync/browser.ini": 8.35,
"browser/base/content/test/tabPrompts/browser.ini": 4.25,
"browser/base/content/test/tabcrashed/browser.ini": 31.52,
"browser/base/content/test/tabs/browser.ini": 273.38,
"browser/base/content/test/trackingUI/browser.ini": 114.43,
"browser/base/content/test/webextensions/browser.ini": 39.34,
"browser/base/content/test/webrtc/browser.ini": 49.16,
"browser/base/content/test/zoom/browser.ini": 10.78,
@@ -786,4 +785,4 @@
"xpcom/string/crashtests/crashtests.list": 0.59,
"xpcom/tests/unit/xpcshell.ini": 55.49,
"xpfe/appshell/test/chrome.ini": 1.14
}
}

View File

@@ -43,9 +43,9 @@ support-files =
raptor.jpg
!/browser/modules/test/browser/head.js
!/browser/base/content/test/general/head.js
!/browser/base/content/test/trackingUI/cookieServer.sjs
!/browser/base/content/test/trackingUI/trackingPage.html
!/browser/base/content/test/trackingUI/trackingAPI.js
!/browser/base/content/test/protectionsUI/cookieServer.sjs
!/browser/base/content/test/protectionsUI/trackingPage.html
!/browser/base/content/test/protectionsUI/trackingAPI.js
[browser_allowListNotifications.js]
support-files = subResources.sjs

View File

@@ -13,7 +13,7 @@ AntiTracking._createTask({
await callRequestStorageAccess();
const TRACKING_PAGE =
"http://another-tracking.example.net/browser/browser/base/content/test/trackingUI/trackingPage.html";
"http://another-tracking.example.net/browser/browser/base/content/test/protectionsUI/trackingPage.html";
async function runChecks(name) {
let iframe = document.createElement("iframe");
iframe.src = TRACKING_PAGE;