summaryrefslogtreecommitdiff
path: root/repo/qt5-qtwebengine
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-27 23:09:07 +0100
committerdavidovski <david@davidovski.xyz>2022-06-27 23:09:07 +0100
commitf6332a43c35387c4a2dea1746be5fd092890ae0e (patch)
treed6599f63de04096f3fc21a98e0b3bb39d55a3531 /repo/qt5-qtwebengine
parentf13e0cac13f90f7f57bce3b26b2e6383de6e4ad2 (diff)
added lf and iptables
Diffstat (limited to 'repo/qt5-qtwebengine')
-rw-r--r--repo/qt5-qtwebengine/0001-pretend-to-stay-at-5.15.3.patch8
-rw-r--r--repo/qt5-qtwebengine/0010-chromium-musl-Match-syscalls-to-match-musl.patch44
-rw-r--r--repo/qt5-qtwebengine/default-pthread-stacksize.patch23
-rw-r--r--repo/qt5-qtwebengine/ffmpeg5.patch151
-rw-r--r--repo/qt5-qtwebengine/fix-chromium-build.patch79
-rw-r--r--repo/qt5-qtwebengine/musl-hacks.patch13
-rw-r--r--repo/qt5-qtwebengine/musl-sandbox.patch181
-rw-r--r--repo/qt5-qtwebengine/nasm.patch13
-rw-r--r--repo/qt5-qtwebengine/qt-chromium-python3.patch1752
-rw-r--r--repo/qt5-qtwebengine/qt-musl-crashpad.patch13
-rw-r--r--repo/qt5-qtwebengine/qt-musl-dispatch_to_musl.patch103
-rw-r--r--repo/qt5-qtwebengine/qt-musl-elf-arm.patch13
-rw-r--r--repo/qt5-qtwebengine/qt-musl-execinfo.patch108
-rw-r--r--repo/qt5-qtwebengine/qt-musl-mallinfo.patch43
-rw-r--r--repo/qt5-qtwebengine/qt-musl-off_t.patch10
-rw-r--r--repo/qt5-qtwebengine/qt-musl-pread-pwrite.patch20
-rw-r--r--repo/qt5-qtwebengine/qt-musl-pvalloc.patch14
-rw-r--r--repo/qt5-qtwebengine/qt-musl-resolve.patch61
-rw-r--r--repo/qt5-qtwebengine/qt-musl-siginfo_t.patch18
-rw-r--r--repo/qt5-qtwebengine/qt-musl-stackstart.patch22
-rw-r--r--repo/qt5-qtwebengine/qt-musl-sysreg-for__WORDSIZE.patch14
-rw-r--r--repo/qt5-qtwebengine/qt-musl-thread-stacksize.patch26
-rw-r--r--repo/qt5-qtwebengine/qt-musl-tid-caching.patch81
-rw-r--r--repo/qt5-qtwebengine/qt5-qtwebengine.xibuild75
-rw-r--r--repo/qt5-qtwebengine/remove-glibc-check.patch78
-rw-r--r--repo/qt5-qtwebengine/sndio.patch142
-rw-r--r--repo/qt5-qtwebengine/support-python3.patch158
27 files changed, 3263 insertions, 0 deletions
diff --git a/repo/qt5-qtwebengine/0001-pretend-to-stay-at-5.15.3.patch b/repo/qt5-qtwebengine/0001-pretend-to-stay-at-5.15.3.patch
new file mode 100644
index 0000000..4b2d9fa
--- /dev/null
+++ b/repo/qt5-qtwebengine/0001-pretend-to-stay-at-5.15.3.patch
@@ -0,0 +1,8 @@
+--- a/.qmake.conf
++++ b/.qmake.conf
+@@ -5,4 +5,4 @@ QTWEBENGINE_OUT_ROOT = $$shadowed($$PWD)
+ load(qt_build_config)
+ CONFIG += warning_clean
+
+-MODULE_VERSION = 5.15.10
++MODULE_VERSION = 5.15.3
diff --git a/repo/qt5-qtwebengine/0010-chromium-musl-Match-syscalls-to-match-musl.patch b/repo/qt5-qtwebengine/0010-chromium-musl-Match-syscalls-to-match-musl.patch
new file mode 100644
index 0000000..524d75d
--- /dev/null
+++ b/repo/qt5-qtwebengine/0010-chromium-musl-Match-syscalls-to-match-musl.patch
@@ -0,0 +1,44 @@
+From ce23b6a6e5a5ebae15dedeebf7044ac9a0249a80 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 15:24:49 -0700
+Subject: [PATCH] chromium: musl: Match syscalls to match musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/third_party/lss/linux_syscall_support.h | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h b/chromium/third_party/lss/linux_syscall_support.h
+index 80a3e56..1e57b1a 100644
+--- a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
++++ b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+@@ -824,6 +824,14 @@ struct kernel_statfs {
+ #endif
+
+
++#undef stat64
++#undef fstat64
++
++#ifndef __NR_fstatat
++#define __NR_fstatat __NR_fstatat64
++#endif
++
++
+ #if defined(__x86_64__)
+ #ifndef ARCH_SET_GS
+ #define ARCH_SET_GS 0x1001
+@@ -1258,6 +1266,14 @@ struct kernel_statfs {
+ #ifndef __NR_getrandom
+ #define __NR_getrandom 318
+ #endif
++
++#ifndef __NR_pread
++#define __NR_pread __NR_pread64
++#endif
++#ifndef __NR_pwrite
++#define __NR_pwrite __NR_pwrite64
++#endif
++
+ /* End of x86-64 definitions */
+ #elif defined(__mips__)
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
diff --git a/repo/qt5-qtwebengine/default-pthread-stacksize.patch b/repo/qt5-qtwebengine/default-pthread-stacksize.patch
new file mode 100644
index 0000000..e0ca792
--- /dev/null
+++ b/repo/qt5-qtwebengine/default-pthread-stacksize.patch
@@ -0,0 +1,23 @@
+--- ./src/3rdparty/chromium/base/threading/platform_thread_linux.cc
++++ ./src/3rdparty/chromium/base/threading/platform_thread_linux.cc
+@@ -186,7 +186,8 @@
+
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+ #if !defined(THREAD_SANITIZER)
+- return 0;
++ // use 2mb to avoid running out of space. This is what android uses
++ return 2 * (1 << 20);
+ #else
+ // ThreadSanitizer bloats the stack heavily. Evidence has been that the
+ // default stack size isn't enough for some browser tests.
+--- ./src/3rdparty/chromium/base/threading/platform_thread_unittest.cc.orig
++++ ./src/3rdparty/chromium/base/threading/platform_thread_unittest.cc
+@@ -411,7 +411,7 @@
+ ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ !defined(THREAD_SANITIZER)) || \
+ (defined(OS_ANDROID) && !defined(ADDRESS_SANITIZER))
+- EXPECT_EQ(0u, stack_size);
++ EXPECT_EQ(2u << 20, stack_size);
+ #else
+ EXPECT_GT(stack_size, 0u);
+ EXPECT_LT(stack_size, 20u * (1 << 20));
diff --git a/repo/qt5-qtwebengine/ffmpeg5.patch b/repo/qt5-qtwebengine/ffmpeg5.patch
new file mode 100644
index 0000000..ea721d1
--- /dev/null
+++ b/repo/qt5-qtwebengine/ffmpeg5.patch
@@ -0,0 +1,151 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/e8ab98ca62f23ee9633111596977c55ece224d2c/trunk/qt5-webengine-ffmpeg5.patch
+diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h
+index 2734a485cbd..70b1877a43c 100644
+--- a/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h
++++ b/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h
+@@ -29,6 +29,7 @@ extern "C" {
+ #include <libavformat/avformat.h>
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
++#include <libavutil/channel_layout.h>
+ #include <libavutil/imgutils.h>
+ #include <libavutil/log.h>
+ #include <libavutil/mastering_display_metadata.h>
+diff --git a/chromium/media/filters/audio_file_reader.cc b/chromium/media/filters/audio_file_reader.cc
+index cb81d920def..bd73908d0ca 100644
+--- a/src/3rdparty/chromium/media/filters/audio_file_reader.cc
++++ b/src/3rdparty/chromium/media/filters/audio_file_reader.cc
+@@ -85,7 +85,7 @@ bool AudioFileReader::OpenDemuxer() {
+ }
+
+ bool AudioFileReader::OpenDecoder() {
+- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
+ if (codec) {
+ // MP3 decodes to S16P which we don't support, tell it to use S16 instead.
+ if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P)
+diff --git a/chromium/media/filters/ffmpeg_audio_decoder.cc b/chromium/media/filters/ffmpeg_audio_decoder.cc
+index 0d825ed791b..72fac6167ef 100644
+--- a/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
++++ b/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
+@@ -329,7 +329,7 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
+ }
+ }
+
+- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
+ if (!codec ||
+ avcodec_open2(codec_context_.get(), codec, &codec_options) < 0) {
+ DLOG(ERROR) << "Could not initialize audio decoder: "
+diff --git a/chromium/media/filters/ffmpeg_demuxer.cc b/chromium/media/filters/ffmpeg_demuxer.cc
+index d34db63f3ef..427565b00c1 100644
+--- a/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc
++++ b/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc
+@@ -98,12 +98,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stream) {
+
+ // Next try to use the first DTS value, for codecs where we know PTS == DTS
+ // (excludes all H26x codecs). The start time must be returned in PTS.
+- if (stream->first_dts != kNoFFmpegTimestamp &&
++ if (av_stream_get_first_dts(stream) != kNoFFmpegTimestamp &&
+ stream->codecpar->codec_id != AV_CODEC_ID_HEVC &&
+ stream->codecpar->codec_id != AV_CODEC_ID_H264 &&
+ stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) {
+ const base::TimeDelta first_pts =
+- ConvertFromTimeBase(stream->time_base, stream->first_dts);
++ ConvertFromTimeBase(stream->time_base, av_stream_get_first_dts(stream));
+ if (first_pts < start_time)
+ start_time = first_pts;
+ }
+@@ -408,11 +408,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
+ scoped_refptr<DecoderBuffer> buffer;
+
+ if (type() == DemuxerStream::TEXT) {
+- int id_size = 0;
++ size_t id_size = 0;
+ uint8_t* id_data = av_packet_get_side_data(
+ packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size);
+
+- int settings_size = 0;
++ size_t settings_size = 0;
+ uint8_t* settings_data = av_packet_get_side_data(
+ packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size);
+
+@@ -424,7 +424,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
+ buffer = DecoderBuffer::CopyFrom(packet->data, packet->size,
+ side_data.data(), side_data.size());
+ } else {
+- int side_data_size = 0;
++ size_t side_data_size = 0;
+ uint8_t* side_data = av_packet_get_side_data(
+ packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size);
+
+@@ -485,7 +485,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
+ packet->size - data_offset);
+ }
+
+- int skip_samples_size = 0;
++ size_t skip_samples_size = 0;
+ const uint32_t* skip_samples_ptr =
+ reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
+ packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
+diff --git a/chromium/media/filters/ffmpeg_glue.cc b/chromium/media/filters/ffmpeg_glue.cc
+index 0ef3521473d..8483ecc348f 100644
+--- a/src/3rdparty/chromium/media/filters/ffmpeg_glue.cc
++++ b/src/3rdparty/chromium/media/filters/ffmpeg_glue.cc
+@@ -59,7 +59,6 @@ static int64_t AVIOSeekOperation(void* opaque, int64_t offset, int whence) {
+ }
+
+ void FFmpegGlue::InitializeFFmpeg() {
+- av_register_all();
+ }
+
+ static void LogContainer(bool is_local_file,
+@@ -95,9 +94,6 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol* protocol) {
+ // Enable fast, but inaccurate seeks for MP3.
+ format_context_->flags |= AVFMT_FLAG_FAST_SEEK;
+
+- // Ensures we can read out various metadata bits like vp8 alpha.
+- format_context_->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
+-
+ // Ensures format parsing errors will bail out. From an audit on 11/2017, all
+ // instances were real failures. Solves bugs like http://crbug.com/710791.
+ format_context_->error_recognition |= AV_EF_EXPLODE;
+diff --git a/chromium/media/filters/ffmpeg_video_decoder.cc b/chromium/media/filters/ffmpeg_video_decoder.cc
+index ef12477ee89..7996606f5f9 100644
+--- a/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
++++ b/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
+@@ -391,7 +391,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config,
+ if (decode_nalus_)
+ codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS;
+
+- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
+ if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
+ ReleaseFFmpegResources();
+ return false;
+diff --git a/chromium/media/filters/media_file_checker.cc b/chromium/media/filters/media_file_checker.cc
+index 59c2a2fc618..1a9872c7acb 100644
+--- a/src/3rdparty/chromium/media/filters/media_file_checker.cc
++++ b/src/3rdparty/chromium/media/filters/media_file_checker.cc
+@@ -68,7 +68,7 @@ bool MediaFileChecker::Start(base::TimeDelta check_time) {
+ auto context = AVStreamToAVCodecContext(format_context->streams[i]);
+ if (!context)
+ continue;
+- AVCodec* codec = avcodec_find_decoder(cp->codec_id);
++ const AVCodec* codec = avcodec_find_decoder(cp->codec_id);
+ if (codec && avcodec_open2(context.get(), codec, nullptr) >= 0) {
+ auto loop = std::make_unique<FFmpegDecodingLoop>(context.get());
+ stream_contexts[i] = {std::move(context), std::move(loop)};
+diff --git a/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+index 9002b874611..d12fade8b63 100644
+--- a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
++++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+@@ -203,7 +203,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings,
+ // a pointer |this|.
+ av_context_->opaque = this;
+
+- AVCodec* codec = avcodec_find_decoder(av_context_->codec_id);
++ const AVCodec* codec = avcodec_find_decoder(av_context_->codec_id);
+ if (!codec) {
+ // This is an indication that FFmpeg has not been initialized or it has not
+ // been compiled/initialized with the correct set of codecs.
diff --git a/repo/qt5-qtwebengine/fix-chromium-build.patch b/repo/qt5-qtwebengine/fix-chromium-build.patch
new file mode 100644
index 0000000..8b26238
--- /dev/null
+++ b/repo/qt5-qtwebengine/fix-chromium-build.patch
@@ -0,0 +1,79 @@
+diff --git a/src/3rdparty/chromium/v8/src/compiler/backend/arm64/code-generator-arm64.cc b/src/3rdparty/chromium/v8/src/compiler/backend/arm64/code-generator-arm64.cc
+index 1c02aa69a..69e5e58de 100644
+--- a/src/3rdparty/chromium/v8/src/compiler/backend/arm64/code-generator-arm64.cc
++++ b/src/3rdparty/chromium/v8/src/compiler/backend/arm64/code-generator-arm64.cc
+@@ -375,6 +375,74 @@ Condition FlagsConditionToCondition(FlagsCondition condition) {
+ UNREACHABLE();
+ }
+
++class WasmOutOfLineTrap : public OutOfLineCode {
++ public:
++ WasmOutOfLineTrap(CodeGenerator* gen, Instruction* instr)
++ : OutOfLineCode(gen), gen_(gen), instr_(instr) {}
++ void Generate() override {
++ Arm64OperandConverter i(gen_, instr_);
++ TrapId trap_id =
++ static_cast<TrapId>(i.InputInt32(instr_->InputCount() - 1));
++ GenerateCallToTrap(trap_id);
++ }
++
++ protected:
++ CodeGenerator* gen_;
++
++ void GenerateWithTrapId(TrapId trap_id) { GenerateCallToTrap(trap_id); }
++
++ private:
++ void GenerateCallToTrap(TrapId trap_id) {
++ if (trap_id == TrapId::kInvalid) {
++ // We cannot test calls to the runtime in cctest/test-run-wasm.
++ // Therefore we emit a call to C here instead of a call to the runtime.
++ __ CallCFunction(ExternalReference::wasm_call_trap_callback_for_testing(),
++ 0);
++ __ LeaveFrame(StackFrame::WASM);
++ auto call_descriptor = gen_->linkage()->GetIncomingDescriptor();
++ int pop_count = static_cast<int>(call_descriptor->StackParameterCount());
++ pop_count += (pop_count & 1); // align
++ __ Drop(pop_count);
++ __ Ret();
++ } else {
++ gen_->AssembleSourcePosition(instr_);
++ // A direct call to a wasm runtime stub defined in this module.
++ // Just encode the stub index. This will be patched when the code
++ // is added to the native module and copied into wasm code space.
++ __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
++ ReferenceMap* reference_map =
++ gen_->zone()->New<ReferenceMap>(gen_->zone());
++ gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
++ __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
++ }
++ }
++
++ Instruction* instr_;
++};
++
++class WasmProtectedInstructionTrap final : public WasmOutOfLineTrap {
++ public:
++ WasmProtectedInstructionTrap(CodeGenerator* gen, int pc, Instruction* instr)
++ : WasmOutOfLineTrap(gen, instr), pc_(pc) {}
++
++ void Generate() override {
++ gen_->AddProtectedInstructionLanding(pc_, __ pc_offset());
++ GenerateWithTrapId(TrapId::kTrapMemOutOfBounds);
++ }
++
++ private:
++ int pc_;
++};
++
++void EmitOOLTrapIfNeeded(Zone* zone, CodeGenerator* codegen,
++ InstructionCode opcode, Instruction* instr, int pc) {
++ const MemoryAccessMode access_mode =
++ static_cast<MemoryAccessMode>(MiscField::decode(opcode));
++ if (access_mode == kMemoryAccessProtected) {
++ zone->New<WasmProtectedInstructionTrap>(codegen, pc, instr);
++ }
++}
++
+ void EmitWordLoadPoisoningIfNeeded(CodeGenerator* codegen,
+ InstructionCode opcode, Instruction* instr,
+ Arm64OperandConverter const& i) {
diff --git a/repo/qt5-qtwebengine/musl-hacks.patch b/repo/qt5-qtwebengine/musl-hacks.patch
new file mode 100644
index 0000000..3c94b19
--- /dev/null
+++ b/repo/qt5-qtwebengine/musl-hacks.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/chromium/net/socket/udp_socket_posix.cc b/src/3rdparty/chromium/net/socket/udp_socket_posix.cc
+index dbc8c5aaf..077bbde33 100644
+--- a/src/3rdparty/chromium/net/socket/udp_socket_posix.cc
++++ b/src/3rdparty/chromium/net/socket/udp_socket_posix.cc
+@@ -1152,7 +1152,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers(
+ msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()});
+ msgvec->reserve(buffers.size());
+ for (size_t j = 0; j < buffers.size(); j++)
+- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0});
++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, 0, 0}, 0});
+ int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0));
+ SendResult send_result(0, 0, std::move(buffers));
+ if (result < 0) {
diff --git a/repo/qt5-qtwebengine/musl-sandbox.patch b/repo/qt5-qtwebengine/musl-sandbox.patch
new file mode 100644
index 0000000..ad01ea8
--- /dev/null
+++ b/repo/qt5-qtwebengine/musl-sandbox.patch
@@ -0,0 +1,181 @@
+diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+index 348ab6e8c..2eac6ef82 100644
+--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+@@ -127,21 +127,11 @@ namespace sandbox {
+ // present (as in newer versions of posix_spawn).
+ ResultExpr RestrictCloneToThreadsAndEPERMFork() {
+ const Arg<unsigned long> flags(0);
+-
+- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2.
+- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES |
+- CLONE_SIGHAND | CLONE_THREAD |
+- CLONE_SYSVSEM;
+- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED;
+-
+- const uint64_t kGlibcPthreadFlags =
+- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD |
+- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID;
+- const BoolExpr glibc_test = flags == kGlibcPthreadFlags;
+-
+- const BoolExpr android_test =
+- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask,
+- flags == kGlibcPthreadFlags);
++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
++ CLONE_THREAD | CLONE_SYSVSEM;
++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
++ CLONE_DETACHED;
++ const BoolExpr thread_clone_ok = (flags&~safe)==required;
+
+ // The following two flags are the two important flags in any vfork-emulating
+ // clone call. EPERM any clone call that contains both of them.
+@@ -151,7 +141,7 @@ ResultExpr RestrictCloneToThreadsAndEPERMFork() {
+ AnyOf((flags & (CLONE_VM | CLONE_THREAD)) == 0,
+ (flags & kImportantCloneVforkFlags) == kImportantCloneVforkFlags);
+
+- return If(IsAndroid() ? android_test : glibc_test, Allow())
++ return If(thread_clone_ok, Allow())
+ .ElseIf(is_fork_or_clone_vfork, Error(EPERM))
+ .Else(CrashSIGSYSClone());
+ }
+diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+index 6e2bd4fee..9f9e4ad8a 100644
+--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -392,6 +392,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
+ #if defined(__i386__)
+ case __NR_waitpid:
+ #endif
++ case __NR_set_tid_address:
+ return true;
+ case __NR_clone: // Should be parameter-restricted.
+ case __NR_setns: // Privileged.
+@@ -404,7 +405,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
+ case __NR_set_thread_area:
+ #endif
+- case __NR_set_tid_address:
+ case __NR_unshare:
+ #if !defined(__mips__) && !defined(__aarch64__)
+ case __NR_vfork:
+@@ -514,6 +514,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_mlock:
+ case __NR_munlock:
+ case __NR_munmap:
++ case __NR_mremap:
++ case __NR_membarrier:
+ return true;
+ case __NR_madvise:
+ case __NR_mincore:
+@@ -531,7 +533,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_modify_ldt:
+ #endif
+ case __NR_mprotect:
+- case __NR_mremap:
+ case __NR_msync:
+ case __NR_munlockall:
+ case __NR_readahead:
+diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h
+index 59d0eab8e..7ae700213 100644
+--- a/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h
++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h
+@@ -1119,4 +1119,8 @@
+ #define __NR_rseq 293
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 283
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_
+diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h
+index 1addd5384..d8811ce87 100644
+--- a/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h
++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h
+@@ -1441,6 +1441,11 @@
+ #define __NR_io_pgetevents (__NR_SYSCALL_BASE+399)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_SYSCALL_BASE+389)
++#endif
++
++
+ // ARM private syscalls.
+ #if !defined(__ARM_NR_BASE)
+ #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
+diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h
+index ec75815a8..612fcfaa9 100644
+--- a/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h
++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h
+@@ -1271,4 +1271,8 @@
+ #define __NR_memfd_create (__NR_Linux + 314)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 318)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
+diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h
+index ddbf97f3d..1742acd4c 100644
+--- a/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h
++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h
+@@ -1433,4 +1433,8 @@
+ #define __NR_memfd_create (__NR_Linux + 354)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 358)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
+diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h
+index a6afc62d9..6ab7740de 100644
+--- a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h
++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h
+@@ -1710,5 +1710,10 @@
+ #define __NR_clone3 435
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 375
++#endif
++
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_
+
+
+diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h
+index 349504aee..6a6d4756f 100644
+--- a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h
++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h
+@@ -1350,5 +1350,10 @@
+ #define __NR_rseq 334
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 324
++#endif
++
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_
+
+diff --git a/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+index 9fe9575eb..fa1a946f6 100644
+--- a/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc
++++ b/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+@@ -93,11 +93,11 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
+ case __NR_sysinfo:
+ case __NR_times:
+ case __NR_uname:
+- return Allow();
+- case __NR_sched_getaffinity:
+ case __NR_sched_getparam:
+ case __NR_sched_getscheduler:
+ case __NR_sched_setscheduler:
++ return Allow();
++ case __NR_sched_getaffinity:
+ return RestrictSchedTarget(GetPolicyPid(), sysno);
+ case __NR_prlimit64:
+ // See crbug.com/662450 and setrlimit comment above.
diff --git a/repo/qt5-qtwebengine/nasm.patch b/repo/qt5-qtwebengine/nasm.patch
new file mode 100644
index 0000000..1d58af6
--- /dev/null
+++ b/repo/qt5-qtwebengine/nasm.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/chromium/third_party/nasm/config/config-linux.h b/src/3rdparty/chromium/third_party/nasm/config/config-linux.h
+index 7eb7c20ff..3bdc2eb39 100644
+--- a/src/3rdparty/chromium/third_party/nasm/config/config-linux.h
++++ b/src/3rdparty/chromium/third_party/nasm/config/config-linux.h
+@@ -139,7 +139,7 @@
+ #define HAVE_ACCESS 1
+
+ /* Define to 1 if you have the `canonicalize_file_name' function. */
+-#define HAVE_CANONICALIZE_FILE_NAME 1
++// #define HAVE_CANONICALIZE_FILE_NAME 1
+
+ /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+ /* #undef HAVE_CPU_TO_LE16 */
diff --git a/repo/qt5-qtwebengine/qt-chromium-python3.patch b/repo/qt5-qtwebengine/qt-chromium-python3.patch
new file mode 100644
index 0000000..41fcb7e
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-chromium-python3.patch
@@ -0,0 +1,1752 @@
+diff -upr b/src/3rdparty/chromium/build/print_python_deps.py a/src/3rdparty/chromium/build/print_python_deps.py
+--- b/src/3rdparty/chromium/build/print_python_deps.py 2022-03-08 18:21:43.709419882 +0100
++++ a/src/3rdparty/chromium/build/print_python_deps.py 2022-03-08 18:23:26.572870672 +0100
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.7
++#!/usr/bin/python
+ # Copyright 2016 The Chromium Authors. All rights reserved.
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+@@ -80,7 +80,7 @@ def _GetTargetPythonVersion(module):
+ if shebang.startswith('#!'):
+ # Examples:
+ # '#!/usr/bin/python'
+- # '#!/usr/bin/python2.7'
++ # '#!/usr/bin/python'
+ # '#!/usr/bin/python3'
+ # '#!/usr/bin/env python3'
+ # '#!/usr/bin/env vpython'
+@@ -152,7 +152,7 @@ def main():
+
+ # Trybots run with vpython as default Python, but with a different config
+ # from //.vpython. To make the is_vpython test work, and to match the behavior
+- # of dev machines, the shebang line must be run with python2.7.
++ # of dev machines, the shebang line must be run with python.
+ #
+ # E.g. $HOME/.vpython-root/dd50d3/bin/python
+ # E.g. /b/s/w/ir/cache/vpython/ab5c79/bin/python
+diff -upr b/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py a/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py
+--- b/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py 2022-03-08 18:21:44.576087412 +0100
++++ a/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py 2022-03-08 18:23:26.572870672 +0100
+@@ -7,7 +7,7 @@
+ Converts a given ASCII proto into a binary resource.
+
+ """
+-
++from __future__ import print_function
+ import abc
+ import imp
+ import optparse
+@@ -196,12 +196,12 @@ class BinaryProtoGenerator:
+ self._ImportProtoModules(opts.path)
+
+ if not self.VerifyArgs(opts):
+- print "Wrong arguments"
++ print("Wrong arguments")
+ return 1
+
+ try:
+ self._GenerateBinaryProtos(opts)
+ except Exception as e:
+- print "ERROR: Failed to render binary version of %s:\n %s\n%s" % (
+- opts.infile, str(e), traceback.format_exc())
++ print("ERROR: Failed to render binary version of %s:\n %s\n%s" %
++ (opts.infile, str(e), traceback.format_exc()))
+ return 1
+diff -upr b/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py a/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py
+--- b/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py 2022-03-08 18:21:44.936087771 +0100
++++ a/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py 2022-03-08 18:23:26.572870672 +0100
+@@ -74,7 +74,7 @@ def main(argv):
+ for filename in parsed_args.source_files:
+ add_file_to_grd(doc, os.path.basename(filename))
+
+- with open(parsed_args.output_filename, 'w') as output_file:
++ with open(parsed_args.output_filename, 'wb') as output_file:
+ output_file.write(doc.toxml(encoding='UTF-8'))
+
+
+diff -upr b/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn a/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn
+--- b/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn 2022-03-08 18:21:45.622755122 +0100
++++ a/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn 2022-03-08 18:23:26.572870672 +0100
+@@ -2,9 +2,11 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
++import("//build/config/python.gni")
+ import("//mojo/public/tools/bindings/mojom.gni")
+ import("//third_party/jinja2/jinja2.gni")
+
++# TODO(crbug.com/1194274): Investigate nondeterminism in Py3 builds.
+ action("precompile_templates") {
+ sources = mojom_generator_sources
+ sources += [
+diff -upr b/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py a/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py
+--- b/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py 2022-03-08 18:21:45.622755122 +0100
++++ a/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py 2022-03-08 18:23:26.572870672 +0100
+@@ -18,7 +18,6 @@ import os
+ import re
+ import sys
+
+-from cStringIO import StringIO
+ from optparse import OptionParser
+
+ sys.path.insert(
+@@ -41,12 +40,9 @@ def main():
+ pattern = re.compile(options.pattern)
+ files = [f for f in os.listdir(options.directory) if pattern.match(f)]
+
+- stream = StringIO()
+- for f in files:
+- print(f, file=stream)
++ contents = '\n'.join(f for f in files) + '\n'
++ WriteFile(contents, options.output)
+
+- WriteFile(stream.getvalue(), options.output)
+- stream.close()
+
+ if __name__ == '__main__':
+ sys.exit(main())
+diff -upr b/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py a/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py
+--- b/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py 2022-03-08 18:21:45.629421795 +0100
++++ a/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py 2022-03-08 18:23:26.572870672 +0100
+@@ -25,6 +25,10 @@ sys.path.append(os.path.join(os.path.dir
+ 'build', 'android', 'gyp'))
+ from util import build_utils
+
++# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted.
++if sys.version_info.major != 2:
++ basestring = str
++ long = int
+
+ GENERATOR_PREFIX = 'java'
+
+diff -upr b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py
+--- b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py 2022-03-08 18:21:45.632755132 +0100
++++ a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py 2022-03-08 18:23:26.572870672 +0100
+@@ -136,9 +136,14 @@ class Stylizer(object):
+
+ def WriteFile(contents, full_path):
+ # If |contents| is same with the file content, we skip updating.
++ if not isinstance(contents, bytes):
++ data = contents.encode('utf8')
++ else:
++ data = contents
++
+ if os.path.isfile(full_path):
+ with open(full_path, 'rb') as destination_file:
+- if destination_file.read() == contents:
++ if destination_file.read() == data:
+ return
+
+ # Make sure the containing directory exists.
+@@ -146,11 +151,8 @@ def WriteFile(contents, full_path):
+ fileutil.EnsureDirectoryExists(full_dir)
+
+ # Dump the data to disk.
+- with open(full_path, "wb") as f:
+- if not isinstance(contents, bytes):
+- f.write(contents.encode('utf-8'))
+- else:
+- f.write(contents)
++ with open(full_path, 'wb') as f:
++ f.write(data)
+
+
+ def AddComputedData(module):
+diff -upr b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py
+--- b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py 2022-03-08 18:21:45.632755132 +0100
++++ a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py 2022-03-08 18:23:26.572870672 +0100
+@@ -398,7 +398,8 @@ class Field(object):
+
+
+ class StructField(Field):
+- pass
++ def __hash__(self):
++ return super(Field, self).__hash__()
+
+
+ class UnionField(Field):
+diff -upr b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py
+--- b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py 2022-03-08 18:21:45.632755132 +0100
++++ a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py 2022-03-08 18:23:26.572870672 +0100
+@@ -75,9 +75,9 @@ def PrecompileTemplates(generator_module
+ os.path.dirname(module.__file__), generator.GetTemplatePrefix())
+ ]))
+ jinja_env.filters.update(generator.GetFilters())
+- jinja_env.compile_templates(
+- os.path.join(output_dir, "%s.zip" % generator.GetTemplatePrefix()),
+- extensions=["tmpl"],
+- zip="stored",
+- py_compile=True,
+- ignore_errors=False)
++ jinja_env.compile_templates(os.path.join(
++ output_dir, "%s.zip" % generator.GetTemplatePrefix()),
++ extensions=["tmpl"],
++ zip="stored",
++ py_compile=sys.version_info.major < 3,
++ ignore_errors=False)
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py 2022-03-08 18:23:26.576204010 +0100
+@@ -344,7 +344,7 @@ def make_default_value_expr(idl_type, de
+ """
+ assert default_value.is_type_compatible_with(idl_type)
+
+- class DefaultValueExpr:
++ class DefaultValueExpr(object):
+ _ALLOWED_SYMBOLS_IN_DEPS = ("isolate")
+
+ def __init__(self, initializer_expr, initializer_deps,
+@@ -502,7 +502,7 @@ def make_v8_to_blink_value(blink_var_nam
+ assert isinstance(blink_var_name, str)
+ assert isinstance(v8_value_expr, str)
+ assert isinstance(idl_type, web_idl.IdlType)
+- assert (argument_index is None or isinstance(argument_index, (int, long)))
++ assert (argument_index is None or isinstance(argument_index, int))
+ assert (default_value is None
+ or isinstance(default_value, web_idl.LiteralConstant))
+
+@@ -622,7 +622,7 @@ def make_v8_to_blink_value_variadic(blin
+ """
+ assert isinstance(blink_var_name, str)
+ assert isinstance(v8_array, str)
+- assert isinstance(v8_array_start_index, (int, long))
++ assert isinstance(v8_array_start_index, int)
+ assert isinstance(idl_type, web_idl.IdlType)
+
+ pattern = ("auto&& ${{{_1}}} = "
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py 2022-03-08 18:23:26.576204010 +0100
+@@ -177,7 +177,7 @@ def generate_callback_interface(callback
+ prop_install_mode=PropInstallMode.UNCONDITIONAL,
+ trampoline_var_name=None,
+ attribute_entries=[],
+- constant_entries=filter(is_unconditional, constant_entries),
++ constant_entries=list(filter(is_unconditional, constant_entries)),
+ exposed_construct_entries=[],
+ operation_entries=[])
+ (install_interface_template_decl, install_interface_template_def,
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py 2022-03-08 18:23:26.576204010 +0100
+@@ -503,13 +503,13 @@ class CompositeNode(CodeNode):
+ gensym_kwargs = {}
+ template_vars = {}
+ for arg in args:
+- assert isinstance(arg, (CodeNode, int, long, str))
++ assert isinstance(arg, (CodeNode, int, str))
+ gensym = CodeNode.gensym()
+ gensym_args.append("${{{}}}".format(gensym))
+ template_vars[gensym] = arg
+ for key, value in kwargs.items():
+- assert isinstance(key, (int, long, str))
+- assert isinstance(value, (CodeNode, int, long, str))
++ assert isinstance(key, (int, str))
++ assert isinstance(value, (CodeNode, int, str))
+ gensym = CodeNode.gensym()
+ gensym_kwargs[key] = "${{{}}}".format(gensym)
+ template_vars[gensym] = value
+@@ -602,7 +602,7 @@ class ListNode(CodeNode):
+ def insert(self, index, node):
+ if node is None:
+ return
+- assert isinstance(index, (int, long))
++ assert isinstance(index, int)
+ assert isinstance(node, CodeNode)
+ assert node.outer is None and node.prev is None
+
+@@ -721,7 +721,7 @@ class SymbolScopeNode(SequenceNode):
+ if not scope_chains:
+ return counts
+
+- self_index = iter(scope_chains).next().index(self)
++ self_index = next(iter(scope_chains)).index(self)
+ scope_chains = map(
+ lambda scope_chain: scope_chain[self_index + 1:], scope_chains)
+ scope_to_likeliness = {}
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py 2022-03-08 18:23:26.576204010 +0100
+@@ -109,7 +109,7 @@ def expr_and(terms):
+
+ if any(term.is_always_false for term in terms):
+ return _Expr(False)
+- terms = filter(lambda x: not x.is_always_true, terms)
++ terms = list(filter(lambda x: not x.is_always_true, terms))
+ if not terms:
+ return _Expr(True)
+ if len(terms) == 1:
+@@ -124,7 +124,7 @@ def expr_or(terms):
+
+ if any(term.is_always_true for term in terms):
+ return _Expr(True)
+- terms = filter(lambda x: not x.is_always_false, terms)
++ terms = list(filter(lambda x: not x.is_always_false, terms))
+ if not terms:
+ return _Expr(False)
+ if len(terms) == 1:
+@@ -222,7 +222,7 @@ def expr_from_exposure(exposure,
+ elif exposure.only_in_secure_contexts is False:
+ secure_context_term = _Expr(True)
+ else:
+- terms = map(ref_enabled, exposure.only_in_secure_contexts)
++ terms = list(map(ref_enabled, exposure.only_in_secure_contexts))
+ secure_context_term = expr_or(
+ [_Expr("${is_in_secure_context}"),
+ expr_not(expr_and(terms))])
+@@ -275,10 +275,11 @@ def expr_from_exposure(exposure,
+
+ # [ContextEnabled]
+ if exposure.context_enabled_features:
+- terms = map(
+- lambda feature: _Expr(
+- "${{context_feature_settings}}->is{}Enabled()".format(
+- feature)), exposure.context_enabled_features)
++ terms = list(
++ map(
++ lambda feature: _Expr(
++ "${{context_feature_settings}}->is{}Enabled()".format(
++ feature)), exposure.context_enabled_features))
+ context_enabled_terms.append(
+ expr_and([_Expr("${context_feature_settings}"),
+ expr_or(terms)]))
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py 2022-03-08 18:23:26.576204010 +0100
+@@ -23,7 +23,7 @@ class _TemplateFormatter(string.Formatte
+ self._template_formatter_indexing_count_ = 0
+
+ def get_value(self, key, args, kwargs):
+- if isinstance(key, (int, long)):
++ if isinstance(key, int):
+ return args[key]
+ assert isinstance(key, str)
+ if not key:
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py 2022-03-08 18:23:26.576204010 +0100
+@@ -116,4 +116,4 @@ def write_code_node_to_file(code_node, f
+ # stderr=format_result.error_message))
+ #
+ # web_idl.file_io.write_to_file_if_changed(filepath, format_result.contents)
+- web_idl.file_io.write_to_file_if_changed(filepath, rendered_text)
++ web_idl.file_io.write_to_file_if_changed(filepath, rendered_text.encode('utf-8'))
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py 2022-03-08 18:23:26.576204010 +0100
+@@ -993,7 +993,7 @@ def make_dict_trace_func(cg_context):
+ _2 = _blink_member_name(member).value_var
+ return TextNode(_format(pattern, _1=_1, _2=_2))
+
+- body.extend(map(make_trace_member_node, own_members))
++ body.extend(list(map(make_trace_member_node, own_members)))
+ body.append(TextNode("BaseClass::Trace(visitor);"))
+
+ return func_decl, func_def
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py 2022-03-08 18:23:26.579537347 +0100
+@@ -582,7 +582,7 @@ def _make_blink_api_call(code_node,
+ overriding_args=None):
+ assert isinstance(code_node, SymbolScopeNode)
+ assert isinstance(cg_context, CodeGenContext)
+- assert num_of_args is None or isinstance(num_of_args, (int, long))
++ assert num_of_args is None or isinstance(num_of_args, int)
+ assert (overriding_args is None
+ or (isinstance(overriding_args, (list, tuple))
+ and all(isinstance(arg, str) for arg in overriding_args)))
+@@ -1196,8 +1196,10 @@ def make_overload_dispatcher(cg_context)
+ did_use_break = did_use_break or can_fail
+
+ conditional = expr_or(
+- map(lambda item: expr_from_exposure(item.function_like.exposure),
+- items))
++ list(
++ map(
++ lambda item: expr_from_exposure(item.function_like.exposure
++ ), items)))
+ if not conditional.is_always_true:
+ node = CxxUnlikelyIfNode(cond=conditional, body=node)
+
+@@ -4642,7 +4644,7 @@ class _PropEntryConstructorGroup(_PropEn
+ def __init__(self, is_context_dependent, exposure_conditional, world,
+ constructor_group, ctor_callback_name, ctor_func_length):
+ assert isinstance(ctor_callback_name, str)
+- assert isinstance(ctor_func_length, (int, long))
++ assert isinstance(ctor_func_length, int)
+
+ _PropEntryBase.__init__(self, is_context_dependent,
+ exposure_conditional, world, constructor_group)
+@@ -4670,7 +4672,7 @@ class _PropEntryOperationGroup(_PropEntr
+ op_func_length,
+ no_alloc_direct_callback_name=None):
+ assert isinstance(op_callback_name, str)
+- assert isinstance(op_func_length, (int, long))
++ assert isinstance(op_func_length, int)
+
+ _PropEntryBase.__init__(self, is_context_dependent,
+ exposure_conditional, world, operation_group)
+@@ -5175,9 +5177,9 @@ def make_install_interface_template(cg_c
+ ])
+
+ if class_like.identifier == "CSSStyleDeclaration":
+- css_properties = filter(
+- lambda attr: "CSSProperty" in attr.extended_attributes,
+- class_like.attributes)
++ css_properties = list(
++ filter(lambda attr: "CSSProperty" in attr.extended_attributes,
++ class_like.attributes))
+ if css_properties:
+ prop_name_list = "".join(
+ map(lambda attr: "\"{}\", ".format(attr.identifier),
+@@ -5567,8 +5569,8 @@ ${instance_object} = ${v8_context}->Glob
+ "V8DOMConfiguration::InstallConstants(${isolate}, "
+ "${interface_template}, ${prototype_template}, "
+ "kConstantCallbackTable, base::size(kConstantCallbackTable));")
+- constant_callback_entries = filter(lambda entry: entry.const_callback_name,
+- constant_entries)
++ constant_callback_entries = list(filter(lambda entry: entry.const_callback_name,
++ constant_entries))
+ install_properties(table_name, constant_callback_entries,
+ _make_constant_callback_registration_table,
+ installer_call_text)
+@@ -5584,8 +5586,8 @@ ${instance_object} = ${v8_context}->Glob
+ "V8DOMConfiguration::InstallConstants(${isolate}, "
+ "${interface_template}, ${prototype_template}, "
+ "kConstantValueTable, base::size(kConstantValueTable));")
+- constant_value_entries = filter(
+- lambda entry: not entry.const_callback_name, constant_entries)
++ constant_value_entries = list(filter(
++ lambda entry: not entry.const_callback_name, constant_entries))
+ install_properties(table_name, constant_value_entries,
+ _make_constant_value_registration_table,
+ installer_call_text)
+@@ -6336,8 +6338,8 @@ def make_v8_context_snapshot_api(cg_cont
+ assert isinstance(component, web_idl.Component)
+
+ derived_interfaces = cg_context.interface.deriveds
+- derived_names = map(lambda interface: interface.identifier,
+- derived_interfaces)
++ derived_names = list(
++ map(lambda interface: interface.identifier, derived_interfaces))
+ derived_names.append(cg_context.interface.identifier)
+ if not ("Window" in derived_names or "HTMLDocument" in derived_names):
+ return None, None
+@@ -6411,9 +6413,11 @@ def _make_v8_context_snapshot_get_refere
+ collect_callbacks(named_properties_object_callback_defs)
+ collect_callbacks(cross_origin_property_callback_defs)
+
+- entry_nodes = map(
+- lambda name: TextNode("reinterpret_cast<intptr_t>({}),".format(name)),
+- filter(None, callback_names))
++ entry_nodes = list(
++ map(
++ lambda name: TextNode("reinterpret_cast<intptr_t>({}),".format(name
++ )),
++ filter(None, callback_names)))
+ table_node = ListNode([
+ TextNode("using namespace ${class_name}Callbacks;"),
+ TextNode("static const intptr_t kReferenceTable[] = {"),
+@@ -6451,10 +6455,11 @@ def _make_v8_context_snapshot_install_pr
+ class_name=None,
+ prop_install_mode=PropInstallMode.V8_CONTEXT_SNAPSHOT,
+ trampoline_var_name=None,
+- attribute_entries=filter(selector, attribute_entries),
+- constant_entries=filter(selector, constant_entries),
+- exposed_construct_entries=filter(selector, exposed_construct_entries),
+- operation_entries=filter(selector, operation_entries))
++ attribute_entries=list(filter(selector, attribute_entries)),
++ constant_entries=list(filter(selector, constant_entries)),
++ exposed_construct_entries=list(
++ filter(selector, exposed_construct_entries)),
++ operation_entries=list(filter(selector, operation_entries)))
+
+ return func_decl, func_def
+
+@@ -6810,11 +6815,11 @@ def generate_interface(interface_identif
+ class_name=impl_class_name,
+ prop_install_mode=PropInstallMode.UNCONDITIONAL,
+ trampoline_var_name=tp_install_unconditional_props,
+- attribute_entries=filter(is_unconditional, attribute_entries),
+- constant_entries=filter(is_unconditional, constant_entries),
+- exposed_construct_entries=filter(is_unconditional,
+- exposed_construct_entries),
+- operation_entries=filter(is_unconditional, operation_entries))
++ attribute_entries=list(filter(is_unconditional, attribute_entries)),
++ constant_entries=list(filter(is_unconditional, constant_entries)),
++ exposed_construct_entries=list(
++ filter(is_unconditional, exposed_construct_entries)),
++ operation_entries=list(filter(is_unconditional, operation_entries)))
+ (install_context_independent_props_decl,
+ install_context_independent_props_def,
+ install_context_independent_props_trampoline) = make_install_properties(
+@@ -6823,11 +6828,14 @@ def generate_interface(interface_identif
+ class_name=impl_class_name,
+ prop_install_mode=PropInstallMode.CONTEXT_INDEPENDENT,
+ trampoline_var_name=tp_install_context_independent_props,
+- attribute_entries=filter(is_context_independent, attribute_entries),
+- constant_entries=filter(is_context_independent, constant_entries),
+- exposed_construct_entries=filter(is_context_independent,
+- exposed_construct_entries),
+- operation_entries=filter(is_context_independent, operation_entries))
++ attribute_entries=list(
++ filter(is_context_independent, attribute_entries)),
++ constant_entries=list(filter(is_context_independent,
++ constant_entries)),
++ exposed_construct_entries=list(
++ filter(is_context_independent, exposed_construct_entries)),
++ operation_entries=list(
++ filter(is_context_independent, operation_entries)))
+ (install_context_dependent_props_decl, install_context_dependent_props_def,
+ install_context_dependent_props_trampoline) = make_install_properties(
+ cg_context,
+@@ -6835,11 +6843,13 @@ def generate_interface(interface_identif
+ class_name=impl_class_name,
+ prop_install_mode=PropInstallMode.CONTEXT_DEPENDENT,
+ trampoline_var_name=tp_install_context_dependent_props,
+- attribute_entries=filter(is_context_dependent, attribute_entries),
+- constant_entries=filter(is_context_dependent, constant_entries),
+- exposed_construct_entries=filter(is_context_dependent,
+- exposed_construct_entries),
+- operation_entries=filter(is_context_dependent, operation_entries))
++ attribute_entries=list(filter(is_context_dependent,
++ attribute_entries)),
++ constant_entries=list(filter(is_context_dependent, constant_entries)),
++ exposed_construct_entries=list(
++ filter(is_context_dependent, exposed_construct_entries)),
++ operation_entries=list(filter(is_context_dependent,
++ operation_entries)))
+ (install_interface_template_decl, install_interface_template_def,
+ install_interface_template_trampoline) = make_install_interface_template(
+ cg_context,
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py 2022-03-08 18:21:46.709422871 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py 2022-03-08 18:23:26.579537347 +0100
+@@ -105,7 +105,7 @@ class MakoRenderer(object):
+ on_error = self._caller_stack_on_error
+ if (len(current) <= len(on_error)
+ and all(current[i] == on_error[i]
+- for i in xrange(len(current)))):
++ for i in range(len(current)))):
+ pass # Error happened in a deeper caller.
+ else:
+ self._caller_stack_on_error = list(self._caller_stack)
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py 2022-03-08 18:23:26.579537347 +0100
+@@ -70,8 +70,13 @@ def gn_format(contents, filename=None):
+
+
+ def _invoke_format_command(command_line, filename, contents):
+- proc = subprocess.Popen(
+- command_line, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
++ kwargs = {}
++ if sys.version_info.major != 2:
++ kwargs['encoding'] = 'utf-8'
++ proc = subprocess.Popen(command_line,
++ stdin=subprocess.PIPE,
++ stdout=subprocess.PIPE,
++ **kwargs)
+ stdout_output, stderr_output = proc.communicate(input=contents)
+ exit_code = proc.wait()
+
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py 2022-03-08 18:23:26.579537347 +0100
+@@ -2,6 +2,7 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
++import functools
+ import multiprocessing
+
+ from .package_initializer import package_initializer
+@@ -76,7 +77,7 @@ class TaskQueue(object):
+ if not report_progress:
+ return
+
+- done_count = reduce(
++ done_count = functools.reduce(
+ lambda count, worker_task: count + bool(worker_task.ready()),
+ self._worker_tasks, 0)
+ report_progress(len(self._worker_tasks), done_count)
+@@ -85,4 +86,4 @@ class TaskQueue(object):
+ def _task_queue_run_tasks(tasks):
+ for task in tasks:
+ func, args, kwargs = task
+- apply(func, args, kwargs)
++ func(*args, **kwargs)
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py 2022-03-08 18:23:26.579537347 +0100
+@@ -13,6 +13,7 @@ import re
+ import sys
+
+ from idl_types import set_ancestors, IdlType
++from itertools import groupby
+ from v8_globals import includes
+ from v8_interface import constant_filters
+ from v8_types import set_component_dirs
+@@ -43,6 +44,7 @@ TEMPLATES_DIR = os.path.normpath(
+ # after path[0] == invoking script dir
+ sys.path.insert(1, THIRD_PARTY_DIR)
+ import jinja2
++from jinja2.filters import make_attrgetter, environmentfilter
+
+
+ def generate_indented_conditional(code, conditional):
+@@ -88,6 +90,13 @@ def runtime_enabled_if(code, name):
+ return generate_indented_conditional(code, function)
+
+
++@environmentfilter
++def do_stringify_key_group_by(environment, value, attribute):
++ expr = make_attrgetter(environment, attribute)
++ key = lambda item: '' if expr(item) is None else str(expr(item))
++ return groupby(sorted(value, key=key), expr)
++
++
+ def initialize_jinja_env(cache_dir):
+ jinja_env = jinja2.Environment(
+ loader=jinja2.FileSystemLoader(TEMPLATES_DIR),
+@@ -117,6 +126,7 @@ def initialize_jinja_env(cache_dir):
+ })
+ jinja_env.filters.update(constant_filters())
+ jinja_env.filters.update(method_filters())
++ jinja_env.filters["stringifykeygroupby"] = do_stringify_key_group_by
+ return jinja_env
+
+
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py 2022-03-08 18:23:26.579537347 +0100
+@@ -80,7 +80,7 @@ def read_idl_file(reader, idl_filename):
+ assert len(interfaces) == 1, (
+ "Expected one interface in file %r, found %d" %
+ (idl_filename, len(interfaces)))
+- return (interfaces.values()[0], includes)
++ return (list(interfaces.values())[0], includes)
+
+
+ def interface_is_global(interface):
+@@ -281,7 +281,7 @@ def main():
+
+ info_provider = create_component_info_provider(
+ os.path.normpath(options.info_dir), options.target_component)
+- idl_filenames = map(str.strip, open(options.idl_files_list))
++ idl_filenames = list(map(str.strip, open(options.idl_files_list)))
+
+ generate_origin_trial_features(info_provider, options, idl_filenames)
+ return 0
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py 2022-03-08 18:23:26.582870685 +0100
+@@ -394,7 +394,8 @@ class IdlInterface(object):
+ else:
+ raise ValueError('Unrecognized node class: %s' % child_class)
+
+- if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1:
++ if len(list(filter(None,
++ [self.iterable, self.maplike, self.setlike]))) > 1:
+ raise ValueError(
+ 'Interface can only have one of iterable<>, maplike<> and setlike<>.'
+ )
+@@ -512,6 +513,9 @@ class IdlAttribute(TypedObject):
+ def accept(self, visitor):
+ visitor.visit_attribute(self)
+
++ def __lt__(self, other):
++ return self.name < other.name
++
+
+ ################################################################################
+ # Constants
+@@ -852,7 +856,7 @@ class IdlIncludes(object):
+ ################################################################################
+
+
+-class Exposure:
++class Exposure(object):
+ """An Exposure holds one Exposed or RuntimeEnabled condition.
+ Each exposure has two properties: exposed and runtime_enabled.
+ Exposure(e, r) corresponds to [Exposed(e r)]. Exposure(e) corresponds to
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py 2022-03-08 18:23:26.582870685 +0100
+@@ -55,8 +55,8 @@ def validate_blink_idl_definitions(idl_f
+ definitions. There is no filename convention in this case.
+ - Otherwise, an IDL file is invalid.
+ """
+- targets = (
+- definitions.interfaces.values() + definitions.dictionaries.values())
++ targets = (list(definitions.interfaces.values()) +
++ list(definitions.dictionaries.values()))
+ number_of_targets = len(targets)
+ if number_of_targets > 1:
+ raise Exception(
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py 2022-03-08 18:23:26.582870685 +0100
+@@ -349,7 +349,7 @@ class IdlUnionType(IdlTypeBase):
+ return True
+
+ def single_matching_member_type(self, predicate):
+- matching_types = filter(predicate, self.flattened_member_types)
++ matching_types = list(filter(predicate, self.flattened_member_types))
+ if len(matching_types) > 1:
+ raise ValueError('%s is ambiguous.' % self.name)
+ return matching_types[0] if matching_types else None
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py 2022-03-08 18:23:26.582870685 +0100
+@@ -196,8 +196,9 @@ class ComponentInfoProviderModules(Compo
+
+ @property
+ def callback_functions(self):
+- return dict(self._component_info_core['callback_functions'].items() +
+- self._component_info_modules['callback_functions'].items())
++ return dict(
++ list(self._component_info_core['callback_functions'].items()) +
++ list(self._component_info_modules['callback_functions'].items()))
+
+ @property
+ def specifier_for_export(self):
+@@ -209,8 +210,8 @@ class ComponentInfoProviderModules(Compo
+
+
+ def load_interfaces_info_overall_pickle(info_dir):
+- with open(os.path.join(info_dir,
+- 'interfaces_info.pickle')) as interface_info_file:
++ with open(os.path.join(info_dir, 'interfaces_info.pickle'),
++ mode='rb') as interface_info_file:
+ return pickle.load(interface_info_file)
+
+
+@@ -236,23 +237,20 @@ def merge_dict_recursively(target, diff)
+
+ def create_component_info_provider_core(info_dir):
+ interfaces_info = load_interfaces_info_overall_pickle(info_dir)
+- with open(
+- os.path.join(info_dir, 'core',
+- 'component_info_core.pickle')) as component_info_file:
++ with open(os.path.join(info_dir, 'core', 'component_info_core.pickle'),
++ mode='rb') as component_info_file:
+ component_info = pickle.load(component_info_file)
+ return ComponentInfoProviderCore(interfaces_info, component_info)
+
+
+ def create_component_info_provider_modules(info_dir):
+ interfaces_info = load_interfaces_info_overall_pickle(info_dir)
+- with open(
+- os.path.join(info_dir, 'core',
+- 'component_info_core.pickle')) as component_info_file:
++ with open(os.path.join(info_dir, 'core', 'component_info_core.pickle'),
++ mode='rb') as component_info_file:
+ component_info_core = pickle.load(component_info_file)
+- with open(
+- os.path.join(
+- info_dir, 'modules',
+- 'component_info_modules.pickle')) as component_info_file:
++ with open(os.path.join(info_dir, 'modules',
++ 'component_info_modules.pickle'),
++ mode='rb') as component_info_file:
+ component_info_modules = pickle.load(component_info_file)
+ return ComponentInfoProviderModules(interfaces_info, component_info_core,
+ component_info_modules)
+@@ -356,7 +354,7 @@ def write_pickle_file(pickle_filename, d
+ pickle_filename = abs(pickle_filename)
+ # If |data| is same with the file content, we skip updating.
+ if os.path.isfile(pickle_filename):
+- with open(pickle_filename) as pickle_file:
++ with open(pickle_filename, 'rb') as pickle_file:
+ try:
+ if pickle.load(pickle_file) == data:
+ return
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py 2022-03-08 18:23:26.582870685 +0100
+@@ -189,7 +189,7 @@ def context_enabled_features(attributes)
+ return sorted([
+ member for member in members
+ if member.get(KEY) and not member.get('exposed_test')
+- ])
++ ], key=lambda item: item['name'])
+
+ def member_filter_by_name(members, name):
+ return [member for member in members if member[KEY] == name]
+@@ -612,7 +612,8 @@ def interface_context(interface, interfa
+ sorted(
+ origin_trial_features(interface, context['constants'],
+ context['attributes'], context['methods']) +
+- context_enabled_features(context['attributes'])),
++ context_enabled_features(context['attributes']),
++ key=lambda item: item['name']),
+ })
+ if context['optional_features']:
+ includes.add('platform/bindings/v8_per_context_data.h')
+@@ -1356,9 +1357,9 @@ def resolution_tests_methods(effective_o
+
+ # Extract argument and IDL type to simplify accessing these in each loop.
+ arguments = [method['arguments'][index] for method in methods]
+- arguments_methods = zip(arguments, methods)
++ arguments_methods = list(zip(arguments, methods))
+ idl_types = [argument['idl_type_object'] for argument in arguments]
+- idl_types_methods = zip(idl_types, methods)
++ idl_types_methods = list(zip(idl_types, methods))
+
+ # We can’t do a single loop through all methods or simply sort them, because
+ # a method may be listed in multiple steps of the resolution algorithm, and
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py 2022-03-08 18:23:26.582870685 +0100
+@@ -46,6 +46,10 @@ import v8_types
+ import v8_utilities
+ from v8_utilities import (has_extended_attribute_value, is_unforgeable)
+
++# TODO: Remove this once Python2 is obsoleted.
++if sys.version_info.major != 2:
++ basestring = str
++
+
+ def method_is_visible(method, interface_is_partial):
+ if 'overloads' in method:
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py 2022-03-08 18:23:26.582870685 +0100
+@@ -271,7 +271,7 @@ EXPOSED_WORKERS = set([
+ ])
+
+
+-class ExposureSet:
++class ExposureSet(object):
+ """An ExposureSet is a collection of Exposure instructions."""
+
+ def __init__(self, exposures=None):
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py 2022-03-08 18:21:46.712756208 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py 2022-03-08 18:23:26.582870685 +0100
+@@ -91,11 +91,13 @@ class CallbackInterface(UserDefinedType,
+ for operation_ir in ir.operations
+ ])
+ self._operation_groups = tuple([
+- OperationGroup(
+- operation_group_ir,
+- filter(lambda x: x.identifier == operation_group_ir.identifier,
+- self._operations),
+- owner=self) for operation_group_ir in ir.operation_groups
++ OperationGroup(operation_group_ir,
++ list(
++ filter(
++ lambda x: x.identifier == operation_group_ir
++ .identifier, self._operations)),
++ owner=self)
++ for operation_group_ir in ir.operation_groups
+ ])
+
+ @property
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py 2022-03-08 18:23:26.582870685 +0100
+@@ -156,4 +156,4 @@ class Database(object):
+ return self._view_by_kind(Database._Kind.UNION)
+
+ def _view_by_kind(self, kind):
+- return self._impl.find_by_kind(kind).values()
++ return list(self._impl.find_by_kind(kind).values())
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py 2022-03-08 18:23:26.582870685 +0100
+@@ -8,8 +8,11 @@ from .runtime_enabled_features import Ru
+ class _Feature(str):
+ """Represents a runtime-enabled feature."""
+
++ def __new__(cls, value):
++ return str.__new__(cls, value)
++
+ def __init__(self, value):
+- str.__init__(self, value)
++ str.__init__(self)
+ self._is_context_dependent = (
+ RuntimeEnabledFeatures.is_context_dependent(self))
+
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py 2022-03-08 18:23:26.586204022 +0100
+@@ -71,8 +71,9 @@ class FunctionLike(WithIdentifier):
+ def num_of_required_arguments(self):
+ """Returns the number of required arguments."""
+ return len(
+- filter(lambda arg: not (arg.is_optional or arg.is_variadic),
+- self.arguments))
++ list(
++ filter(lambda arg: not (arg.is_optional or arg.is_variadic),
++ self.arguments)))
+
+
+ class OverloadGroup(WithIdentifier):
+@@ -171,8 +172,7 @@ class OverloadGroup(WithIdentifier):
+ Returns the effective overload set.
+ https://heycam.github.io/webidl/#compute-the-effective-overload-set
+ """
+- assert argument_count is None or isinstance(argument_count,
+- (int, long))
++ assert argument_count is None or isinstance(argument_count, int)
+
+ N = argument_count
+ S = []
+@@ -188,21 +188,21 @@ class OverloadGroup(WithIdentifier):
+
+ S.append(
+ OverloadGroup.EffectiveOverloadItem(
+- X, map(lambda arg: arg.idl_type, X.arguments),
+- map(lambda arg: arg.optionality, X.arguments)))
++ X, list(map(lambda arg: arg.idl_type, X.arguments)),
++ list(map(lambda arg: arg.optionality, X.arguments))))
+
+ if X.is_variadic:
+- for i in xrange(n, max(maxarg, N)):
+- t = map(lambda arg: arg.idl_type, X.arguments)
+- o = map(lambda arg: arg.optionality, X.arguments)
+- for _ in xrange(n, i + 1):
++ for i in range(n, max(maxarg, N)):
++ t = list(map(lambda arg: arg.idl_type, X.arguments))
++ o = list(map(lambda arg: arg.optionality, X.arguments))
++ for _ in range(n, i + 1):
+ t.append(X.arguments[-1].idl_type)
+ o.append(X.arguments[-1].optionality)
+ S.append(OverloadGroup.EffectiveOverloadItem(X, t, o))
+
+- t = map(lambda arg: arg.idl_type, X.arguments)
+- o = map(lambda arg: arg.optionality, X.arguments)
+- for i in xrange(n - 1, -1, -1):
++ t = list(map(lambda arg: arg.idl_type, X.arguments))
++ o = list(map(lambda arg: arg.optionality, X.arguments))
++ for i in range(n - 1, -1, -1):
+ if X.arguments[i].optionality == IdlType.Optionality.REQUIRED:
+ break
+ S.append(OverloadGroup.EffectiveOverloadItem(X, t[:i], o[:i]))
+@@ -222,7 +222,7 @@ class OverloadGroup(WithIdentifier):
+ for item in items)
+ assert len(items) > 1
+
+- for index in xrange(len(items[0].type_list)):
++ for index in range(len(items[0].type_list)):
+ # Assume that the given items are valid, and we only need to test
+ # the two types.
+ if OverloadGroup.are_distinguishable_types(
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py 2022-03-08 18:23:26.586204022 +0100
+@@ -149,8 +149,8 @@ class IdlCompiler(object):
+ for old_ir in old_irs:
+ new_ir = make_copy(old_ir)
+ self._ir_map.add(new_ir)
+- new_ir.attributes = filter(not_disabled, new_ir.attributes)
+- new_ir.operations = filter(not_disabled, new_ir.operations)
++ new_ir.attributes = list(filter(not_disabled, new_ir.attributes))
++ new_ir.operations = list(filter(not_disabled, new_ir.operations))
+
+ def _record_defined_in_partial_and_mixin(self):
+ old_irs = self._ir_map.irs_of_kinds(
+@@ -231,7 +231,7 @@ class IdlCompiler(object):
+ only_to_members_of_partial_or_mixin=False)
+ propagate_to_exposure(propagate)
+
+- map(process_member_like, ir.iter_all_members())
++ list(map(process_member_like, ir.iter_all_members()))
+
+ def process_member_like(ir):
+ propagate = functools.partial(propagate_extattr, ir=ir)
+@@ -257,7 +257,7 @@ class IdlCompiler(object):
+
+ self._ir_map.move_to_new_phase()
+
+- map(process_interface_like, old_irs)
++ list(map(process_interface_like, old_irs))
+
+ def _determine_blink_headers(self):
+ irs = self._ir_map.irs_of_kinds(
+@@ -422,9 +422,9 @@ class IdlCompiler(object):
+ assert not new_interface.deriveds
+ derived_set = identifier_to_derived_set.get(
+ new_interface.identifier, set())
+- new_interface.deriveds = map(
+- lambda id_: self._ref_to_idl_def_factory.create(id_),
+- sorted(derived_set))
++ new_interface.deriveds = list(
++ map(lambda id_: self._ref_to_idl_def_factory.create(id_),
++ sorted(derived_set)))
+
+ def _supplement_missing_html_constructor_operation(self):
+ # Temporary mitigation of misuse of [HTMLConstructor]
+@@ -553,7 +553,8 @@ class IdlCompiler(object):
+ self._ir_map.add(new_ir)
+
+ for group in new_ir.iter_all_overload_groups():
+- exposures = map(lambda overload: overload.exposure, group)
++ exposures = list(map(lambda overload: overload.exposure,
++ group))
+
+ # [Exposed]
+ if any(not exposure.global_names_and_features
+@@ -653,8 +654,8 @@ class IdlCompiler(object):
+ constructs = set()
+ for global_name in global_names:
+ constructs.update(exposed_map.get(global_name, []))
+- new_ir.exposed_constructs = map(
+- self._ref_to_idl_def_factory.create, sorted(constructs))
++ new_ir.exposed_constructs = list(
++ map(self._ref_to_idl_def_factory.create, sorted(constructs)))
+
+ assert not new_ir.legacy_window_aliases
+ if new_ir.identifier != 'Window':
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py 2022-03-08 18:23:26.586204022 +0100
+@@ -180,8 +180,9 @@ class Interface(UserDefinedType, WithExt
+ self._constructor_groups = tuple([
+ ConstructorGroup(
+ group_ir,
+- filter(lambda x: x.identifier == group_ir.identifier,
+- self._constructors),
++ list(
++ filter(lambda x: x.identifier == group_ir.identifier,
++ self._constructors)),
+ owner=self) for group_ir in ir.constructor_groups
+ ])
+ assert len(self._constructor_groups) <= 1
+@@ -192,8 +193,9 @@ class Interface(UserDefinedType, WithExt
+ self._named_constructor_groups = tuple([
+ ConstructorGroup(
+ group_ir,
+- filter(lambda x: x.identifier == group_ir.identifier,
+- self._named_constructors),
++ list(
++ filter(lambda x: x.identifier == group_ir.identifier,
++ self._named_constructors)),
+ owner=self) for group_ir in ir.named_constructor_groups
+ ])
+ self._operations = tuple([
+@@ -203,22 +205,23 @@ class Interface(UserDefinedType, WithExt
+ self._operation_groups = tuple([
+ OperationGroup(
+ group_ir,
+- filter(lambda x: x.identifier == group_ir.identifier,
+- self._operations),
++ list(
++ filter(lambda x: x.identifier == group_ir.identifier,
++ self._operations)),
+ owner=self) for group_ir in ir.operation_groups
+ ])
+ self._exposed_constructs = tuple(ir.exposed_constructs)
+ self._legacy_window_aliases = tuple(ir.legacy_window_aliases)
+ self._indexed_and_named_properties = None
+- indexed_and_named_property_operations = filter(
+- lambda x: x.is_indexed_or_named_property_operation,
+- self._operations)
++ indexed_and_named_property_operations = list(
++ filter(lambda x: x.is_indexed_or_named_property_operation,
++ self._operations))
+ if indexed_and_named_property_operations:
+ self._indexed_and_named_properties = IndexedAndNamedProperties(
+ indexed_and_named_property_operations, owner=self)
+ self._stringifier = None
+- stringifier_operation_irs = filter(lambda x: x.is_stringifier,
+- ir.operations)
++ stringifier_operation_irs = list(
++ filter(lambda x: x.is_stringifier, ir.operations))
+ if stringifier_operation_irs:
+ assert len(stringifier_operation_irs) == 1
+ op_ir = make_copy(stringifier_operation_irs[0])
+@@ -231,8 +234,9 @@ class Interface(UserDefinedType, WithExt
+ attribute = None
+ if operation.stringifier_attribute:
+ attr_id = operation.stringifier_attribute
+- attributes = filter(lambda x: x.identifier == attr_id,
+- self._attributes)
++ attributes = list(
++ filter(lambda x: x.identifier == attr_id,
++ self._attributes))
+ assert len(attributes) == 1
+ attribute = attributes[0]
+ self._stringifier = Stringifier(operation, attribute, owner=self)
+@@ -578,8 +582,9 @@ class Iterable(WithDebugInfo):
+ self._operation_groups = tuple([
+ OperationGroup(
+ group_ir,
+- filter(lambda x: x.identifier == group_ir.identifier,
+- self._operations),
++ list(
++ filter(lambda x: x.identifier == group_ir.identifier,
++ self._operations)),
+ owner=owner) for group_ir in ir.operation_groups
+ ])
+
+@@ -666,8 +671,9 @@ class Maplike(WithDebugInfo):
+ self._operation_groups = tuple([
+ OperationGroup(
+ group_ir,
+- filter(lambda x: x.identifier == group_ir.identifier,
+- self._operations),
++ list(
++ filter(lambda x: x.identifier == group_ir.identifier,
++ self._operations)),
+ owner=owner) for group_ir in ir.operation_groups
+ ])
+
+@@ -755,8 +761,9 @@ class Setlike(WithDebugInfo):
+ self._operation_groups = tuple([
+ OperationGroup(
+ group_ir,
+- filter(lambda x: x.identifier == group_ir.identifier,
+- self._operations),
++ list(
++ filter(lambda x: x.identifier == group_ir.identifier,
++ self._operations)),
+ owner=owner) for group_ir in ir.operation_groups
+ ])
+
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py 2022-03-08 18:23:26.586204022 +0100
+@@ -2,6 +2,8 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
++import sys
++
+ from .argument import Argument
+ from .ast_group import AstGroup
+ from .attribute import Attribute
+@@ -30,6 +32,11 @@ from .operation import Operation
+ from .typedef import Typedef
+
+
++# TODO: Remove this once Python2 is obsoleted.
++if sys.version_info.major != 2:
++ long = int
++
++
+ def load_and_register_idl_definitions(filepaths, register_ir,
+ create_ref_to_idl_def, idl_type_factory):
+ """
+@@ -160,7 +167,7 @@ class _IRBuilder(object):
+ child_nodes = list(node.GetChildren())
+ extended_attributes = self._take_extended_attributes(child_nodes)
+
+- members = map(self._build_interface_member, child_nodes)
++ members = list(map(self._build_interface_member, child_nodes))
+ attributes = []
+ constants = []
+ operations = []
+@@ -302,7 +309,7 @@ class _IRBuilder(object):
+ child_nodes = list(node.GetChildren())
+ inherited = self._take_inheritance(child_nodes)
+ extended_attributes = self._take_extended_attributes(child_nodes)
+- own_members = map(self._build_dictionary_member, child_nodes)
++ own_members = list(map(self._build_dictionary_member, child_nodes))
+
+ return Dictionary.IR(
+ identifier=Identifier(node.GetName()),
+@@ -336,7 +343,7 @@ class _IRBuilder(object):
+
+ child_nodes = list(node.GetChildren())
+ extended_attributes = self._take_extended_attributes(child_nodes)
+- members = map(self._build_interface_member, child_nodes)
++ members = list(map(self._build_interface_member, child_nodes))
+ constants = []
+ operations = []
+ for member in members:
+@@ -456,8 +463,8 @@ class _IRBuilder(object):
+ assert len(child_nodes) == 1
+ child = child_nodes[0]
+ if child.GetClass() == 'Arguments':
+- arguments = map(build_extattr_argument,
+- child.GetChildren())
++ arguments = list(
++ map(build_extattr_argument, child.GetChildren()))
+ elif child.GetClass() == 'Call':
+ assert len(child.GetChildren()) == 1
+ grand_child = child.GetChildren()[0]
+@@ -486,7 +493,9 @@ class _IRBuilder(object):
+
+ assert node.GetClass() == 'ExtAttributes'
+ return ExtendedAttributes(
+- filter(None, map(build_extended_attribute, node.GetChildren())))
++ list(
++ filter(None, map(build_extended_attribute,
++ node.GetChildren()))))
+
+ def _build_inheritance(self, node):
+ assert node.GetClass() == 'Inherit'
+@@ -506,7 +515,7 @@ class _IRBuilder(object):
+
+ def _build_iterable(self, node):
+ assert node.GetClass() == 'Iterable'
+- types = map(self._build_type, node.GetChildren())
++ types = list(map(self._build_type, node.GetChildren()))
+ assert len(types) == 1 or len(types) == 2
+ if len(types) == 1: # value iterator
+ key_type, value_type = (None, types[0])
+@@ -584,7 +593,7 @@ class _IRBuilder(object):
+ def _build_maplike(self, node, interface_identifier):
+ assert node.GetClass() == 'Maplike'
+ assert isinstance(interface_identifier, Identifier)
+- types = map(self._build_type, node.GetChildren())
++ types = list(map(self._build_type, node.GetChildren()))
+ assert len(types) == 2
+ key_type, value_type = types
+ is_readonly = bool(node.GetProperty('READONLY'))
+@@ -676,7 +685,7 @@ class _IRBuilder(object):
+ def _build_setlike(self, node, interface_identifier):
+ assert node.GetClass() == 'Setlike'
+ assert isinstance(interface_identifier, Identifier)
+- types = map(self._build_type, node.GetChildren())
++ types = list(map(self._build_type, node.GetChildren()))
+ assert len(types) == 1
+ value_type = types[0]
+ is_readonly = bool(node.GetProperty('READONLY'))
+@@ -838,7 +847,7 @@ class _IRBuilder(object):
+
+ def build_union_type(node, extended_attributes):
+ return self._idl_type_factory.union_type(
+- member_types=map(self._build_type, node.GetChildren()),
++ member_types=list(map(self._build_type, node.GetChildren())),
+ is_optional=is_optional,
+ extended_attributes=extended_attributes,
+ debug_info=self._build_debug_info(node))
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py 2022-03-08 18:23:26.586204022 +0100
+@@ -3,6 +3,13 @@
+ # found in the LICENSE file.
+
+
++import sys
++
++# TODO: Remove this once Python2 is obsoleted.
++if sys.version_info.major != 2:
++ long = int
++ basestring = str
++
+ def make_copy(obj, memo=None):
+ """
+ Creates a copy of the given object, which should be an IR or part of IR.
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py 2022-03-08 18:23:26.586204022 +0100
+@@ -107,11 +107,13 @@ class Namespace(UserDefinedType, WithExt
+ for operation_ir in ir.operations
+ ])
+ self._operation_groups = tuple([
+- OperationGroup(
+- operation_group_ir,
+- filter(lambda x: x.identifier == operation_group_ir.identifier,
+- self._operations),
+- owner=self) for operation_group_ir in ir.operation_groups
++ OperationGroup(operation_group_ir,
++ list(
++ filter(
++ lambda x: x.identifier == operation_group_ir
++ .identifier, self._operations)),
++ owner=self)
++ for operation_group_ir in ir.operation_groups
+ ])
+
+ @property
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl a/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl
+--- b/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl 2022-03-08 18:21:46.716089544 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl 2022-03-08 18:23:26.586204022 +0100
+@@ -59,9 +59,9 @@ void {{v8_class}}::ToImpl(v8::Isolate* i
+ DCHECK(executionContext);
+ {% endif %}{# has_origin_trial_members #}
+ {% endif %}{# members #}
+- {% for origin_trial_test, origin_trial_member_list in members | groupby('origin_trial_feature_name') %}
++ {% for origin_trial_test, origin_trial_member_list in members | stringifykeygroupby('origin_trial_feature_name') %}
+ {% filter origin_trial_enabled(origin_trial_test, "executionContext") %}
+- {% for feature_name, member_list in origin_trial_member_list | groupby('runtime_enabled_feature_name') %}
++ {% for feature_name, member_list in origin_trial_member_list | stringifykeygroupby('runtime_enabled_feature_name') %}
+ {% filter runtime_enabled(feature_name) %}
+ {% for member in member_list %}
+ v8::Local<v8::Value> {{member.v8_value}};
+@@ -147,9 +147,9 @@ bool toV8{{cpp_class}}(const {{cpp_class
+ DCHECK(executionContext);
+ {% endif %}{# has_origin_trial_members #}
+ {% endif %}{# members #}
+- {% for origin_trial_test, origin_trial_member_list in members | groupby('origin_trial_feature_name') %}
++ {% for origin_trial_test, origin_trial_member_list in members | stringifykeygroupby('origin_trial_feature_name') %}
+ {% filter origin_trial_enabled(origin_trial_test, "executionContext") %}
+- {% for feature_name, member_list in origin_trial_member_list | groupby('runtime_enabled_feature_name') %}
++ {% for feature_name, member_list in origin_trial_member_list | stringifykeygroupby('runtime_enabled_feature_name') %}
+ {% filter runtime_enabled(feature_name) %}
+ {% for member in member_list %}
+ v8::Local<v8::Value> {{member.v8_value}};
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py 2022-03-08 18:21:46.719422881 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py 2022-03-08 18:23:26.586204022 +0100
+@@ -71,7 +71,7 @@ class Expansion(object):
+ def enabled_longhands(self):
+ include = lambda longhand: not longhand[
+ 'runtime_flag'] or self.is_enabled(longhand['runtime_flag'])
+- return filter(include, self._longhands)
++ return list(filter(include, self._longhands))
+
+ @property
+ def index(self):
+@@ -87,8 +87,9 @@ class Expansion(object):
+
+ def create_expansions(longhands):
+ flags = collect_runtime_flags(longhands)
+- expansions = map(lambda mask: Expansion(longhands, flags, mask),
+- range(1 << len(flags)))
++ expansions = list(
++ map(lambda mask: Expansion(longhands, flags, mask),
++ range(1 << len(flags))))
+ assert len(expansions) > 0
+ # We generate 2^N expansions for N flags, so enforce some limit.
+ assert len(flags) <= 4, 'Too many runtime flags for a single shorthand'
+@@ -114,14 +115,14 @@ class StylePropertyShorthandWriter(json5
+
+ self._longhand_dictionary = defaultdict(list)
+ for property_ in json5_properties.shorthands:
+- property_['longhand_enum_keys'] = map(enum_key_for_css_property,
+- property_['longhands'])
+- property_['longhand_property_ids'] = map(id_for_css_property,
+- property_['longhands'])
+-
+- longhands = map(
+- lambda name: json5_properties.properties_by_name[name],
+- property_['longhands'])
++ property_['longhand_enum_keys'] = list(
++ map(enum_key_for_css_property, property_['longhands']))
++ property_['longhand_property_ids'] = list(
++ map(id_for_css_property, property_['longhands']))
++
++ longhands = list(
++ map(lambda name: json5_properties.properties_by_name[name],
++ property_['longhands']))
+ property_['expansions'] = create_expansions(longhands)
+ for longhand_enum_key in property_['longhand_enum_keys']:
+ self._longhand_dictionary[longhand_enum_key].append(property_)
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py 2022-03-08 18:21:46.719422881 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py 2022-03-08 18:23:26.586204022 +0100
+@@ -42,8 +42,8 @@ class CSSPropertyInstancesWriter(json5_g
+ aliases = self._css_properties.aliases
+
+ # Lists of PropertyClassData.
+- self._property_classes_by_id = map(self.get_class, properties)
+- self._alias_classes_by_id = map(self.get_class, aliases)
++ self._property_classes_by_id = list(map(self.get_class, properties))
++ self._alias_classes_by_id = list(map(self.get_class, aliases))
+
+ # Sort by enum value.
+ self._property_classes_by_id.sort(key=lambda t: t.enum_value)
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py 2022-03-08 18:21:46.722756218 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py 2022-03-08 18:23:26.586204022 +0100
+@@ -95,7 +95,7 @@ def main():
+
+ open(args.output_file, 'wb').write(
+ generate_gperf(gperf_path,
+- open(infile).read(), gperf_args))
++ open(infile).read(), gperf_args).encode('utf-8'))
+
+
+ if __name__ == '__main__':
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py 2022-03-08 18:21:46.722756218 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py 2022-03-08 18:23:26.586204022 +0100
+@@ -66,7 +66,7 @@ class InFile(object):
+ self._defaults = defaults
+ self._valid_values = copy.deepcopy(
+ valid_values if valid_values else {})
+- self._parse(map(str.strip, lines))
++ self._parse(list(map(str.strip, lines)))
+
+ @classmethod
+ def load_from_files(self, file_paths, defaults, valid_values,
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py 2022-03-08 18:21:46.722756218 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py 2022-03-08 18:23:26.589537360 +0100
+@@ -32,10 +32,15 @@ import os
+ import os.path
+ import shlex
+ import shutil
++import sys
+ import optparse
+
+ from in_file import InFile
+
++# TODO: Remove this once Python2 is obsoleted.
++if sys.version_info.major != 2:
++ basestring = str
++
+
+ #########################################################
+ # This is now deprecated - use json5_generator.py instead
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py 2022-03-08 18:21:46.722756218 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py 2022-03-08 18:23:26.589537360 +0100
+@@ -138,7 +138,7 @@ class RuntimeFeatureWriter(BaseRuntimeFe
+ except Exception:
+ # If trouble unpickling, overwrite
+ pass
+- with open(os.path.abspath(file_name), 'w') as pickle_file:
++ with open(os.path.abspath(file_name), 'wb') as pickle_file:
+ pickle.dump(features_map, pickle_file)
+
+ def _template_inputs(self):
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl 2022-03-08 18:21:46.722756218 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl 2022-03-08 18:23:26.589537360 +0100
+@@ -26,7 +26,7 @@ using {{namespace}}FunctionMap = HashMap
+
+ static {{namespace}}FunctionMap* g_{{namespace|lower}}_constructors = nullptr;
+
+-{% for tag in tags|sort if not tag.noConstructor %}
++{% for tag in tags|sort(attribute='name') if not tag.noConstructor %}
+ static {{namespace}}Element* {{namespace}}{{tag.name.to_upper_camel_case()}}Constructor(
+ Document& document, const CreateElementFlags flags) {
+ {% if tag.runtimeEnabled %}
+@@ -52,7 +52,7 @@ static void Create{{namespace}}FunctionM
+ // Empty array initializer lists are illegal [dcl.init.aggr] and will not
+ // compile in MSVC. If tags list is empty, add check to skip this.
+ static const Create{{namespace}}FunctionMapData data[] = {
+- {% for tag in tags|sort if not tag.noConstructor %}
++ {% for tag in tags|sort(attribute='name') if not tag.noConstructor %}
+ { {{cpp_namespace}}::{{tag|symbol}}Tag, {{namespace}}{{tag.name.to_upper_camel_case()}}Constructor },
+ {% endfor %}
+ };
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl 2022-03-08 18:21:46.726089554 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl 2022-03-08 18:23:26.589537360 +0100
+@@ -22,7 +22,7 @@ HTMLTypeMap CreateHTMLTypeMap() {
+ const char* name;
+ HTMLElementType type;
+ } kTags[] = {
+- {% for tag in tags|sort %}
++ {% for tag in tags|sort(attribute='name') %}
+ { "{{tag.name}}", HTMLElementType::k{{tag.js_interface}} },
+ {% endfor %}
+ };
+@@ -42,7 +42,7 @@ HTMLElementType htmlElementTypeForTag(co
+ if (it == html_type_map.end())
+ return HTMLElementType::kHTMLUnknownElement;
+
+- {% for tag in tags|sort %}
++ {% for tag in tags|sort(attribute='name') %}
+ {% if tag.runtimeEnabled %}
+ if (tagName == "{{tag.name}}") {
+ if (!RuntimeEnabledFeatures::{{tag.runtimeEnabled}}Enabled(document->GetExecutionContext())) {
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl 2022-03-08 18:21:46.726089554 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl 2022-03-08 18:23:26.589537360 +0100
+@@ -15,7 +15,7 @@ namespace blink {
+ class Document;
+
+ // Type checking.
+-{% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers %}
++{% for tag in tags|sort(attribute='name') if not tag.multipleTagNames and not tag.noTypeHelpers %}
+ class {{tag.interface}};
+ template <>
+ inline bool IsElementOfType<const {{tag.interface}}>(const Node& node) {
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl 2022-03-08 18:21:46.726089554 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl 2022-03-08 18:23:26.589537360 +0100
+@@ -25,7 +25,7 @@
+
+
+ {% macro trie_leaf(index, object, return_macro, lowercase_data) %}
+-{% set name, value = object.items()[0] %}
++{% set name, value = (object.items()|list)[0] %}
+ {% if name|length %}
+ if (
+ {%- for c in name -%}
+@@ -45,7 +45,7 @@ return {{ return_macro(value) }};
+
+
+ {% macro trie_switch(trie, index, return_macro, lowercase_data) %}
+-{% if trie|length == 1 and trie.values()[0] is string %}
++{% if trie|length == 1 and (trie.values()|list)[0] is string %}
+ {{ trie_leaf(index, trie, return_macro, lowercase_data) -}}
+ {% else %}
+ {% if lowercase_data %}
+diff -upr b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
+--- b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl 2022-03-08 18:21:46.726089554 +0100
++++ a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl 2022-03-08 18:23:26.589537360 +0100
+@@ -24,12 +24,12 @@ namespace {{cpp_namespace}} {
+ {{symbol_export}}extern const WTF::AtomicString& {{namespace_prefix}}NamespaceURI;
+
+ // Tags
+-{% for tag in tags|sort %}
++{% for tag in tags|sort(attribute='name') %}
+ {{symbol_export}}extern const blink::{{namespace}}QualifiedName& {{tag|symbol}}Tag;
+ {% endfor %}
+
+ // Attributes
+-{% for attr in attrs|sort %}
++{% for attr in attrs|sort(attribute='name') %}
+ {{symbol_export}}extern const blink::QualifiedName& {{attr|symbol}}Attr;
+ {% endfor %}
+
+diff -upr b/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py a/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py
+--- b/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py 2022-03-08 18:21:48.266091088 +0100
++++ a/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py 2022-03-08 18:23:26.589537360 +0100
+@@ -201,6 +201,10 @@ def _compute_python_dependencies(root_di
+
+ paths = set()
+ for path in module_paths:
++ # Builtin/namespaced modules may return None for the file path.
++ if not path:
++ continue
++
+ path = os.path.abspath(path)
+
+ if not path.startswith(root_dir):
+diff -upr b/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn a/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn
+--- b/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn 2022-03-08 18:21:48.312757801 +0100
++++ a/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn 2022-03-08 18:23:26.589537360 +0100
+@@ -2,6 +2,8 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
++import("//build/config/python.gni")
++
+ import("//third_party/blink/public/public_features.gni")
+ import("./all_devtools_files.gni")
+ import("./all_devtools_modules.gni")
+diff -upr b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py
+--- b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py 2022-03-08 18:21:50.282759764 +0100
++++ a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py 2022-03-08 18:23:26.589537360 +0100
+@@ -45,7 +45,8 @@ def rollup(input_path, output_path, file
+ ['--format', 'iife', '-n', 'InspectorOverlay'] + ['--input', target] +
+ ['--plugin', rollup_plugin],
+ stdout=subprocess.PIPE,
+- stderr=subprocess.PIPE)
++ stderr=subprocess.PIPE,
++ text=True)
+ out, error = rollup_process.communicate()
+ if not out:
+ raise Exception("rollup failed: " + error)
+diff -upr b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py
+--- b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py 2022-03-08 18:21:50.282759764 +0100
++++ a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py 2022-03-08 18:23:26.589537360 +0100
+@@ -10,7 +10,7 @@ Builds applications in release mode:
+ and the application loader into a single script.
+ """
+
+-from cStringIO import StringIO
++from io import StringIO
+ from os import path
+ from os.path import join
+ import copy
+@@ -145,8 +145,7 @@ class ReleaseBuilder(object):
+ resource_content = read_file(path.join(self.application_dir, resource_name))
+ if not (resource_name.endswith('.html')
+ or resource_name.endswith('md')):
+- resource_content += resource_source_url(resource_name).encode(
+- 'utf-8')
++ resource_content += resource_source_url(resource_name)
+ resource_content = resource_content.replace('\\', '\\\\')
+ resource_content = resource_content.replace('\n', '\\n')
+ resource_content = resource_content.replace('"', '\\"')
+@@ -173,7 +172,9 @@ class ReleaseBuilder(object):
+ def _concatenate_application_script(self, output):
+ output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors())
+ if self.descriptors.extends:
+- output.write('Root.applicationDescriptor.modules.push(...%s);' % json.dumps(self.descriptors.application.values()))
++ output.write(
++ 'Root.applicationDescriptor.modules.push(...%s);' %
++ json.dumps(list(self.descriptors.application.values())))
+ else:
+ output.write('Root.applicationDescriptor = %s;' % self.descriptors.application_json())
+
+diff -upr b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py
+--- b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py 2022-03-08 18:21:50.282759764 +0100
++++ a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py 2022-03-08 18:23:26.589537360 +0100
+@@ -123,7 +123,7 @@ def main(argv):
+
+ try:
+ os.makedirs(path.join(output_directory, 'Images'))
+- except OSError, e:
++ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise e
+
+@@ -147,7 +147,7 @@ def main(argv):
+ shutil.copy(path.join(dirname, filename), path.join(output_directory, 'Images'))
+ add_file_to_grd(doc, path.join('Images', filename))
+
+- with open(parsed_args.output_filename, 'w') as output_file:
++ with open(parsed_args.output_filename, 'wb') as output_file:
+ output_file.write(doc.toxml(encoding='UTF-8'))
+
+
+diff -upr b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py
+--- b/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py 2022-03-08 18:21:50.282759764 +0100
++++ a/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py 2022-03-08 18:23:26.589537360 +0100
+@@ -7,6 +7,8 @@
+ Utilities for the modular DevTools build.
+ """
+
++from __future__ import print_function
++
+ import collections
+ from os import path
+ import os
+@@ -40,7 +42,7 @@ def load_and_parse_json(filename):
+ try:
+ return json.loads(read_file(filename))
+ except:
+- print 'ERROR: Failed to parse %s' % filename
++ print('ERROR: Failed to parse %s' % filename)
+ raise
+
+ class Descriptors:
+@@ -57,7 +59,7 @@ class Descriptors:
+
+ def application_json(self):
+ result = dict()
+- result['modules'] = self.application.values()
++ result['modules'] = list(self.application.values())
+ return json.dumps(result)
+
+ def all_compiled_files(self):
+diff -upr b/src/3rdparty/chromium/third_party/jinja2/tests.py a/src/3rdparty/chromium/third_party/jinja2/tests.py
+--- b/src/3rdparty/chromium/third_party/jinja2/tests.py 2022-03-08 18:21:51.709427852 +0100
++++ a/src/3rdparty/chromium/third_party/jinja2/tests.py 2022-03-08 18:23:26.589537360 +0100
+@@ -10,7 +10,7 @@
+ """
+ import operator
+ import re
+-from collections import Mapping
++from collections.abc import Mapping
+ from jinja2.runtime import Undefined
+ from jinja2._compat import text_type, string_types, integer_types
+ import decimal
+diff -upr b/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py a/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py
+--- b/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py 2022-03-08 18:21:55.126097923 +0100
++++ a/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py 2022-03-08 18:23:26.589537360 +0100
+@@ -48,9 +48,10 @@ def ReadFilteredData(path):
+ data = ukm_model.UKM_XML_TYPE.Parse(ukm_file.read())
+ event_tag = ukm_model._EVENT_TYPE.tag
+ metric_tag = ukm_model._METRIC_TYPE.tag
+- data[event_tag] = filter(ukm_model.IsNotObsolete, data[event_tag])
++ data[event_tag] = list(filter(ukm_model.IsNotObsolete, data[event_tag]))
+ for event in data[event_tag]:
+- event[metric_tag] = filter(ukm_model.IsNotObsolete, event[metric_tag])
++ event[metric_tag] = list(
++ filter(ukm_model.IsNotObsolete, event[metric_tag]))
+ return data
+
+
+diff -upr b/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py a/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py
+--- b/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py 2022-03-08 18:21:55.569431698 +0100
++++ a/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py 2022-03-08 18:23:26.589537360 +0100
+@@ -45,12 +45,15 @@ Example Output: ./ui/ozone/generate_cons
+ } // namespace ui
+ """
+
++try:
++ from StringIO import StringIO # for Python 2
++except ImportError:
++ from io import StringIO # for Python 3
+ import optparse
+ import os
+ import collections
+ import re
+ import sys
+-import string
+
+
+ def GetTypedefName(typename):
+@@ -68,7 +71,7 @@ def GetConstructorName(typename, platfor
+ This is just "Create" + typename + platform.
+ """
+
+- return 'Create' + typename + string.capitalize(platform)
++ return 'Create' + typename + platform.capitalize()
+
+
+ def GenerateConstructorList(out, namespace, export, typenames, platforms,
+@@ -163,12 +166,14 @@ def main(argv):
+ sys.exit(1)
+
+ # Write to standard output or file specified by --output_cc.
+- out_cc = sys.stdout
++ out_cc = getattr(sys.stdout, 'buffer', sys.stdout)
+ if options.output_cc:
+ out_cc = open(options.output_cc, 'wb')
+
+- GenerateConstructorList(out_cc, options.namespace, options.export,
++ out_cc_str = StringIO()
++ GenerateConstructorList(out_cc_str, options.namespace, options.export,
+ typenames, platforms, includes, usings)
++ out_cc.write(out_cc_str.getvalue().encode('utf-8'))
+
+ if options.output_cc:
+ out_cc.close()
+diff -upr b/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py a/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py
+--- b/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py 2022-03-08 18:21:55.569431698 +0100
++++ a/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py 2022-03-08 18:23:26.592870697 +0100
+@@ -49,12 +49,15 @@ Example Output: ./generate_ozone_platfor
+
+ """
+
++try:
++ from StringIO import StringIO # for Python 2
++except ImportError:
++ from io import StringIO # for Python 3
+ import optparse
+ import os
+ import collections
+ import re
+ import sys
+-import string
+
+
+ def GetConstantName(name):
+@@ -63,7 +66,7 @@ def GetConstantName(name):
+ We just capitalize the platform name and prepend "CreateOzonePlatform".
+ """
+
+- return 'kPlatform' + string.capitalize(name)
++ return 'kPlatform' + name.capitalize()
+
+
+ def GeneratePlatformListText(out, platforms):
+@@ -149,9 +152,9 @@ def main(argv):
+ platforms.insert(0, options.default)
+
+ # Write to standard output or file specified by --output_{cc,h}.
+- out_cc = sys.stdout
+- out_h = sys.stdout
+- out_txt = sys.stdout
++ out_cc = getattr(sys.stdout, 'buffer', sys.stdout)
++ out_h = getattr(sys.stdout, 'buffer', sys.stdout)
++ out_txt = getattr(sys.stdout, 'buffer', sys.stdout)
+ if options.output_cc:
+ out_cc = open(options.output_cc, 'wb')
+ if options.output_h:
+@@ -159,9 +162,16 @@ def main(argv):
+ if options.output_txt:
+ out_txt = open(options.output_txt, 'wb')
+
+- GeneratePlatformListText(out_txt, platforms)
+- GeneratePlatformListHeader(out_h, platforms)
+- GeneratePlatformListSource(out_cc, platforms)
++ out_txt_str = StringIO()
++ out_h_str = StringIO()
++ out_cc_str = StringIO()
++
++ GeneratePlatformListText(out_txt_str, platforms)
++ out_txt.write(out_txt_str.getvalue().encode('utf-8'))
++ GeneratePlatformListHeader(out_h_str, platforms)
++ out_h.write(out_h_str.getvalue().encode('utf-8'))
++ GeneratePlatformListSource(out_cc_str, platforms)
++ out_cc.write(out_cc_str.getvalue().encode('utf-8'))
+
+ if options.output_cc:
+ out_cc.close()
diff --git a/repo/qt5-qtwebengine/qt-musl-crashpad.patch b/repo/qt5-qtwebengine/qt-musl-crashpad.patch
new file mode 100644
index 0000000..0dd9789
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-crashpad.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h
+index 5b55c24..08cec52 100644
+--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h
++++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h
+@@ -273,7 +273,7 @@ union FloatContext {
+ "Size mismatch");
+ #elif defined(ARCH_CPU_ARMEL)
+ static_assert(sizeof(f32_t::fpregs) == sizeof(user_fpregs), "Size mismatch");
+-#if !defined(__GLIBC__)
++#if defined(OS_ANDROID)
+ static_assert(sizeof(f32_t::vfp) == sizeof(user_vfp), "Size mismatch");
+ #endif
+ #elif defined(ARCH_CPU_ARM64)
diff --git a/repo/qt5-qtwebengine/qt-musl-dispatch_to_musl.patch b/repo/qt5-qtwebengine/qt-musl-dispatch_to_musl.patch
new file mode 100644
index 0000000..a58a688
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-dispatch_to_musl.patch
@@ -0,0 +1,103 @@
+--- a/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc
++++ b/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc
+@@ -8,6 +8,7 @@
+ #include <dlfcn.h>
+ #include <malloc.h>
+
++#if defined(__GLIBC__)
+ // This translation unit defines a default dispatch for the allocator shim which
+ // routes allocations to libc functions.
+ // The code here is strongly inspired from tcmalloc's libc_override_glibc.h.
+@@ -87,3 +88,92 @@ const AllocatorDispatch AllocatorDispatc
+ nullptr, /* aligned_free_function */
+ nullptr, /* next */
+ };
++
++#else // defined(__GLIBC__)
++
++#include <dlfcn.h>
++
++extern "C" {
++// Declare function pointers to the memory functions
++typedef void* (*t_libc_malloc)(size_t size);
++typedef void* (*t_libc_calloc)(size_t n, size_t size);
++typedef void* (*t_libc_realloc)(void* address, size_t size);
++typedef void* (*t_libc_memalign)(size_t alignment, size_t size);
++typedef void (*t_libc_free)(void* ptr);
++typedef size_t (*t_libc_malloc_usable_size)(void* ptr);
++
++// Static instances of pointers to libc.so dl symbols
++static t_libc_malloc libc_malloc = NULL;
++static t_libc_calloc libc_calloc = NULL;
++static t_libc_realloc libc_realloc = NULL;
++static t_libc_memalign libc_memalign = NULL;
++static t_libc_free libc_free = NULL;
++static t_libc_malloc_usable_size libc_malloc_usable_size = NULL;
++
++// resolve the symbols in libc.so
++void musl_libc_memory_init(void)
++{
++ libc_malloc = (t_libc_malloc) dlsym(RTLD_NEXT, "malloc");
++ libc_calloc = (t_libc_calloc) dlsym(RTLD_NEXT, "calloc");
++ libc_realloc = (t_libc_realloc) dlsym(RTLD_NEXT, "realloc");
++ libc_memalign = (t_libc_memalign) dlsym(RTLD_NEXT, "memalign");
++ libc_free = (t_libc_free) dlsym(RTLD_NEXT, "free");
++ libc_malloc_usable_size = (t_libc_malloc_usable_size) dlsym(RTLD_NEXT, "malloc_usable_size");
++}
++} // extern "C"
++
++namespace {
++
++using base::allocator::AllocatorDispatch;
++
++void* MuslMalloc(const AllocatorDispatch*, size_t size, void* context) {
++ if (!libc_malloc)
++ musl_libc_memory_init();
++ return (*libc_malloc)(size);
++}
++
++void* MuslCalloc(const AllocatorDispatch*, size_t n, size_t size, void* context) {
++ if (!libc_calloc)
++ musl_libc_memory_init();
++ return (*libc_calloc)(n, size);
++}
++
++void* MuslRealloc(const AllocatorDispatch*, void* address, size_t size, void* context) {
++ if (!libc_realloc)
++ musl_libc_memory_init();
++ return (*libc_realloc)(address, size);
++}
++
++void* MuslMemalign(const AllocatorDispatch*, size_t alignment, size_t size, void* context) {
++ if (!libc_memalign)
++ musl_libc_memory_init();
++ return (*libc_memalign)(alignment, size);
++}
++
++void MuslFree(const AllocatorDispatch*, void* address, void* context) {
++ if (!libc_free)
++ musl_libc_memory_init();
++ (*libc_free)(address);
++}
++
++size_t MuslGetSizeEstimate(const AllocatorDispatch*, void* address, void* context) {
++ // TODO(siggi, primiano): malloc_usable_size may need redirection in the
++ // presence of interposing shims that divert allocations.
++ if (!libc_malloc_usable_size)
++ musl_libc_memory_init();
++ return (*libc_malloc_usable_size)(address);
++}
++
++} // namespace
++
++const AllocatorDispatch AllocatorDispatch::default_dispatch = {
++ &MuslMalloc, /* alloc_function */
++ &MuslCalloc, /* alloc_zero_initialized_function */
++ &MuslMemalign, /* alloc_aligned_function */
++ &MuslRealloc, /* realloc_function */
++ &MuslFree, /* free_function */
++ &MuslGetSizeEstimate, /* get_size_estimate_function */
++ nullptr, /* next */
++};
++
++#endif
diff --git a/repo/qt5-qtwebengine/qt-musl-elf-arm.patch b/repo/qt5-qtwebengine/qt-musl-elf-arm.patch
new file mode 100644
index 0000000..9253c41
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-elf-arm.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/chromium/v8/src/base/cpu.cc b/src/3rdparty/chromium/v8/src/base/cpu.cc
+index f1c48fa13..ba8389c8c 100644
+--- a/src/3rdparty/chromium/v8/src/base/cpu.cc
++++ b/src/3rdparty/chromium/v8/src/base/cpu.cc
+@@ -20,7 +20,7 @@
+ #if V8_OS_QNX
+ #include <sys/syspage.h> // cpuinfo
+ #endif
+-#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64)
++#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64 || V8_HOST_ARCH_ARM)
+ #include <elf.h>
+ #endif
+ #if V8_OS_AIX
diff --git a/repo/qt5-qtwebengine/qt-musl-execinfo.patch b/repo/qt5-qtwebengine/qt-musl-execinfo.patch
new file mode 100644
index 0000000..01a5c94
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-execinfo.patch
@@ -0,0 +1,108 @@
+diff --git a/src/3rdparty/chromium/base/debug/stack_trace.cc b/src/3rdparty/chromium/base/debug/stack_trace.cc
+index d8ca822d9..f6f3d9c69 100644
+--- a/src/3rdparty/chromium/base/debug/stack_trace.cc
++++ b/src/3rdparty/chromium/base/debug/stack_trace.cc
+@@ -225,14 +225,14 @@ std::string StackTrace::ToString() const {
+ }
+ std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) & !defined(_AIX)
++#if defined(__GLIBC__) & !defined(_AIX)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
+diff --git a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
+index f4ddf9c1e..aef993613 100644
+--- a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
++++ b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
+@@ -27,7 +27,7 @@
+ #if !defined(USE_SYMBOLIZE)
+ #include <cxxabi.h>
+ #endif
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ #include <execinfo.h>
+ #endif
+
+@@ -88,7 +88,7 @@ void DemangleSymbols(std::string* text) {
+ // Note: code in this function is NOT async-signal safe (std::string uses
+ // malloc internally).
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ std::string::size_type search_from = 0;
+ while (search_from < text->size()) {
+ // Look for the start of a mangled symbol, from search_from.
+@@ -123,7 +123,7 @@ void DemangleSymbols(std::string* text) {
+ search_from = mangled_start + 2;
+ }
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(_AIX)
+ }
+ #endif // !defined(USE_SYMBOLIZE)
+
+@@ -135,7 +135,7 @@ class BacktraceOutputHandler {
+ virtual ~BacktraceOutputHandler() = default;
+ };
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
+ // This should be more than enough to store a 64-bit number in hex:
+ // 16 hex digits + 1 for null-terminator.
+@@ -218,7 +218,7 @@ void ProcessBacktrace(void* const* trace,
+ }
+ #endif // defined(USE_SYMBOLIZE)
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(_AIX)
+
+ void PrintToStderr(const char* output) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+@@ -834,7 +834,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ // Though the backtrace API man page does not list any possible negative
+ // return values, we take no chance.
+ return base::saturated_cast<size_t>(backtrace(trace, count));
+@@ -847,13 +847,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ PrintBacktraceOutputHandler handler;
+ ProcessBacktrace(trace_, count_, prefix_string, &handler);
+ #endif
+ }
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+ void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
+ const char* prefix_string) const {
+ StreamBacktraceOutputHandler handler(os);
+diff --git a/src/3rdparty/chromium/base/logging.cc b/src/3rdparty/chromium/base/logging.cc
+index 4c4bfa6af..0ca5c2159 100644
+--- a/src/3rdparty/chromium/base/logging.cc
++++ b/src/3rdparty/chromium/base/logging.cc
+@@ -548,7 +548,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+
+ LogMessage::~LogMessage() {
+ size_t stack_start = stream_.tellp();
+-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \
++#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(__GLIBC__) && \
+ !defined(OS_AIX)
+ if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+ // Include a stack trace on a fatal, unless a debugger is attached.
diff --git a/repo/qt5-qtwebengine/qt-musl-mallinfo.patch b/repo/qt5-qtwebengine/qt-musl-mallinfo.patch
new file mode 100644
index 0000000..c7b7f27
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-mallinfo.patch
@@ -0,0 +1,43 @@
+diff --git a/src/3rdparty/chromium/base/process/process_metrics_posix.cc b/src/3rdparty/chromium/base/process/process_metrics_posix.cc
+index 9d12c427b..9030de9f6 100644
+--- a/src/3rdparty/chromium/base/process/process_metrics_posix.cc
++++ b/src/3rdparty/chromium/base/process/process_metrics_posix.cc
+@@ -119,14 +119,14 @@ size_t ProcessMetrics::GetMallocUsage() {
+ malloc_statistics_t stats = {0};
+ malloc_zone_statistics(nullptr, &stats);
+ return stats.size_in_use;
+-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
+ struct mallinfo minfo = mallinfo();
+ #if BUILDFLAG(USE_TCMALLOC)
+ return minfo.uordblks;
+ #else
+ return minfo.hblkhd + minfo.arena;
+ #endif
+-#elif defined(OS_FUCHSIA)
++#else //if defined(OS_FUCHSIA) // also musl doesn't do this.
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
+diff --git a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
+index c327f4865..2717eca5a 100644
+--- a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
++++ b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
+@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+ }
+ #elif defined(OS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(__GLIBC__)
+ struct mallinfo info = mallinfo();
+ // In case of Android's jemalloc |arena| is 0 and the outer pages size is
+ // reported by |hblkhd|. In case of dlmalloc the total is given by
+@@ -142,6 +142,8 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+
+ // Total allocated space is given by |uordblks|.
+ allocated_objects_size = info.uordblks;
++#else
++ // musl libc does not support mallinfo()
+ #endif
+
+ MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc");
diff --git a/repo/qt5-qtwebengine/qt-musl-off_t.patch b/repo/qt5-qtwebengine/qt-musl-off_t.patch
new file mode 100644
index 0000000..6b44789
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-off_t.patch
@@ -0,0 +1,10 @@
+--- a/src/3rdparty/chromium/third_party/ots/include/opentype-sanitiser.h
++++ b/src/3rdparty/chromium/third_party/ots/include/opentype-sanitiser.h
+@@ -21,6 +21,7 @@ typedef unsigned __int64 uint64_t;
+ #define ots_htons(x) _byteswap_ushort (x)
+ #else
+ #include <arpa/inet.h>
++#include <sys/types.h>
+ #include <stdint.h>
+ #define ots_ntohl(x) ntohl (x)
+ #define ots_ntohs(x) ntohs (x)
diff --git a/repo/qt5-qtwebengine/qt-musl-pread-pwrite.patch b/repo/qt5-qtwebengine/qt-musl-pread-pwrite.patch
new file mode 100644
index 0000000..623f609
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-pread-pwrite.patch
@@ -0,0 +1,20 @@
+diff --git a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+index 5d9c2e8..e81e7b4 100644
+--- a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
++++ b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+@@ -1835,6 +1835,15 @@ struct kernel_statfs {
+ /* End of s390/s390x definitions */
+ #endif
+
++#ifndef __GLIBC__
++ /* For Musl libc pread/pread is the same as pread64/pwrite64 */
++#ifndef __NR_pread
++#define __NR_pread __NR_pread64
++#endif
++#ifndef __NR_pwrite
++#define __NR_pwrite __NR_pwrite64
++#endif
++#endif /* ifndef __GLIBC__ */
+
+ /* After forking, we must make sure to only call system calls. */
+ #if defined(__BOUNDED_POINTERS__)
diff --git a/repo/qt5-qtwebengine/qt-musl-pvalloc.patch b/repo/qt5-qtwebengine/qt-musl-pvalloc.patch
new file mode 100644
index 0000000..d5caf38
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-pvalloc.patch
@@ -0,0 +1,14 @@
+--- qtwebengine/src/core/api/qtbug-61521.cpp 2017-11-29 09:42:29.000000000 +0100
++++ qtwebengine/src/core/api/qtbug-61521.cpp 2018-01-28 06:49:29.454175725 +0100
+@@ -111,7 +111,11 @@
+ }
+
+ SHIM_HIDDEN void* ShimPvalloc(size_t size) {
++#if defined(__GLIBC__)
+ return pvalloc(size);
++#else
++ return valloc((size+4095)&~4095);
++#endif
+ }
+
+ SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) {
diff --git a/repo/qt5-qtwebengine/qt-musl-resolve.patch b/repo/qt5-qtwebengine/qt-musl-resolve.patch
new file mode 100644
index 0000000..386062e
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-resolve.patch
@@ -0,0 +1,61 @@
+--- a/src/3rdparty/chromium/net/dns/dns_reloader.cc
++++ b/src/3rdparty/chromium/net/dns/dns_reloader.cc
+@@ -9,6 +9,10 @@
+
+ #include <resolv.h>
+
++#if !defined(__GLIBC__)
++#include "resolv_compat.h"
++#endif
++
+ #include "base/lazy_instance.h"
+ #include "base/macros.h"
+ #include "base/notreached.h"
+--- a/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc
++++ b/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc
+@@ -8,6 +8,10 @@
+ #include <string>
+ #include <type_traits>
+
++#if !defined(__GLIBC__)
++#include "resolv_compat.h"
++#endif
++
+ #include "base/bind.h"
+ #include "base/files/file.h"
+ #include "base/files/file_path.h"
+diff --git a/src/3rdparty/chromium/net/dns/resolv_compat.h b/src/3rdparty/chromium/net/dns/resolv_compat.h
+new file mode 100644
+index 0000000..4f0e852
+--- /dev/null
++++ b/src/3rdparty/chromium/net/dns/resolv_compat.h
+@@ -0,0 +1,29 @@
++#if !defined(__GLIBC__)
++/***************************************************************************
++ * resolv_compat.h
++ *
++ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc
++ * Note: res_init() is actually deprecated according to
++ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html
++ **************************************************************************/
++#include <string.h>
++
++static inline int res_ninit(res_state statp)
++{
++ int rc = res_init();
++ if (statp != &_res) {
++ memcpy(statp, &_res, sizeof(*statp));
++ }
++ return rc;
++}
++
++static inline int res_nclose(res_state statp)
++{
++ if (!statp)
++ return -1;
++ if (statp != &_res) {
++ memset(statp, 0, sizeof(*statp));
++ }
++ return 0;
++}
++#endif
diff --git a/repo/qt5-qtwebengine/qt-musl-siginfo_t.patch b/repo/qt5-qtwebengine/qt-musl-siginfo_t.patch
new file mode 100644
index 0000000..b071563
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-siginfo_t.patch
@@ -0,0 +1,18 @@
+There's a subtle difference in the internal name of siginfo_t fields
+between glibc and musl. The structure itself is equivalent, so it
+should suffice to add a macro to rename the field.
+
+--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc
++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc
+@@ -25,6 +25,11 @@
+ #include "sandbox/linux/system_headers/linux_seccomp.h"
+ #include "sandbox/linux/system_headers/linux_signal.h"
+
++// musl libc defines siginfo_t __si_fields instead of _sifields
++#if !defined(__GLIBC__)
++#define _sifields __si_fields
++#endif
++
+ namespace {
+
+ struct arch_sigsys {
diff --git a/repo/qt5-qtwebengine/qt-musl-stackstart.patch b/repo/qt5-qtwebengine/qt-musl-stackstart.patch
new file mode 100644
index 0000000..2214af4
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-stackstart.patch
@@ -0,0 +1,22 @@
+diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc
+index 1aaaa1c60..f49152fa6 100644
+--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc
++++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc
+@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
+ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
+ // correctly for the main thread.
+
+-#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ // pthread_getattr_np() can fail if the thread is not invoked by
+ // pthread_create() (e.g., the main thread of blink_unittests).
+@@ -97,7 +97,7 @@ return Threading::ThreadStackSize();
+ }
+
+ void* GetStackStart() {
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ pthread_attr_t attr;
+ int error;
diff --git a/repo/qt5-qtwebengine/qt-musl-sysreg-for__WORDSIZE.patch b/repo/qt5-qtwebengine/qt-musl-sysreg-for__WORDSIZE.patch
new file mode 100644
index 0000000..de9377e
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-sysreg-for__WORDSIZE.patch
@@ -0,0 +1,14 @@
+diff --git a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+index d03c7a8..d43fda0 100644
+--- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
++++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+@@ -37,6 +37,9 @@
+ #include <limits.h>
+ #include <link.h>
+ #include <stddef.h>
++#ifndef __GLIBC__
++#include <sys/reg.h>
++#endif
+
+ #include "common/memory_range.h"
+
diff --git a/repo/qt5-qtwebengine/qt-musl-thread-stacksize.patch b/repo/qt5-qtwebengine/qt-musl-thread-stacksize.patch
new file mode 100644
index 0000000..80c3d34
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-thread-stacksize.patch
@@ -0,0 +1,26 @@
+diff --git a/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc b/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc
+index 02bf49b..05ee182 100644
+--- a/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc
++++ b/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc
+@@ -13,7 +13,7 @@ namespace pp {
+ namespace {
+
+ // Use 2MB default stack size for Native Client, otherwise use system default.
+-#if defined(__native_client__)
++#if defined(__native_client__) || !defined(__GLIBC__)
+ const size_t kDefaultStackSize = 2 * 1024 * 1024;
+ #else
+ const size_t kDefaultStackSize = 0;
+diff --git a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
+index cf7f3ec..e06a5ce 100644
+--- a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
++++ b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
+@@ -854,7 +854,7 @@ void Thread::Start() {
+ #if V8_OS_MACOSX
+ // Default on Mac OS X is 512kB -- bump up to 1MB
+ stack_size = 1 * 1024 * 1024;
+-#elif V8_OS_AIX
++#elif V8_OS_AIX || !defined(__GLIBC__)
+ // Default on AIX is 96kB -- bump up to 2MB
+ stack_size = 2 * 1024 * 1024;
+ #endif
diff --git a/repo/qt5-qtwebengine/qt-musl-tid-caching.patch b/repo/qt5-qtwebengine/qt-musl-tid-caching.patch
new file mode 100644
index 0000000..acbee25
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt-musl-tid-caching.patch
@@ -0,0 +1,81 @@
+--- ./src/3rdparty/chromium/sandbox/linux/services/namespace_sandbox.cc.orig
++++ ./src/3rdparty/chromium/sandbox/linux/services/namespace_sandbox.cc
+@@ -209,6 +209,70 @@
+ return base::LaunchProcess(argv, launch_options_copy);
+ }
+
++#if defined(__aarch64__) || defined(__arm__)
++#define TLS_ABOVE_TP
++#endif
++
++struct musl_pthread
++{
++ /* Part 1 -- these fields may be external or
++ * internal (accessed via asm) ABI. Do not change. */
++ struct pthread *self;
++#ifndef TLS_ABOVE_TP
++ uintptr_t *dtv;
++#endif
++ struct pthread *prev, *next; /* non-ABI */
++ uintptr_t sysinfo;
++#ifndef TLS_ABOVE_TP
++#ifdef CANARY_PAD
++ uintptr_t canary_pad;
++#endif
++ uintptr_t canary;
++#endif
++
++/* Part 2 -- implementation details, non-ABI. */
++ int tid;
++ int errno_val;
++ volatile int detach_state;
++ volatile int cancel;
++ volatile unsigned char canceldisable, cancelasync;
++ unsigned char tsd_used:1;
++ unsigned char dlerror_flag:1;
++ unsigned char *map_base;
++ size_t map_size;
++ void *stack;
++ size_t stack_size;
++ size_t guard_size;
++ void *result;
++ struct __ptcb *cancelbuf;
++ void **tsd;
++ struct {
++ volatile void *volatile head;
++ long off;
++ volatile void *volatile pending;
++ } robust_list;
++ int h_errno_val;
++ volatile int timer_id;
++ locale_t locale;
++ volatile int killlock[1];
++ char *dlerror_buf;
++ void *stdio_locks;
++
++ /* Part 3 -- the positions of these fields relative to
++ * the end of the structure is external and internal ABI. */
++#ifdef TLS_ABOVE_TP
++ uintptr_t canary;
++ uintptr_t *dtv;
++#endif
++};
++
++void MaybeUpdateMuslTidCache()
++{
++ pid_t real_tid = sys_gettid();
++ pid_t* cached_tid_location = &reinterpret_cast<struct musl_pthread*>(pthread_self())->tid;
++ *cached_tid_location = real_tid;
++}
++
+ // static
+ pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) {
+ const pid_t pid =
+@@ -226,6 +290,7 @@
+ #if defined(LIBC_GLIBC)
+ MaybeUpdateGlibcTidCache();
+ #endif
++ MaybeUpdateMuslTidCache();
+ return 0;
+ }
+
diff --git a/repo/qt5-qtwebengine/qt5-qtwebengine.xibuild b/repo/qt5-qtwebengine/qt5-qtwebengine.xibuild
new file mode 100644
index 0000000..833a12f
--- /dev/null
+++ b/repo/qt5-qtwebengine/qt5-qtwebengine.xibuild
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+NAME="qt5-qtwebengine"
+DESC="Qt5 - QtWebEngine components"
+
+MAKEDEPS="ffmpeg glib gst-plugins-base gstreamer icu libxcomposite libxext libxkbcommon libxkbfile libxrender libxslt mesa ninja alsa-lib bison musl-legacy-compat flex fontconfig gperf gzip harfbuzz jsoncpp libevent libjpeg-turbo libpng libsrtp libvpx libwebp libxcursor libxi libxml2 libxrandr libxslt libxtst linux-headers nodejs nss opus pcre protobuf pulseaudio sndio qt5-qtbase qt5-qtdeclarative qt5-qtwebchannel re2 ruby snappy sqlite3 yasm zlib python"
+
+PKG_VER=5.15.3_git20220407
+_commit="56260bb605a74fabdfc74cef3bf890394af88b3d"
+_chromium_commit="d13d0924c4e18ecc4b79adf0fec142ee9a9eaa14"
+# commit of catapult version with python3 support
+_catapult_commit="5eedfe23148a234211ba477f76fc2ea2e8529189"
+SOURCE="https://invent.kde.org/qt/qt/qtwebengine/-/archive/$_commit.tar.gz"
+
+ADDITIONAL="
+ https://invent.kde.org/qt/qt/qtwebengine-chromium/-/archive/$_chromium_commit.tar.gz
+ https://dev.alpinelinux.org/archive/qt5-qtwebengine/catapult-$_catapult_commit.tar.gz
+0001-pretend-to-stay-at-5.15.3.patch
+0010-chromium-musl-Match-syscalls-to-match-musl.patch
+default-pthread-stacksize.patch
+ffmpeg5.patch
+fix-chromium-build.patch
+musl-hacks.patch
+musl-sandbox.patch
+nasm.patch
+qt-chromium-python3.patch
+qt-musl-crashpad.patch
+qt-musl-dispatch_to_musl.patch
+qt-musl-elf-arm.patch
+qt-musl-execinfo.patch
+qt-musl-mallinfo.patch
+qt-musl-off_t.patch
+qt-musl-pread-pwrite.patch
+qt-musl-pvalloc.patch
+qt-musl-resolve.patch
+qt-musl-siginfo_t.patch
+qt-musl-stackstart.patch
+qt-musl-sysreg-for__WORDSIZE.patch
+qt-musl-thread-stacksize.patch
+qt-musl-tid-caching.patch
+remove-glibc-check.patch
+sndio.patch
+support-python3.patch
+"
+
+prepare() {
+ tar xf *.tar.gz
+ rmdir "$BUILD_ROOT/src/3rdparty"
+ mv "$BUILD_ROOT/qtwebengine-chromium-$_chromium_commit" "$BUILD_ROOT/src/3rdparty"
+ mkdir "$BUILD_ROOT"/.git "$BUILD_ROOT/src/3rdparty/chromium/.git"
+
+ # update vendored catapult version to python3 compatible version.
+ rm -r "$BUILD_ROOT/src/3rdparty/chromium/third_party/catapult"
+ mv "$BUILD_ROOT"/catapult "$BUILD_ROOT/src/3rdparty/chromium/third_party/catapult"
+
+ apply_patches
+}
+
+build() {
+ qmake-qt5 QMAKE_EXTRA_ARGS+="-webengine-sndio -system-ffmpeg -system-opus -system-webp -proprietary-codecs" CONFIG+=force_debug_info
+ make
+}
+
+package() {
+ make install INSTALL_ROOT="$PKG_DEST"
+ sed -i -e 's:-L/home[^ ]\+::g' "$PKG_DEST"/usr/lib/pkgconfig/*.pc
+
+ # Drop QMAKE_PRL_BUILD_DIR because reference the build dir
+ find "$PKG_DEST/usr/lib" -type f -name '*.prl' \
+ -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
+
+ install -d "$PKG_DEST"/usr/share/licenses
+ ln -s /usr/share/licenses/qt5-base "$PKG_DEST"/usr/share/licenses/qt5-qtwebengine
+}
+
diff --git a/repo/qt5-qtwebengine/remove-glibc-check.patch b/repo/qt5-qtwebengine/remove-glibc-check.patch
new file mode 100644
index 0000000..1d94b6b
--- /dev/null
+++ b/repo/qt5-qtwebengine/remove-glibc-check.patch
@@ -0,0 +1,78 @@
+Qt checks if glibc is available and if not disables large part of Qt5WebEngine and thus cripples functionality.
+However these parts work fine with Musl so there is no need to disable them.
+Just remove the check so it builds again. Since 5.15.1 is the last version of Qt to be released with this build system it'll be obsolete with Qt6 and there is no real point in fixing this upstream.
+
+
+diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
+index e7f869a1..de18523d 100644
+--- a/src/buildtools/config/support.pri
++++ b/src/buildtools/config/support.pri
+@@ -189,15 +189,6 @@ defineTest(qtwebengine_checkForHostPkgCfg) {
+ return(true)
+ }
+
+-defineTest(qtwebengine_checkForGlibc) {
+- module = $$1
+- !qtConfig(webengine-system-glibc) {
+- qtwebengine_skipBuild("A suitable version >= 2.27 of libc required to build $${module} could not be found.")
+- return(false)
+- }
+- return(true)
+-}
+-
+ defineTest(qtwebengine_checkForKhronos) {
+ module = $$1
+ !qtConfig(webengine-system-khr) {
+diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
+index 88d1790c..8623f6d7 100644
+--- a/src/buildtools/configure.json
++++ b/src/buildtools/configure.json
+@@ -264,18 +264,6 @@
+ "label": "system gn",
+ "type": "detectGn"
+ },
+- "webengine-glibc": {
+- "label": "glibc > 2.16",
+- "type": "compile",
+- "test": {
+- "include": "features.h",
+- "tail": [
+- "#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 17",
+- "#error glibc versions below 2.17 are not supported",
+- "#endif"
+- ]
+- }
+- },
+ "webengine-gperf": {
+ "label": "gperf",
+ "type": "detectGperf"
+@@ -379,7 +367,6 @@
+ && (!config.sanitizer || features.webengine-sanitizer)
+ && (!config.linux || features.pkg-config)
+ && (!config.linux || features.webengine-host-pkg-config)
+- && (!config.linux || features.webengine-system-glibc)
+ && (!config.linux || features.webengine-system-khr)
+ && (!config.linux || features.webengine-system-nss)
+ && (!config.linux || features.webengine-system-dbus)
+@@ -517,11 +504,6 @@
+ "condition": "config.unix && !config.darwin && libs.webengine-nss",
+ "output": [ "privateFeature" ]
+ },
+- "webengine-system-glibc": {
+- "label": "glibc",
+- "condition": "config.linux && tests.webengine-glibc",
+- "output": [ "privateFeature" ]
+- },
+ "webengine-system-x11" : {
+ "label": "x11",
+ "condition": "config.unix && libs.webengine-x11",
+@@ -782,8 +764,7 @@
+ "webengine-system-fontconfig",
+ "webengine-system-dbus",
+ "webengine-system-nss",
+- "webengine-system-khr",
+- "webengine-system-glibc"
++ "webengine-system-khr"
+ ]
+ },
+ {
diff --git a/repo/qt5-qtwebengine/sndio.patch b/repo/qt5-qtwebengine/sndio.patch
new file mode 100644
index 0000000..771e630
--- /dev/null
+++ b/repo/qt5-qtwebengine/sndio.patch
@@ -0,0 +1,142 @@
+from void-packages, 0101,0102-sndio.patch
+--- a/src/core/configure.json 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:28:00.591236926 +0200
+@@ -21,6 +21,7 @@
+ "webengine-printing-and-pdf": "boolean",
+ "webengine-proprietary-codecs": "boolean",
+ "webengine-pulseaudio": "boolean",
++ "webengine-sndio": "boolean",
+ "webengine-spellchecker": "boolean",
+ "webengine-native-spellchecker": "boolean",
+ "webengine-extensions": "boolean",
+@@ -31,6 +32,7 @@
+ "webengine-kerberos": "boolean",
+ "alsa": { "type": "boolean", "name": "webengine-alsa" },
+ "pulseaudio": { "type": "boolean", "name": "webengine-pulseaudio" },
++ "sndio": { "type": "boolean", "name": "webengine-sndio" },
+ "ffmpeg": { "type": "enum", "name": "webengine-system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
+ "opus": { "type": "enum", "name": "webengine-system-opus", "values": { "system": "yes", "qt": "no" } },
+ "webp": { "type": "enum", "name": "webengine-system-libwebp", "values": { "system": "yes", "qt": "no" } },
+@@ -68,7 +70,13 @@
+ "sources": [
+ { "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" }
+ ]
+- }
++ },
++ "sndio": {
++ "label": "sndio",
++ "sources": [
++ { "type": "pkgConfig", "args": "libsndio >= 1.5.0 libsndio" }
++ ]
++ }
+ },
+ "tests" : {
+ "webengine-host-compiler": {
+@@ -136,6 +144,10 @@
+ "condition": "libs.webengine-pulseaudio",
+ "output": [ "privateFeature" ]
+ },
++ "webengine-sndio": {
++ "label": "Use sndio",
++ "output": [ "privateFeature" ]
++ },
+ "webengine-pepper-plugins": {
+ "label": "Pepper Plugins",
+ "purpose": "Enables use of Pepper Flash plugins.",
+@@ -308,6 +320,11 @@
+ "condition": "config.unix"
+ },
+ {
++ "type": "feature",
++ "args": "webengine-sndio",
++ "condition": "config.unix"
++ },
++ {
+ "type": "feature",
+ "args": "webengine-sanitizer",
+ "condition": "config.sanitizer"
+--- a/src/3rdparty/chromium/media/audio/linux/audio_manager_linux.cc
++++ b/src/3rdparty/chromium/media/audio/linux/audio_manager_linux.cc
+@@ -20,6 +20,10 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include <sndio.h>
++#include "media/audio/openbsd/audio_manager_openbsd.h"
++#endif
+
+ namespace media {
+
+@@ -27,7 +31,8 @@ enum LinuxAudioIO {
+ kPulse,
+ kAlsa,
+ kCras,
+- kAudioIOMax = kCras // Must always be equal to largest logged entry.
++ kSndio,
++ kAudioIOMax = kSndio // Must always be equal to largest logged entry.
+ };
+
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -41,6 +46,17 @@ std::unique_ptr<media::AudioManager> CreateAudioManager(
+ }
+ #endif
+
++#if defined(USE_SNDIO)
++ struct sio_hdl * hdl = NULL;
++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) {
++ sio_close(hdl);
++ UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1);
++ return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),
++ audio_log_factory);
++ }
++ DVLOG(1) << "Sndio is not available on the OS";
++#endif
++
+ #if defined(USE_PULSEAUDIO)
+ pa_threaded_mainloop* pa_mainloop = nullptr;
+ pa_context* pa_context = nullptr;
+--- a/src/3rdparty/chromium/media/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:32:27.960817513 +0200
+@@ -65,6 +65,9 @@
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ }
+
+ # Internal grouping of the configs necessary to support sub-folders having their
+--- a/src/3rdparty/chromium/media/media_options.gni 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:29:22.958630783 +0200
+@@ -114,6 +114,9 @@
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enables runtime selection of sndio library for audio.
++ use_sndio = false
++
+ # Alsa should be used on non-Android, non-Mac POSIX systems.
+ # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
+ if (is_posix && !is_android && !is_mac &&
+--- a/src/3rdparty/chromium/media/audio/BUILD.gn 2021-02-23 16:36:59.000000000 +0100
++++ - 2021-03-07 22:00:34.889682069 +0100
+@@ -238,6 +238,17 @@
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
+
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "openbsd/audio_manager_openbsd.cc",
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
++
+ if (use_alsa) {
+ libs += [ "asound" ]
+ sources += [
diff --git a/repo/qt5-qtwebengine/support-python3.patch b/repo/qt5-qtwebengine/support-python3.patch
new file mode 100644
index 0000000..cc5e457
--- /dev/null
+++ b/repo/qt5-qtwebengine/support-python3.patch
@@ -0,0 +1,158 @@
+diff -upr a/configure.pri b/configure.pri
+--- a/configure.pri 2022-01-21 11:47:42.000000000 +0100
++++ b/configure.pri 2022-03-08 18:45:03.650823421 +0100
+@@ -7,20 +7,7 @@ QTWEBENGINE_SOURCE_TREE = $$PWD
+ equals(QMAKE_HOST.os, Windows): EXE_SUFFIX = .exe
+
+ defineTest(isPythonVersionSupported) {
+- python = $$system_quote($$system_path($$1))
+- python_version = $$system('$$python -c "import sys; print(sys.version_info[0:3])"')
+- python_version ~= s/[()]//g
+- python_version = $$split(python_version, ',')
+- python_major_version = $$first(python_version)
+- greaterThan(python_major_version, 2) {
+- qtLog("Python version 3 is not supported by Chromium.")
+- return(false)
+- }
+- python_minor_version = $$member(python_version, 1)
+- python_patch_version = $$member(python_version, 2)
+- greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): greaterThan(python_patch_version, 4): return(true)
+- qtLog("Unsupported python version: $${python_major_version}.$${python_minor_version}.$${python_patch_version}.")
+- return(false)
++ return(true)
+ }
+
+ defineTest(qtConfTest_detectJumboBuild) {
+@@ -52,22 +39,22 @@ defineTest(qtConfReport_jumboBuild) {
+ qtConfReportPadded($${1}, $$mergeLimit)
+ }
+
+-defineTest(qtConfTest_detectPython2) {
+- python = $$qtConfFindInPath("python2$$EXE_SUFFIX")
++defineTest(qtConfTest_detectPython) {
++ python = $$qtConfFindInPath("python3$$EXE_SUFFIX")
+ isEmpty(python) {
+- qtLog("'python2$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
++ qtLog("'python3$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
+ python = $$qtConfFindInPath("python$$EXE_SUFFIX")
+ }
+ isEmpty(python) {
+- qtLog("'python$$EXE_SUFFIX' not found in PATH. Giving up.")
++ qtLog("'python3$$EXE_SUFFIX' and 'python$$EXE_SUFFIX' not found in PATH. Giving up.")
+ return(false)
+ }
+ !isPythonVersionSupported($$python) {
+- qtLog("A suitable Python 2 executable could not be located.")
++ qtLog("A suitable Python executable could not be located.")
+ return(false)
+ }
+
+- # Make tests.python2.location available in configure.json.
++ # Make tests.python.location available in configure.json.
+ $${1}.location = $$clean_path($$python)
+ export($${1}.location)
+ $${1}.cache += location
+diff -upr a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
+--- a/mkspecs/features/functions.prf 2022-01-21 11:47:42.000000000 +0100
++++ b/mkspecs/features/functions.prf 2022-03-08 18:45:34.740851611 +0100
+@@ -39,11 +39,11 @@ defineReplace(which) {
+
+ # Returns the unquoted path to the python executable.
+ defineReplace(pythonPath) {
+- isEmpty(QMAKE_PYTHON2) {
++ isEmpty(QMAKE_PYTHON) {
+ # Fallback for building QtWebEngine with Qt < 5.8
+- QMAKE_PYTHON2 = python
++ QMAKE_PYTHON = python3
+ }
+- return($$QMAKE_PYTHON2)
++ return($$QMAKE_PYTHON)
+ }
+
+ # Returns the python executable for use with shell / make targets.
+diff -upr a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
+--- a/src/buildtools/config/support.pri 2022-01-21 11:47:42.000000000 +0100
++++ b/src/buildtools/config/support.pri 2022-03-08 18:44:25.677455634 +0100
+@@ -21,7 +21,7 @@ defineReplace(qtwebengine_checkWebEngine
+ !qtwebengine_checkForGperf(QtWebEngine):return(false)
+ !qtwebengine_checkForBison(QtWebEngine):return(false)
+ !qtwebengine_checkForFlex(QtWebEngine):return(false)
+- !qtwebengine_checkForPython2(QtWebEngine):return(false)
++ !qtwebengine_checkForPython(QtWebEngine):return(false)
+ !qtwebengine_checkForNodejs(QtWebEngine):return(false)
+ !qtwebengine_checkForSanitizer(QtWebEngine):return(false)
+ linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false)
+@@ -51,7 +51,7 @@ defineReplace(qtwebengine_checkPdfError)
+ !qtwebengine_checkForGperf(QtPdf):return(false)
+ !qtwebengine_checkForBison(QtPdf):return(false)
+ !qtwebengine_checkForFlex(QtPdf):return(false)
+- !qtwebengine_checkForPython2(QtPdf):return(false)
++ !qtwebengine_checkForPython(QtPdf):return(false)
+ !qtwebengine_checkForSanitizer(QtPdf):return(false)
+ linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false)
+ linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false)
+@@ -147,10 +147,10 @@ defineTest(qtwebengine_checkForFlex) {
+ return(true)
+ }
+
+-defineTest(qtwebengine_checkForPython2) {
++defineTest(qtwebengine_checkForPython) {
+ module = $$1
+- !qtConfig(webengine-python2) {
+- qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build $${module}.")
++ !qtConfig(webengine-python) {
++ qtwebengine_skipBuild("Python is required to build $${module}.")
+ return(false)
+ }
+ return(true)
+diff -upr a/src/buildtools/configure.json b/src/buildtools/configure.json
+--- a/src/buildtools/configure.json 2022-01-21 11:47:42.000000000 +0100
++++ b/src/buildtools/configure.json 2022-03-08 18:44:25.677455634 +0100
+@@ -295,9 +295,9 @@
+ "label": "system ninja",
+ "type": "detectNinja"
+ },
+- "webengine-python2": {
+- "label": "python2",
+- "type": "detectPython2",
++ "webengine-python": {
++ "label": "python",
++ "type": "detectPython",
+ "log": "location"
+ },
+ "webengine-winversion": {
+@@ -374,7 +374,7 @@
+ && features.webengine-gperf
+ && features.webengine-bison
+ && features.webengine-flex
+- && features.webengine-python2
++ && features.webengine-python
+ && features.webengine-nodejs
+ && (!config.sanitizer || features.webengine-sanitizer)
+ && (!config.linux || features.pkg-config)
+@@ -400,7 +400,7 @@
+ && features.webengine-gperf
+ && features.webengine-bison
+ && features.webengine-flex
+- && features.webengine-python2
++ && features.webengine-python
+ && (!config.sanitizer || features.webengine-sanitizer)
+ && (!config.linux || features.pkg-config)
+ && (!config.linux || features.webengine-host-pkg-config)
+@@ -423,12 +423,12 @@
+ "autoDetect": "features.private_tests",
+ "output": [ "privateFeature" ]
+ },
+- "webengine-python2": {
+- "label": "python2",
+- "condition": "tests.webengine-python2",
++ "webengine-python": {
++ "label": "python",
++ "condition": "tests.webengine-python",
+ "output": [
+ "privateFeature",
+- { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
++ { "type": "varAssign", "name": "QMAKE_PYTHON", "value": "tests.webengine-python.location" }
+ ]
+ },
+ "webengine-gperf": {