diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/components/cookiebanners | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
15 files changed, 2813 insertions, 18 deletions
diff --git a/toolkit/components/cookiebanners/CookieBannerChild.sys.mjs b/toolkit/components/cookiebanners/CookieBannerChild.sys.mjs index 4d8b481504..b56303d95b 100644 --- a/toolkit/components/cookiebanners/CookieBannerChild.sys.mjs +++ b/toolkit/components/cookiebanners/CookieBannerChild.sys.mjs @@ -488,18 +488,18 @@ export class CookieBannerChild extends JSWindowActorChild { let querySelectorTimeUS = Math.round(querySelectorTimeMS * 1000); if (this.#isTopLevel) { - Glean.cookieBannersClick.querySelectorRunCountPerWindowTopLevel.accumulateSamples( - [querySelectorCount] + Glean.cookieBannersClick.querySelectorRunCountPerWindowTopLevel.accumulateSingleSample( + querySelectorCount ); - Glean.cookieBannersClick.querySelectorRunDurationPerWindowTopLevel.accumulateSamples( - [querySelectorTimeUS] + Glean.cookieBannersClick.querySelectorRunDurationPerWindowTopLevel.accumulateSingleSample( + querySelectorTimeUS ); } else { - Glean.cookieBannersClick.querySelectorRunCountPerWindowFrame.accumulateSamples( - [querySelectorCount] + Glean.cookieBannersClick.querySelectorRunCountPerWindowFrame.accumulateSingleSample( + querySelectorCount ); - Glean.cookieBannersClick.querySelectorRunDurationPerWindowFrame.accumulateSamples( - [querySelectorTimeUS] + Glean.cookieBannersClick.querySelectorRunDurationPerWindowFrame.accumulateSingleSample( + querySelectorTimeUS ); } diff --git a/toolkit/components/cookiebanners/components.conf b/toolkit/components/cookiebanners/components.conf index adf85f8d2d..744fb75510 100644 --- a/toolkit/components/cookiebanners/components.conf +++ b/toolkit/components/cookiebanners/components.conf @@ -36,4 +36,17 @@ Classes = [ 'constructor': 'CookieBannerListService', 'processes': ProcessSelector.MAIN_PROCESS_ONLY, }, + { + 'cid': '{56197e18-d144-45b5-9f77-84102f064462}', + 'interfaces': ['nsICookieBannerTelemetryService'], + 'headers': ['/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.h'], + 'contract_ids': ['@mozilla.org/cookie-banner-telemetry-service;1'], + 'type': 'mozilla::nsCookieBannerTelemetryService', + 'singleton': True, + 'constructor': 'mozilla::nsCookieBannerTelemetryService::GetSingleton', + 'categories': { + 'profile-after-change': 'nsCookieBannerTelemetryService', + }, + 'processes': ProcessSelector.MAIN_PROCESS_ONLY, + }, ] diff --git a/toolkit/components/cookiebanners/cookieBanner.pb.cc b/toolkit/components/cookiebanners/cookieBanner.pb.cc new file mode 100644 index 0000000000..e415588ce0 --- /dev/null +++ b/toolkit/components/cookiebanners/cookieBanner.pb.cc @@ -0,0 +1,983 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: cookieBanner.proto + +#include "cookieBanner.pb.h" + +#include <algorithm> + +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/wire_format_lite.h> +#include <google/protobuf/io/zero_copy_stream_impl_lite.h> +// @@protoc_insertion_point(includes) +#include <google/protobuf/port_def.inc> + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace mozilla { +namespace cookieBanner { +PROTOBUF_CONSTEXPR GoogleSOCSCookie_extraData::GoogleSOCSCookie_extraData( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.platform_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.region_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.unused1_)*/0u + , /*decltype(_impl_.unused2_)*/0u} {} +struct GoogleSOCSCookie_extraDataDefaultTypeInternal { + PROTOBUF_CONSTEXPR GoogleSOCSCookie_extraDataDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~GoogleSOCSCookie_extraDataDefaultTypeInternal() {} + union { + GoogleSOCSCookie_extraData _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GoogleSOCSCookie_extraDataDefaultTypeInternal _GoogleSOCSCookie_extraData_default_instance_; +PROTOBUF_CONSTEXPR GoogleSOCSCookie_timeData::GoogleSOCSCookie_timeData( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.timestamp_)*/uint64_t{0u}} {} +struct GoogleSOCSCookie_timeDataDefaultTypeInternal { + PROTOBUF_CONSTEXPR GoogleSOCSCookie_timeDataDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~GoogleSOCSCookie_timeDataDefaultTypeInternal() {} + union { + GoogleSOCSCookie_timeData _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GoogleSOCSCookie_timeDataDefaultTypeInternal _GoogleSOCSCookie_timeData_default_instance_; +PROTOBUF_CONSTEXPR GoogleSOCSCookie::GoogleSOCSCookie( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.data_)*/nullptr + , /*decltype(_impl_.time_)*/nullptr + , /*decltype(_impl_.gdpr_choice_)*/0u} {} +struct GoogleSOCSCookieDefaultTypeInternal { + PROTOBUF_CONSTEXPR GoogleSOCSCookieDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~GoogleSOCSCookieDefaultTypeInternal() {} + union { + GoogleSOCSCookie _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GoogleSOCSCookieDefaultTypeInternal _GoogleSOCSCookie_default_instance_; +} // namespace cookieBanner +} // namespace mozilla +namespace mozilla { +namespace cookieBanner { + +// =================================================================== + +class GoogleSOCSCookie_extraData::_Internal { + public: + using HasBits = decltype(std::declval<GoogleSOCSCookie_extraData>()._impl_._has_bits_); + static void set_has_unused1(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_platform(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_region(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_unused2(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static bool MissingRequiredFields(const HasBits& has_bits) { + return ((has_bits[0] & 0x0000000f) ^ 0x0000000f) != 0; + } +}; + +GoogleSOCSCookie_extraData::GoogleSOCSCookie_extraData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:mozilla.cookieBanner.GoogleSOCSCookie.extraData) +} +GoogleSOCSCookie_extraData::GoogleSOCSCookie_extraData(const GoogleSOCSCookie_extraData& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + GoogleSOCSCookie_extraData* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.platform_){} + , decltype(_impl_.region_){} + , decltype(_impl_.unused1_){} + , decltype(_impl_.unused2_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.platform_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.platform_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_platform()) { + _this->_impl_.platform_.Set(from._internal_platform(), + _this->GetArenaForAllocation()); + } + _impl_.region_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.region_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_region()) { + _this->_impl_.region_.Set(from._internal_region(), + _this->GetArenaForAllocation()); + } + ::memcpy(&_impl_.unused1_, &from._impl_.unused1_, + static_cast<size_t>(reinterpret_cast<char*>(&_impl_.unused2_) - + reinterpret_cast<char*>(&_impl_.unused1_)) + sizeof(_impl_.unused2_)); + // @@protoc_insertion_point(copy_constructor:mozilla.cookieBanner.GoogleSOCSCookie.extraData) +} + +inline void GoogleSOCSCookie_extraData::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.platform_){} + , decltype(_impl_.region_){} + , decltype(_impl_.unused1_){0u} + , decltype(_impl_.unused2_){0u} + }; + _impl_.platform_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.platform_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.region_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.region_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +GoogleSOCSCookie_extraData::~GoogleSOCSCookie_extraData() { + // @@protoc_insertion_point(destructor:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void GoogleSOCSCookie_extraData::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.platform_.Destroy(); + _impl_.region_.Destroy(); +} + +void GoogleSOCSCookie_extraData::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void GoogleSOCSCookie_extraData::Clear() { +// @@protoc_insertion_point(message_clear_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _impl_.platform_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.region_.ClearNonDefaultToEmpty(); + } + } + if (cached_has_bits & 0x0000000cu) { + ::memset(&_impl_.unused1_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&_impl_.unused2_) - + reinterpret_cast<char*>(&_impl_.unused1_)) + sizeof(_impl_.unused2_)); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* GoogleSOCSCookie_extraData::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // required uint32 unused1 = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + _Internal::set_has_unused1(&has_bits); + _impl_.unused1_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // required string platform = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { + auto str = _internal_mutable_platform(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // required string region = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { + auto str = _internal_mutable_region(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // required uint32 unused2 = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { + _Internal::set_has_unused2(&has_bits); + _impl_.unused2_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* GoogleSOCSCookie_extraData::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // required uint32 unused1 = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_unused1(), target); + } + + // required string platform = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_platform(), target); + } + + // required string region = 3; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_region(), target); + } + + // required uint32 unused2 = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_unused2(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + return target; +} + +size_t GoogleSOCSCookie_extraData::RequiredFieldsByteSizeFallback() const { +// @@protoc_insertion_point(required_fields_byte_size_fallback_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + size_t total_size = 0; + + if (_internal_has_platform()) { + // required string platform = 2; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_platform()); + } + + if (_internal_has_region()) { + // required string region = 3; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_region()); + } + + if (_internal_has_unused1()) { + // required uint32 unused1 = 1; + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused1()); + } + + if (_internal_has_unused2()) { + // required uint32 unused2 = 4; + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused2()); + } + + return total_size; +} +size_t GoogleSOCSCookie_extraData::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + size_t total_size = 0; + + if (((_impl_._has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) { // All required fields are present. + // required string platform = 2; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_platform()); + + // required string region = 3; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_region()); + + // required uint32 unused1 = 1; + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused1()); + + // required uint32 unused2 = 4; + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused2()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void GoogleSOCSCookie_extraData::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const GoogleSOCSCookie_extraData*>( + &from)); +} + +void GoogleSOCSCookie_extraData::MergeFrom(const GoogleSOCSCookie_extraData& from) { + GoogleSOCSCookie_extraData* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_platform(from._internal_platform()); + } + if (cached_has_bits & 0x00000002u) { + _this->_internal_set_region(from._internal_region()); + } + if (cached_has_bits & 0x00000004u) { + _this->_impl_.unused1_ = from._impl_.unused1_; + } + if (cached_has_bits & 0x00000008u) { + _this->_impl_.unused2_ = from._impl_.unused2_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void GoogleSOCSCookie_extraData::CopyFrom(const GoogleSOCSCookie_extraData& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GoogleSOCSCookie_extraData::IsInitialized() const { + if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; + return true; +} + +void GoogleSOCSCookie_extraData::InternalSwap(GoogleSOCSCookie_extraData* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.platform_, lhs_arena, + &other->_impl_.platform_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.region_, lhs_arena, + &other->_impl_.region_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie_extraData, _impl_.unused2_) + + sizeof(GoogleSOCSCookie_extraData::_impl_.unused2_) + - PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie_extraData, _impl_.unused1_)>( + reinterpret_cast<char*>(&_impl_.unused1_), + reinterpret_cast<char*>(&other->_impl_.unused1_)); +} + +std::string GoogleSOCSCookie_extraData::GetTypeName() const { + return "mozilla.cookieBanner.GoogleSOCSCookie.extraData"; +} + + +// =================================================================== + +class GoogleSOCSCookie_timeData::_Internal { + public: + using HasBits = decltype(std::declval<GoogleSOCSCookie_timeData>()._impl_._has_bits_); + static void set_has_timestamp(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static bool MissingRequiredFields(const HasBits& has_bits) { + return ((has_bits[0] & 0x00000001) ^ 0x00000001) != 0; + } +}; + +GoogleSOCSCookie_timeData::GoogleSOCSCookie_timeData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:mozilla.cookieBanner.GoogleSOCSCookie.timeData) +} +GoogleSOCSCookie_timeData::GoogleSOCSCookie_timeData(const GoogleSOCSCookie_timeData& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + GoogleSOCSCookie_timeData* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.timestamp_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _this->_impl_.timestamp_ = from._impl_.timestamp_; + // @@protoc_insertion_point(copy_constructor:mozilla.cookieBanner.GoogleSOCSCookie.timeData) +} + +inline void GoogleSOCSCookie_timeData::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.timestamp_){uint64_t{0u}} + }; +} + +GoogleSOCSCookie_timeData::~GoogleSOCSCookie_timeData() { + // @@protoc_insertion_point(destructor:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void GoogleSOCSCookie_timeData::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void GoogleSOCSCookie_timeData::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void GoogleSOCSCookie_timeData::Clear() { +// @@protoc_insertion_point(message_clear_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.timestamp_ = uint64_t{0u}; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* GoogleSOCSCookie_timeData::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // required uint64 timeStamp = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + _Internal::set_has_timestamp(&has_bits); + _impl_.timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* GoogleSOCSCookie_timeData::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // required uint64 timeStamp = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_timestamp(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + return target; +} + +size_t GoogleSOCSCookie_timeData::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + size_t total_size = 0; + + // required uint64 timeStamp = 1; + if (_internal_has_timestamp()) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_timestamp()); + } + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void GoogleSOCSCookie_timeData::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const GoogleSOCSCookie_timeData*>( + &from)); +} + +void GoogleSOCSCookie_timeData::MergeFrom(const GoogleSOCSCookie_timeData& from) { + GoogleSOCSCookie_timeData* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_timestamp()) { + _this->_internal_set_timestamp(from._internal_timestamp()); + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void GoogleSOCSCookie_timeData::CopyFrom(const GoogleSOCSCookie_timeData& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GoogleSOCSCookie_timeData::IsInitialized() const { + if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; + return true; +} + +void GoogleSOCSCookie_timeData::InternalSwap(GoogleSOCSCookie_timeData* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.timestamp_, other->_impl_.timestamp_); +} + +std::string GoogleSOCSCookie_timeData::GetTypeName() const { + return "mozilla.cookieBanner.GoogleSOCSCookie.timeData"; +} + + +// =================================================================== + +class GoogleSOCSCookie::_Internal { + public: + using HasBits = decltype(std::declval<GoogleSOCSCookie>()._impl_._has_bits_); + static void set_has_gdpr_choice(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& data(const GoogleSOCSCookie* msg); + static void set_has_data(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& time(const GoogleSOCSCookie* msg); + static void set_has_time(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static bool MissingRequiredFields(const HasBits& has_bits) { + return ((has_bits[0] & 0x00000007) ^ 0x00000007) != 0; + } +}; + +const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& +GoogleSOCSCookie::_Internal::data(const GoogleSOCSCookie* msg) { + return *msg->_impl_.data_; +} +const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& +GoogleSOCSCookie::_Internal::time(const GoogleSOCSCookie* msg) { + return *msg->_impl_.time_; +} +GoogleSOCSCookie::GoogleSOCSCookie(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:mozilla.cookieBanner.GoogleSOCSCookie) +} +GoogleSOCSCookie::GoogleSOCSCookie(const GoogleSOCSCookie& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + GoogleSOCSCookie* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.data_){nullptr} + , decltype(_impl_.time_){nullptr} + , decltype(_impl_.gdpr_choice_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + if (from._internal_has_data()) { + _this->_impl_.data_ = new ::mozilla::cookieBanner::GoogleSOCSCookie_extraData(*from._impl_.data_); + } + if (from._internal_has_time()) { + _this->_impl_.time_ = new ::mozilla::cookieBanner::GoogleSOCSCookie_timeData(*from._impl_.time_); + } + _this->_impl_.gdpr_choice_ = from._impl_.gdpr_choice_; + // @@protoc_insertion_point(copy_constructor:mozilla.cookieBanner.GoogleSOCSCookie) +} + +inline void GoogleSOCSCookie::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.data_){nullptr} + , decltype(_impl_.time_){nullptr} + , decltype(_impl_.gdpr_choice_){0u} + }; +} + +GoogleSOCSCookie::~GoogleSOCSCookie() { + // @@protoc_insertion_point(destructor:mozilla.cookieBanner.GoogleSOCSCookie) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void GoogleSOCSCookie::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.data_; + if (this != internal_default_instance()) delete _impl_.time_; +} + +void GoogleSOCSCookie::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void GoogleSOCSCookie::Clear() { +// @@protoc_insertion_point(message_clear_start:mozilla.cookieBanner.GoogleSOCSCookie) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(_impl_.data_ != nullptr); + _impl_.data_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(_impl_.time_ != nullptr); + _impl_.time_->Clear(); + } + } + _impl_.gdpr_choice_ = 0u; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* GoogleSOCSCookie::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // required uint32 gdpr_choice = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + _Internal::set_has_gdpr_choice(&has_bits); + _impl_.gdpr_choice_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_data(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_time(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* GoogleSOCSCookie::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:mozilla.cookieBanner.GoogleSOCSCookie) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // required uint32 gdpr_choice = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_gdpr_choice(), target); + } + + // required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2; + if (cached_has_bits & 0x00000001u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(2, _Internal::data(this), + _Internal::data(this).GetCachedSize(), target, stream); + } + + // required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3; + if (cached_has_bits & 0x00000002u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(3, _Internal::time(this), + _Internal::time(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:mozilla.cookieBanner.GoogleSOCSCookie) + return target; +} + +size_t GoogleSOCSCookie::RequiredFieldsByteSizeFallback() const { +// @@protoc_insertion_point(required_fields_byte_size_fallback_start:mozilla.cookieBanner.GoogleSOCSCookie) + size_t total_size = 0; + + if (_internal_has_data()) { + // required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.data_); + } + + if (_internal_has_time()) { + // required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.time_); + } + + if (_internal_has_gdpr_choice()) { + // required uint32 gdpr_choice = 1; + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_gdpr_choice()); + } + + return total_size; +} +size_t GoogleSOCSCookie::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:mozilla.cookieBanner.GoogleSOCSCookie) + size_t total_size = 0; + + if (((_impl_._has_bits_[0] & 0x00000007) ^ 0x00000007) == 0) { // All required fields are present. + // required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.data_); + + // required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.time_); + + // required uint32 gdpr_choice = 1; + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_gdpr_choice()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void GoogleSOCSCookie::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const GoogleSOCSCookie*>( + &from)); +} + +void GoogleSOCSCookie::MergeFrom(const GoogleSOCSCookie& from) { + GoogleSOCSCookie* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.cookieBanner.GoogleSOCSCookie) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_mutable_data()->::mozilla::cookieBanner::GoogleSOCSCookie_extraData::MergeFrom( + from._internal_data()); + } + if (cached_has_bits & 0x00000002u) { + _this->_internal_mutable_time()->::mozilla::cookieBanner::GoogleSOCSCookie_timeData::MergeFrom( + from._internal_time()); + } + if (cached_has_bits & 0x00000004u) { + _this->_impl_.gdpr_choice_ = from._impl_.gdpr_choice_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void GoogleSOCSCookie::CopyFrom(const GoogleSOCSCookie& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.cookieBanner.GoogleSOCSCookie) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GoogleSOCSCookie::IsInitialized() const { + if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; + if (_internal_has_data()) { + if (!_impl_.data_->IsInitialized()) return false; + } + if (_internal_has_time()) { + if (!_impl_.time_->IsInitialized()) return false; + } + return true; +} + +void GoogleSOCSCookie::InternalSwap(GoogleSOCSCookie* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie, _impl_.gdpr_choice_) + + sizeof(GoogleSOCSCookie::_impl_.gdpr_choice_) + - PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie, _impl_.data_)>( + reinterpret_cast<char*>(&_impl_.data_), + reinterpret_cast<char*>(&other->_impl_.data_)); +} + +std::string GoogleSOCSCookie::GetTypeName() const { + return "mozilla.cookieBanner.GoogleSOCSCookie"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace cookieBanner +} // namespace mozilla +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* +Arena::CreateMaybeMessage< ::mozilla::cookieBanner::GoogleSOCSCookie_extraData >(Arena* arena) { + return Arena::CreateMessageInternal< ::mozilla::cookieBanner::GoogleSOCSCookie_extraData >(arena); +} +template<> PROTOBUF_NOINLINE ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* +Arena::CreateMaybeMessage< ::mozilla::cookieBanner::GoogleSOCSCookie_timeData >(Arena* arena) { + return Arena::CreateMessageInternal< ::mozilla::cookieBanner::GoogleSOCSCookie_timeData >(arena); +} +template<> PROTOBUF_NOINLINE ::mozilla::cookieBanner::GoogleSOCSCookie* +Arena::CreateMaybeMessage< ::mozilla::cookieBanner::GoogleSOCSCookie >(Arena* arena) { + return Arena::CreateMessageInternal< ::mozilla::cookieBanner::GoogleSOCSCookie >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include <google/protobuf/port_undef.inc> diff --git a/toolkit/components/cookiebanners/cookieBanner.pb.h b/toolkit/components/cookiebanners/cookieBanner.pb.h new file mode 100644 index 0000000000..f7bb138489 --- /dev/null +++ b/toolkit/components/cookiebanners/cookieBanner.pb.h @@ -0,0 +1,1058 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: cookieBanner.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_cookieBanner_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_cookieBanner_2eproto + +#include <limits> +#include <string> + +#include <google/protobuf/port_def.inc> +#if PROTOBUF_VERSION < 3021000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/port_undef.inc> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata_lite.h> +#include <google/protobuf/message_lite.h> +#include <google/protobuf/repeated_field.h> // IWYU pragma: export +#include <google/protobuf/extension_set.h> // IWYU pragma: export +// @@protoc_insertion_point(includes) +#include <google/protobuf/port_def.inc> +#define PROTOBUF_INTERNAL_EXPORT_cookieBanner_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_cookieBanner_2eproto { + static const uint32_t offsets[]; +}; +namespace mozilla { +namespace cookieBanner { +class GoogleSOCSCookie; +struct GoogleSOCSCookieDefaultTypeInternal; +extern GoogleSOCSCookieDefaultTypeInternal _GoogleSOCSCookie_default_instance_; +class GoogleSOCSCookie_extraData; +struct GoogleSOCSCookie_extraDataDefaultTypeInternal; +extern GoogleSOCSCookie_extraDataDefaultTypeInternal _GoogleSOCSCookie_extraData_default_instance_; +class GoogleSOCSCookie_timeData; +struct GoogleSOCSCookie_timeDataDefaultTypeInternal; +extern GoogleSOCSCookie_timeDataDefaultTypeInternal _GoogleSOCSCookie_timeData_default_instance_; +} // namespace cookieBanner +} // namespace mozilla +PROTOBUF_NAMESPACE_OPEN +template<> ::mozilla::cookieBanner::GoogleSOCSCookie* Arena::CreateMaybeMessage<::mozilla::cookieBanner::GoogleSOCSCookie>(Arena*); +template<> ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* Arena::CreateMaybeMessage<::mozilla::cookieBanner::GoogleSOCSCookie_extraData>(Arena*); +template<> ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* Arena::CreateMaybeMessage<::mozilla::cookieBanner::GoogleSOCSCookie_timeData>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace mozilla { +namespace cookieBanner { + +// =================================================================== + +class GoogleSOCSCookie_extraData final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:mozilla.cookieBanner.GoogleSOCSCookie.extraData) */ { + public: + inline GoogleSOCSCookie_extraData() : GoogleSOCSCookie_extraData(nullptr) {} + ~GoogleSOCSCookie_extraData() override; + explicit PROTOBUF_CONSTEXPR GoogleSOCSCookie_extraData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GoogleSOCSCookie_extraData(const GoogleSOCSCookie_extraData& from); + GoogleSOCSCookie_extraData(GoogleSOCSCookie_extraData&& from) noexcept + : GoogleSOCSCookie_extraData() { + *this = ::std::move(from); + } + + inline GoogleSOCSCookie_extraData& operator=(const GoogleSOCSCookie_extraData& from) { + CopyFrom(from); + return *this; + } + inline GoogleSOCSCookie_extraData& operator=(GoogleSOCSCookie_extraData&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const GoogleSOCSCookie_extraData& default_instance() { + return *internal_default_instance(); + } + static inline const GoogleSOCSCookie_extraData* internal_default_instance() { + return reinterpret_cast<const GoogleSOCSCookie_extraData*>( + &_GoogleSOCSCookie_extraData_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(GoogleSOCSCookie_extraData& a, GoogleSOCSCookie_extraData& b) { + a.Swap(&b); + } + inline void Swap(GoogleSOCSCookie_extraData* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GoogleSOCSCookie_extraData* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + GoogleSOCSCookie_extraData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<GoogleSOCSCookie_extraData>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const GoogleSOCSCookie_extraData& from); + void MergeFrom(const GoogleSOCSCookie_extraData& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(GoogleSOCSCookie_extraData* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "mozilla.cookieBanner.GoogleSOCSCookie.extraData"; + } + protected: + explicit GoogleSOCSCookie_extraData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPlatformFieldNumber = 2, + kRegionFieldNumber = 3, + kUnused1FieldNumber = 1, + kUnused2FieldNumber = 4, + }; + // required string platform = 2; + bool has_platform() const; + private: + bool _internal_has_platform() const; + public: + void clear_platform(); + const std::string& platform() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_platform(ArgT0&& arg0, ArgT... args); + std::string* mutable_platform(); + PROTOBUF_NODISCARD std::string* release_platform(); + void set_allocated_platform(std::string* platform); + private: + const std::string& _internal_platform() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_platform(const std::string& value); + std::string* _internal_mutable_platform(); + public: + + // required string region = 3; + bool has_region() const; + private: + bool _internal_has_region() const; + public: + void clear_region(); + const std::string& region() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_region(ArgT0&& arg0, ArgT... args); + std::string* mutable_region(); + PROTOBUF_NODISCARD std::string* release_region(); + void set_allocated_region(std::string* region); + private: + const std::string& _internal_region() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_region(const std::string& value); + std::string* _internal_mutable_region(); + public: + + // required uint32 unused1 = 1; + bool has_unused1() const; + private: + bool _internal_has_unused1() const; + public: + void clear_unused1(); + uint32_t unused1() const; + void set_unused1(uint32_t value); + private: + uint32_t _internal_unused1() const; + void _internal_set_unused1(uint32_t value); + public: + + // required uint32 unused2 = 4; + bool has_unused2() const; + private: + bool _internal_has_unused2() const; + public: + void clear_unused2(); + uint32_t unused2() const; + void set_unused2(uint32_t value); + private: + uint32_t _internal_unused2() const; + void _internal_set_unused2(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:mozilla.cookieBanner.GoogleSOCSCookie.extraData) + private: + class _Internal; + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr platform_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr region_; + uint32_t unused1_; + uint32_t unused2_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_cookieBanner_2eproto; +}; +// ------------------------------------------------------------------- + +class GoogleSOCSCookie_timeData final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:mozilla.cookieBanner.GoogleSOCSCookie.timeData) */ { + public: + inline GoogleSOCSCookie_timeData() : GoogleSOCSCookie_timeData(nullptr) {} + ~GoogleSOCSCookie_timeData() override; + explicit PROTOBUF_CONSTEXPR GoogleSOCSCookie_timeData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GoogleSOCSCookie_timeData(const GoogleSOCSCookie_timeData& from); + GoogleSOCSCookie_timeData(GoogleSOCSCookie_timeData&& from) noexcept + : GoogleSOCSCookie_timeData() { + *this = ::std::move(from); + } + + inline GoogleSOCSCookie_timeData& operator=(const GoogleSOCSCookie_timeData& from) { + CopyFrom(from); + return *this; + } + inline GoogleSOCSCookie_timeData& operator=(GoogleSOCSCookie_timeData&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const GoogleSOCSCookie_timeData& default_instance() { + return *internal_default_instance(); + } + static inline const GoogleSOCSCookie_timeData* internal_default_instance() { + return reinterpret_cast<const GoogleSOCSCookie_timeData*>( + &_GoogleSOCSCookie_timeData_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(GoogleSOCSCookie_timeData& a, GoogleSOCSCookie_timeData& b) { + a.Swap(&b); + } + inline void Swap(GoogleSOCSCookie_timeData* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GoogleSOCSCookie_timeData* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + GoogleSOCSCookie_timeData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<GoogleSOCSCookie_timeData>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const GoogleSOCSCookie_timeData& from); + void MergeFrom(const GoogleSOCSCookie_timeData& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(GoogleSOCSCookie_timeData* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "mozilla.cookieBanner.GoogleSOCSCookie.timeData"; + } + protected: + explicit GoogleSOCSCookie_timeData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTimeStampFieldNumber = 1, + }; + // required uint64 timeStamp = 1; + bool has_timestamp() const; + private: + bool _internal_has_timestamp() const; + public: + void clear_timestamp(); + uint64_t timestamp() const; + void set_timestamp(uint64_t value); + private: + uint64_t _internal_timestamp() const; + void _internal_set_timestamp(uint64_t value); + public: + + // @@protoc_insertion_point(class_scope:mozilla.cookieBanner.GoogleSOCSCookie.timeData) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + uint64_t timestamp_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_cookieBanner_2eproto; +}; +// ------------------------------------------------------------------- + +class GoogleSOCSCookie final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:mozilla.cookieBanner.GoogleSOCSCookie) */ { + public: + inline GoogleSOCSCookie() : GoogleSOCSCookie(nullptr) {} + ~GoogleSOCSCookie() override; + explicit PROTOBUF_CONSTEXPR GoogleSOCSCookie(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GoogleSOCSCookie(const GoogleSOCSCookie& from); + GoogleSOCSCookie(GoogleSOCSCookie&& from) noexcept + : GoogleSOCSCookie() { + *this = ::std::move(from); + } + + inline GoogleSOCSCookie& operator=(const GoogleSOCSCookie& from) { + CopyFrom(from); + return *this; + } + inline GoogleSOCSCookie& operator=(GoogleSOCSCookie&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const GoogleSOCSCookie& default_instance() { + return *internal_default_instance(); + } + static inline const GoogleSOCSCookie* internal_default_instance() { + return reinterpret_cast<const GoogleSOCSCookie*>( + &_GoogleSOCSCookie_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(GoogleSOCSCookie& a, GoogleSOCSCookie& b) { + a.Swap(&b); + } + inline void Swap(GoogleSOCSCookie* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GoogleSOCSCookie* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + GoogleSOCSCookie* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<GoogleSOCSCookie>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const GoogleSOCSCookie& from); + void MergeFrom(const GoogleSOCSCookie& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(GoogleSOCSCookie* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "mozilla.cookieBanner.GoogleSOCSCookie"; + } + protected: + explicit GoogleSOCSCookie(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef GoogleSOCSCookie_extraData extraData; + typedef GoogleSOCSCookie_timeData timeData; + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 2, + kTimeFieldNumber = 3, + kGdprChoiceFieldNumber = 1, + }; + // required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2; + bool has_data() const; + private: + bool _internal_has_data() const; + public: + void clear_data(); + const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& data() const; + PROTOBUF_NODISCARD ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* release_data(); + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* mutable_data(); + void set_allocated_data(::mozilla::cookieBanner::GoogleSOCSCookie_extraData* data); + private: + const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& _internal_data() const; + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* _internal_mutable_data(); + public: + void unsafe_arena_set_allocated_data( + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* data); + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* unsafe_arena_release_data(); + + // required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3; + bool has_time() const; + private: + bool _internal_has_time() const; + public: + void clear_time(); + const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& time() const; + PROTOBUF_NODISCARD ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* release_time(); + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* mutable_time(); + void set_allocated_time(::mozilla::cookieBanner::GoogleSOCSCookie_timeData* time); + private: + const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& _internal_time() const; + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* _internal_mutable_time(); + public: + void unsafe_arena_set_allocated_time( + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* time); + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* unsafe_arena_release_time(); + + // required uint32 gdpr_choice = 1; + bool has_gdpr_choice() const; + private: + bool _internal_has_gdpr_choice() const; + public: + void clear_gdpr_choice(); + uint32_t gdpr_choice() const; + void set_gdpr_choice(uint32_t value); + private: + uint32_t _internal_gdpr_choice() const; + void _internal_set_gdpr_choice(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:mozilla.cookieBanner.GoogleSOCSCookie) + private: + class _Internal; + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* data_; + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* time_; + uint32_t gdpr_choice_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_cookieBanner_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// GoogleSOCSCookie_extraData + +// required uint32 unused1 = 1; +inline bool GoogleSOCSCookie_extraData::_internal_has_unused1() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool GoogleSOCSCookie_extraData::has_unused1() const { + return _internal_has_unused1(); +} +inline void GoogleSOCSCookie_extraData::clear_unused1() { + _impl_.unused1_ = 0u; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline uint32_t GoogleSOCSCookie_extraData::_internal_unused1() const { + return _impl_.unused1_; +} +inline uint32_t GoogleSOCSCookie_extraData::unused1() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.extraData.unused1) + return _internal_unused1(); +} +inline void GoogleSOCSCookie_extraData::_internal_set_unused1(uint32_t value) { + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.unused1_ = value; +} +inline void GoogleSOCSCookie_extraData::set_unused1(uint32_t value) { + _internal_set_unused1(value); + // @@protoc_insertion_point(field_set:mozilla.cookieBanner.GoogleSOCSCookie.extraData.unused1) +} + +// required string platform = 2; +inline bool GoogleSOCSCookie_extraData::_internal_has_platform() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool GoogleSOCSCookie_extraData::has_platform() const { + return _internal_has_platform(); +} +inline void GoogleSOCSCookie_extraData::clear_platform() { + _impl_.platform_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& GoogleSOCSCookie_extraData::platform() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.extraData.platform) + return _internal_platform(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void GoogleSOCSCookie_extraData::set_platform(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.platform_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:mozilla.cookieBanner.GoogleSOCSCookie.extraData.platform) +} +inline std::string* GoogleSOCSCookie_extraData::mutable_platform() { + std::string* _s = _internal_mutable_platform(); + // @@protoc_insertion_point(field_mutable:mozilla.cookieBanner.GoogleSOCSCookie.extraData.platform) + return _s; +} +inline const std::string& GoogleSOCSCookie_extraData::_internal_platform() const { + return _impl_.platform_.Get(); +} +inline void GoogleSOCSCookie_extraData::_internal_set_platform(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.platform_.Set(value, GetArenaForAllocation()); +} +inline std::string* GoogleSOCSCookie_extraData::_internal_mutable_platform() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.platform_.Mutable(GetArenaForAllocation()); +} +inline std::string* GoogleSOCSCookie_extraData::release_platform() { + // @@protoc_insertion_point(field_release:mozilla.cookieBanner.GoogleSOCSCookie.extraData.platform) + if (!_internal_has_platform()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.platform_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.platform_.IsDefault()) { + _impl_.platform_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void GoogleSOCSCookie_extraData::set_allocated_platform(std::string* platform) { + if (platform != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.platform_.SetAllocated(platform, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.platform_.IsDefault()) { + _impl_.platform_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:mozilla.cookieBanner.GoogleSOCSCookie.extraData.platform) +} + +// required string region = 3; +inline bool GoogleSOCSCookie_extraData::_internal_has_region() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool GoogleSOCSCookie_extraData::has_region() const { + return _internal_has_region(); +} +inline void GoogleSOCSCookie_extraData::clear_region() { + _impl_.region_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const std::string& GoogleSOCSCookie_extraData::region() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.extraData.region) + return _internal_region(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void GoogleSOCSCookie_extraData::set_region(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.region_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:mozilla.cookieBanner.GoogleSOCSCookie.extraData.region) +} +inline std::string* GoogleSOCSCookie_extraData::mutable_region() { + std::string* _s = _internal_mutable_region(); + // @@protoc_insertion_point(field_mutable:mozilla.cookieBanner.GoogleSOCSCookie.extraData.region) + return _s; +} +inline const std::string& GoogleSOCSCookie_extraData::_internal_region() const { + return _impl_.region_.Get(); +} +inline void GoogleSOCSCookie_extraData::_internal_set_region(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.region_.Set(value, GetArenaForAllocation()); +} +inline std::string* GoogleSOCSCookie_extraData::_internal_mutable_region() { + _impl_._has_bits_[0] |= 0x00000002u; + return _impl_.region_.Mutable(GetArenaForAllocation()); +} +inline std::string* GoogleSOCSCookie_extraData::release_region() { + // @@protoc_insertion_point(field_release:mozilla.cookieBanner.GoogleSOCSCookie.extraData.region) + if (!_internal_has_region()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* p = _impl_.region_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.region_.IsDefault()) { + _impl_.region_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void GoogleSOCSCookie_extraData::set_allocated_region(std::string* region) { + if (region != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.region_.SetAllocated(region, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.region_.IsDefault()) { + _impl_.region_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:mozilla.cookieBanner.GoogleSOCSCookie.extraData.region) +} + +// required uint32 unused2 = 4; +inline bool GoogleSOCSCookie_extraData::_internal_has_unused2() const { + bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool GoogleSOCSCookie_extraData::has_unused2() const { + return _internal_has_unused2(); +} +inline void GoogleSOCSCookie_extraData::clear_unused2() { + _impl_.unused2_ = 0u; + _impl_._has_bits_[0] &= ~0x00000008u; +} +inline uint32_t GoogleSOCSCookie_extraData::_internal_unused2() const { + return _impl_.unused2_; +} +inline uint32_t GoogleSOCSCookie_extraData::unused2() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.extraData.unused2) + return _internal_unused2(); +} +inline void GoogleSOCSCookie_extraData::_internal_set_unused2(uint32_t value) { + _impl_._has_bits_[0] |= 0x00000008u; + _impl_.unused2_ = value; +} +inline void GoogleSOCSCookie_extraData::set_unused2(uint32_t value) { + _internal_set_unused2(value); + // @@protoc_insertion_point(field_set:mozilla.cookieBanner.GoogleSOCSCookie.extraData.unused2) +} + +// ------------------------------------------------------------------- + +// GoogleSOCSCookie_timeData + +// required uint64 timeStamp = 1; +inline bool GoogleSOCSCookie_timeData::_internal_has_timestamp() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool GoogleSOCSCookie_timeData::has_timestamp() const { + return _internal_has_timestamp(); +} +inline void GoogleSOCSCookie_timeData::clear_timestamp() { + _impl_.timestamp_ = uint64_t{0u}; + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline uint64_t GoogleSOCSCookie_timeData::_internal_timestamp() const { + return _impl_.timestamp_; +} +inline uint64_t GoogleSOCSCookie_timeData::timestamp() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.timeData.timeStamp) + return _internal_timestamp(); +} +inline void GoogleSOCSCookie_timeData::_internal_set_timestamp(uint64_t value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.timestamp_ = value; +} +inline void GoogleSOCSCookie_timeData::set_timestamp(uint64_t value) { + _internal_set_timestamp(value); + // @@protoc_insertion_point(field_set:mozilla.cookieBanner.GoogleSOCSCookie.timeData.timeStamp) +} + +// ------------------------------------------------------------------- + +// GoogleSOCSCookie + +// required uint32 gdpr_choice = 1; +inline bool GoogleSOCSCookie::_internal_has_gdpr_choice() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool GoogleSOCSCookie::has_gdpr_choice() const { + return _internal_has_gdpr_choice(); +} +inline void GoogleSOCSCookie::clear_gdpr_choice() { + _impl_.gdpr_choice_ = 0u; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline uint32_t GoogleSOCSCookie::_internal_gdpr_choice() const { + return _impl_.gdpr_choice_; +} +inline uint32_t GoogleSOCSCookie::gdpr_choice() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.gdpr_choice) + return _internal_gdpr_choice(); +} +inline void GoogleSOCSCookie::_internal_set_gdpr_choice(uint32_t value) { + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.gdpr_choice_ = value; +} +inline void GoogleSOCSCookie::set_gdpr_choice(uint32_t value) { + _internal_set_gdpr_choice(value); + // @@protoc_insertion_point(field_set:mozilla.cookieBanner.GoogleSOCSCookie.gdpr_choice) +} + +// required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2; +inline bool GoogleSOCSCookie::_internal_has_data() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.data_ != nullptr); + return value; +} +inline bool GoogleSOCSCookie::has_data() const { + return _internal_has_data(); +} +inline void GoogleSOCSCookie::clear_data() { + if (_impl_.data_ != nullptr) _impl_.data_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& GoogleSOCSCookie::_internal_data() const { + const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* p = _impl_.data_; + return p != nullptr ? *p : reinterpret_cast<const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData&>( + ::mozilla::cookieBanner::_GoogleSOCSCookie_extraData_default_instance_); +} +inline const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& GoogleSOCSCookie::data() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.data) + return _internal_data(); +} +inline void GoogleSOCSCookie::unsafe_arena_set_allocated_data( + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* data) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.data_); + } + _impl_.data_ = data; + if (data) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:mozilla.cookieBanner.GoogleSOCSCookie.data) +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* GoogleSOCSCookie::release_data() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* temp = _impl_.data_; + _impl_.data_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* GoogleSOCSCookie::unsafe_arena_release_data() { + // @@protoc_insertion_point(field_release:mozilla.cookieBanner.GoogleSOCSCookie.data) + _impl_._has_bits_[0] &= ~0x00000001u; + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* temp = _impl_.data_; + _impl_.data_ = nullptr; + return temp; +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* GoogleSOCSCookie::_internal_mutable_data() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.data_ == nullptr) { + auto* p = CreateMaybeMessage<::mozilla::cookieBanner::GoogleSOCSCookie_extraData>(GetArenaForAllocation()); + _impl_.data_ = p; + } + return _impl_.data_; +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* GoogleSOCSCookie::mutable_data() { + ::mozilla::cookieBanner::GoogleSOCSCookie_extraData* _msg = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:mozilla.cookieBanner.GoogleSOCSCookie.data) + return _msg; +} +inline void GoogleSOCSCookie::set_allocated_data(::mozilla::cookieBanner::GoogleSOCSCookie_extraData* data) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.data_; + } + if (data) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(data); + if (message_arena != submessage_arena) { + data = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, data, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.data_ = data; + // @@protoc_insertion_point(field_set_allocated:mozilla.cookieBanner.GoogleSOCSCookie.data) +} + +// required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3; +inline bool GoogleSOCSCookie::_internal_has_time() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || _impl_.time_ != nullptr); + return value; +} +inline bool GoogleSOCSCookie::has_time() const { + return _internal_has_time(); +} +inline void GoogleSOCSCookie::clear_time() { + if (_impl_.time_ != nullptr) _impl_.time_->Clear(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& GoogleSOCSCookie::_internal_time() const { + const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* p = _impl_.time_; + return p != nullptr ? *p : reinterpret_cast<const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData&>( + ::mozilla::cookieBanner::_GoogleSOCSCookie_timeData_default_instance_); +} +inline const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& GoogleSOCSCookie::time() const { + // @@protoc_insertion_point(field_get:mozilla.cookieBanner.GoogleSOCSCookie.time) + return _internal_time(); +} +inline void GoogleSOCSCookie::unsafe_arena_set_allocated_time( + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* time) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.time_); + } + _impl_.time_ = time; + if (time) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:mozilla.cookieBanner.GoogleSOCSCookie.time) +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* GoogleSOCSCookie::release_time() { + _impl_._has_bits_[0] &= ~0x00000002u; + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* temp = _impl_.time_; + _impl_.time_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* GoogleSOCSCookie::unsafe_arena_release_time() { + // @@protoc_insertion_point(field_release:mozilla.cookieBanner.GoogleSOCSCookie.time) + _impl_._has_bits_[0] &= ~0x00000002u; + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* temp = _impl_.time_; + _impl_.time_ = nullptr; + return temp; +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* GoogleSOCSCookie::_internal_mutable_time() { + _impl_._has_bits_[0] |= 0x00000002u; + if (_impl_.time_ == nullptr) { + auto* p = CreateMaybeMessage<::mozilla::cookieBanner::GoogleSOCSCookie_timeData>(GetArenaForAllocation()); + _impl_.time_ = p; + } + return _impl_.time_; +} +inline ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* GoogleSOCSCookie::mutable_time() { + ::mozilla::cookieBanner::GoogleSOCSCookie_timeData* _msg = _internal_mutable_time(); + // @@protoc_insertion_point(field_mutable:mozilla.cookieBanner.GoogleSOCSCookie.time) + return _msg; +} +inline void GoogleSOCSCookie::set_allocated_time(::mozilla::cookieBanner::GoogleSOCSCookie_timeData* time) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.time_; + } + if (time) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(time); + if (message_arena != submessage_arena) { + time = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, time, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.time_ = time; + // @@protoc_insertion_point(field_set_allocated:mozilla.cookieBanner.GoogleSOCSCookie.time) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace cookieBanner +} // namespace mozilla + +// @@protoc_insertion_point(global_scope) + +#include <google/protobuf/port_undef.inc> +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_cookieBanner_2eproto diff --git a/toolkit/components/cookiebanners/cookieBanner.proto b/toolkit/components/cookiebanners/cookieBanner.proto new file mode 100644 index 0000000000..ae20fed484 --- /dev/null +++ b/toolkit/components/cookiebanners/cookieBanner.proto @@ -0,0 +1,25 @@ +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; + +package mozilla.cookieBanner; + +// Represent the SOCS cookie used to store GDPR choice on the google search. +message GoogleSOCSCookie { + // The GDPR choice. 1 means reject All and 2 means Accept or Custom. + required uint32 gdpr_choice = 1; + message extraData { + required uint32 unused1 = 1; + // The value Represents where does the consent is set. We will use this + // value to differentiate Accept and Custom. + required string platform = 2; + required string region = 3; + required uint32 unused2 = 4; + } + required extraData data = 2; + + message timeData { + required uint64 timeStamp = 1; + } + required timeData time = 3; +} diff --git a/toolkit/components/cookiebanners/metrics.yaml b/toolkit/components/cookiebanners/metrics.yaml index 8dabab39f3..98f86fd4a7 100644 --- a/toolkit/components/cookiebanners/metrics.yaml +++ b/toolkit/components/cookiebanners/metrics.yaml @@ -210,6 +210,72 @@ cookie.banners: - pbz@mozilla.com - tihuang@mozilla.com expires: 128 + google_gdpr_choice_cookie: + type: labeled_string + description: > + Records the GDPR choice on Google Search based on the "SOCS" cookie of the + Google Search domains. The value could be "Accept", "Reject" or "Custom". + We use the label to record different choices on different Google domains. + We only collect this if the default search engine is Google. + bugs: + - https://bugzilla.mozilla.org/1874741 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1874741#c10 + data_sensitivity: + - stored_content + notification_emails: + - pbz@mozilla.com + - tihuang@mozilla.com + expires: never + google_gdpr_choice_cookie_event: + type: event + description: > + Recorded whenever a GDPR choice is made on a Google Search page. We assess + the "SOCS" cookie to know the GDPR choice. + bugs: + - https://bugzilla.mozilla.org/1874741 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1874741#c10 + data_sensitivity: + - stored_content + notification_emails: + - pbz@mozilla.com + - tihuang@mozilla.com + expires: never + extra_keys: + search_domain: + description: The Google search domain where the GDPR choice was made. + type: string + choice: + description: > + The GDPR choice. The value could be "Accept", "Reject" or "Custom". + type: string + region: + description: > + The region where the GDPR consent is made. This is based on the IP + location. + type: string + google_gdpr_choice_cookie_event_pbm: + type: event + description: > + Recorded whenever a GDPR choice is made on a Google Search page on private + browsing windows. We assess the "SOCS" cookie to know the GDPR choice. + bugs: + - https://bugzilla.mozilla.org/1874741 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1874741#c10 + data_sensitivity: + - stored_content + notification_emails: + - pbz@mozilla.com + - tihuang@mozilla.com + expires: never + extra_keys: + choice: + description: > + The GDPR choice. The value could be "Accept", "Reject" or "Custom". + type: string + cookie.banners.click: handle_duration: type: timing_distribution diff --git a/toolkit/components/cookiebanners/moz.build b/toolkit/components/cookiebanners/moz.build index 774c1dd96f..7dfbdb2c6b 100644 --- a/toolkit/components/cookiebanners/moz.build +++ b/toolkit/components/cookiebanners/moz.build @@ -14,11 +14,15 @@ XPIDL_SOURCES += [ "nsICookieBannerListService.idl", "nsICookieBannerRule.idl", "nsICookieBannerService.idl", + "nsICookieBannerTelemetryService.idl", "nsICookieRule.idl", ] XPIDL_MODULE = "toolkit_cookiebanners" +DEFINES["GOOGLE_PROTOBUF_NO_RTTI"] = True +DEFINES["GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER"] = True + EXTRA_JS_MODULES += [ "CookieBannerListService.sys.mjs", ] @@ -31,15 +35,18 @@ EXPORTS.mozilla += [ "nsClickRule.h", "nsCookieBannerRule.h", "nsCookieBannerService.h", + "nsCookieBannerTelemetryService.h", "nsCookieInjector.h", "nsCookieRule.h", ] UNIFIED_SOURCES += [ + "cookieBanner.pb.cc", "CookieBannerDomainPrefService.cpp", "nsClickRule.cpp", "nsCookieBannerRule.cpp", "nsCookieBannerService.cpp", + "nsCookieBannerTelemetryService.cpp", "nsCookieInjector.cpp", "nsCookieRule.cpp", ] diff --git a/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.cpp b/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.cpp new file mode 100644 index 0000000000..23906650f4 --- /dev/null +++ b/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.cpp @@ -0,0 +1,392 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsCookieBannerTelemetryService.h" + +#include "cookieBanner.pb.h" + +#include "mozilla/Base64.h" +#include "mozilla/ClearOnShutdown.h" +#include "mozilla/glean/GleanMetrics.h" +#include "mozilla/OriginAttributes.h" +#include "mozilla/StaticPtr.h" +#include "mozilla/Logging.h" +#include "Cookie.h" +#include "nsCRT.h" +#include "nsError.h" +#include "nsICookie.h" +#include "nsICookieManager.h" +#include "nsICookieNotification.h" +#include "nsTHashSet.h" +#include "nsIObserverService.h" +#include "nsIScriptSecurityManager.h" +#include "nsISearchService.h" +#include "nsServiceManagerUtils.h" +#include "nsStringFwd.h" +#include "nsTArray.h" + +namespace mozilla { + +NS_IMPL_ISUPPORTS(nsCookieBannerTelemetryService, + nsICookieBannerTelemetryService, nsIObserver) + +static LazyLogModule gCookieBannerTelemetryLog( + "nsCookieBannerTelemetryService"); + +static StaticRefPtr<nsCookieBannerTelemetryService> + sCookieBannerTelemetryServiceSingleton; + +// A hash set used to tell whether a base domain is a Google domain. +static StaticAutoPtr<nsTHashSet<nsCString>> sGoogleDomainsSet; + +namespace { + +// A helper function that decodes Google's SOCS cookie and returns the GDPR +// choice and the region. The choice and be either "Accept", "Reject", or +// "Custom". +nsresult DecodeSOCSGoogleCookie(const nsACString& aCookie, nsACString& aChoice, + nsACString& aRegion) { + aChoice.Truncate(); + aRegion.Truncate(); + + FallibleTArray<uint8_t> decoded; + nsresult rv = + Base64URLDecode(aCookie, Base64URLDecodePaddingPolicy::Ignore, decoded); + NS_ENSURE_SUCCESS(rv, rv); + + std::string buf(reinterpret_cast<const char*>(decoded.Elements()), + decoded.Length()); + cookieBanner::GoogleSOCSCookie socs; + + if (!socs.ParseFromString(buf)) { + return NS_ERROR_CANNOT_CONVERT_DATA; + } + + aRegion.Assign(socs.data().region().c_str(), socs.data().region().length()); + + // The first field represents the gdpr choice, 1 means "Reject" and 2 means + // either "Accept" or "Custom". We need to check a following field to decide. + if (socs.gdpr_choice() == 1) { + aChoice.AssignLiteral("Reject"); + return NS_OK; + } + + // The platform field represents where does this GDPR consent is selected. The + // value can be either "gws_*" or "boq_identityfrontenduiserver_*". If the + // field value starts with "gws_", it means the consent is from the Google + // search page. Otherwise, it's from the consent.google.com, which is used for + // the custom setting. + std::string prefix = "gws_"; + + if (socs.data().platform().compare(0, prefix.length(), prefix) == 0) { + aChoice.AssignLiteral("Accept"); + return NS_OK; + } + + aChoice.AssignLiteral("Custom"); + return NS_OK; +} + +} // anonymous namespace + +// static +already_AddRefed<nsCookieBannerTelemetryService> +nsCookieBannerTelemetryService::GetSingleton() { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, ("GetSingleton.")); + + if (!sCookieBannerTelemetryServiceSingleton) { + sCookieBannerTelemetryServiceSingleton = + new nsCookieBannerTelemetryService(); + + RunOnShutdown([] { + DebugOnly<nsresult> rv = + sCookieBannerTelemetryServiceSingleton->Shutdown(); + NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), + "nsCookieBannerTelemetryService::Shutdown failed."); + + sCookieBannerTelemetryServiceSingleton = nullptr; + }); + } + + return do_AddRef(sCookieBannerTelemetryServiceSingleton); +} + +nsresult nsCookieBannerTelemetryService::Init() { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, ("Init.")); + if (mIsInitialized) { + return NS_OK; + } + + mIsInitialized = true; + + nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); + NS_ENSURE_TRUE(obsSvc, NS_ERROR_FAILURE); + + nsresult rv = obsSvc->AddObserver(this, "browser-search-service", false); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsSvc->AddObserver(this, "idle-daily", false); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsSvc->AddObserver(this, "cookie-changed", false); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsSvc->AddObserver(this, "private-cookie-changed", false); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; +} + +nsresult nsCookieBannerTelemetryService::Shutdown() { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, ("Shutdown.")); + + if (!mIsInitialized) { + return NS_OK; + } + + mIsInitialized = false; + + sGoogleDomainsSet = nullptr; + + nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); + NS_ENSURE_TRUE(obsSvc, NS_ERROR_FAILURE); + + nsresult rv = obsSvc->RemoveObserver(this, "browser-search-service"); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsSvc->RemoveObserver(this, "idle-daily"); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsSvc->RemoveObserver(this, "cookie-changed"); + NS_ENSURE_SUCCESS(rv, rv); + + rv = obsSvc->RemoveObserver(this, "private-cookie-changed"); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; +} + +NS_IMETHODIMP +nsCookieBannerTelemetryService::Observe(nsISupports* aSubject, + const char* aTopic, + const char16_t* aData) { + if (nsCRT::strcmp(aTopic, "profile-after-change") == 0) { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, + ("Observe profile-after-change")); + + return Init(); + } + + if (nsCRT::strcmp(aTopic, "idle-daily") == 0) { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, ("idle-daily")); + + return MaybeReportGoogleGDPRChoiceTelemetry(); + } + + if (nsCRT::strcmp(aTopic, "browser-search-service") == 0 && + nsDependentString(aData).EqualsLiteral("init-complete")) { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, + ("Observe browser-search-service::init-complete.")); + mIsSearchServiceInitialized = true; + + return MaybeReportGoogleGDPRChoiceTelemetry(); + } + + if (nsCRT::strcmp(aTopic, "cookie-changed") == 0 || + nsCRT::strcmp(aTopic, "private-cookie-changed") == 0) { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, ("Observe %s", aTopic)); + + nsCOMPtr<nsICookieNotification> notification = do_QueryInterface(aSubject); + NS_ENSURE_TRUE(notification, NS_ERROR_FAILURE); + + if (notification->GetAction() != nsICookieNotification::COOKIE_ADDED && + notification->GetAction() != nsICookieNotification::COOKIE_CHANGED) { + return NS_OK; + } + + nsCOMPtr<nsICookie> cookie; + nsresult rv = notification->GetCookie(getter_AddRefs(cookie)); + NS_ENSURE_SUCCESS(rv, rv); + + nsAutoCString name; + rv = cookie->GetName(name); + NS_ENSURE_SUCCESS(rv, rv); + + // Bail out early if this is not a SOCS cookie. + if (!name.EqualsLiteral("SOCS")) { + return NS_OK; + } + + // A "SOCS" cookie is added. We record the GDPR choice as well as an event + // telemetry for recording a choice has been made at the moment. + return MaybeReportGoogleGDPRChoiceTelemetry(cookie, true); + } + + return NS_OK; +} + +nsresult nsCookieBannerTelemetryService::MaybeReportGoogleGDPRChoiceTelemetry( + nsICookie* aCookie, bool aReportEvent) { + MOZ_ASSERT(mIsInitialized); + nsresult rv; + + // Don't report the telemetry if the search service is not yet initialized. + if (!mIsSearchServiceInitialized) { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, + ("Search Service is not yet initialized.")); + return NS_OK; + } + + // We only collect Google GDPR choice if Google is the default search engine. + nsCOMPtr<nsISearchService> searchService( + do_GetService("@mozilla.org/browser/search-service;1", &rv)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr<nsISearchEngine> engine; + rv = searchService->GetDefaultEngine(getter_AddRefs(engine)); + NS_ENSURE_SUCCESS(rv, rv); + + // Bail out early if no default search engine is available. This could happen + // if no search engine is shipped with the Gecko. + if (!engine) { + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, + ("No default search engine is available.")); + return NS_OK; + } + + nsAutoString id; + rv = engine->GetId(id); + NS_ENSURE_SUCCESS(rv, rv); + + // Bail out early if the default search engine is not Google. + if (!id.EqualsLiteral("google@search.mozilla.orgdefault")) { + return NS_OK; + } + + // Build up the Google domain set from the alternative Google search domains + if (!sGoogleDomainsSet) { + sGoogleDomainsSet = new nsTHashSet<nsCString>(); + + nsTArray<nsCString> googleDomains; + rv = searchService->GetAlternateDomains("www.google.com"_ns, googleDomains); + NS_ENSURE_SUCCESS(rv, rv); + + for (const auto& domain : googleDomains) { + // We need to trim down the preceding "www" to get the host because the + // alternate domains provided by search service always have leading "www". + // However, the "SOCS" cookie is always set for all subdomains, e.g. + // ".google.com". Therefore, we need to trim down "www" to match the host + // of the cookie. + NS_ENSURE_TRUE(domain.Length() > 3, NS_ERROR_FAILURE); + sGoogleDomainsSet->Insert(Substring(domain, 3, domain.Length() - 3)); + } + } + + nsTArray<RefPtr<nsICookie>> cookies; + if (aCookie) { + const auto& attrs = aCookie->AsCookie().OriginAttributesRef(); + + // We only report cookies for the default originAttributes or private + // browsing mode. + if (attrs.mPrivateBrowsingId != + nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID || + attrs == OriginAttributes()) { + cookies.AppendElement(RefPtr<nsICookie>(aCookie)); + } + } else { + // If no cookie is given, we will iterate all cookies under Google Search + // domains. + nsCOMPtr<nsICookieManager> cookieManager = + do_GetService("@mozilla.org/cookiemanager;1"); + if (!cookieManager) { + return NS_ERROR_FAILURE; + } + + for (const auto& domain : *sGoogleDomainsSet) { + // Getting Google Search cookies only for normal windows. We will exclude + // cookies of non-default originAttributes, like cookies from containers. + // + // Note that we need to trim the leading "." from the domain here. + nsTArray<RefPtr<nsICookie>> googleCookies; + rv = cookieManager->GetCookiesWithOriginAttributes( + u"{ \"privateBrowsingId\": 0, \"userContextId\": 0 }"_ns, + Substring(domain, 1, domain.Length() - 1), googleCookies); + NS_ENSURE_SUCCESS(rv, rv); + + cookies.AppendElements(googleCookies); + } + } + + for (const auto& cookie : cookies) { + nsAutoCString name; + rv = cookie->GetName(name); + NS_ENSURE_SUCCESS(rv, rv); + + if (!name.EqualsLiteral("SOCS")) { + continue; + } + + nsAutoCString host; + rv = cookie->GetHost(host); + NS_ENSURE_SUCCESS(rv, rv); + + if (!sGoogleDomainsSet->Contains(host)) { + continue; + } + + nsAutoCString value; + rv = cookie->GetValue(value); + NS_ENSURE_SUCCESS(rv, rv); + + nsAutoCString choice; + nsAutoCString region; + rv = DecodeSOCSGoogleCookie(value, choice, region); + NS_ENSURE_SUCCESS(rv, rv); + + bool isPrivateBrowsing = + cookie->AsCookie().OriginAttributesRef().mPrivateBrowsingId != + nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID; + + MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug, + ("Record the Google GDPR choice %s on the host %s in region %s for " + "the %s window", + choice.get(), host.get(), region.get(), + isPrivateBrowsing ? "private" : "normal")); + + // We rely on the dynamical labelled string which can send most 16 different + // labels per report. In average cases, 16 labels is sufficient because we + // expect a user might have only 1 or 2 "SOCS" cookies on different Google + // Search domains. + // + // Note that we only report event telemetry for private browsing windows + // because the private session is ephemeral. People can change GDPR + // choice across different private sessions, so it's hard to collect the + // state correctly. + if (!isPrivateBrowsing) { + glean::cookie_banners::google_gdpr_choice_cookie.Get(host).Set(choice); + } + + if (aReportEvent) { + if (isPrivateBrowsing) { + glean::cookie_banners::GoogleGdprChoiceCookieEventPbmExtra extra = { + .choice = Some(choice), + }; + glean::cookie_banners::google_gdpr_choice_cookie_event_pbm.Record( + Some(extra)); + } else { + glean::cookie_banners::GoogleGdprChoiceCookieEventExtra extra = { + .choice = Some(choice), + .region = Some(region), + .searchDomain = Some(host), + }; + glean::cookie_banners::google_gdpr_choice_cookie_event.Record( + Some(extra)); + } + } + } + + return NS_OK; +} + +} // namespace mozilla diff --git a/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.h b/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.h new file mode 100644 index 0000000000..1236343ad9 --- /dev/null +++ b/toolkit/components/cookiebanners/nsCookieBannerTelemetryService.h @@ -0,0 +1,47 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_nsCookieBannerTelemetryService_h__ +#define mozilla_nsCookieBannerTelemetryService_h__ + +#include "nsICookieBannerTelemetryService.h" + +#include "nsIObserver.h" + +class nsICookie; + +namespace mozilla { +class nsCookieBannerTelemetryService final + : public nsICookieBannerTelemetryService, + public nsIObserver { + NS_DECL_ISUPPORTS + NS_DECL_NSIOBSERVER + + NS_DECL_NSICOOKIEBANNERTELEMETRYSERVICE + + public: + static already_AddRefed<nsCookieBannerTelemetryService> GetSingleton(); + + private: + nsCookieBannerTelemetryService() = default; + ~nsCookieBannerTelemetryService() = default; + + bool mIsInitialized = false; + bool mIsSearchServiceInitialized = false; + + [[nodiscard]] nsresult Init(); + + [[nodiscard]] nsresult Shutdown(); + + // Record the telemetry regarding the GDPR choice on Google Search domains. + // We only record if the default search engine is Google. When passing no + // cookie, we will walk through all cookies under Google Search domains. + // Otherwise, we will report the GDPR choice according to the given cookie. + [[nodiscard]] nsresult MaybeReportGoogleGDPRChoiceTelemetry( + nsICookie* aCookie = nullptr, bool aReportEvent = false); +}; + +} // namespace mozilla + +#endif diff --git a/toolkit/components/cookiebanners/nsICookieBannerRule.idl b/toolkit/components/cookiebanners/nsICookieBannerRule.idl index 0ad557fe54..5ed456c90c 100644 --- a/toolkit/components/cookiebanners/nsICookieBannerRule.idl +++ b/toolkit/components/cookiebanners/nsICookieBannerRule.idl @@ -85,7 +85,7 @@ interface nsICookieBannerRule : nsISupports { * aOptIn - The CSS selector for selecting the opt-in banner button */ void addClickRule(in ACString aPresence, - [optional] in bool aSkipPresenceVisibilityCheck, + [optional] in boolean aSkipPresenceVisibilityCheck, [optional] in nsIClickRule_RunContext aRunContext, [optional] in ACString aHide, [optional] in ACString aOptOut, diff --git a/toolkit/components/cookiebanners/nsICookieBannerService.idl b/toolkit/components/cookiebanners/nsICookieBannerService.idl index b58e726310..4d8db6f94e 100644 --- a/toolkit/components/cookiebanners/nsICookieBannerService.idl +++ b/toolkit/components/cookiebanners/nsICookieBannerService.idl @@ -58,13 +58,13 @@ interface nsICookieBannerService : nsISupports { * this will return none, only reject rules or accept rules if there is no * reject rule available. */ - Array<nsICookieRule> getCookiesForURI(in nsIURI aURI, in bool aIsPrivateBrowsing); + Array<nsICookieRule> getCookiesForURI(in nsIURI aURI, in boolean aIsPrivateBrowsing); /** * Look up the click rules for a given domain. */ Array<nsIClickRule> getClickRulesForDomain(in ACString aDomain, - in bool aIsTopLevel); + in boolean aIsTopLevel); /** * Insert a cookie banner rule for a domain. If there was previously a rule @@ -131,28 +131,28 @@ interface nsICookieBannerService : nsISupports { * this session. */ boolean shouldStopBannerClickingForSite(in ACString aSite, - in bool aIsTopLevel, - in bool aIsPrivate); + in boolean aIsTopLevel, + in boolean aIsPrivate); /** * Mark that the cookie banner handling code was executed for the given site * for this session. */ void markSiteExecuted(in ACString aSite, - in bool aIsTopLevel, - in bool aIsPrivate); + in boolean aIsTopLevel, + in boolean aIsPrivate); /* * Remove the executed record for a given site under the private browsing * session or the normal session. */ - void removeExecutedRecordForSite(in ACString aSite, in bool aIsPrivate); + void removeExecutedRecordForSite(in ACString aSite, in boolean aIsPrivate); /** * Remove all the record of sites where cookie banner handling has been * executed under the private browsing session or normal session. */ - void removeAllExecutedRecords(in bool aIsPrivate); + void removeAllExecutedRecords(in boolean aIsPrivate); /** * Clears the in-memory set that we use to maintain the domains that we have diff --git a/toolkit/components/cookiebanners/nsICookieBannerTelemetryService.idl b/toolkit/components/cookiebanners/nsICookieBannerTelemetryService.idl new file mode 100644 index 0000000000..9c027bf88e --- /dev/null +++ b/toolkit/components/cookiebanners/nsICookieBannerTelemetryService.idl @@ -0,0 +1,13 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * Service singleton which collect cookie banner telemetry. + */ +[scriptable, builtinclass, uuid(56197e18-d144-45b5-9f77-84102f064462)] +interface nsICookieBannerTelemetryService : nsISupports {}; diff --git a/toolkit/components/cookiebanners/test/browser/browser.toml b/toolkit/components/cookiebanners/test/browser/browser.toml index 69728540d9..a3f8a96489 100644 --- a/toolkit/components/cookiebanners/test/browser/browser.toml +++ b/toolkit/components/cookiebanners/test/browser/browser.toml @@ -36,6 +36,8 @@ support-files = [ ["browser_bannerClicking_visibilityOverride.js"] support-files = ["file_banner_invisible.html"] +["browser_cookiebanner_gdpr_telemetry.js"] + ["browser_cookiebanner_telemetry.js"] support-files = ["file_iframe_banner.html"] diff --git a/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_gdpr_telemetry.js b/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_gdpr_telemetry.js new file mode 100644 index 0000000000..2d6f3343b8 --- /dev/null +++ b/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_gdpr_telemetry.js @@ -0,0 +1,189 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const { SiteDataTestUtils } = ChromeUtils.importESModule( + "resource://testing-common/SiteDataTestUtils.sys.mjs" +); + +const TEST_CASES = [ + { + value: "CAISHAgBEhJnd3NfMjAyNDAzMjUtMF9SQzEaAmRlIAEaBgiAw42wBg", + expected: "Accept", + region: "de", + host: ".google.de", + }, + { + value: "CAESHAgBEhJnd3NfMjAyNDAzMjUtMF9SQzEaAmRlIAEaBgiAw42wBg", + expected: "Reject", + region: "de", + host: ".google.de", + }, + { + value: + "CAISNQgBEitib3FfaWRlbnRpdHlmcm9udGVuZHVpc2VydmVyXzIwMjQwMzI0LjA4X3AwGgJkZSADGgYIgMONsAY", + expected: "Custom", + region: "de", + host: ".google.de", + }, + { + value: "CAISHAgBEhJnd3NfMjAyNDAzMjUtMF9SQzEaAmVuIAEaBgiAw42wBg", + expected: "Accept", + region: "en", + host: ".google.com", + }, +]; + +add_setup(async function () { + registerCleanupFunction(async () => { + // Clear cookies that have been set during testing. + await SiteDataTestUtils.clear(); + }); +}); + +add_task(async function test_google_gdpr_telemetry() { + // Clear telemetry before starting telemetry test. + Services.fog.testResetFOG(); + + for (let test of TEST_CASES) { + // Add a Google SOCS cookie to trigger recording telemetry. + SiteDataTestUtils.addToCookies({ + name: "SOCS", + value: test.value, + host: test.host, + path: "/", + }); + + // Verify if the google GDPR choice cookie telemetry is recorded properly. + is( + Glean.cookieBanners.googleGdprChoiceCookie[test.host].testGetValue(), + test.expected, + "The Google GDPR telemetry is recorded properly." + ); + + // Verify the the event telemetry is recorded properly. + let events = Glean.cookieBanners.googleGdprChoiceCookieEvent.testGetValue(); + let event = events[events.length - 1]; + + is( + event.extra.search_domain, + test.host, + "The Google GDPR event telemetry records the search domain properly." + ); + + is( + event.extra.choice, + test.expected, + "The Google GDPR event telemetry records the choice properly." + ); + + is( + event.extra.region, + test.region, + "The Google GDPR event telemetry records the region properly." + ); + } + + is( + Glean.cookieBanners.googleGdprChoiceCookieEvent.testGetValue().length, + TEST_CASES.length, + "The number of events is expected." + ); +}); + +add_task(async function test_invalid_google_socs_cookies() { + // Clear telemetry before starting telemetry test. + Services.fog.testResetFOG(); + + // Add an invalid Google SOCS cookie which is not Base64 encoding. + SiteDataTestUtils.addToCookies({ + name: "SOCS", + value: "invalid", + host: ".google.com", + path: "/", + }); + + // Ensure no GDPR telemetry is recorded. + is( + Glean.cookieBanners.googleGdprChoiceCookie[".google.com"].testGetValue(), + null, + "No Google GDPR telemetry is recorded." + ); + + is( + Glean.cookieBanners.googleGdprChoiceCookieEvent.testGetValue(), + null, + "No event telemetry is recorded." + ); + + // Add an invalid Google SOCS cookie which is Base64 encoding but in wrong + // protobuf format. + SiteDataTestUtils.addToCookies({ + name: "SOCS", + value: "CAISAggBGgYIgMONsAY", + host: ".google.com", + path: "/", + }); + + // Ensure no GDPR telemetry is recorded. + is( + Glean.cookieBanners.googleGdprChoiceCookie[".google.com"].testGetValue(), + null, + "No Google GDPR telemetry is recorded." + ); + + is( + Glean.cookieBanners.googleGdprChoiceCookieEvent.testGetValue(), + null, + "No event telemetry is recorded." + ); +}); + +add_task(async function test_google_gdpr_telemetry_pbm() { + // Clear telemetry before starting telemetry test. + Services.fog.testResetFOG(); + + for (let test of TEST_CASES) { + // Add a private Google SOCS cookie to trigger recording telemetry. + SiteDataTestUtils.addToCookies({ + name: "SOCS", + value: test.value, + host: test.host, + path: "/", + originAttributes: { privateBrowsingId: 1 }, + }); + + // Ensure we don't record google GDPR choice cookie telemetry. + is( + Glean.cookieBanners.googleGdprChoiceCookie[test.host].testGetValue(), + null, + "No Google GDPR telemetry is recorded." + ); + + // Verify the the event telemetry for PBM is recorded properly. + let events = + Glean.cookieBanners.googleGdprChoiceCookieEventPbm.testGetValue(); + let event = events[events.length - 1]; + + is( + event.extra.choice, + test.expected, + "The Google GDPR event telemetry records the choice properly." + ); + + is(event.extra.search_domain, undefined, "No search domain is recorded."); + is(event.extra.region, undefined, "No region is recorded."); + } + + is( + Glean.cookieBanners.googleGdprChoiceCookieEventPbm.testGetValue().length, + TEST_CASES.length, + "The number of events is expected." + ); + + // We need to notify the "last-pb-context-exited" tp explicitly remove private + // cookies. Otherwise, the remaining private cookies could affect following + // tests. The SiteDataTestUtils.clear() doesn't clear for private cookies. + Services.obs.notifyObservers(null, "last-pb-context-exited"); +}); diff --git a/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_telemetry.js b/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_telemetry.js index 7366ae2ab6..8ac30770cb 100644 --- a/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_telemetry.js +++ b/toolkit/components/cookiebanners/test/browser/browser_cookiebanner_telemetry.js @@ -86,7 +86,7 @@ async function reloadBrowser(browser, url) { let reloaded = BrowserTestUtils.browserLoaded(browser, false, url); // Reload as a user. - window.BrowserReload(); + window.BrowserCommands.reload(); await reloaded; } |