diff -Nru webkit2gtk-2.36.4/debian/changelog webkit2gtk-2.36.6/debian/changelog --- webkit2gtk-2.36.4/debian/changelog 2022-08-03 15:27:29.000000000 +0000 +++ webkit2gtk-2.36.6/debian/changelog 2022-08-10 12:56:32.000000000 +0000 @@ -1,8 +1,15 @@ -webkit2gtk (2.36.4-1ubuntu1) kinetic; urgency=medium +webkit2gtk (2.36.6-1) unstable; urgency=high - * Enable wpe now that the MIR has been accepted + * New upstream release. + * The WebKitGTK security advisory WSA-2022-0007 lists the following + security fixes in the latest versions of WebKitGTK: + - CVE identifiers: CVE-2022-32792, CVE-2022-32816 and CVE-2022-2294 + (fixed in 2.36.5). + * debian/rules: + - Enable wpe on Ubuntu now that the MIR has been accepted (thanks, + Sebastien Bacher) (Closes: #1016585). - -- Sebastien Bacher Wed, 03 Aug 2022 17:27:29 +0200 + -- Alberto Garcia Wed, 10 Aug 2022 14:56:32 +0200 webkit2gtk (2.36.4-1) unstable; urgency=high diff -Nru webkit2gtk-2.36.4/debian/control webkit2gtk-2.36.6/debian/control --- webkit2gtk-2.36.4/debian/control 2022-08-03 15:27:29.000000000 +0000 +++ webkit2gtk-2.36.6/debian/control 2022-08-10 12:56:32.000000000 +0000 @@ -1,8 +1,7 @@ Source: webkit2gtk Priority: optional Section: web -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian WebKit Maintainers +Maintainer: Debian WebKit Maintainers Uploaders: Gustavo Noronha Silva , Emilio Pozuelo Monfort , Alberto Garcia diff -Nru webkit2gtk-2.36.4/Documentation/jsc-glib-4.0/html/index.html webkit2gtk-2.36.6/Documentation/jsc-glib-4.0/html/index.html --- webkit2gtk-2.36.4/Documentation/jsc-glib-4.0/html/index.html 2022-07-04 22:52:59.652512300 +0000 +++ webkit2gtk-2.36.6/Documentation/jsc-glib-4.0/html/index.html 2022-08-07 09:51:57.646558300 +0000 @@ -14,7 +14,7 @@
-

for JavaScriptCore 2.36.4

+

for JavaScriptCore 2.36.6


diff -Nru webkit2gtk-2.36.4/Documentation/jsc-glib-4.0/html/jsc-glib-4.0-JSCVersion.html webkit2gtk-2.36.6/Documentation/jsc-glib-4.0/html/jsc-glib-4.0-JSCVersion.html --- webkit2gtk-2.36.4/Documentation/jsc-glib-4.0/html/jsc-glib-4.0-JSCVersion.html 2022-07-04 22:52:59.655845600 +0000 +++ webkit2gtk-2.36.6/Documentation/jsc-glib-4.0/html/jsc-glib-4.0-JSCVersion.html 2022-08-07 09:51:57.649891600 +0000 @@ -175,7 +175,7 @@

JSC_MICRO_VERSION

-
#define JSC_MICRO_VERSION (4)
+
#define JSC_MICRO_VERSION (6)
 
diff -Nru webkit2gtk-2.36.4/Documentation/webkit2gtk-4.0/html/index.html webkit2gtk-2.36.6/Documentation/webkit2gtk-4.0/html/index.html --- webkit2gtk-2.36.4/Documentation/webkit2gtk-4.0/html/index.html 2022-07-04 22:54:14.242668600 +0000 +++ webkit2gtk-2.36.6/Documentation/webkit2gtk-4.0/html/index.html 2022-08-07 09:53:14.159631300 +0000 @@ -14,7 +14,7 @@
-

for WebKitGTK 2.36.4

+

for WebKitGTK 2.36.6


diff -Nru webkit2gtk-2.36.4/Documentation/webkit2gtk-4.0/html/webkit2gtk-4.0-WebKitVersion.html webkit2gtk-2.36.6/Documentation/webkit2gtk-4.0/html/webkit2gtk-4.0-WebKitVersion.html --- webkit2gtk-2.36.4/Documentation/webkit2gtk-4.0/html/webkit2gtk-4.0-WebKitVersion.html 2022-07-04 22:54:14.256002000 +0000 +++ webkit2gtk-2.36.6/Documentation/webkit2gtk-4.0/html/webkit2gtk-4.0-WebKitVersion.html 2022-08-07 09:53:14.172964600 +0000 @@ -213,7 +213,7 @@

WEBKIT_MICRO_VERSION

-
#define WEBKIT_MICRO_VERSION (4)
+
#define WEBKIT_MICRO_VERSION (6)
 

Like webkit_get_micro_version(), but from the headers used at application compile time, rather than from the library linked diff -Nru webkit2gtk-2.36.4/Documentation/webkitdomgtk-4.0/html/index.html webkit2gtk-2.36.6/Documentation/webkitdomgtk-4.0/html/index.html --- webkit2gtk-2.36.4/Documentation/webkitdomgtk-4.0/html/index.html 2022-07-04 22:53:36.835923400 +0000 +++ webkit2gtk-2.36.6/Documentation/webkitdomgtk-4.0/html/index.html 2022-08-07 09:52:36.573092200 +0000 @@ -14,7 +14,7 @@

-

for WebKitDOMGTK+ 2.36.4

+

for WebKitDOMGTK+ 2.36.6


diff -Nru webkit2gtk-2.36.4/NEWS webkit2gtk-2.36.6/NEWS --- webkit2gtk-2.36.4/NEWS 2022-07-04 22:47:34.661839000 +0000 +++ webkit2gtk-2.36.6/NEWS 2022-08-06 22:02:11.018181600 +0000 @@ -1,4 +1,27 @@ ================ +WebKitGTK 2.36.6 +================ + +What's new in WebKitGTK 2.36.6? + + - Fix handling of touchpad scrolling on GTK4 builds. + - Fix WebKitGTK not allowing to be used from non-main threads. + - Fix several crashes and rendering issues. + +================ +WebKitGTK 2.36.5 +================ + +What's new in WebKitGTK 2.36.5? + + - Add support for PAC proxy in the WebDriver implementation. + - Fix video playback when loaded through custom URIs, this fixes video + playback in the Yelp documentation browser. + - Fix WebKitWebView::context-menu when using GTK4. + - Fix LTO builds with GCC. + - Fix several crashes and rendering issues. + +================ WebKitGTK 2.36.4 ================ diff -Nru webkit2gtk-2.36.4/Source/cmake/OptionsGTK.cmake webkit2gtk-2.36.6/Source/cmake/OptionsGTK.cmake --- webkit2gtk-2.36.4/Source/cmake/OptionsGTK.cmake 2022-07-04 15:56:43.777941700 +0000 +++ webkit2gtk-2.36.6/Source/cmake/OptionsGTK.cmake 2022-08-06 21:59:46.101853600 +0000 @@ -3,7 +3,7 @@ WEBKIT_OPTION_BEGIN() -SET_PROJECT_VERSION(2 36 4) +SET_PROJECT_VERSION(2 36 6) set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") @@ -227,11 +227,11 @@ endif () if (WEBKITGTK_API_VERSION VERSION_EQUAL "4.0") - CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 93 8 56) - CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 38 8 20) + CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 93 10 56) + CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 38 10 20) elseif (WEBKITGTK_API_VERSION VERSION_EQUAL "4.1") - CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 1 8 1) - CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 1 8 1) + CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 1 10 1) + CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 1 10 1) elseif (WEBKITGTK_API_VERSION VERSION_EQUAL "5.0") CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 0 0 0) CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 0 0 0) diff -Nru webkit2gtk-2.36.4/Source/JavaScriptCore/b3/B3ReduceStrength.cpp webkit2gtk-2.36.6/Source/JavaScriptCore/b3/B3ReduceStrength.cpp --- webkit2gtk-2.36.4/Source/JavaScriptCore/b3/B3ReduceStrength.cpp 2022-06-30 09:49:25.969520600 +0000 +++ webkit2gtk-2.36.6/Source/JavaScriptCore/b3/B3ReduceStrength.cpp 2022-07-22 09:26:12.100839400 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2020 Apple Inc. All rights reserved. + * Copyright (C) 2015-2022 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -388,6 +388,61 @@ } } + template + IntRange sExt() + { + ASSERT(m_min >= INT32_MIN); + ASSERT(m_max <= INT32_MAX); + int64_t typeMin = std::numeric_limits::min(); + int64_t typeMax = std::numeric_limits::max(); + auto min = m_min; + auto max = m_max; + + if (typeMin <= min && min <= typeMax + && typeMin <= max && max <= typeMax) + return IntRange(min, max); + + // Given type T with N bits, signed extension will turn bit N-1 as + // a sign bit. If bits N-1 upwards are identical for both min and max, + // then we're guaranteed that even after the sign extension, min and + // max will still be in increasing order. + // + // For example, when T is int8_t, the space of numbers from highest to + // lowest are as follows (in binary bits): + // + // highest 0 111 1111 ^ + // ... | + // 1 0 000 0001 | top segment + // 0 0 000 0000 v + // + // -1 1 111 1111 ^ + // -2 1 111 1110 | bottom segment + // ... | + // lowest 1 000 0000 v + // + // Note that if we exclude the sign bit, the range is made up of 2 segments + // of contiguous increasing numbers. If min and max are both in the same + // segment before the sign extension, then min and max will continue to be + // in a contiguous segment after the sign extension. Only when min and max + // spans across more than 1 of these segments, will min and max no longer + // be guaranteed to be in a contiguous range after the sign extension. + // + // Hence, we can check if bits N-1 and up are identical for the range min + // and max. If so, then the new min and max can be be computed by simply + // applying sign extension to their original values. + + constexpr unsigned numberOfBits = countOfBits; + constexpr int64_t segmentMask = (1ll << (numberOfBits - 1)) - 1; + constexpr int64_t topBitsMask = ~segmentMask; + int64_t minTopBits = topBitsMask & min; + int64_t maxTopBits = topBitsMask & max; + + if (minTopBits == maxTopBits) + return IntRange(static_cast(static_cast(min)), static_cast(static_cast(max))); + + return top(); + } + IntRange zExt32() { ASSERT(m_min >= INT32_MIN); @@ -2765,9 +2820,11 @@ rangeFor(value->child(1), timeToLive - 1), value->type()); case SExt8: + return rangeFor(value->child(0), timeToLive - 1).sExt(); case SExt16: + return rangeFor(value->child(0), timeToLive - 1).sExt(); case SExt32: - return rangeFor(value->child(0), timeToLive - 1); + return rangeFor(value->child(0), timeToLive - 1).sExt(); case ZExt32: return rangeFor(value->child(0), timeToLive - 1).zExt32(); diff -Nru webkit2gtk-2.36.4/Source/JavaScriptCore/CMakeLists.txt webkit2gtk-2.36.6/Source/JavaScriptCore/CMakeLists.txt --- webkit2gtk-2.36.4/Source/JavaScriptCore/CMakeLists.txt 2022-06-30 09:49:25.126187800 +0000 +++ webkit2gtk-2.36.6/Source/JavaScriptCore/CMakeLists.txt 2022-07-12 21:53:48.162090300 +0000 @@ -456,7 +456,7 @@ COMMAND ${MASM_EXECUTABLE} ${LLINT_MASM_FLAGS} ${JavaScriptCore_DERIVED_SOURCES_DIR}/LowLevelInterpreterWin.obj ${JavaScriptCore_DERIVED_SOURCES_DIR}/LowLevelInterpreterWin.asm VERBATIM) list(APPEND JavaScriptCore_SOURCES ${JavaScriptCore_DERIVED_SOURCES_DIR}/LowLevelInterpreterWin.obj) - add_library(LowLevelInterpreterLib STATIC llint/LowLevelInterpreter.cpp) + add_library(LowLevelInterpreterLib OBJECT llint/LowLevelInterpreter.cpp) else () # As there's poor toolchain support for using `.file` directives in # inline asm (i.e. there's no way to avoid clashes with the `.file` @@ -465,7 +465,7 @@ # an object file. We only need to do this for LowLevelInterpreter.cpp # and cmake doesn't allow us to introduce a compiler wrapper for a # single source file, so we need to create a separate target for it. - add_library(LowLevelInterpreterLib STATIC llint/LowLevelInterpreter.cpp + add_library(LowLevelInterpreterLib OBJECT llint/LowLevelInterpreter.cpp ${JavaScriptCore_DERIVED_SOURCES_DIR}/${LLIntOutput}) endif () @@ -1496,7 +1496,13 @@ COMPILE_OPTIONS "-fno-lto") endif () -list(APPEND JavaScriptCore_PRIVATE_LIBRARIES LowLevelInterpreterLib) +# When building JavaScriptCore as an object library, we need to make sure the +# lowlevelinterpreter lib objects get propogated. +if (${JavaScriptCore_LIBRARY_TYPE} STREQUAL "OBJECT") + list(APPEND JavaScriptCore_PRIVATE_LIBRARIES $) +else () + list(APPEND JavaScriptCore_SOURCES $) +endif () WEBKIT_COMPUTE_SOURCES(JavaScriptCore) list(APPEND JavaScriptCore_SOURCES diff -Nru webkit2gtk-2.36.4/Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorServer.cpp webkit2gtk-2.36.6/Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorServer.cpp --- webkit2gtk-2.36.4/Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorServer.cpp 2022-06-30 09:49:26.802853300 +0000 +++ webkit2gtk-2.36.6/Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorServer.cpp 2022-07-22 19:24:19.886103000 +0000 @@ -67,6 +67,10 @@ g_variant_lookup(proxy.get(), "type", "&s", &proxyType); capabilities.proxy->type = String::fromUTF8(proxyType); + const char* autoconfigURL; + if (g_variant_lookup(proxy.get(), "autoconfigURL", "&s", &autoconfigURL)) + capabilities.proxy->autoconfigURL = String::fromUTF8(autoconfigURL); + const char* ftpURL; if (g_variant_lookup(proxy.get(), "ftpURL", "&s", &ftpURL)) capabilities.proxy->ftpURL = String::fromUTF8(ftpURL); diff -Nru webkit2gtk-2.36.4/Source/JavaScriptCore/inspector/remote/RemoteInspector.h webkit2gtk-2.36.6/Source/JavaScriptCore/inspector/remote/RemoteInspector.h --- webkit2gtk-2.36.4/Source/JavaScriptCore/inspector/remote/RemoteInspector.h 2022-06-30 09:49:26.799520000 +0000 +++ webkit2gtk-2.36.6/Source/JavaScriptCore/inspector/remote/RemoteInspector.h 2022-07-22 19:24:19.886103000 +0000 @@ -93,6 +93,7 @@ Vector> certificates; struct Proxy { String type; + std::optional autoconfigURL; std::optional ftpURL; std::optional httpURL; std::optional httpsURL; diff -Nru webkit2gtk-2.36.4/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionConstructor.cpp webkit2gtk-2.36.6/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionConstructor.cpp --- webkit2gtk-2.36.4/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionConstructor.cpp 2022-06-30 09:49:27.086186400 +0000 +++ webkit2gtk-2.36.6/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionConstructor.cpp 2022-07-27 22:02:00.752712200 +0000 @@ -63,6 +63,8 @@ MarkedArgumentBuffer values; forEachInIterable(globalObject, tagParameters, [&] (VM&, JSGlobalObject*, JSValue nextValue) { values.append(nextValue); + if (UNLIKELY(values.hasOverflowed())) + throwOutOfMemoryError(globalObject, scope); }); RETURN_IF_EXCEPTION(scope, { }); diff -Nru webkit2gtk-2.36.4/Source/WebCore/dom/ContainerNode.cpp webkit2gtk-2.36.6/Source/WebCore/dom/ContainerNode.cpp --- webkit2gtk-2.36.4/Source/WebCore/dom/ContainerNode.cpp 2022-06-30 09:49:31.992849600 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/dom/ContainerNode.cpp 2022-08-05 12:14:39.259189600 +0000 @@ -330,9 +330,9 @@ auto children = oldParent->removeAllChildrenWithScriptAssertion(ChildChange::Source::Parser); - // FIXME: assert that we don't dispatch events here since this container node is still disconnected. for (auto& child : children) { - RELEASE_ASSERT(!child->parentNode() && &child->treeScope() == &treeScope()); + if (child->parentNode()) // Previous parserAppendChild may have mutated DOM. + continue; ASSERT(!ensurePreInsertionValidity(child, nullptr).hasException()); child->setTreeScopeRecursively(treeScope()); parserAppendChild(child); diff -Nru webkit2gtk-2.36.4/Source/WebCore/html/HTMLInputElement.cpp webkit2gtk-2.36.6/Source/WebCore/html/HTMLInputElement.cpp --- webkit2gtk-2.36.4/Source/WebCore/html/HTMLInputElement.cpp 2022-06-30 09:49:32.732849100 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/html/HTMLInputElement.cpp 2022-08-04 13:39:11.044793800 +0000 @@ -1598,11 +1598,15 @@ void HTMLInputElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree) { + HTMLTextFormControlElement::removedFromAncestor(removalType, oldParentOfRemovedTree); if (removalType.treeScopeChanged && isRadioButton()) oldParentOfRemovedTree.treeScope().radioButtonGroups().removeButton(*this); if (removalType.disconnectedFromDocument && !form()) removeFromRadioButtonGroup(); - HTMLTextFormControlElement::removedFromAncestor(removalType, oldParentOfRemovedTree); + if (removalType.disconnectedFromDocument && m_hasPendingUserAgentShadowTreeUpdate) { + document().removeElementWithPendingUserAgentShadowTreeUpdate(*this); + m_hasPendingUserAgentShadowTreeUpdate = false; + } ASSERT(!isConnected()); if (removalType.disconnectedFromDocument && !form() && isRadioButton()) updateValidity(); diff -Nru webkit2gtk-2.36.4/Source/WebCore/html/HTMLMediaElement.cpp webkit2gtk-2.36.6/Source/WebCore/html/HTMLMediaElement.cpp --- webkit2gtk-2.36.4/Source/WebCore/html/HTMLMediaElement.cpp 2022-07-01 15:01:10.023370000 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/html/HTMLMediaElement.cpp 2022-07-27 18:44:13.067809000 +0000 @@ -1485,6 +1485,11 @@ mediaLoadingFailed(MediaPlayer::NetworkState::FormatError); return; } +#elif USE(GSTREAMER) + if (!url.isEmpty() && !frame->loader().willLoadMediaElementURL(url, *this)) { + mediaLoadingFailed(MediaPlayer::NetworkState::FormatError); + return; + } #endif #if ENABLE(CONTENT_EXTENSIONS) diff -Nru webkit2gtk-2.36.4/Source/WebCore/Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp webkit2gtk-2.36.6/Source/WebCore/Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp --- webkit2gtk-2.36.4/Source/WebCore/Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp 2022-06-30 09:49:31.206183400 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp 2022-07-27 22:16:37.610573300 +0000 @@ -113,7 +113,7 @@ { ASSERT(isMainThread()); - auto data = WebAudioBufferList { audioDescription, static_cast(sampleCount) }; + auto data = WebAudioBufferList { audioDescription, sampleCount }; { Locker locker { m_dataSourceLock }; m_dataSource->pullSamples(*data.list(), sampleCount, time.timeValue(), 0, AudioSampleDataSource::Copy); diff -Nru webkit2gtk-2.36.4/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceCocoa.cpp webkit2gtk-2.36.6/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceCocoa.cpp --- webkit2gtk-2.36.4/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceCocoa.cpp 2022-06-30 09:49:31.249516700 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceCocoa.cpp 2022-07-27 22:16:37.610573300 +0000 @@ -80,7 +80,7 @@ // Heap allocations are forbidden on the audio thread for performance reasons so we need to // explicitly allow the following allocation(s). DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions; - m_audioBuffer = makeUnique(description, safeCast(numberOfFrames)); + m_audioBuffer = makeUnique(description, numberOfFrames); audioBuffer = &downcast(*m_audioBuffer); } else audioBuffer->setSampleCount(numberOfFrames); diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h webkit2gtk-2.36.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h --- webkit2gtk-2.36.4/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2022-06-30 09:49:35.386180600 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2022-07-13 09:19:35.480357600 +0000 @@ -345,7 +345,7 @@ bool m_areVolumeAndMuteInitialized { false }; #if USE(TEXTURE_MAPPER_GL) - TextureMapperGL::Flags m_textureMapperFlags; + TextureMapperGL::Flags m_textureMapperFlags { TextureMapperGL::NoFlag }; #endif GRefPtr m_volumeElement; diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/gtk/GRefPtrGtk.cpp webkit2gtk-2.36.6/Source/WebCore/platform/gtk/GRefPtrGtk.cpp --- webkit2gtk-2.36.4/Source/WebCore/platform/gtk/GRefPtrGtk.cpp 2022-06-30 09:49:35.556180700 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/gtk/GRefPtrGtk.cpp 2022-07-28 14:52:50.165240300 +0000 @@ -89,6 +89,19 @@ if (ptr) gsk_render_node_unref(ptr); } + +template <> GdkEvent* refGPtr(GdkEvent* ptr) +{ + if (ptr) + gdk_event_ref(ptr); + return ptr; +} + +template <> void derefGPtr(GdkEvent* ptr) +{ + if (ptr) + gdk_event_unref(ptr); +} #endif } diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/gtk/GRefPtrGtk.h webkit2gtk-2.36.6/Source/WebCore/platform/gtk/GRefPtrGtk.h --- webkit2gtk-2.36.4/Source/WebCore/platform/gtk/GRefPtrGtk.h 2022-06-30 09:49:35.556180700 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/gtk/GRefPtrGtk.h 2022-07-28 14:52:50.165240300 +0000 @@ -46,6 +46,9 @@ #if USE(GTK4) template <> GskRenderNode* refGPtr(GskRenderNode* ptr); template <> void derefGPtr(GskRenderNode* ptr); + +template <> GdkEvent* refGPtr(GdkEvent* ptr); +template <> void derefGPtr(GdkEvent* ptr); #endif } diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/mock/MockAudioDestinationCocoa.h webkit2gtk-2.36.6/Source/WebCore/platform/mock/MockAudioDestinationCocoa.h --- webkit2gtk-2.36.4/Source/WebCore/platform/mock/MockAudioDestinationCocoa.h 2022-06-30 09:49:36.316180200 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/mock/MockAudioDestinationCocoa.h 2022-07-27 22:16:37.613906600 +0000 @@ -54,7 +54,7 @@ Ref m_workQueue; RunLoop::Timer m_timer; - uint32_t m_numberOfFramesToProcess { 384 }; + size_t m_numberOfFramesToProcess { 384 }; }; } // namespace WebCore diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/SoupNetworkProxySettings.h webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/SoupNetworkProxySettings.h --- webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/SoupNetworkProxySettings.h 2022-06-30 09:49:36.429513500 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/SoupNetworkProxySettings.h 2022-07-22 19:24:19.886103000 +0000 @@ -33,7 +33,7 @@ namespace WebCore { struct SoupNetworkProxySettings { - enum class Mode { Default, NoProxy, Custom }; + enum class Mode { Default, NoProxy, Custom, Auto }; SoupNetworkProxySettings() = default; @@ -59,7 +59,19 @@ return *this; } - bool isEmpty() const { return mode == Mode::Custom && defaultProxyURL.isNull() && !ignoreHosts && proxyMap.isEmpty(); } + bool isEmpty() const + { + switch (mode) { + case Mode::Default: + case Mode::NoProxy: + return false; + case Mode::Custom: + return defaultProxyURL.isNull() && !ignoreHosts && proxyMap.isEmpty(); + case Mode::Auto: + return defaultProxyURL.isNull(); + } + RELEASE_ASSERT_NOT_REACHED(); + } Mode mode { Mode::Default }; CString defaultProxyURL; @@ -76,7 +88,8 @@ WebCore::SoupNetworkProxySettings::Mode, WebCore::SoupNetworkProxySettings::Mode::Default, WebCore::SoupNetworkProxySettings::Mode::NoProxy, - WebCore::SoupNetworkProxySettings::Mode::Custom + WebCore::SoupNetworkProxySettings::Mode::Custom, + WebCore::SoupNetworkProxySettings::Mode::Auto >; }; diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp --- webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2022-06-30 09:49:36.429513500 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2022-07-22 19:24:19.886103000 +0000 @@ -33,6 +33,7 @@ #include "GUniquePtrSoup.h" #include "Logging.h" #include "SoupVersioning.h" +#include "WebKitAutoconfigProxyResolver.h" #include #include #include @@ -299,6 +300,9 @@ for (const auto& iter : m_proxySettings.proxyMap) g_simple_proxy_resolver_set_uri_proxy(G_SIMPLE_PROXY_RESOLVER(resolver.get()), iter.key.data(), iter.value.data()); break; + case SoupNetworkProxySettings::Mode::Auto: + resolver = webkitAutoconfigProxyResolverNew(m_proxySettings.defaultProxyURL); + break; } soup_session_set_proxy_resolver(m_soupSession.get(), resolver.get()); diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.cpp webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.cpp --- webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.cpp 1970-01-01 00:00:00.000000000 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.cpp 2022-07-22 19:24:19.886103000 +0000 @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2022 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitAutoconfigProxyResolver.h" + +#include +#include + +struct _WebKitAutoconfigProxyResolverPrivate { + GRefPtr pacRunner; + CString autoconfigURL; +}; + +static void webkitAutoconfigProxyResolverInterfaceInit(GProxyResolverInterface*); + +WEBKIT_DEFINE_TYPE_WITH_CODE(WebKitAutoconfigProxyResolver, webkit_autoconfig_proxy_resolver, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(G_TYPE_PROXY_RESOLVER, webkitAutoconfigProxyResolverInterfaceInit)) + +static void webkit_autoconfig_proxy_resolver_class_init(WebKitAutoconfigProxyResolverClass*) +{ +} + +GRefPtr webkitAutoconfigProxyResolverNew(const CString& autoconfigURL) +{ + GUniqueOutPtr error; + GRefPtr pacRunner = adoptGRef(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, + static_cast(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS), + nullptr, "org.gtk.GLib.PACRunner", "/org/gtk/GLib/PACRunner", "org.gtk.GLib.PACRunner", nullptr, &error.outPtr())); + if (!pacRunner) { + g_warning("Could not start proxy autoconfiguration helper: %s\n", error->message); + return nullptr; + } + + auto* proxyResolver = WEBKIT_AUTOCONFIG_PROXY_RESOLVER(g_object_new(WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER, nullptr)); + proxyResolver->priv->pacRunner = WTFMove(pacRunner); + proxyResolver->priv->autoconfigURL = autoconfigURL; + + return adoptGRef(G_PROXY_RESOLVER(proxyResolver)); +} + +static gchar** webkitAutoconfigProxyResolverLookup(GProxyResolver* proxyResolver, const char* uri, GCancellable* cancellable, GError** error) +{ + auto* priv = WEBKIT_AUTOCONFIG_PROXY_RESOLVER(proxyResolver)->priv; + GRefPtr variant = adoptGRef(g_dbus_proxy_call_sync(priv->pacRunner.get(), "Lookup", g_variant_new("(ss)", priv->autoconfigURL.data(), uri), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error)); + if (!variant) + return nullptr; + + gchar** proxies; + g_variant_get(variant.get(), "(^as)", &proxies); + return proxies; +} + +static void webkitAutoconfigProxyResolverLookupAsync(GProxyResolver* proxyResolver, const char* uri, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData) +{ + GTask* task = g_task_new(proxyResolver, cancellable, callback, userData); + auto* priv = WEBKIT_AUTOCONFIG_PROXY_RESOLVER(proxyResolver)->priv; + g_dbus_proxy_call(priv->pacRunner.get(), "Lookup", g_variant_new("(ss)", priv->autoconfigURL.data(), uri), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + [](GObject* source, GAsyncResult* result, gpointer userData) { + GRefPtr task = adoptGRef(G_TASK(userData)); + GUniqueOutPtr error; + GRefPtr variant = adoptGRef(g_dbus_proxy_call_finish(G_DBUS_PROXY(source), result, &error.outPtr())); + if (variant) { + gchar** proxies; + g_variant_get(variant.get(), "(^as)", &proxies); + g_task_return_pointer(task.get(), proxies, reinterpret_cast(g_strfreev)); + } else + g_task_return_error(task.get(), error.release()); + }, task); +} + +static gchar** webkitAutoconfigProxyResolverLookupFinish(GProxyResolver*, GAsyncResult* result, GError** error) +{ + return static_cast(g_task_propagate_pointer(G_TASK(result), error)); +} + +static void webkitAutoconfigProxyResolverInterfaceInit(GProxyResolverInterface* interface) +{ + interface->lookup = webkitAutoconfigProxyResolverLookup; + interface->lookup_async = webkitAutoconfigProxyResolverLookupAsync; + interface->lookup_finish = webkitAutoconfigProxyResolverLookupFinish; +} diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.h webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.h --- webkit2gtk-2.36.4/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.h 1970-01-01 00:00:00.000000000 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/network/soup/WebKitAutoconfigProxyResolver.h 2022-07-22 19:24:19.886103000 +0000 @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2022 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include +#include +#include + +#define WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER (webkit_autoconfig_proxy_resolver_get_type ()) +#define WEBKIT_AUTOCONFIG_PROXY_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER, WebKitAutoconfigProxyResolver)) +#define WEBKIT_IS_AUTOCONFIG_PROXY_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER)) +#define WEBKIT_AUTOCONFIG_PROXY_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER, WebKitAutoconfigProxyResolverClass)) +#define WEBKIT_IS_AUTOCONFIG_PROXY_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER)) +#define WEBKIT_AUTOCONFIG_PROXY_RESOLVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WEBKIT_TYPE_AUTOCONFIG_PROXY_RESOLVER, WebKitAutoconfigProxyResolverClass)) + +typedef struct _WebKitAutoconfigProxyResolver WebKitAutoconfigProxyResolver; +typedef struct _WebKitAutoconfigProxyResolverClass WebKitAutoconfigProxyResolverClass; +typedef struct _WebKitAutoconfigProxyResolverPrivate WebKitAutoconfigProxyResolverPrivate; + +struct _WebKitAutoconfigProxyResolver { + GObject parent; + + WebKitAutoconfigProxyResolverPrivate* priv; +}; + +struct _WebKitAutoconfigProxyResolverClass { + GObjectClass parentClass; +}; + +GType webkit_autoconfig_proxy_resolver_get_type(void); + +GRefPtr webkitAutoconfigProxyResolverNew(const CString&); diff -Nru webkit2gtk-2.36.4/Source/WebCore/platform/SourcesSoup.txt webkit2gtk-2.36.6/Source/WebCore/platform/SourcesSoup.txt --- webkit2gtk-2.36.4/Source/WebCore/platform/SourcesSoup.txt 2022-06-30 09:49:33.726181700 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/platform/SourcesSoup.txt 2022-07-22 19:24:19.886103000 +0000 @@ -36,5 +36,6 @@ platform/network/soup/SynchronousLoaderClientSoup.cpp platform/network/soup/URLSoup.cpp platform/network/soup/WebKitFormDataInputStream.cpp @no-unify +platform/network/soup/WebKitAutoconfigProxyResolver.cpp @no-unify platform/soup/PublicSuffixSoup.cpp diff -Nru webkit2gtk-2.36.4/Source/WebCore/workers/service/server/SWScriptStorage.cpp webkit2gtk-2.36.6/Source/WebCore/workers/service/server/SWScriptStorage.cpp --- webkit2gtk-2.36.4/Source/WebCore/workers/service/server/SWScriptStorage.cpp 2022-06-30 09:49:36.952846300 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/workers/service/server/SWScriptStorage.cpp 2022-07-27 22:26:00.687023000 +0000 @@ -91,6 +91,9 @@ writeData({ entry.segment->data(), entry.segment->size() }); }; + // Make sure we delete the file before writing as there may be code using a mmap'd version of this file. + FileSystem::deleteFile(scriptPath); + if (!shouldUseFileMapping(script.buffer()->size())) { auto handle = FileSystem::openFile(scriptPath, FileSystem::FileOpenMode::Write); if (!FileSystem::isHandleValid(handle)) { @@ -105,8 +108,6 @@ return script; } - // Make sure we delete the file before writing as there may be code using a mmap'd version of this file. - FileSystem::deleteFile(scriptPath); auto mappedFile = FileSystem::mapToFile(scriptPath, script.buffer()->size(), WTFMove(iterateOverBufferAndWriteData)); if (!mappedFile) { RELEASE_LOG_ERROR(ServiceWorker, "SWScriptStorage::store: Failure to store %s, FileSystem::mapToFile() failed", scriptPath.utf8().data()); diff -Nru webkit2gtk-2.36.4/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp webkit2gtk-2.36.6/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp --- webkit2gtk-2.36.4/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp 2022-06-30 09:49:36.972846500 +0000 +++ webkit2gtk-2.36.6/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp 2022-08-02 08:10:29.864148600 +0000 @@ -1326,6 +1326,9 @@ } #if ENABLE(XSLT) + if (isDetached()) + return; + bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && shouldRenderInXMLTreeViewerMode(*document()); if (xmlViewerMode) { XMLTreeViewer xmlTreeViewer(*document()); diff -Nru webkit2gtk-2.36.4/Source/WebDriver/Capabilities.h webkit2gtk-2.36.6/Source/WebDriver/Capabilities.h --- webkit2gtk-2.36.4/Source/WebDriver/Capabilities.h 2022-06-30 09:49:36.972846500 +0000 +++ webkit2gtk-2.36.6/Source/WebDriver/Capabilities.h 2022-07-22 19:24:19.886103000 +0000 @@ -55,7 +55,7 @@ struct Proxy { String type; - std::optional autoconfigURL; + std::optional autoconfigURL; std::optional ftpURL; std::optional httpURL; std::optional httpsURL; diff -Nru webkit2gtk-2.36.4/Source/WebDriver/glib/SessionHostGlib.cpp webkit2gtk-2.36.6/Source/WebDriver/glib/SessionHostGlib.cpp --- webkit2gtk-2.36.4/Source/WebDriver/glib/SessionHostGlib.cpp 2022-06-30 09:49:36.979513200 +0000 +++ webkit2gtk-2.36.6/Source/WebDriver/glib/SessionHostGlib.cpp 2022-07-22 19:24:19.889436200 +0000 @@ -264,6 +264,8 @@ GVariantBuilder dictBuilder; g_variant_builder_init(&dictBuilder, G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(&dictBuilder, "{sv}", "type", g_variant_new_string(m_capabilities.proxy->type.utf8().data())); + if (m_capabilities.proxy->autoconfigURL) + g_variant_builder_add(&dictBuilder, "{sv}", "autoconfigURL", g_variant_new_string(m_capabilities.proxy->autoconfigURL->string().utf8().data())); if (m_capabilities.proxy->ftpURL) g_variant_builder_add(&dictBuilder, "{sv}", "ftpURL", g_variant_new_string(m_capabilities.proxy->ftpURL->string().utf8().data())); if (m_capabilities.proxy->httpURL) diff -Nru webkit2gtk-2.36.4/Source/WebDriver/glib/WebDriverServiceGLib.cpp webkit2gtk-2.36.6/Source/WebDriver/glib/WebDriverServiceGLib.cpp --- webkit2gtk-2.36.4/Source/WebDriver/glib/WebDriverServiceGLib.cpp 2022-06-30 09:49:36.979513200 +0000 +++ webkit2gtk-2.36.6/Source/WebDriver/glib/WebDriverServiceGLib.cpp 2022-07-22 19:26:12.478735700 +0000 @@ -80,9 +80,9 @@ || (proposedMajor == requiredMajor && proposedMinor == requiredMinor && proposedMicro >= requiredMicro); } -bool WebDriverService::platformSupportProxyType(const String& proxyType) const +bool WebDriverService::platformSupportProxyType(const String&) const { - return proxyType != "pac"; + return true; } } // namespace WebDriver diff -Nru webkit2gtk-2.36.4/Source/WebDriver/WebDriverService.cpp webkit2gtk-2.36.6/Source/WebDriver/WebDriverService.cpp --- webkit2gtk-2.36.4/Source/WebDriver/WebDriverService.cpp 2022-06-30 09:49:36.979513200 +0000 +++ webkit2gtk-2.36.6/Source/WebDriver/WebDriverService.cpp 2022-07-22 19:25:44.648909000 +0000 @@ -405,9 +405,14 @@ if (proxy.type == "direct" || proxy.type == "autodetect" || proxy.type == "system") return proxy; + if (proxy.type == "pac") { - proxy.autoconfigURL = proxyObject.getString("proxyAutoconfigUrl"_s); - if (!proxy.autoconfigURL) + auto autoconfigURL = proxyObject.getString("proxyAutoconfigUrl"_s); + if (!autoconfigURL) + return std::nullopt; + + proxy.autoconfigURL = URL({ }, autoconfigURL); + if (!proxy.autoconfigURL->isValid()) return std::nullopt; return proxy; diff -Nru webkit2gtk-2.36.4/Source/WebKit/gtk/NEWS webkit2gtk-2.36.6/Source/WebKit/gtk/NEWS --- webkit2gtk-2.36.4/Source/WebKit/gtk/NEWS 2022-07-04 22:47:34.661839000 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/gtk/NEWS 2022-08-06 22:02:11.018181600 +0000 @@ -1,4 +1,27 @@ ================ +WebKitGTK 2.36.6 +================ + +What's new in WebKitGTK 2.36.6? + + - Fix handling of touchpad scrolling on GTK4 builds. + - Fix WebKitGTK not allowing to be used from non-main threads. + - Fix several crashes and rendering issues. + +================ +WebKitGTK 2.36.5 +================ + +What's new in WebKitGTK 2.36.5? + + - Add support for PAC proxy in the WebDriver implementation. + - Fix video playback when loaded through custom URIs, this fixes video + playback in the Yelp documentation browser. + - Fix WebKitWebView::context-menu when using GTK4. + - Fix LTO builds with GCC. + - Fix several crashes and rendering issues. + +================ WebKitGTK 2.36.4 ================ diff -Nru webkit2gtk-2.36.4/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h webkit2gtk-2.36.6/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h --- webkit2gtk-2.36.4/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2022-06-30 09:49:37.489512700 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2022-08-06 20:01:53.754010000 +0000 @@ -30,6 +30,7 @@ #include "WebsiteData.h" #include #include +#include #include #include #include @@ -39,10 +40,6 @@ class Connection; } -namespace WTF { -class CallbackAggregator; -}; - namespace WebCore { struct RetrieveRecordsOptions; } diff -Nru webkit2gtk-2.36.4/Source/WebKit/NetworkProcess/NetworkProcess.cpp webkit2gtk-2.36.6/Source/WebKit/NetworkProcess/NetworkProcess.cpp --- webkit2gtk-2.36.4/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2022-06-30 09:49:37.469512700 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2022-08-06 20:01:39.047304400 +0000 @@ -1402,6 +1402,7 @@ void NetworkProcess::fetchWebsiteData(PAL::SessionID sessionID, OptionSet websiteDataTypes, OptionSet fetchOptions, CompletionHandler&& completionHandler) { + RELEASE_LOG(Storage, "NetworkProcess::fetchWebsiteData started to fetch data for session %" PRIu64, sessionID.toUInt64()); struct CallbackAggregator final : public ThreadSafeRefCounted { explicit CallbackAggregator(CompletionHandler&& completionHandler) : m_completionHandler(WTFMove(completionHandler)) @@ -1412,6 +1413,7 @@ { RunLoop::main().dispatch([completionHandler = WTFMove(m_completionHandler), websiteData = WTFMove(m_websiteData)] () mutable { completionHandler(WTFMove(websiteData)); + RELEASE_LOG(Storage, "NetworkProcess::fetchWebsiteData finished fetching data"); }); } @@ -1492,6 +1494,7 @@ void NetworkProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet websiteDataTypes, WallTime modifiedSince, CompletionHandler&& completionHandler) { + RELEASE_LOG(Storage, "NetworkProcess::deleteWebsiteData started to delete data modified since %f for session %" PRIu64, modifiedSince.secondsSinceEpoch().value(), sessionID.toUInt64()); auto* session = networkSession(sessionID); #if PLATFORM(COCOA) || USE(SOUP) @@ -1510,7 +1513,10 @@ WebCore::CredentialStorage::clearSessionCredentials(); } - auto clearTasksHandler = WTF::CallbackAggregator::create(WTFMove(completionHandler)); + auto clearTasksHandler = WTF::CallbackAggregator::create([completionHandler = WTFMove(completionHandler)]() mutable { + completionHandler(); + RELEASE_LOG(Storage, "NetworkProcess::deleteWebsiteData finished deleting modified data"); + }); if (websiteDataTypes.contains(WebsiteDataType::DOMCache) && session) CacheStorage::Engine::clearAllCaches(*session, [clearTasksHandler] { }); @@ -1576,6 +1582,7 @@ void NetworkProcess::deleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet websiteDataTypes, const Vector& originDatas, const Vector& cookieHostNames, const Vector& HSTSCacheHostNames, const Vector& registrableDomains, CompletionHandler&& completionHandler) { + RELEASE_LOG(Storage, "NetworkProcess::deleteWebsiteDataForOrigins started to delete data for session %" PRIu64, sessionID.toUInt64()); auto* session = networkSession(sessionID); if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { @@ -1595,7 +1602,10 @@ } #endif - auto clearTasksHandler = WTF::CallbackAggregator::create(WTFMove(completionHandler)); + auto clearTasksHandler = WTF::CallbackAggregator::create([completionHandler = WTFMove(completionHandler)]() mutable { + completionHandler(); + RELEASE_LOG(Storage, "NetworkProcess::deleteWebsiteDataForOrigins finished deleting data"); + }); if (websiteDataTypes.contains(WebsiteDataType::PrivateClickMeasurements) && session) { for (auto& originData : originDatas) diff -Nru webkit2gtk-2.36.4/Source/WebKit/Platform/IPC/Connection.cpp webkit2gtk-2.36.6/Source/WebKit/Platform/IPC/Connection.cpp --- webkit2gtk-2.36.4/Source/WebKit/Platform/IPC/Connection.cpp 2022-06-30 09:49:37.512846000 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/Platform/IPC/Connection.cpp 2022-08-05 12:37:01.085426000 +0000 @@ -422,12 +422,11 @@ { ASSERT(RunLoop::isMain()); - if (!isValid()) { - // Someone already called invalidate(). + if (std::exchange(m_didInvalidationOnMainThread, true)) return; - } - + m_isValid = false; + clearAsyncReplyHandlers(*this); m_connectionQueue->dispatch([protectedThis = Ref { *this }]() mutable { @@ -893,6 +892,7 @@ void Connection::connectionDidClose() { // The connection is now invalid. + m_isValid = false; platformInvalidate(); { @@ -922,13 +922,9 @@ RunLoop::main().dispatch([protectedThis = Ref { *this }]() mutable { // If the connection has been explicitly invalidated before dispatchConnectionDidClose was called, // then the connection will be invalid here. - if (!protectedThis->isValid()) + if (std::exchange(protectedThis->m_didInvalidationOnMainThread, true)) return; - // Set m_isValid to false before calling didClose, otherwise, sendSync will try to send a message - // to the connection and will then wait indefinitely for a reply. - protectedThis->m_isValid = false; - protectedThis->m_client.didClose(protectedThis.get()); clearAsyncReplyHandlers(protectedThis.get()); @@ -1059,7 +1055,8 @@ void Connection::dispatchMessage(Decoder& decoder) { - RELEASE_ASSERT(isValid()); + ASSERT(RunLoop::isMain()); + RELEASE_ASSERT(!m_didInvalidationOnMainThread); if (decoder.messageReceiverName() == ReceiverName::AsyncReply) { auto handler = takeAsyncReplyHandler(*this, decoder.destinationID()); if (!handler) { diff -Nru webkit2gtk-2.36.4/Source/WebKit/Platform/IPC/Connection.h webkit2gtk-2.36.6/Source/WebKit/Platform/IPC/Connection.h --- webkit2gtk-2.36.4/Source/WebKit/Platform/IPC/Connection.h 2022-06-30 09:49:37.512846000 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/Platform/IPC/Connection.h 2022-07-19 09:14:30.591540800 +0000 @@ -397,6 +397,7 @@ Client& m_client; UniqueID m_uniqueID; bool m_isServer; + bool m_didInvalidationOnMainThread { false }; // Main thread only. std::atomic m_isValid { true }; bool m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage { false }; diff -Nru webkit2gtk-2.36.4/Source/WebKit/Shared/AuxiliaryProcess.cpp webkit2gtk-2.36.6/Source/WebKit/Shared/AuxiliaryProcess.cpp --- webkit2gtk-2.36.4/Source/WebKit/Shared/AuxiliaryProcess.cpp 2022-06-30 09:49:37.589512600 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/Shared/AuxiliaryProcess.cpp 2022-07-19 07:20:42.750827300 +0000 @@ -56,6 +56,8 @@ AuxiliaryProcess::~AuxiliaryProcess() { + if (m_connection) + m_connection->invalidate(); } void AuxiliaryProcess::didClose(IPC::Connection&) diff -Nru webkit2gtk-2.36.4/Source/WebKit/Shared/gtk/WebEventFactory.cpp webkit2gtk-2.36.6/Source/WebKit/Shared/gtk/WebEventFactory.cpp --- webkit2gtk-2.36.4/Source/WebKit/Shared/gtk/WebEventFactory.cpp 2022-06-30 09:49:37.656179200 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/Shared/gtk/WebEventFactory.cpp 2022-08-03 20:24:41.596179700 +0000 @@ -246,7 +246,7 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event) { - WebWheelEvent::Phase phase = gdk_event_is_scroll_stop_event(event) ? + WebWheelEvent::Phase phase = !event || gdk_event_is_scroll_stop_event(event) ? WebWheelEvent::Phase::PhaseEnded : WebWheelEvent::Phase::PhaseChanged; return createWebWheelEvent(event, phase, WebWheelEvent::Phase::PhaseNone); @@ -298,7 +298,8 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& wheelTicks) { - WebWheelEvent::Phase phase = gdk_event_is_scroll_stop_event(event) ? + WebWheelEvent::Phase phase = gdk_event_get_event_type(const_cast(event)) != GDK_SCROLL + || gdk_event_is_scroll_stop_event(event) ? WebWheelEvent::Phase::PhaseEnded : WebWheelEvent::Phase::PhaseChanged; return createWebWheelEvent(event, position, globalPosition, wheelTicks, phase, WebWheelEvent::Phase::PhaseNone); @@ -309,9 +310,20 @@ // FIXME: [GTK] Add a setting to change the pixels per line used for scrolling // https://bugs.webkit.org/show_bug.cgi?id=54826 float step = static_cast(Scrollbar::pixelsPerLineStep()); - FloatSize delta(wheelTicks.width() * step, wheelTicks.height() * step); - + FloatSize delta; bool hasPreciseScrollingDeltas = false; + +#if GTK_CHECK_VERSION(4, 7, 0) + hasPreciseScrollingDeltas = gdk_event_get_event_type(const_cast(event)) != GDK_SCROLL + || gdk_scroll_event_get_unit(const_cast(event)) != GDK_SCROLL_UNIT_WHEEL; + + if (hasPreciseScrollingDeltas) + delta = wheelTicks; + else + delta = wheelTicks.scaled(step); +#else + delta = wheelTicks.scaled(step); + GdkScrollDirection direction; if (!gdk_event_get_scroll_direction(event, &direction)) { double deltaX, deltaY; @@ -320,6 +332,7 @@ hasPreciseScrollingDeltas = gdk_device_get_source(device) != GDK_SOURCE_MOUSE; } } +#endif return WebWheelEvent(WebEvent::Wheel, position, diff -Nru webkit2gtk-2.36.4/Source/WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp webkit2gtk-2.36.6/Source/WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp --- webkit2gtk-2.36.4/Source/WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp 2022-06-30 09:49:37.666179200 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp 2022-07-22 19:24:19.896103000 +0000 @@ -135,10 +135,13 @@ { ASSERT(!settings.isEmpty()); encoder << settings.mode; - if (settings.mode != SoupNetworkProxySettings::Mode::Custom) + if (settings.mode != SoupNetworkProxySettings::Mode::Custom && settings.mode != SoupNetworkProxySettings::Mode::Auto) return; encoder << settings.defaultProxyURL; + if (settings.mode == SoupNetworkProxySettings::Mode::Auto) + return; + uint32_t ignoreHostsCount = settings.ignoreHosts ? g_strv_length(settings.ignoreHosts.get()) : 0; encoder << ignoreHostsCount; if (ignoreHostsCount) { @@ -153,12 +156,15 @@ if (!decoder.decode(settings.mode)) return false; - if (settings.mode != SoupNetworkProxySettings::Mode::Custom) + if (settings.mode != SoupNetworkProxySettings::Mode::Custom && settings.mode != SoupNetworkProxySettings::Mode::Auto) return true; if (!decoder.decode(settings.defaultProxyURL)) return false; + if (settings.mode == SoupNetworkProxySettings::Mode::Auto) + return !settings.isEmpty(); + uint32_t ignoreHostsCount; if (!decoder.decode(ignoreHostsCount)) return false; diff -Nru webkit2gtk-2.36.4/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp webkit2gtk-2.36.6/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp --- webkit2gtk-2.36.4/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp 2022-06-30 09:49:37.766179300 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp 2022-07-22 19:26:39.891898400 +0000 @@ -23,8 +23,10 @@ #include "APIAutomationSessionClient.h" #include "WebKitApplicationInfo.h" #include "WebKitAutomationSessionPrivate.h" +#include "WebKitNetworkProxySettingsPrivate.h" #include "WebKitWebContextPrivate.h" #include "WebKitWebViewPrivate.h" +#include "WebKitWebsiteDataManagerPrivate.h" #include #include #include @@ -318,7 +320,7 @@ #if ENABLE(REMOTE_INSPECTOR) static WebKitNetworkProxyMode parseProxyCapabilities(const Inspector::RemoteInspector::Client::SessionCapabilities::Proxy& proxy, WebKitNetworkProxySettings** settings) { - if (proxy.type == "system") + if (proxy.type == "system" || proxy.type == "autodetect") return WEBKIT_NETWORK_PROXY_MODE_DEFAULT; if (proxy.type == "direct") @@ -358,11 +360,22 @@ webkit_web_context_allow_tls_certificate_for_host(webContext, tlsCertificate.get(), certificate.first.utf8().data()); } if (capabilities.proxy) { - WebKitNetworkProxySettings* proxySettings = nullptr; - auto proxyMode = parseProxyCapabilities(*capabilities.proxy, &proxySettings); - webkit_website_data_manager_set_network_proxy_settings(webkit_web_context_get_website_data_manager(webContext), proxyMode, proxySettings); - if (proxySettings) - webkit_network_proxy_settings_free(proxySettings); + if (capabilities.proxy->type == "pac"_s) { + // FIXME: expose pac proxy in public API. + auto settings = WebCore::SoupNetworkProxySettings(WebCore::SoupNetworkProxySettings::Mode::Auto); + if (capabilities.proxy->autoconfigURL) + settings.defaultProxyURL = capabilities.proxy->autoconfigURL->utf8(); + if (!settings.isEmpty()) { + auto& dataStore = webkitWebsiteDataManagerGetDataStore(webkit_web_context_get_website_data_manager(webContext)); + dataStore.setNetworkProxySettings(WTFMove(settings)); + } + } else { + WebKitNetworkProxySettings* proxySettings = nullptr; + auto proxyMode = parseProxyCapabilities(*capabilities.proxy, &proxySettings); + webkit_website_data_manager_set_network_proxy_settings(webkit_web_context_get_website_data_manager(webContext), proxyMode, proxySettings); + if (proxySettings) + webkit_network_proxy_settings_free(proxySettings); + } } return session; } diff -Nru webkit2gtk-2.36.4/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp webkit2gtk-2.36.6/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp --- webkit2gtk-2.36.4/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2022-07-01 15:15:01.020366400 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2022-07-28 14:52:50.165240300 +0000 @@ -1030,6 +1030,71 @@ return !object; } +#if PLATFORM(GTK) && USE(GTK4) +static GdkEvent* gValueGetEvent(const GValue* value) +{ + g_return_val_if_fail(G_VALUE_HOLDS(value, GDK_TYPE_EVENT), NULL); + + return reinterpret_cast(value->data[0].v_pointer); +} + +typedef gboolean (*ContextMenuCallback) (gpointer, WebKitContextMenu*, GdkEvent*, WebKitHitTestResult*, gpointer); + +static void webkitWebViewContextMenuMarshal(GClosure* closure, GValue* returnValue, guint nParams, const GValue* params, gpointer, gpointer marshalData) +{ + auto* cc = reinterpret_cast(closure); + gpointer data1, data2; + + g_return_if_fail(returnValue); + g_return_if_fail(nParams == 4); + + if (G_CCLOSURE_SWAP_DATA(closure)) { + data1 = closure->data; + data2 = g_value_peek_pointer(¶ms[0]); + } else { + data1 = g_value_peek_pointer(¶ms[0]); + data2 = closure->data; + } + + auto* menu = WEBKIT_CONTEXT_MENU(g_value_get_object(¶ms[1])); + auto* event = gValueGetEvent(¶ms[2]); + auto* result = WEBKIT_HIT_TEST_RESULT(g_value_get_object(¶ms[3])); + + auto callback = reinterpret_cast(marshalData ? marshalData : cc->callback); + gboolean ret = callback(data1, menu, event, result, data2); + g_value_set_boolean(returnValue, ret); +} + +static void webkitWebViewContextMenuMarshalVa(GClosure* closure, GValue* returnValue, gpointer instance, va_list args, gpointer marshalData, int, GType*) +{ + auto* cc = reinterpret_cast(closure); + gpointer data1, data2; + + g_return_if_fail(returnValue); + + if (G_CCLOSURE_SWAP_DATA(closure)) { + data1 = closure->data; + data2 = instance; + } else { + data1 = instance; + data2 = closure->data; + } + + va_list argsCopy; + G_VA_COPY(argsCopy, args); + + GRefPtr menu = WEBKIT_CONTEXT_MENU(va_arg(argsCopy, gpointer)); + GRefPtr event = reinterpret_cast(va_arg(argsCopy, gpointer)); + GRefPtr result = WEBKIT_HIT_TEST_RESULT(va_arg(argsCopy, gpointer)); + + va_end(argsCopy); + + auto callback = reinterpret_cast(marshalData ? marshalData : cc->callback); + gboolean ret = callback(data1, menu.get(), event.get(), result.get(), data2); + g_value_set_boolean(returnValue, ret); +} +#endif + static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(webViewClass); @@ -2071,15 +2136,26 @@ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(WebKitWebViewClass, context_menu), g_signal_accumulator_true_handled, nullptr, +#if USE(GTK4) + webkitWebViewContextMenuMarshal, +#else g_cclosure_marshal_generic, +#endif G_TYPE_BOOLEAN, 3, WEBKIT_TYPE_CONTEXT_MENU, #if PLATFORM(GTK) +#if USE(GTK4) + GDK_TYPE_EVENT, +#else GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE, +#endif #elif PLATFORM(WPE) G_TYPE_POINTER, // FIXME: use a wpe thing here. I'm not sure we want to expose libwpe in the API. #endif WEBKIT_TYPE_HIT_TEST_RESULT); +#if USE(GTK4) + g_signal_set_va_marshaller(signals[CONTEXT_MENU], G_TYPE_FROM_CLASS(webViewClass), webkitWebViewContextMenuMarshalVa); +#endif /** * WebKitWebView::context-menu-dismissed: diff -Nru webkit2gtk-2.36.4/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp webkit2gtk-2.36.6/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp --- webkit2gtk-2.36.4/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2022-06-30 09:49:37.796179300 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2022-08-03 20:24:41.599513000 +0000 @@ -1312,7 +1312,7 @@ #endif #if USE(GTK4) -static gboolean webkitWebViewBaseScroll(WebKitWebViewBase* webViewBase, double deltaX, double deltaY, GtkEventController* eventController) +static gboolean handleScroll(WebKitWebViewBase* webViewBase, double deltaX, double deltaY, bool isEnd, GtkEventController* eventController) { WebKitWebViewBasePrivate* priv = webViewBase->priv; if (priv->dialog) @@ -1326,27 +1326,37 @@ int32_t eventTime = static_cast(gtk_event_controller_get_current_event_time(eventController)); - GdkDevice* device = gdk_event_get_device(event); - GdkInputSource source = gdk_device_get_source(device); - - bool isEnd = gdk_scroll_event_is_stop(event) ? true : false; + GdkDevice* device = gtk_event_controller_get_current_event_device(eventController); + // We only have hold events on touchpads, so assume one if we get no event. + GdkInputSource source = device ? gdk_device_get_source(device) : GDK_SOURCE_TOUCHPAD; PlatformGtkScrollData scrollData = { .delta = delta, .eventTime = eventTime, .source = source, .isEnd = isEnd }; if (controller->handleScrollWheelEvent(&scrollData)) return GDK_EVENT_STOP; } - if (shouldInvertDirectionForScrollEvent(priv->mouseIsOverScrollbar, gdk_event_get_modifier_state(event) & GDK_SHIFT_MASK)) + if (!isEnd && shouldInvertDirectionForScrollEvent(priv->mouseIsOverScrollbar, gdk_event_get_modifier_state(event) & GDK_SHIFT_MASK)) std::swap(deltaX, deltaY); - priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(event, priv->lastMotionEvent ? IntPoint(priv->lastMotionEvent->position) : IntPoint(), FloatSize(-deltaX, -deltaY))); + if (event) + priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(event, priv->lastMotionEvent ? IntPoint(priv->lastMotionEvent->position) : IntPoint(), FloatSize(-deltaX, -deltaY))); return GDK_EVENT_STOP; } +static void webkitWebViewBaseScrollBegin(WebKitWebViewBase* webViewBase, GtkEventController* controller) +{ + handleScroll(webViewBase, 0, 0, false, controller); +} + +static gboolean webkitWebViewBaseScroll(WebKitWebViewBase* webViewBase, double deltaX, double deltaY, GtkEventController* eventController) +{ + return handleScroll(webViewBase, deltaX, deltaY, false, eventController); +} + static void webkitWebViewBaseScrollEnd(WebKitWebViewBase* webViewBase, GtkEventController* controller) { - webkitWebViewBaseScroll(webViewBase, 0, 0, controller); + handleScroll(webViewBase, 0, 0, true, controller); } #endif @@ -2082,6 +2092,7 @@ #if USE(GTK4) auto* controller = gtk_event_controller_scroll_new(GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES); + g_signal_connect_object(controller, "scroll-begin", G_CALLBACK(webkitWebViewBaseScrollBegin), viewWidget, G_CONNECT_SWAPPED); g_signal_connect_object(controller, "scroll", G_CALLBACK(webkitWebViewBaseScroll), viewWidget, G_CONNECT_SWAPPED); g_signal_connect_object(controller, "scroll-end", G_CALLBACK(webkitWebViewBaseScrollEnd), viewWidget, G_CONNECT_SWAPPED); gtk_widget_add_controller(viewWidget, controller); diff -Nru webkit2gtk-2.36.4/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp webkit2gtk-2.36.6/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp --- webkit2gtk-2.36.4/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp 2022-06-30 09:49:37.909512500 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp 2022-08-03 20:24:41.602846400 +0000 @@ -38,8 +38,12 @@ static const Seconds swipeMaxAnimationDuration = 400_ms; static const double swipeAnimationBaseVelocity = 0.002; +#if GTK_CHECK_VERSION(4, 7, 0) +static const double gtkScrollDeltaMultiplier = 1; +#else // GTK divides all scroll deltas by 10, compensate for that static const double gtkScrollDeltaMultiplier = 10; +#endif static const double swipeTouchpadBaseWidth = 400; // This is derivative of the easing function at t=0 @@ -191,10 +195,11 @@ } Seconds time = Seconds::fromMilliseconds(eventTime); - if (time != m_prevTime) + if (time > m_prevTime) { m_velocity = deltaX / (time - m_prevTime).milliseconds(); + m_prevTime = time; + } - m_prevTime = time; m_progress += deltaX; bool swipingLeft = m_viewGestureController.isPhysicallySwipingLeft(m_direction); diff -Nru webkit2gtk-2.36.4/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp webkit2gtk-2.36.6/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp --- webkit2gtk-2.36.4/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2022-06-30 09:49:37.909512500 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2022-07-28 14:52:50.168573600 +0000 @@ -73,7 +73,8 @@ static inline bool menuWidgetHasItems(GtkWidget* widget) { - return g_menu_model_get_n_items(gtk_popover_menu_get_menu_model(GTK_POPOVER_MENU(widget))); + GMenuModel* model = gtk_popover_menu_get_menu_model(GTK_POPOVER_MENU(widget)); + return model ? g_menu_model_get_n_items(model) : 0; } static inline void bindModelToMenuWidget(GtkWidget* widget, GMenuModel* model) diff -Nru webkit2gtk-2.36.4/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp webkit2gtk-2.36.6/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp --- webkit2gtk-2.36.4/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2022-06-30 09:49:37.902845900 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2022-08-06 20:01:53.757343300 +0000 @@ -313,6 +313,7 @@ void WebsiteDataStore::fetchDataAndApply(OptionSet dataTypes, OptionSet fetchOptions, Ref&& queue, Function)>&& apply) { + RELEASE_LOG(Storage, "WebsiteDataStore::fetchDataAndApply started to fetch data for session %" PRIu64, m_sessionID.toUInt64()); class CallbackAggregator final : public ThreadSafeRefCounted { public: static Ref create(OptionSet fetchOptions, Ref&& queue, Function)>&& apply, WebsiteDataStore& dataStore) @@ -327,8 +328,9 @@ auto records = WTF::map(WTFMove(m_websiteDataRecords), [this](auto&& entry) { return m_queue.ptr() != &WorkQueue::main() ? crossThreadCopy(WTFMove(entry.value)) : WTFMove(entry.value); }); - m_queue->dispatch([apply = WTFMove(m_apply), records = WTFMove(records)] () mutable { + m_queue->dispatch([apply = WTFMove(m_apply), records = WTFMove(records), sessionID = m_protectedDataStore->sessionID()] () mutable { apply(WTFMove(records)); + RELEASE_LOG(Storage, "WebsiteDataStore::fetchDataAndApply finished fetching data for session %" PRIu64, sessionID.toUInt64()); }); } @@ -550,34 +552,13 @@ return ProcessAccessType::None; } -class RemovalCallbackAggregator : public ThreadSafeRefCounted { -public: - static Ref create(WebsiteDataStore& dataStore, CompletionHandler&& completionHandler) - { - return adoptRef(*new RemovalCallbackAggregator(dataStore, WTFMove(completionHandler))); - } - - ~RemovalCallbackAggregator() - { - ASSERT(RunLoop::isMain()); - RunLoop::main().dispatch(WTFMove(m_completionHandler)); - } - -private: - RemovalCallbackAggregator(WebsiteDataStore& dataStore, CompletionHandler&& completionHandler) - : m_protectedDataStore(dataStore) - , m_completionHandler(WTFMove(completionHandler)) - { - ASSERT(RunLoop::isMain()); - } - - Ref m_protectedDataStore; - CompletionHandler m_completionHandler; -}; - void WebsiteDataStore::removeData(OptionSet dataTypes, WallTime modifiedSince, Function&& completionHandler) { - auto callbackAggregator = RemovalCallbackAggregator::create(*this, WTFMove(completionHandler)); + RELEASE_LOG(Storage, "WebsiteDataStore::removeData started to delete data modified since %f for session %" PRIu64, modifiedSince.secondsSinceEpoch().value(), m_sessionID.toUInt64()); + auto callbackAggregator = MainRunLoopCallbackAggregator::create([protectedThis = Ref { *this }, sessionID = m_sessionID, completionHandler = WTFMove(completionHandler)] { + RELEASE_LOG(Storage, "WebsiteDataStore::removeData finished deleting modified data for session %" PRIu64, sessionID.toUInt64()); + completionHandler(); + }); #if ENABLE(VIDEO) if (dataTypes.contains(WebsiteDataType::DiskCache)) { @@ -664,15 +645,18 @@ void WebsiteDataStore::removeData(OptionSet dataTypes, const Vector& dataRecords, Function&& completionHandler) { - Vector origins; + RELEASE_LOG(Storage, "WebsiteDataStore::removeData started to delete data for session %" PRIu64, m_sessionID.toUInt64()); + auto callbackAggregator = MainRunLoopCallbackAggregator::create([protectedThis = Ref { *this }, sessionID = m_sessionID, completionHandler = WTFMove(completionHandler)] { + RELEASE_LOG(Storage, "WebsiteDataStore::removeData finished deleting data for session %" PRIu64, sessionID.toUInt64()); + completionHandler(); + }); + Vector origins; for (const auto& dataRecord : dataRecords) { for (auto& origin : dataRecord.origins) origins.append(origin); } - auto callbackAggregator = RemovalCallbackAggregator::create(*this, WTFMove(completionHandler)); - if (dataTypes.contains(WebsiteDataType::DiskCache)) { HashSet origins; for (const auto& dataRecord : dataRecords) { diff -Nru webkit2gtk-2.36.4/Source/WebKit/WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h webkit2gtk-2.36.6/Source/WebKit/WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h --- webkit2gtk-2.36.4/Source/WebKit/WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h 2022-06-30 09:49:38.079512400 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h 2022-08-06 20:02:43.770806300 +0000 @@ -28,13 +28,10 @@ #include "Connection.h" #include #include +#include #include #include -namespace WTF { -class CallbackAggregator; -} - namespace WebCore { struct MessageWithMessagePorts; } diff -Nru webkit2gtk-2.36.4/Source/WebKit/WebProcess/WebProcess.cpp webkit2gtk-2.36.6/Source/WebKit/WebProcess/WebProcess.cpp --- webkit2gtk-2.36.4/Source/WebKit/WebProcess/WebProcess.cpp 2022-06-30 09:49:38.116179000 +0000 +++ webkit2gtk-2.36.6/Source/WebKit/WebProcess/WebProcess.cpp 2022-07-19 09:14:30.591540800 +0000 @@ -1142,7 +1142,7 @@ return IPC::Connection::identifierIsValid(connectionInfo.identifier()); }; - static constexpr unsigned maxFailedAttempts = 10; + static constexpr unsigned maxFailedAttempts = 30; unsigned failedAttempts = 0; while (!requestConnection()) { if (++failedAttempts >= maxFailedAttempts) diff -Nru webkit2gtk-2.36.4/Source/WTF/wtf/CallbackAggregator.h webkit2gtk-2.36.6/Source/WTF/wtf/CallbackAggregator.h --- webkit2gtk-2.36.4/Source/WTF/wtf/CallbackAggregator.h 2022-06-30 09:49:30.079517600 +0000 +++ webkit2gtk-2.36.6/Source/WTF/wtf/CallbackAggregator.h 2022-08-06 20:01:53.754010000 +0000 @@ -32,11 +32,12 @@ namespace WTF { -class CallbackAggregator : public ThreadSafeRefCounted { +template +class CallbackAggregatorOnThread : public ThreadSafeRefCounted, destructionThread> { public: - static Ref create(CompletionHandler&& callback) { return adoptRef(*new CallbackAggregator(WTFMove(callback))); } + static auto create(CompletionHandler&& callback) { return adoptRef(*new CallbackAggregatorOnThread(WTFMove(callback))); } - ~CallbackAggregator() + ~CallbackAggregatorOnThread() { ASSERT(m_wasConstructedOnMainThread == isMainThread()); if (m_callback) @@ -44,7 +45,7 @@ } private: - explicit CallbackAggregator(CompletionHandler&& callback) + explicit CallbackAggregatorOnThread(CompletionHandler&& callback) : m_callback(WTFMove(callback)) #if ASSERT_ENABLED , m_wasConstructedOnMainThread(isMainThread()) @@ -58,6 +59,10 @@ #endif }; +using CallbackAggregator = CallbackAggregatorOnThread; +using MainRunLoopCallbackAggregator = CallbackAggregatorOnThread; + } // namespace WTF using WTF::CallbackAggregator; +using WTF::MainRunLoopCallbackAggregator; diff -Nru webkit2gtk-2.36.4/Source/WTF/wtf/URLHelpers.cpp webkit2gtk-2.36.6/Source/WTF/wtf/URLHelpers.cpp --- webkit2gtk-2.36.4/Source/WTF/wtf/URLHelpers.cpp 2022-06-30 09:49:30.132851000 +0000 +++ webkit2gtk-2.36.6/Source/WTF/wtf/URLHelpers.cpp 2022-07-27 22:06:17.704455900 +0000 @@ -92,6 +92,20 @@ } } +template<> bool isLookalikeCharacterOfScriptType(UChar32 codePoint) +{ + switch (codePoint) { + case 0x15AF: /* CANADIAN SYLLABICS AIVILIK B */ + case 0x15B4: /* CANADIAN SYLLABICS BLACKFOOT WE */ + case 0x157C: /* CANADIAN SYLLABICS NUNAVUT H */ + case 0x166D: /* CANADIAN SYLLABICS CHI SIGN */ + case 0x166E: /* CANADIAN SYLLABICS FULL STOP */ + return true; + default: + return false; + } +} + template bool isOfScriptType(UChar32 codePoint) { @@ -287,7 +301,8 @@ return false; default: return isLookalikeSequence(previousCodePoint, codePoint) - || isLookalikeSequence(previousCodePoint, codePoint); + || isLookalikeSequence(previousCodePoint, codePoint) + || isLookalikeSequence(previousCodePoint, codePoint); } }