git: 229eae94451f - main - www/chromium: update to 99.0.4844.82

From: Rene Ladan <rene_at_FreeBSD.org>
Date: Mon, 21 Mar 2022 11:06:40 UTC
The branch main has been updated by rene:

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

commit 229eae94451f1213d3fc5d2198728d0a909d43f6
Author:     Robert Nagy <robert@openbsd.org>
AuthorDate: 2022-03-21 11:02:18 +0000
Commit:     Rene Ladan <rene@FreeBSD.org>
CommitDate: 2022-03-21 11:06:21 +0000

    www/chromium: update to 99.0.4844.82
    
    While here:
    - respect download location settings [1]
    - fix manual page installation
    - fix build on arm64
    - fixup pkg-plist
    
    PR:             262673
    Reported by:    o.hushchenkov@gmail.com
---
 www/chromium/Makefile                              |  4 +--
 www/chromium/distinfo                              | 10 +++---
 ...atch-chrome_browser_download_download__prefs.cc | 40 ++++++++++++----------
 .../patch-chrome_browser_profiles_profile__impl.cc | 30 +++++++++-------
 .../patch-third__party_skia_src_core_SkCpu.cpp     | 26 ++++++++++++++
 www/chromium/pkg-plist                             |  3 --
 6 files changed, 72 insertions(+), 41 deletions(-)

diff --git a/www/chromium/Makefile b/www/chromium/Makefile
index 26ecb4f7eb36..a2e9e554b7ba 100644
--- a/www/chromium/Makefile
+++ b/www/chromium/Makefile
@@ -1,7 +1,7 @@
 # Created by: Florent Thoumie <flz@FreeBSD.org>
 
 PORTNAME=	chromium
-PORTVERSION=	99.0.4844.74
+PORTVERSION=	99.0.4844.82
 CATEGORIES=	www
 MASTER_SITES=	https://commondatastorage.googleapis.com/chromium-browser-official/ \
 		https://nerd.hu/distfiles/:fonts
@@ -279,7 +279,7 @@ do-install:
 	@${MKDIR} ${STAGEDIR}${DATADIR}
 	${INSTALL_MAN} ${WRKSRC}/chrome/app/resources/manpage.1.in \
 		${STAGEDIR}${MANPREFIX}/man/man1/chrome.1
-	@${SED} -ie 's,\@\@PACKAGE\@\@,chromium,g;s,\@\@MENUNAME\@\@,Chromium Web Browser,g' \
+	@${SED} -i "" -e 's,\@\@PACKAGE\@\@,chromium,g;s,\@\@MENUNAME\@\@,Chromium Web Browser,g' \
 		${STAGEDIR}${MANPREFIX}/man/man1/chrome.1
 	${CP} ${WRKSRC}/chrome/app/theme/chromium/product_logo_22_mono.png ${WRKSRC}/chrome/app/theme/chromium/product_logo_22.png
 .for s in 22 24 48 64 128 256
diff --git a/www/chromium/distinfo b/www/chromium/distinfo
index 10d39f810fad..275f70c8d20f 100644
--- a/www/chromium/distinfo
+++ b/www/chromium/distinfo
@@ -1,7 +1,7 @@
-TIMESTAMP = 1647412274
-SHA256 (chromium-99.0.4844.74.tar.xz) = 2d5f464730fde0260d1b00db1b38210344952ec91a5b3c544c99c43e76ffbb98
-SIZE (chromium-99.0.4844.74.tar.xz) = 1316293332
-SHA256 (chromium-99.0.4844.74-testdata.tar.xz) = 9b3de3c3f2decc2481aa11dace73dcea150b84d0b69b095117f6caeac0c0ceb6
-SIZE (chromium-99.0.4844.74-testdata.tar.xz) = 258879148
+TIMESTAMP = 1647811738
+SHA256 (chromium-99.0.4844.82.tar.xz) = b8bb0bc1410de8b9d98889c79410726a4e78801d4e54ea23b23b7b4015c7d25c
+SIZE (chromium-99.0.4844.82.tar.xz) = 1316414584
+SHA256 (chromium-99.0.4844.82-testdata.tar.xz) = 2af7befb56c8b904ca575c9830896c969a5f41ab9854593dbd2f4c79d6824003
+SIZE (chromium-99.0.4844.82-testdata.tar.xz) = 258942728
 SHA256 (test_fonts-cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb.tar.gz) = ec973eccd669d417fbf2d0a4dac730744a3174268ff062db5451b55c82bc3492
 SIZE (test_fonts-cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb.tar.gz) = 26759650
