Bug 1571893 - Remove the prefs that can cause Gecko to stop honouring the Content Blocking allow list; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D40895

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-08-07 15:54:54 +00:00
Родитель f74ee121f7
Коммит b05ce1a78b
38 изменённых файлов: 70 добавлений и 282 удалений

Просмотреть файл

@ -15530,8 +15530,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
MOZ_ASSERT_IF(parent, !nsContentUtils::IsInPrivateBrowsing(parent));
MOZ_ASSERT_IF(
NS_SUCCEEDED(AntiTrackingCommon::IsOnContentBlockingAllowList(
parent->GetDocumentURI(), false,
AntiTrackingCommon::eStorageChecks, isOnAllowList)),
parent->GetDocumentURI(), false, isOnAllowList)),
!isOnAllowList);
auto performFinalChecks = [inner]()

Просмотреть файл

@ -705,18 +705,6 @@
value: 2
mirror: always
# Whether Content Blocking allow list is respected for ETP interventions.
- name: browser.contentblocking.allowlist.storage.enabled
type: bool
value: true
mirror: always
# Whether Content Blocking allow list is respected for tracking annotations.
- name: browser.contentblocking.allowlist.annotations.enabled
type: bool
value: true
mirror: always
- name: browser.contentblocking.database.enabled
type: bool
value: false

Просмотреть файл

