commit 90547a9e803f986ba54e2c23be10bfefa09c4006
Author: Akarshan Biswas <akarshanbiswas(a)fedoraproject.org>
Date: Sat Aug 10 14:02:53 2019 +0530
Add a patch to fix Unrar wrapper
chromium-vaapi.spec | 3 +
fixunrarwrapper.patch | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 155 insertions(+)
---
diff --git a/chromium-vaapi.spec b/chromium-vaapi.spec
index 015e744..b20a452 100644
--- a/chromium-vaapi.spec
+++ b/chromium-vaapi.spec
@@ -184,6 +184,8 @@ Patch1: enable-vaapi.patch
Patch2: widevine.patch
Patch3: Do-not-use-VPP-on-Linux-Add-some-info-logs-and-fix-v.patch
Patch4: chromium-skia-harmony.patch
+#Fix unrar wrapper:
https://bugs.chromium.org/p/chromium/issues/detail?id=884521
+Patch5: fixunrarwrapper.patch
Patch50: nounrar.patch
# Bootstrap still uses python command
Patch51: py2-bootstrap.patch
@@ -225,6 +227,7 @@ chromium-vaapi is an open-source web browser, powered by WebKit
(Blink)
%patch2 -p1 -b .widevine
%patch3 -p1 -b .fixvaapi
%patch4 -p0 -b .skia
+%patch5 -p1 -b .unrarwrap
%patch50 -p1 -b .nounrar
%patch51 -p1 -b .py2boot
%if %{with system_libicu}
diff --git a/fixunrarwrapper.patch b/fixunrarwrapper.patch
new file mode 100644
index 0000000..01e4964
--- /dev/null
+++ b/fixunrarwrapper.patch
@@ -0,0 +1,152 @@
+diff --git a/third_party/unrar/BUILD.gn b/third_party/unrar/BUILD.gn
+index 333a00899cfe..9ff77d68e782 100644
+--- a/third_party/unrar/BUILD.gn
++++ b/third_party/unrar/BUILD.gn
+@@ -7,54 +7,7 @@ import("//build/config/features.gni")
+ if (safe_browsing_mode == 1) {
+ static_library("unrar") {
+ sources = [
+- "src/archive.cpp",
+- "src/arcread.cpp",
+- "src/blake2s.cpp",
+- "src/cmddata.cpp",
+- "src/consio.cpp",
+- "src/crc.cpp",
+- "src/crypt.cpp",
+- "src/encname.cpp",
+- "src/errhnd.cpp",
+- "src/extinfo.cpp",
+- "src/extract.cpp",
+- "src/filcreat.cpp",
+- "src/file.cpp",
+- "src/filefn.cpp",
+- "src/filestr.cpp",
+- "src/find.cpp",
+- "src/getbits.cpp",
+- "src/global.cpp",
+- "src/hash.cpp",
+- "src/headers.cpp",
+- "src/list.cpp",
+- "src/match.cpp",
+- "src/options.cpp",
+- "src/pathfn.cpp",
+- "src/qopen.cpp",
+- "src/rarvm.cpp",
+- "src/rawread.cpp",
+- "src/rdwrfn.cpp",
+- "src/recvol.cpp",
+- "src/resource.cpp",
+- "src/rijndael.cpp",
+- "src/rs.cpp",
+- "src/rs16.cpp",
+- "src/scantree.cpp",
+- "src/secpassword.cpp",
+- "src/sha1.cpp",
+- "src/sha256.cpp",
+- "src/smallfn.cpp",
+- "src/strfn.cpp",
+- "src/strlist.cpp",
+- "src/system.cpp",
+- "src/threadpool.cpp",
+- "src/timefn.cpp",
+- "src/ui.cpp",
+- "src/unicode.cpp",
+- "src/unpack.cpp",
+ "src/unrar_wrapper.cc",
+- "src/volume.cpp",
+ ]
+ if (is_win) {
+ sources += [ "src/isnt.cpp" ]
+diff --git a/third_party/unrar/src/unrar_wrapper.cc
b/third_party/unrar/src/unrar_wrapper.cc
+index 63b31f008861..6879a2d84988 100644
+--- a/third_party/unrar/src/unrar_wrapper.cc
++++ b/third_party/unrar/src/unrar_wrapper.cc
+@@ -9,7 +9,6 @@
+ #include "base/files/file_path.h"
+ #include "base/metrics/histogram_macros.h"
+ #include "build/build_config.h"
+-#include "third_party/unrar/src/rar.hpp"
+
+ namespace third_party_unrar {
+
+@@ -18,62 +17,10 @@ RarReader::RarReader() {}
+ RarReader::~RarReader() {}
+
+ bool RarReader::Open(base::File rar_file, base::File temp_file) {
+- rar_file_ = std::move(rar_file);
+- temp_file_ = std::move(temp_file);
+-
+- archive_ = std::make_unique<Archive>();
+- archive_->SetFileHandle(rar_file_.GetPlatformFile());
+- archive_->SetTempFileHandle(temp_file_.GetPlatformFile());
+-
+- bool open_success = archive_->Open(L"dummy.rar");
+- UMA_HISTOGRAM_BOOLEAN("SBClientDownload.RarOpenSuccess", open_success);
+- if (!open_success)
+- return false;
+-
+- bool is_valid_archive = archive_->IsArchive(/*EnableBroken=*/true);
+- UMA_HISTOGRAM_BOOLEAN("SBClientDownload.RarValidArchive",
is_valid_archive);
+- if (!is_valid_archive)
+- return false;
+-
+- UMA_HISTOGRAM_BOOLEAN("SBClientDownload.RarHeadersEncrypted",
+- archive_->Encrypted);
+-
+- command_ = std::make_unique<CommandData>();
+- command_->ParseArg(const_cast<wchar_t*>(L"-p"));
+- command_->ParseArg(const_cast<wchar_t*>(L"x"));
+- command_->ParseDone();
+-
+- extractor_ = std::make_unique<CmdExtract>(command_.get());
+- extractor_->ExtractArchiveInit(*archive_);
+-
+- return true;
++ return false;
+ }
+
+ bool RarReader::ExtractNextEntry() {
+- bool success = true, repeat = true;
+- while (success || repeat) {
+- temp_file_.Seek(base::File::Whence::FROM_BEGIN, 0);
+- temp_file_.SetLength(0);
+- size_t header_size = archive_->ReadHeader();
+- repeat = false;
+- success = extractor_->ExtractCurrentFile(
+- *archive_, header_size, repeat); // |repeat| is passed by reference
+-
+- if (archive_->GetHeaderType() == HEAD_FILE) {
+-#if defined(OS_WIN)
+- current_entry_.file_path = base::FilePath(archive_->FileHead.FileName);
+-#else
+- std::wstring wide_filename(archive_->FileHead.FileName);
+- std::string filename(wide_filename.begin(), wide_filename.end());
+- current_entry_.file_path = base::FilePath(filename);
+-#endif
+- current_entry_.is_directory = archive_->FileHead.Dir;
+- current_entry_.is_encrypted = archive_->FileHead.Encrypted;
+- current_entry_.file_size = extractor_->GetCurrentFileSize();
+- return true;
+- }
+- }
+-
+ return false;
+ }
+
+diff --git a/third_party/unrar/src/unrar_wrapper.h
b/third_party/unrar/src/unrar_wrapper.h
+index 05bf5b256383..b96260c70971 100644
+--- a/third_party/unrar/src/unrar_wrapper.h
++++ b/third_party/unrar/src/unrar_wrapper.h
+@@ -12,9 +12,9 @@
+
+ // Forward declare the unrar symbols needed for extraction, so users of
+ // RarReader don't need all the symbols from unrar.
+-class Archive;
+-class CmdExtract;
+-class CommandData;
++class Archive {};
++class CmdExtract {};
++class CommandData {};
+
+ namespace third_party_unrar {
+