diff --git a/www/chromium/files/patch-chrome_browser_download_download__prefs.cc b/www/chromium/files/patch-chrome_browser_download_download__prefs.cc
index 9dbb2956cd6f..11bfe5f3bdb7 100644
--- a/www/chromium/files/patch-chrome_browser_download_download__prefs.cc
+++ b/www/chromium/files/patch-chrome_browser_download_download__prefs.cc
@@ -1,4 +1,4 @@
---- chrome/browser/download/download_prefs.cc.orig	2022-02-28 16:54:41 UTC
+--- chrome/browser/download/download_prefs.cc.orig	2022-03-20 09:08:36 UTC
 +++ chrome/browser/download/download_prefs.cc
 @@ -13,6 +13,7 @@
  #include "base/callback_helpers.h"
@@ -8,16 +8,18 @@
  #include "base/feature_list.h"
  #include "base/files/file_util.h"
  #include "base/no_destructor.h"
-@@ -60,6 +61,8 @@
+@@ -60,6 +61,10 @@
  #include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
  #endif
  
-+#include "sandbox/policy/switches.h"
++#if BUILDFLAG(IS_OPENBSD)
++#include "sandbox/policy/openbsd/sandbox_openbsd.h"
++#endif
 +
  using content::BrowserContext;
  using content::BrowserThread;
  using content::DownloadManager;