@ -390,16 +390,10 @@ void LowerPriorityHelper(nsIChannel* aChannel) {
} // namespace
// static
void UrlClassifierCommon::AnnotateChannel(
nsIChannel* aChannel,
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose,
uint32_t aClassificationFlags, uint32_t aLoadingState) {
void UrlClassifierCommon::AnnotateChannel(nsIChannel* aChannel,
uint32_t aClassificationFlags,
uint32_t aLoadingState) {
MOZ_ASSERT(aChannel);
MOZ_ASSERT(aPurpose == AntiTrackingCommon::eTrackingProtection ||
aPurpose == AntiTrackingCommon::eTrackingAnnotations ||
aPurpose == AntiTrackingCommon::eFingerprinting ||
aPurpose == AntiTrackingCommon::eCryptomining ||
aPurpose == AntiTrackingCommon::eSocialTracking);
nsCOMPtr<nsIURI> chanURI;
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
@ -426,7 +420,7 @@ void UrlClassifierCommon::AnnotateChannel(
IsCryptominingClassificationFlag(aClassificationFlags);
if (validClassificationFlags &&
(isThirdPartyWithTopLevelWinURI || IsAllowListed(aChannel, aPurpose))) {
(isThirdPartyWithTopLevelWinURI || IsAllowListed(aChannel))) {
UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
aChannel, aLoadingState);
}
@ -438,15 +432,7 @@ void UrlClassifierCommon::AnnotateChannel(
}
// static
bool UrlClassifierCommon::IsAllowListed(
nsIChannel* aChannel,
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose) {
MOZ_ASSERT(aPurpose == AntiTrackingCommon::eTrackingProtection ||
aPurpose == AntiTrackingCommon::eTrackingAnnotations ||
aPurpose == AntiTrackingCommon::eFingerprinting ||
aPurpose == AntiTrackingCommon::eCryptomining ||
aPurpose == AntiTrackingCommon::eSocialTracking);
bool UrlClassifierCommon::IsAllowListed(nsIChannel* aChannel) {
nsCOMPtr<nsIHttpChannelInternal> channel = do_QueryInterface(aChannel);
if (!channel) {
UC_LOG(("nsChannelClassifier: Not an HTTP channel"));
@ -475,7 +461,7 @@ bool UrlClassifierCommon::IsAllowListed(
bool isAllowListed = false;
rv = AntiTrackingCommon::IsOnContentBlockingAllowList(
topWinURI, NS_UsePrivateBrowsing(aChannel), aPurpose, isAllowListed);
topWinURI, NS_UsePrivateBrowsing(aChannel), isAllowListed);
if (NS_FAILED(rv)) { // normal for some loads, no need to print a warning
return false;
}

Просмотреть файл

@ -48,14 +48,11 @@ class UrlClassifierCommon final {
static nsresult CreatePairwiseWhiteListURI(nsIChannel* aChannel,
nsIURI** aURI);
static void AnnotateChannel(
nsIChannel* aChannel,
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose,
uint32_t aClassificationFlags, uint32_t aLoadingState);
static void AnnotateChannel(nsIChannel* aChannel,
uint32_t aClassificationFlags,
uint32_t aLoadingState);
static bool IsAllowListed(
nsIChannel* aChannel,
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose);
static bool IsAllowListed(nsIChannel* aChannel);
static bool IsTrackingClassificationFlag(uint32_t aFlag);

Просмотреть файл

@ -144,7 +144,7 @@ UrlClassifierFeatureCryptominingAnnotation::ProcessChannel(
UrlClassifierCommon::SetTrackingInfo(aChannel, aList, aHashes);
UrlClassifierCommon::AnnotateChannel(
aChannel, AntiTrackingCommon::eCryptomining, flags,
aChannel, flags,
nsIWebProgressListener::STATE_LOADED_CRYPTOMINING_CONTENT);
return NS_OK;
}

Просмотреть файл

@ -146,8 +146,7 @@ UrlClassifierFeatureCryptominingProtection::ProcessChannel(
NS_ENSURE_ARG_POINTER(aChannel);
NS_ENSURE_ARG_POINTER(aShouldContinue);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
aChannel, AntiTrackingCommon::eCryptomining);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(aChannel);
// This is a blocking feature.
*aShouldContinue = isAllowListed;

Просмотреть файл

@ -146,7 +146,7 @@ UrlClassifierFeatureFingerprintingAnnotation::ProcessChannel(
UrlClassifierCommon::SetTrackingInfo(aChannel, aList, aHashes);
UrlClassifierCommon::AnnotateChannel(
aChannel, AntiTrackingCommon::eFingerprinting, flags,
aChannel, flags,
nsIWebProgressListener::STATE_LOADED_FINGERPRINTING_CONTENT);
return NS_OK;

Просмотреть файл

@ -150,8 +150,7 @@ UrlClassifierFeatureFingerprintingProtection::ProcessChannel(
NS_ENSURE_ARG_POINTER(aChannel);
NS_ENSURE_ARG_POINTER(aShouldContinue);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
aChannel, AntiTrackingCommon::eFingerprinting);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(aChannel);
// This is a blocking feature.
*aShouldContinue = isAllowListed;

Просмотреть файл

@ -150,7 +150,7 @@ UrlClassifierFeatureSocialTrackingAnnotation::ProcessChannel(
nsIHttpChannel::ClassificationFlags::CLASSIFIED_SOCIALTRACKING);
UrlClassifierCommon::AnnotateChannel(
aChannel, AntiTrackingCommon::eSocialTracking, flags,
aChannel, flags,
nsIWebProgressListener::STATE_LOADED_SOCIALTRACKING_CONTENT);
return NS_OK;

Просмотреть файл

@ -150,8 +150,7 @@ UrlClassifierFeatureSocialTrackingProtection::ProcessChannel(
NS_ENSURE_ARG_POINTER(aChannel);
NS_ENSURE_ARG_POINTER(aShouldContinue);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
aChannel, AntiTrackingCommon::eSocialTracking);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(aChannel);
// This is a blocking feature.
*aShouldContinue = isAllowListed;

Просмотреть файл

@ -143,8 +143,7 @@ UrlClassifierFeatureTrackingAnnotation::ProcessChannel(
UrlClassifierCommon::SetTrackingInfo(aChannel, aList, aHashes);
UrlClassifierCommon::AnnotateChannel(
aChannel, AntiTrackingCommon::eTrackingAnnotations, flags,
nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT);
aChannel, flags, nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT);
return NS_OK;
}

Просмотреть файл

@ -143,8 +143,7 @@ UrlClassifierFeatureTrackingProtection::ProcessChannel(
NS_ENSURE_ARG_POINTER(aChannel);
NS_ENSURE_ARG_POINTER(aShouldContinue);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
aChannel, AntiTrackingCommon::eTrackingProtection);
bool isAllowListed = UrlClassifierCommon::IsAllowListed(aChannel);
// This is a blocking feature.
*aShouldContinue = isAllowListed;

Просмотреть файл

@ -14,7 +14,6 @@
#include "mozilla/Logging.h"
#include "mozilla/MruCache.h"
#include "mozilla/Pair.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_extensions.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozIThirdPartyUtil.h"
@ -314,8 +313,7 @@ bool CheckContentBlockingAllowList(nsIURI* aTopWinURI,
bool aIsPrivateBrowsing) {
bool isAllowed = false;
nsresult rv = AntiTrackingCommon::IsOnContentBlockingAllowList(
aTopWinURI, aIsPrivateBrowsing, AntiTrackingCommon::eStorageChecks,
isAllowed);
aTopWinURI, aIsPrivateBrowsing, isAllowed);
if (NS_SUCCEEDED(rv) && isAllowed) {
LOG_SPEC(
("The top-level window (%s) is on the content blocking allow list, "
@ -1770,30 +1768,9 @@ bool AntiTrackingCommon::MaybeIsFirstPartyStorageAccessGrantedFor(
}
nsresult AntiTrackingCommon::IsOnContentBlockingAllowList(
nsIURI* aTopWinURI, bool aIsPrivateBrowsing,
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose,
bool& aIsAllowListed) {
nsIURI* aTopWinURI, bool aIsPrivateBrowsing, bool& aIsAllowListed) {
aIsAllowListed = false;
// For storage checks, check the storage pref, and for annotations checks,
// check the corresponding pref as well. This allows each set of checks to
// be disabled individually if needed.
if ((aPurpose == eStorageChecks &&
!StaticPrefs::browser_contentblocking_allowlist_storage_enabled()) ||
(aPurpose == eTrackingAnnotations &&
!StaticPrefs::browser_contentblocking_allowlist_annotations_enabled()) ||
(aPurpose == eFingerprinting &&
!StaticPrefs::privacy_trackingprotection_fingerprinting_enabled()) ||
(aPurpose == eCryptomining &&
!StaticPrefs::privacy_trackingprotection_cryptomining_enabled()) ||
(aPurpose == eSocialTracking &&
!StaticPrefs::privacy_trackingprotection_socialtracking_enabled())) {
LOG(
("Attempting to check the content blocking allow list aborted because "
"the third-party cookies UI has been disabled."));
return NS_OK;
}
LOG_SPEC(("Deciding whether the user has overridden content blocking for %s",
_spec),
aTopWinURI);

Просмотреть файл

@ -125,19 +125,10 @@ class AntiTrackingCommon final {
const nsCString& aParentOrigin, const nsCString& aGrantedOrigin,
int aAllowMode);
enum ContentBlockingAllowListPurpose {
eStorageChecks,
eTrackingProtection,
eTrackingAnnotations,
eFingerprinting,
eCryptomining,
eSocialTracking,
};
// Check whether a top window URI is on the content blocking allow list.
static nsresult IsOnContentBlockingAllowList(
nsIURI* aTopWinURI, bool aIsPrivateBrowsing,
ContentBlockingAllowListPurpose aPurpose, bool& aIsAllowListed);
static nsresult IsOnContentBlockingAllowList(nsIURI* aTopWinURI,
bool aIsPrivateBrowsing,
bool& aIsAllowListed);
enum class BlockingDecision {
eBlock,

Просмотреть файл

@ -72,11 +72,36 @@ this.AntiTracking = {
accessRemoval = null,
callbackAfterRemoval = null
) {
let runExtraTests = true;
let options = {};
if (typeof callbackNonTracking == "object" && !!callbackNonTracking) {
options.callback = callbackNonTracking.callback;
runExtraTests = callbackNonTracking.runExtraTests;
if ("cookieBehavior" in callbackNonTracking) {
options.cookieBehavior = callbackNonTracking.cookieBehavior;
} else {
options.cookieBehavior = BEHAVIOR_ACCEPT;
}
if ("blockingByAllowList" in callbackNonTracking) {
options.blockingByAllowList = callbackNonTracking.blockingByAllowList;
} else {
options.blockingByAllowList = false;
}
if ("expectedBlockingNotifications" in callbackNonTracking) {
options.expectedBlockingNotifications =
callbackNonTracking.expectedBlockingNotifications;
} else {
options.expectedBlockingNotifications = 0;
}
callbackNonTracking = options.callback;
options.accessRemoval = null;
options.callbackAfterRemoval = null;
}
// Here we want to test that a 3rd party context is simply blocked.
this._createTask({
name,
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
blockingByContentBlockingRTUI: true,
allowList: false,
callback: callbackTracking,
extraPrefs,
@ -88,48 +113,7 @@ this.AntiTracking = {
});
this._createCleanupTask(cleanupFunction);
this._createTask({
name,
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
blockingByContentBlockingRTUI: false,
allowList: true,
callback: callbackTracking,
extraPrefs,
expectedBlockingNotifications,
runInPrivateWindow,
iframeSandbox,
accessRemoval,
callbackAfterRemoval,
});
this._createCleanupTask(cleanupFunction);
if (callbackNonTracking) {
let runExtraTests = true;
let options = {};
if (typeof callbackNonTracking == "object") {
options.callback = callbackNonTracking.callback;
runExtraTests = callbackNonTracking.runExtraTests;
if ("cookieBehavior" in callbackNonTracking) {
options.cookieBehavior = callbackNonTracking.cookieBehavior;
} else {
options.cookieBehavior = BEHAVIOR_ACCEPT;
}
if ("blockingByContentBlockingRTUI" in callbackNonTracking) {
options.blockingByContentBlockingRTUI =
callbackNonTracking.blockingByContentBlockingRTUI;
} else {
options.blockingByContentBlockingRTUI = false;
}
if ("blockingByAllowList" in callbackNonTracking) {
options.blockingByAllowList = callbackNonTracking.blockingByAllowList;
} else {
options.blockingByAllowList = false;
}
callbackNonTracking = options.callback;
options.accessRemoval = null;
options.callbackAfterRemoval = null;
}
// Phase 1: Here we want to test that a 3rd party context is not blocked if pref is off.
if (runExtraTests) {
// There are five ways in which the third-party context may not be blocked:
@ -142,7 +126,6 @@ this.AntiTracking = {
this._createTask({
name,
cookieBehavior: BEHAVIOR_ACCEPT,
blockingByContentBlockingRTUI: true,
allowList: false,
callback: callbackNonTracking,
extraPrefs,
@ -157,7 +140,6 @@ this.AntiTracking = {
this._createTask({
name,
cookieBehavior: BEHAVIOR_ACCEPT,
blockingByContentBlockingRTUI: false,
allowList: true,
callback: callbackNonTracking,
extraPrefs,
@ -169,25 +151,9 @@ this.AntiTracking = {
});
this._createCleanupTask(cleanupFunction);
this._createTask({
name,
cookieBehavior: BEHAVIOR_ACCEPT,
blockingByContentBlockingRTUI: false,
allowList: false,
callback: callbackNonTracking,
extraPrefs,
expectedBlockingNotifications: 0,
runInPrivateWindow,
iframeSandbox,
accessRemoval: null, // only passed with non-blocking callback
callbackAfterRemoval: null,
});
this._createCleanupTask(cleanupFunction);
this._createTask({
name,
cookieBehavior: BEHAVIOR_REJECT,
blockingByContentBlockingRTUI: true,
allowList: false,
callback: callbackTracking,
extraPrefs,
@ -202,7 +168,6 @@ this.AntiTracking = {
this._createTask({
name,
cookieBehavior: BEHAVIOR_LIMIT_FOREIGN,
blockingByContentBlockingRTUI: true,
allowList: true,
callback: callbackNonTracking,
extraPrefs,
@ -217,7 +182,6 @@ this.AntiTracking = {
this._createTask({
name,
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
blockingByContentBlockingRTUI: true,
allowList: true,
callback: callbackNonTracking,
extraPrefs,
@ -232,7 +196,6 @@ this.AntiTracking = {
this._createTask({
name,
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
blockingByContentBlockingRTUI: true,
allowList: true,
callback: callbackNonTracking,
extraPrefs,
@ -247,7 +210,6 @@ this.AntiTracking = {
this._createTask({
name,
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
blockingByContentBlockingRTUI: false,
allowList: false,
callback: callbackNonTracking,
extraPrefs,
@ -259,6 +221,21 @@ this.AntiTracking = {
thirdPartyPage: TEST_ANOTHER_3RD_PARTY_PAGE,
});
this._createCleanupTask(cleanupFunction);
} else {
// This is only used for imageCacheWorker.js tests
this._createTask({
name,
cookieBehavior: options.cookieBehavior,
allowList: options.blockingByAllowList,
callback: options.callback,
extraPrefs,
expectedBlockingNotifications: options.expectedBlockingNotifications,
runInPrivateWindow,
iframeSandbox,
accessRemoval: options.accessRemoval,
callbackAfterRemoval: options.callbackAfterRemoval,
});
this._createCleanupTask(cleanupFunction);
}
// Phase 2: Here we want to test that a third-party context doesn't
@ -310,24 +287,11 @@ this.AntiTracking = {
await windowClosed;
},
async _setupTest(
win,
cookieBehavior,
blockingByContentBlockingRTUI,
extraPrefs
) {
async _setupTest(win, cookieBehavior, extraPrefs) {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["dom.storage_access.enabled", true],
[
"browser.contentblocking.allowlist.annotations.enabled",
blockingByContentBlockingRTUI,
],
[
"browser.contentblocking.allowlist.storage.enabled",
blockingByContentBlockingRTUI,
],
["network.cookie.cookieBehavior", cookieBehavior],
["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", false],
@ -376,9 +340,7 @@ this.AntiTracking = {
: "non-blocking") +
" cookieBehavior (" +
options.cookieBehavior +
") and " +
(options.blockingByContentBlockingRTUI ? "" : "no") +
" contentBlocking third-party cookies UI with" +
") with" +
(options.allowList ? "" : "out") +
" allow list test " +
options.name +
@ -412,7 +374,6 @@ this.AntiTracking = {
await AntiTracking._setupTest(
win,
options.cookieBehavior,
options.blockingByContentBlockingRTUI,
options.extraPrefs
);
@ -452,7 +413,6 @@ this.AntiTracking = {
let doAccessRemovalChecks =
typeof options.accessRemoval == "string" &&
options.cookieBehavior == BEHAVIOR_REJECT_TRACKER &&
options.blockingByContentBlockingRTUI &&
!options.allowList;
let thirdPartyPage;
if (typeof options.thirdPartyPage == "string") {
@ -664,12 +624,7 @@ this.AntiTracking = {
await TestUtils.topicObserved("browser-delayed-startup-finished");
}
await AntiTracking._setupTest(
win,
BEHAVIOR_REJECT_TRACKER,
true,
extraPrefs
);
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, extraPrefs);
info("Creating a new tab");
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
@ -755,12 +710,7 @@ this.AntiTracking = {
await TestUtils.topicObserved("browser-delayed-startup-finished");
}
await AntiTracking._setupTest(
win,
BEHAVIOR_REJECT_TRACKER,
true,
extraPrefs
);
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, extraPrefs);
info("Creating a new tab");
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);

Просмотреть файл

@ -69,8 +69,6 @@ skip-if = fission
[browser_existingCookiesForSubresources.js]
[browser_firstPartyCookieRejectionHonoursAllowList.js]
[browser_imageCache4.js]
[browser_imageCache4-1.js]
[browser_imageCache4-2.js]
[browser_imageCache8.js]
[browser_onBeforeRequestNotificationForTrackingResources.js]
[browser_onModifyRequestNotificationForTrackingResources.js]

Просмотреть файл

@ -4,8 +4,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -4,8 +4,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -4,8 +4,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -96,8 +96,6 @@ add_task(async function() {
// Now set up our prefs
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -4,8 +4,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT],
["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", false],

Просмотреть файл

@ -1,14 +0,0 @@
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlockingRTUI = false;
let blockingByAllowList = true;
let expectedBlockingNotifications =
Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER;
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + "/";
}
/* import-globals-from imageCacheWorker.js */
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);

Просмотреть файл

@ -1,14 +0,0 @@
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlockingRTUI = false;
let blockingByAllowList = false;
let expectedBlockingNotifications =
Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER;
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + "/";
}
/* import-globals-from imageCacheWorker.js */
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);

Просмотреть файл

@ -1,5 +1,4 @@
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlockingRTUI = true;
let blockingByAllowList = false;
let expectedBlockingNotifications =
Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER;

Просмотреть файл

@ -1,5 +1,4 @@
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlockingRTUI = true;
let blockingByAllowList = true;
let expectedBlockingNotifications =
Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER;

Просмотреть файл

@ -5,8 +5,6 @@ add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [
["dom.storage_access.enabled", true],
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -53,8 +53,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
["privacy.trackingprotection.enabled", true],
// the test doesn't open a private window, so we don't care about this pref's value
["privacy.trackingprotection.pbmode.enabled", false],

Просмотреть файл

@ -50,8 +50,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
["privacy.trackingprotection.enabled", true],
// the test doesn't open a private window, so we don't care about this pref's value
["privacy.trackingprotection.pbmode.enabled", false],

Просмотреть файл

@ -287,8 +287,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -6,8 +6,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -31,8 +31,6 @@ async function testDoorHanger(
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
["dom.storage_access.auto_grants", true],
["dom.storage_access.auto_grants.delayed", false],
["dom.storage_access.enabled", true],

Просмотреть файл

@ -1,7 +1,5 @@
/* import-globals-from antitracking_head.js */
let counter = 0;
AntiTracking.runTest(
"Storage Access API called in a sandboxed iframe",
// blocking callback
@ -46,23 +44,7 @@ AntiTracking.runTest(
},
null, // non-blocking callback
// cleanup function
async _ => {
// The test harness calls this function twice. Our cleanup function is set
// up so that the first time that it's called, it would do the cleanup, but
// the second time it would bail out early. This ensures that after the
// first time, a re-run of this test still sees the blocking notifications,
// but also that the permission set here will be visible to the next steps
// of the test.
if (++counter % 2 == 0) {
return;
}
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
resolve()
);
});
},
null, // cleanup function
[["dom.storage_access.enabled", true]], // extra prefs
false, // no window open test
false, // no user-interaction test
@ -162,9 +144,6 @@ AntiTracking.runTest(
null, // non-blocking callback
// cleanup function
async _ => {
if (++counter % 2 == 1) {
return;
}
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
resolve()

Просмотреть файл

@ -7,8 +7,6 @@ add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [
["dom.storage_access.enabled", true],
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -4,8 +4,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -20,8 +20,6 @@ add_task(async function() {
set: [
["browser.cache.disk.enable", false],
["browser.cache.memory.enable", false],
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
[
"network.cookie.cookieBehavior",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,

Просмотреть файл

@ -9,8 +9,6 @@ add_task(async function() {
await SpecialPowers.flushPrefEnv();
await SpecialPowers.pushPrefEnv({
set: [
["browser.contentblocking.allowlist.annotations.enabled", true],
["browser.contentblocking.allowlist.storage.enabled", true],
["dom.storage_access.auto_grants", true],
["dom.storage_access.auto_grants.delayed", false],
["dom.storage_access.enabled", true],

Просмотреть файл

@ -30,7 +30,6 @@ AntiTracking.runTest(
{
runExtraTests: false,
cookieBehavior,
blockingByContentBlockingRTUI,
blockingByAllowList,
callback: async _ => {
// Let's load the image twice here as well.

Просмотреть файл

@ -172,17 +172,6 @@ async function interactWithTracker() {
}
function isOnContentBlockingAllowList() {
let prefs = [
"browser.contentblocking.allowlist.storage.enabled",
"browser.contentblocking.allowlist.annotations.enabled",
];
function allEnabled(prev, pref) {
return pref && SpecialPowers.Services.prefs.getBoolPref(pref);
}
if (!prefs.reduce(allEnabled)) {
return false;
}
let url = new URL(SpecialPowers.wrap(top).location.href);
let origin = SpecialPowers.Services.io.newURI("https://" + url.host);
let types = ["trackingprotection", "trackingprotection-pb"];