git: f14f291a6dfe - main - www/*chromium: bump _LIBCPP_VERSION check to 160000 and fallback to base::ranges

From: Robert Nagy <rnagy_at_FreeBSD.org>
Date: Mon, 28 Aug 2023 19:12:35 UTC
The branch main has been updated by rnagy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f14f291a6dfea6d167aa9800a5ea05125c4b776f

commit f14f291a6dfea6d167aa9800a5ea05125c4b776f
Author:     Robert Nagy <rnagy@FreeBSD.org>
AuthorDate: 2023-08-28 12:57:23 +0000
Commit:     Robert Nagy <rnagy@FreeBSD.org>
CommitDate: 2023-08-28 19:12:26 +0000

    www/*chromium: bump _LIBCPP_VERSION check to 160000 and fallback to base::ranges
    
    the chromium source tree provides ranges functions so let's use them
    in case our libcxx is too old
    
    PR:     273376
---
 www/chromium/Makefile                              |  1 +
 ...__manager_core_browser_ui_passwords__grouper.cc | 25 +++++---------
 ..._webauthn_core_browser_passkey__sync__bridge.cc | 38 ++++++++--------------
 www/ungoogled-chromium/Makefile                    |  1 +
 ...__manager_core_browser_ui_passwords__grouper.cc | 25 +++++---------
 ..._webauthn_core_browser_passkey__sync__bridge.cc | 38 ++++++++--------------
 6 files changed, 46 insertions(+), 82 deletions(-)

diff --git a/www/chromium/Makefile b/www/chromium/Makefile
index ca14ce792b6d..b70c1bb9bc24 100644
--- a/www/chromium/Makefile
+++ b/www/chromium/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	chromium
 PORTVERSION=	116.0.5845.110
+PORTREVISION=	1
 CATEGORIES=	www wayland
 MASTER_SITES=	https://commondatastorage.googleapis.com/chromium-browser-official/ \
 		https://nerd.hu/distfiles/:external
diff --git a/www/chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc b/www/chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc
index 21710d467d67..2fc39b9c22df 100644
--- a/www/chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc
+++ b/www/chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc
@@ -1,21 +1,14 @@
---- components/password_manager/core/browser/ui/passwords_grouper.cc.orig	2023-08-17 12:40:56 UTC
+--- components/password_manager/core/browser/ui/passwords_grouper.cc.orig	2023-08-28 12:53:33 UTC
 +++ components/password_manager/core/browser/ui/passwords_grouper.cc
-@@ -399,6 +399,7 @@ absl::optional<PasskeyCredential> PasswordsGrouper::Ge
-   if (group_id_iterator == map_signon_realm_to_group_id_.end()) {
-     return absl::nullopt;
-   }
-+#if BUILDFLAG(IS_OPENBSD) || (BUILDFLAG(IS_FREEBSD) && (_LIBCPP_VERSION > 15000))
-   // Find the passkey in the group.
+@@ -403,7 +403,11 @@ absl::optional<PasskeyCredential> PasswordsGrouper::Ge
    const std::vector<PasskeyCredential>& passkeys =
        map_group_id_to_credentials_[group_id_iterator->second].passkeys;
-@@ -410,6 +411,10 @@ absl::optional<PasskeyCredential> PasswordsGrouper::Ge
-     return absl::nullopt;
-   }
-   return *passkey_it;
+   const auto passkey_it =
++#if (_LIBCPP_VERSION >= 160000)
+       std::ranges::find_if(passkeys, [&credential](const auto& passkey) {
 +#else
-+  LOG(ERROR) << "Unable to lookup in password group";
-+  return absl::nullopt;
++      base::ranges::find_if(passkeys, [&credential](const auto& passkey) {
 +#endif
- }
- 
- void PasswordsGrouper::ClearCache() {
+         return credential.passkey_credential_id == passkey.credential_id();
+       });
+   if (passkey_it == passkeys.end()) {
diff --git a/www/chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc b/www/chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc
index 3706546c7e46..6ce03fae477d 100644
--- a/www/chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc
+++ b/www/chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc
@@ -1,38 +1,26 @@
---- components/webauthn/core/browser/passkey_sync_bridge.cc.orig	2023-08-17 12:40:56 UTC
+--- components/webauthn/core/browser/passkey_sync_bridge.cc.orig	2023-08-28 12:53:33 UTC
 +++ components/webauthn/core/browser/passkey_sync_bridge.cc
-@@ -267,6 +267,7 @@ PasskeySyncBridge::GetAllPasskeys() const {
- 
+@@ -268,7 +268,11 @@ PasskeySyncBridge::GetAllPasskeys() const {
  bool PasskeySyncBridge::DeletePasskey(const std::string& credential_id) {
    // Find the credential with the given |credential_id|.
-+#if BUILDFLAG(IS_OPENBSD) || (BUILDFLAG(IS_FREEBSD) && (_LIBCPP_VERSION > 15000))
    const auto passkey_it =
++#if (_LIBCPP_VERSION >= 160000)
        std::ranges::find_if(data_, [&credential_id](const auto& passkey) {
-         return passkey.second.credential_id() == credential_id;
-@@ -313,11 +314,16 @@ bool PasskeySyncBridge::DeletePasskey(const std::strin
-                      weak_ptr_factory_.GetWeakPtr()));
-   NotifyPasskeysChanged();
-   return true;
 +#else
-+  LOG(ERROR) << "Unable to delete passkey"; 
-+  return false;
++      base::ranges::find_if(data_, [&credential_id](const auto& passkey) {
 +#endif
- }
- 
- bool PasskeySyncBridge::UpdatePasskey(const std::string& credential_id,
+         return passkey.second.credential_id() == credential_id;
+       });
+   if (passkey_it == data_.end()) {
+@@ -319,7 +323,11 @@ bool PasskeySyncBridge::UpdatePasskey(const std::strin
                                        PasskeyChange change) {
    // Find the credential with the given |credential_id|.
-+#if BUILDFLAG(IS_OPENBSD) || (BUILDFLAG(IS_FREEBSD) && (_LIBCPP_VERSION > 15000))
    const auto passkey_it =
++#if (_LIBCPP_VERSION >= 160000)
        std::ranges::find_if(data_, [&credential_id](const auto& passkey) {
-         return passkey.second.credential_id() == credential_id;
-@@ -341,6 +347,10 @@ bool PasskeySyncBridge::UpdatePasskey(const std::strin
-                      weak_ptr_factory_.GetWeakPtr()));
-   NotifyPasskeysChanged();
-   return true;
 +#else
-+  LOG(ERROR) << "Unable to update passkey"; 
-+  return false;
++      base::ranges::find_if(data_, [&credential_id](const auto& passkey) {
 +#endif
- }
- 
- std::string PasskeySyncBridge::AddNewPasskeyForTesting(
+         return passkey.second.credential_id() == credential_id;
+       });
+   if (passkey_it == data_.end()) {
diff --git a/www/ungoogled-chromium/Makefile b/www/ungoogled-chromium/Makefile
index 342c55b3c4f4..ed418f68a92e 100644
--- a/www/ungoogled-chromium/Makefile
+++ b/www/ungoogled-chromium/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	ungoogled-chromium
 PORTVERSION=	116.0.5845.110
 UGVERSION=	${DISTVERSION}-1
+PORTREVISION=	1
 CATEGORIES=	www wayland
 MASTER_SITES=	https://commondatastorage.googleapis.com/chromium-browser-official/ \
 		https://nerd.hu/distfiles/:external
diff --git a/www/ungoogled-chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc b/www/ungoogled-chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc
index 07062ea679a4..2fc39b9c22df 100644
--- a/www/ungoogled-chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc
+++ b/www/ungoogled-chromium/files/patch-components_password__manager_core_browser_ui_passwords__grouper.cc
@@ -1,21 +1,14 @@
---- components/password_manager/core/browser/ui/passwords_grouper.cc.orig	2023-08-18 10:26:52 UTC
+--- components/password_manager/core/browser/ui/passwords_grouper.cc.orig	2023-08-28 12:53:33 UTC
 +++ components/password_manager/core/browser/ui/passwords_grouper.cc
-@@ -399,6 +399,7 @@ absl::optional<PasskeyCredential> PasswordsGrouper::Ge
-   if (group_id_iterator == map_signon_realm_to_group_id_.end()) {
-     return absl::nullopt;
-   }
-+#if BUILDFLAG(IS_OPENBSD) || (BUILDFLAG(IS_FREEBSD) && (_LIBCPP_VERSION > 15000))
-   // Find the passkey in the group.
+@@ -403,7 +403,11 @@ absl::optional<PasskeyCredential> PasswordsGrouper::Ge
    const std::vector<PasskeyCredential>& passkeys =
        map_group_id_to_credentials_[group_id_iterator->second].passkeys;
-@@ -410,6 +411,10 @@ absl::optional<PasskeyCredential> PasswordsGrouper::Ge
-     return absl::nullopt;
-   }
-   return *passkey_it;
+   const auto passkey_it =
++#if (_LIBCPP_VERSION >= 160000)
+       std::ranges::find_if(passkeys, [&credential](const auto& passkey) {
 +#else
-+  LOG(ERROR) << "Unable to lookup in password group";
-+  return absl::nullopt;
++      base::ranges::find_if(passkeys, [&credential](const auto& passkey) {
 +#endif
- }
- 
- void PasswordsGrouper::ClearCache() {
+         return credential.passkey_credential_id == passkey.credential_id();
+       });
+   if (passkey_it == passkeys.end()) {
diff --git a/www/ungoogled-chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc b/www/ungoogled-chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc
index 1c2426b02813..6ce03fae477d 100644
--- a/www/ungoogled-chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc
+++ b/www/ungoogled-chromium/files/patch-components_webauthn_core_browser_passkey__sync__bridge.cc
@@ -1,38 +1,26 @@
---- components/webauthn/core/browser/passkey_sync_bridge.cc.orig	2023-08-18 10:26:52 UTC
+--- components/webauthn/core/browser/passkey_sync_bridge.cc.orig	2023-08-28 12:53:33 UTC
 +++ components/webauthn/core/browser/passkey_sync_bridge.cc
-@@ -267,6 +267,7 @@ PasskeySyncBridge::GetAllPasskeys() const {
- 
+@@ -268,7 +268,11 @@ PasskeySyncBridge::GetAllPasskeys() const {
  bool PasskeySyncBridge::DeletePasskey(const std::string& credential_id) {
    // Find the credential with the given |credential_id|.
-+#if BUILDFLAG(IS_OPENBSD) || (BUILDFLAG(IS_FREEBSD) && (_LIBCPP_VERSION > 15000))
    const auto passkey_it =
++#if (_LIBCPP_VERSION >= 160000)
        std::ranges::find_if(data_, [&credential_id](const auto& passkey) {
-         return passkey.second.credential_id() == credential_id;
-@@ -313,11 +314,16 @@ bool PasskeySyncBridge::DeletePasskey(const std::strin
-                      weak_ptr_factory_.GetWeakPtr()));
-   NotifyPasskeysChanged();
-   return true;
 +#else
-+  LOG(ERROR) << "Unable to delete passkey"; 
-+  return false;
++      base::ranges::find_if(data_, [&credential_id](const auto& passkey) {
 +#endif
- }
- 
- bool PasskeySyncBridge::UpdatePasskey(const std::string& credential_id,
+         return passkey.second.credential_id() == credential_id;
+       });
+   if (passkey_it == data_.end()) {
+@@ -319,7 +323,11 @@ bool PasskeySyncBridge::UpdatePasskey(const std::strin
                                        PasskeyChange change) {
    // Find the credential with the given |credential_id|.
-+#if BUILDFLAG(IS_OPENBSD) || (BUILDFLAG(IS_FREEBSD) && (_LIBCPP_VERSION > 15000))
    const auto passkey_it =
++#if (_LIBCPP_VERSION >= 160000)
        std::ranges::find_if(data_, [&credential_id](const auto& passkey) {
-         return passkey.second.credential_id() == credential_id;
-@@ -341,6 +347,10 @@ bool PasskeySyncBridge::UpdatePasskey(const std::strin
-                      weak_ptr_factory_.GetWeakPtr()));
-   NotifyPasskeysChanged();
-   return true;
 +#else
-+  LOG(ERROR) << "Unable to update passkey"; 
-+  return false;
++      base::ranges::find_if(data_, [&credential_id](const auto& passkey) {
 +#endif
- }
- 
- std::string PasskeySyncBridge::AddNewPasskeyForTesting(
+         return passkey.second.credential_id() == credential_id;
+       });
+   if (passkey_it == data_.end()) {