-@@ -70,7 +73,7 @@ namespace {
+@@ -70,7 +75,7 @@ namespace {
  // Consider downloads 'dangerous' if they go to the home directory on Linux and
  // to the desktop on any platform.
  bool DownloadPathIsDangerous(const base::FilePath& download_path) {
@@ -26,7 +28,7 @@
    base::FilePath home_dir = base::GetHomeDir();
    if (download_path == home_dir) {
      return true;
-@@ -168,7 +171,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi
+@@ -168,7 +173,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi
  #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
  
  #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
@@ -35,7 +37,7 @@
    should_open_pdf_in_system_reader_ =
        prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
  #endif
-@@ -287,7 +290,7 @@ void DownloadPrefs::RegisterProfilePrefs(
+@@ -287,7 +292,7 @@ void DownloadPrefs::RegisterProfilePrefs(
    registry->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
                                   default_download_path);
  #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
@@ -44,7 +46,7 @@
    registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false);
  #endif
  #if BUILDFLAG(IS_ANDROID)
-@@ -421,7 +424,7 @@ bool DownloadPrefs::IsDownloadPathManaged() const {
+@@ -421,7 +426,7 @@ bool DownloadPrefs::IsDownloadPathManaged() const {
  
  bool DownloadPrefs::IsAutoOpenByUserUsed() const {
  #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
@@ -53,7 +55,7 @@
    if (ShouldOpenPdfInSystemReader())
      return true;
  #endif
-@@ -436,7 +439,7 @@ bool DownloadPrefs::IsAutoOpenEnabled(const GURL& url,
+@@ -436,7 +441,7 @@ bool DownloadPrefs::IsAutoOpenEnabled(const GURL& url,
    DCHECK(extension[0] == base::FilePath::kExtensionSeparator);
    extension.erase(0, 1);
  #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
@@ -62,7 +64,7 @@
    if (base::FilePath::CompareEqualIgnoreCase(extension,
                                               FILE_PATH_LITERAL("pdf")) &&
        ShouldOpenPdfInSystemReader())
-@@ -491,7 +494,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens
+@@ -491,7 +496,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens
  }
  
  #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
@@ -71,7 +73,7 @@
  void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) {
    if (should_open_pdf_in_system_reader_ == should_open)
      return;
-@@ -513,7 +516,7 @@ bool DownloadPrefs::ShouldOpenPdfInSystemReader() cons
+@@ -513,7 +518,7 @@ bool DownloadPrefs::ShouldOpenPdfInSystemReader() cons
  
  void DownloadPrefs::ResetAutoOpenByUser() {
  #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
@@ -80,18 +82,18 @@
    SetShouldOpenPdfInSystemReader(false);
  #endif
    auto_open_by_user_.clear();
-@@ -651,9 +654,13 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa
-   // Fall back to the default download directory for all other paths.
-   return GetDefaultDownloadDirectoryForProfile();
+@@ -653,7 +658,14 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa
  #else
-+  // If unveil(2) is used, force the file dialog directory to something we
-+  // know is available.
-+  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
-+
    // If the stored download directory is an absolute path, we presume it's
    // correct; there's not really much more validation we can do here.
--  if (path.IsAbsolute())
-+  if (command_line->HasSwitch(sandbox::policy::switches::kDisableUnveil) && path.IsAbsolute())
++#if BUILDFLAG(IS_OPENBSD)
++  // If unveil(2) is used, force the file dialog directory to something we
++  // know is available.
++  auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
++  if (!sandbox->unveil_initialized() && path.IsAbsolute())
++#else
+   if (path.IsAbsolute())
++#endif
      return path;
  
    // When the default download directory is *not* an absolute path, we use the
diff --git a/www/chromium/files/patch-chrome_browser_profiles_profile__impl.cc b/www/chromium/files/patch-chrome_browser_profiles_profile__impl.cc
index eedb1286b9ff..fad03295c3f7 100644
--- a/www/chromium/files/patch-chrome_browser_profiles_profile__impl.cc
+++ b/www/chromium/files/patch-chrome_browser_profiles_profile__impl.cc
@@ -1,25 +1,31 @@
---- chrome/browser/profiles/profile_impl.cc.orig	2022-02-28 16:54:41 UTC
+--- chrome/browser/profiles/profile_impl.cc.orig	2022-03-20 09:08:36 UTC
 +++ chrome/browser/profiles/profile_impl.cc
-@@ -182,6 +182,7 @@
- #include "services/preferences/public/mojom/preferences.mojom.h"
- #include "services/preferences/public/mojom/tracked_preference_validation_delegate.mojom.h"
- #include "services/service_manager/public/cpp/service.h"
-+#include "sandbox/policy/switches.h"
- #include "ui/base/l10n/l10n_util.h"
+@@ -264,6 +264,10 @@
+ #include "chrome/browser/spellchecker/spellcheck_service.h"
+ #endif
  
- #if BUILDFLAG(IS_CHROMEOS_ASH)
-@@ -850,7 +851,13 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) 
++#if BUILDFLAG(IS_OPENBSD)
++#include "sandbox/policy/openbsd/sandbox_openbsd.h"
++#endif
++
+ using bookmarks::BookmarkModel;
+ using content::BrowserThread;
+ using content::DownloadManagerDelegate;
+@@ -850,7 +854,17 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) 
  }
  
  base::FilePath ProfileImpl::last_selected_directory() {
--  return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#if BUILDFLAG(IS_OPENBSD)
 +  // If unveil(2) is used, force the file dialog directory to something we
 +  // know is available.
-+  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
-+  if (!command_line->HasSwitch(sandbox::policy::switches::kDisableUnveil))
++  auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
++  if (sandbox->unveil_initialized())
 +    return GetPrefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
 +  else
 +    return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#else
+   return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#endif
  }
  
  void ProfileImpl::set_last_selected_directory(const base::FilePath& path) {
diff --git a/www/chromium/files/patch-third__party_skia_src_core_SkCpu.cpp b/www/chromium/files/patch-third__party_skia_src_core_SkCpu.cpp
new file mode 100644
index 000000000000..f35def466fcc
--- /dev/null
+++ b/www/chromium/files/patch-third__party_skia_src_core_SkCpu.cpp
@@ -0,0 +1,26 @@
+--- third_party/skia/src/core/SkCpu.cpp.orig	2022-03-21 06:36:22 UTC
++++ third_party/skia/src/core/SkCpu.cpp
+@@ -73,6 +73,23 @@
+         return features;
+     }
+ 
++#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__)
++    #include <machine/armreg.h>
++    #ifndef ID_AA64ISAR0_CRC32_VAL
++    #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
++    #endif
++
++    static uint32_t read_cpu_features() {
++      uint32_t features = 0;
++      uint64_t id_aa64isar0;
++
++      id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
++      if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
++        features |= SkCpu::CRC32;
++      }
++      return features;
++    }
++
+ #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
+     #include <sys/auxv.h>
+ 
diff --git a/www/chromium/pkg-plist b/www/chromium/pkg-plist
index c2cf62c92e9e..2aa267c1c49c 100644
--- a/www/chromium/pkg-plist
+++ b/www/chromium/pkg-plist
@@ -132,9 +132,6 @@ bin/chrome
 %%DATADIR%%/v8_context_snapshot.bin
 %%DEBUG%%%%DATADIR%%/character_data_generator
 %%DEBUG%%%%DATADIR%%/libVkLayer_khronos_validation.so
-%%DEBUG%%%%DATADIR%%/libimmediate_crash_test_helper.so
-%%DEBUG%%%%DATADIR%%/libmalloc_wrapper.so
-%%DEBUG%%%%DATADIR%%/libtest_shared_library.so
 %%DRIVER%%bin/chromedriver
 man/man1/chrome.1.gz
 share/applications/chromium-browser.desktop