зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1766377 - Fix sign-compare warnings related to IDL constants. r=anti-tracking-reviewers,necko-reviewers,kershaw,timhuang
dom/network/TCPSocket.cpp(973,38): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'nsISocketTransport::(unnamed enum at obj-aarch64-pc-mingw32/dist/include/nsISocketTransport.h:102:3)' [-Werror,-Wsign-compare] if (static_cast<uint32_t>(aStatus) != ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ dom/security/ReferrerInfo.cpp(216,26): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'nsIWebProgressListener::(unnamed enum at obj-aarch64-pc-mingw32/dist/include/nsIWebProgressListener.h:41:3)' [-Werror,-Wsign-compare] rejectedReason != ~~~~~~~~~~~~~~ ^ toolkit/components/antitracking/StorageAccess.cpp(175,23): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'nsIWebProgressListener::(unnamed enum at obj-aarch64-pc-mingw32/dist/include/nsIWebProgressListener.h:41:3)' [-Werror,-Wsign-compare] if (aRejectedReason == ~~~~~~~~~~~~~~~ ^ toolkit/components/antitracking/StorageAccess.cpp(415,26): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'nsIWebProgressListener::(unnamed enum at obj-aarch64-pc-mingw32/dist/include/nsIWebProgressListener.h:41:3)' [-Werror,-Wsign-compare] aRejectedReason == ~~~~~~~~~~~~~~~ ^ toolkit/components/antitracking/StorageAccess.cpp(428,26): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'nsIWebProgressListener::(unnamed enum at obj-aarch64-pc-mingw32/dist/include/nsIWebProgressListener.h:41:3)' [-Werror,-Wsign-compare] return aRejectedReason == ~~~~~~~~~~~~~~~ ^ Differential Revision: https://phabricator.services.mozilla.com/D144693
This commit is contained in:
Родитель
e55237be4d
Коммит
74adf910ba
|
@ -971,7 +971,7 @@ NS_IMETHODIMP
|
||||||
TCPSocket::OnTransportStatus(nsITransport* aTransport, nsresult aStatus,
|
TCPSocket::OnTransportStatus(nsITransport* aTransport, nsresult aStatus,
|
||||||
int64_t aProgress, int64_t aProgressMax) {
|
int64_t aProgress, int64_t aProgressMax) {
|
||||||
if (static_cast<uint32_t>(aStatus) !=
|
if (static_cast<uint32_t>(aStatus) !=
|
||||||
nsISocketTransport::STATUS_CONNECTED_TO) {
|
static_cast<uint32_t>(nsISocketTransport::STATUS_CONNECTED_TO)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,8 @@ ReferrerPolicy ReferrerInfo::GetDefaultReferrerPolicy(nsIHttpChannel* aChannel,
|
||||||
!ContentBlocking::ShouldAllowAccessFor(aChannel, aURI,
|
!ContentBlocking::ShouldAllowAccessFor(aChannel, aURI,
|
||||||
&rejectedReason) &&
|
&rejectedReason) &&
|
||||||
rejectedReason !=
|
rejectedReason !=
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN;
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN);
|
||||||
// Here we intentionally do not notify about the rejection reason, if any
|
// Here we intentionally do not notify about the rejection reason, if any
|
||||||
// in order to avoid this check to have any visible side-effects (e.g. a
|
// in order to avoid this check to have any visible side-effects (e.g. a
|
||||||
// web console report.)
|
// web console report.)
|
||||||
|
|
|
@ -115,15 +115,23 @@ void ReportBlockingToConsole(uint64_t aWindowID, nsIURI* aURI,
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
aRejectedReason == 0 ||
|
aRejectedReason == 0 ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN ||
|
static_cast<uint32_t>(
|
||||||
aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL ||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) ||
|
||||||
aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
|
aRejectedReason ==
|
||||||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL) ||
|
||||||
|
aRejectedReason ==
|
||||||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN));
|
||||||
|
|
||||||
if (aURI->SchemeIs("chrome") || aURI->SchemeIs("about")) {
|
if (aURI->SchemeIs("chrome") || aURI->SchemeIs("about")) {
|
||||||
return;
|
return;
|
||||||
|
@ -409,15 +417,23 @@ void ContentBlockingNotifier::OnDecision(nsIChannel* aChannel,
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
aRejectedReason == 0 ||
|
aRejectedReason == 0 ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN ||
|
static_cast<uint32_t>(
|
||||||
aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL ||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) ||
|
||||||
aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
|
aRejectedReason ==
|
||||||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL) ||
|
||||||
|
aRejectedReason ==
|
||||||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN));
|
||||||
MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
|
MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
|
||||||
aDecision == BlockingDecision::eAllow);
|
aDecision == BlockingDecision::eAllow);
|
||||||
|
|
||||||
|
@ -440,15 +456,23 @@ void ContentBlockingNotifier::OnDecision(nsPIDOMWindowInner* aWindow,
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
aRejectedReason == 0 ||
|
aRejectedReason == 0 ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN ||
|
static_cast<uint32_t>(
|
||||||
aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL ||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) ||
|
||||||
aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
|
aRejectedReason ==
|
||||||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL) ||
|
||||||
|
aRejectedReason ==
|
||||||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN));
|
||||||
MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
|
MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
|
||||||
aDecision == BlockingDecision::eAllow);
|
aDecision == BlockingDecision::eAllow);
|
||||||
|
|
||||||
|
|
|
@ -165,15 +165,18 @@ static StorageAccess InternalStorageAllowedCheck(
|
||||||
|
|
||||||
// We want to have a partitioned storage only for trackers.
|
// We want to have a partitioned storage only for trackers.
|
||||||
if (aRejectedReason ==
|
if (aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) {
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER)) {
|
||||||
return StorageAccess::ePartitionTrackersOrDeny;
|
return StorageAccess::ePartitionTrackersOrDeny;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to have a partitioned storage for all third parties.
|
// We want to have a partitioned storage for all third parties.
|
||||||
if (aRejectedReason ==
|
if (aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) {
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN)) {
|
||||||
return StorageAccess::ePartitionForeignOrDeny;
|
return StorageAccess::ePartitionForeignOrDeny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,11 +412,14 @@ bool ShouldPartitionStorage(StorageAccess aAccess) {
|
||||||
|
|
||||||
bool ShouldPartitionStorage(uint32_t aRejectedReason) {
|
bool ShouldPartitionStorage(uint32_t aRejectedReason) {
|
||||||
return aRejectedReason ==
|
return aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) ||
|
||||||
aRejectedReason ==
|
aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN;
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StoragePartitioningEnabled(StorageAccess aAccess,
|
bool StoragePartitioningEnabled(StorageAccess aAccess,
|
||||||
|
@ -426,7 +432,8 @@ bool StoragePartitioningEnabled(StorageAccess aAccess,
|
||||||
bool StoragePartitioningEnabled(uint32_t aRejectedReason,
|
bool StoragePartitioningEnabled(uint32_t aRejectedReason,
|
||||||
nsICookieJarSettings* aCookieJarSettings) {
|
nsICookieJarSettings* aCookieJarSettings) {
|
||||||
return aRejectedReason ==
|
return aRejectedReason ==
|
||||||
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN &&
|
static_cast<uint32_t>(
|
||||||
|
nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) &&
|
||||||
aCookieJarSettings->GetCookieBehavior() ==
|
aCookieJarSettings->GetCookieBehavior() ==
|
||||||
nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN;
|
nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче