blob: 6f21a68a8bda0628d090f7cf24793cfbf64b8857 [file] [log] [blame]
2021-07-29 Myles C. Maxfield <mmaxfield@apple.com>
Stop building WebGPU and the WHLSL compiler to decrease binary size
https://bugs.webkit.org/show_bug.cgi?id=228179
Reviewed by Dean Jackson, Robin Morisset, and Devin Rousso.
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultWebGPUEnabled): Deleted.
* Shared/WebPreferencesDefaultValues.h:
2021-07-29 Carlos Alberto Lopez Perez <clopez@igalia.com>
[WPE][GTK] build broken with python2 after r280382
https://bugs.webkit.org/show_bug.cgi?id=228629
Reviewed by Philippe Normand.
Call {PYTHON_EXECUTABLE} instead of python3. Our build currently
supports both versions of python (2 and 3). If the user wants
to force a specific version it can do that via the CMake argument
-DPYTHON_EXECUTABLE=/path/to/python/interpreter
No new tests, is a build fix.
* PlatformGTK.cmake:
* PlatformWPE.cmake:
2021-07-29 Jer Noble <jer.noble@apple.com>
[macOS|AS] VTImageRotationSession returns a kVTImageRotationNotSupportedErr, breaks painting rotated videos
https://bugs.webkit.org/show_bug.cgi?id=228620
Reviewed by Per Arne Vollan.
Error is thrown from ImageRotationSessionVT, forcing WebKit to go down software rotation path.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-07-29 Devin Rousso <drousso@apple.com>
[Payment Request] `additionalShippingMethods` are not used if a `paymentMethodType` is provided
https://bugs.webkit.org/show_bug.cgi?id=228599
<rdar://problem/81190366>
Reviewed by Andy Estes.
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
* Platform/cocoa/PaymentAuthorizationPresenter.mm:
(WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection):
(WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection):
Also convert and set the `shippingMethods` on the update.
2021-07-29 Kate Cheney <katherine_cheney@apple.com>
REGRESSION (r278877) [Cocoa] WebAuthn stopped working for non-Safari browsers
https://bugs.webkit.org/show_bug.cgi?id=228116
<rdar://problem/80693607>
Patch by Brent Fulgham.
Reviewed by Per Arne Vollan.
We should not be using the PAC key to confirm a valid WebContent process is the source of
WebAuthn-related messages. Instead, we should confirm the message source is an Apple-signed
executable, and that the signining identity is for the WebContent process.
* Shared/Cocoa/CodeSigning.h: Renamed from Source/WebKit/Shared/mac/CodeSigning.h.
* Shared/Cocoa/CodeSigning.mm: Renamed from Source/WebKit/Shared/mac/CodeSigning.mm.
(WebKit::codeSigningIdentifier):
(WebKit::codeSigningIdentifierForCurrentProcess):
(WebKit::currentProcessIsPlatformBinary):
(WebKit::codeSigningIdentifierAndPlatformBinaryStatus):
* Shared/Cocoa/XPCEndpoint.mm:
(WebKit::XPCEndpoint::XPCEndpoint):
* SourcesCocoa.txt:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::messageSourceIsValidWebContentProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getWebAuthnProcessConnection):
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebProcessProxyMac.mm:
* WebKit.xcodeproj/project.pbxproj:
2021-07-29 Peng Liu <peng.liu6@apple.com>
The bundle path of downlevel Safari is wrong
https://bugs.webkit.org/show_bug.cgi?id=228339
Reviewed by Tim Horton.
Use the same approach as `isSystemWebKit` to check whether the WebKit bundle
is from the staged framework.
* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::isFeatureFlagEnabled):
2021-07-29 Kate Cheney <katherine_cheney@apple.com>
CORS preflight checks not attributed to the correct application
https://bugs.webkit.org/show_bug.cgi?id=228585
<rdar://problem/81220151>
Reviewed by Alex Christensen.
We use _attributedBundleIdentifier to attribute loads to the correct
application. This parameter is set on each NSURLSession in the per-page
session sets. This patch sets the webPageProxyID for CORS preflight check
in the load parameters so the network data task knows to use the per-page
session set, so the loads get attributed to the right application.
* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::startPreflight):
2021-07-29 Peng Liu <peng.liu6@apple.com>
[macOS Catalina] Some feature preferences have wrong default values
https://bugs.webkit.org/show_bug.cgi?id=228564
Reviewed by Tim Horton.
When `HAVE(SYSTEM_FEATURE_FLAGS)` is false, we still need to enable
some features by default.
This patch makes sure the following features are enabled by default
on macOS (consistent with the properties in WebKit-macos.plist):
- async_frame_and_overflow_scrolling
- gpu_process_canvas_rendering
- gpu_process_media
- gpu_process_webrtc
- incremental_pdf
- vp9_decoder
- webm_format_reader
- webm_parser
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
(WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
(WebKit::defaultUseGPUProcessForMediaEnabled):
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
(WebKit::defaultCaptureVideoInGPUProcessEnabled):
(WebKit::defaultWebRTCCodecsInGPUProcess):
(WebKit::defaultIncrementalPDFEnabled):
(WebKit::defaultWebMFormatReaderEnabled):
2021-07-29 Youenn Fablet <youenn@apple.com>
NetworkRTCUDPSocketCocoaConnections nw_listener_set_state_changed_handler callback should hold a reference to its listener
https://bugs.webkit.org/show_bug.cgi?id=228551
<rdar://81137047>
Reviewed by Alex Christensen.
nw_listener is not guaranteed to stay valid when calling the state change callback.
We need to hold a reference to the listener in the callback.
To prevent memory leaks, the callback will clear its listener reference when entering cancelled state.
The cancelled state is guaranteed to happen when calling cancel in the listener, which happens when closing the socket.
Covered by existing tests.
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
2021-07-29 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, late July 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=228579
Unreviewed non-unified build fixes.
* NetworkProcess/IndexedDB/WebIDBServer.cpp: Add missing "Logging.h" header.
* NetworkProcess/NetworkBroadcastChannelRegistry.cpp: Add missing
<WebCore/MessageWithMessagePorts.h> header.
* NetworkProcess/NetworkConnectionToWebProcess.cpp: Add missing
"NetworkBroadcastChannelRegistry.h" header.
* UIProcess/gtk/WebDateTimePickerGtk.cpp:
(WebKit::timeToString): Add missing WebCore:: namespace prefix to usages of constants of the
WebCore::SecondFormat enum.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Add missing
<WebCore/FrameView.h> header.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: Add missing
<WebCore/RenderView.h> header.
* WebProcess/gtk/GtkSettingsManagerProxy.cpp: Add missing "WebCore.h" header.
2021-07-28 Jean-Yves Avenard <jya@apple.com>
[WebAudio] Add webm/opus container support
https://bugs.webkit.org/show_bug.cgi?id=227110
<rdar://problem/79437067>
Reviewed by Jer Noble.
Add default value for webm_webaudio feature flag for the different platforms.
Disabled by default on all platforms.
Fly-by fix: don't make webm parser dependent on VP9 support.
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultWebMWebAudioEnabled):
* Shared/WebPreferencesDefaultValues.h:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
2021-07-28 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Start tracking resource uses for ImageBuffers
https://bugs.webkit.org/show_bug.cgi?id=228225
Reviewed by Said Abou-Hallawa.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::cacheImageBuffer):
(WebKit::RemoteResourceCacheProxy::cachedImageBuffer):
(WebKit::RemoteResourceCacheProxy::releaseImageBuffer):
(WebKit::RemoteResourceCacheProxy::recordImageBufferUse):
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-07-28 Aditya Keerthi <akeerthi@apple.com>
[iOS] <select> picker value committed to incorrect element after programmatic focus change
https://bugs.webkit.org/show_bug.cgi?id=228556
rdar://81222952
Reviewed by Wenson Hsieh.
The old <select> picker is a UIPickerView that only commits any value
changes to the WebProcess once the user dismisses the picker, or focus
is lost programmatically. Currently, the value change is committed by
sending a message to the WebProcess, telling it to update the value of
the currently focused element. However, when focus is changed
programmatically, the focused element in the WebProcess is updated
before the commit, and the incorrect element's value can be changed.
To fix, update all methods which commit value changes to the focused
element to take an ElementContext parameter representing the element
that needs its value modified. Then, in the WebProcess, rather than
commit the value change to the currently focused element, retrieve the
element from the ElementContext, ensuring the correct element is
updated.
Note that this bug only surfaces in the old <select> picker, on apps
linked before iOS 13, since the new picker commits value changes
immediately and dismisses itself.
Test: fast/forms/ios/select-picker-change-and-focus-another-select-programmatically.html
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView accessoryClear]):
(-[WKContentView updateFocusedElementValueAsNumber:]):
(-[WKContentView updateFocusedElementValue:]):
(-[WKContentView updateFocusedElementValueAsColor:]):
(-[WKContentView updateFocusedElementSelectedIndex:allowsMultipleSelection:]):
(-[WKContentView insertTextSuggestion:]):
(-[WKContentView selectMenu:didSelectItemAtIndex:]):
(-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setFocusedElementValue):
(WebKit::WebPageProxy::setFocusedElementValueAsNumber):
(WebKit::WebPageProxy::setFocusedElementSelectedIndex):
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker reset:]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker pickerView:row:column:checked:]):
(-[WKSelectSinglePicker controlEndEditing]):
(-[WKSelectPicker didSelectOptionIndex:]):
(-[WKSelectPickerTableViewController tableView:didSelectRowAtIndexPath:]):
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setFocusedElementValue):
(WebKit::WebPage::setFocusedElementValueAsNumber):
(WebKit::WebPage::setFocusedElementSelectedIndex):
2021-07-28 Tim Horton <timothy_horton@apple.com>
iOS Simulator doesn't have any WebKit system feature flags
https://bugs.webkit.org/show_bug.cgi?id=228557
rdar://80991854
Reviewed by Darin Adler.
* Scripts/generate-feature-flags-plist.sh:
Install iOS feature flags for the simulator (and watchOS and tvOS for their respective simulators).
This was causing on-by-default features like GPUP to be disabled in the simulator.
2021-07-28 Alex Christensen <achristensen@webkit.org>
WebSocket: Safari on iOS 15 beta 3 is sending invalid close frame
https://bugs.webkit.org/show_bug.cgi?id=228329
Reviewed by Youenn Fablet.
Our NSURLSession WebSocket implementation had two bugs:
1. It was sending 1005 as the close code if none was specified.
It now sends no close code, which matches Chrome and Firefox.
2. It was not sending a close code before the close reason when a WebSocket is closed due to navigation.
It now sends the close code in 2 bytes before the reason, which matches Chrome and Firefox.
Side note: our CFReadStream/CFWriteStream implementation sent neither the code nor the reason
in this case, which matches no other browser.
Covered by an API test.
* NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
(WebKit::WebSocketTask::close):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::fail):
(WebKit::WebSocketChannel::disconnect):
2021-07-28 Philippe Normand <pnormand@igalia.com>
[WPE][GTK] SVN_REVISION drifting away if bots don't re-run cmake
https://bugs.webkit.org/show_bug.cgi?id=228290
Reviewed by Michael Catanzaro.
* PlatformGTK.cmake: Expand ${BUILD_REVISION} with apply-build-revision-to-files.py for
non-tarball builds, or let CMake do it for tarball builds.
* PlatformWPE.cmake: Ditto.
* UIProcess/API/glib/WebKitProtocolHandler.cpp:
(WebKit::WebKitProtocolHandler::handleGPU): Use generated BuildRevision.h header
* gtk/webkit2gtk-web-extension.pc.in: Switch revision var to ${} format, so that we can choose to
either let CMake expand it or do it ourselves.
* gtk/webkit2gtk.pc.in: Ditto.
2021-07-27 Devin Rousso <drousso@apple.com>
[Modern Media Controls] [macOS] Overflow button still shows as `on` even after contextmenu is dismissed
https://bugs.webkit.org/show_bug.cgi?id=228310
<rdar://problem/81124786>
Reviewed by Wenson Hsieh.
Pipe along the `-[NSMenuDelegate menuDidClose:]` signal to the WebProcess so the `WebCore::ContextMenuProvider`
can handle it if needed.
* UIProcess/WebContextMenuProxy.cpp:
(WebKit::WebContextMenuProxy::useContextMenuItems):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(-[WKMenuDelegate menuWillOpen:]):
(-[WKMenuDelegate menuDidClose:]):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showContextMenu):
(WebKit::WebPageProxy::didShowContextMenu):
(WebKit::WebPageProxy::didDismissContextMenu): Added.
* WebProcess/WebPage/WebContextMenu.cpp:
(WebKit::WebContextMenu::show):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::startWaitingForContextMenuToShow): Added.
(WebKit::WebPage::contextMenuShowing): Deleted.
(WebKit::WebPage::contextMenuHidden): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didShowContextMenu): Added.
(WebKit::WebPage::didDismissContextMenu): Added.
(WebKit::WebPage::mouseEvent):
Drive-by: Rename `m_contextMenuShowing` to `m_waitingForContextMenuToShow` for clarity.
2021-07-27 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Code cleanup after r280356
https://bugs.webkit.org/show_bug.cgi?id=228495
Reviewed by Wenson Hsieh.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::putPixelBuffer):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::recordNativeImageUse):
(WebKit::RemoteResourceCacheProxy::recordFontUse):
(WebKit::RemoteResourceCacheProxy::cacheNativeImage): Deleted.
(WebKit::RemoteResourceCacheProxy::cacheFont): Deleted.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-07-27 Aditya Keerthi <akeerthi@apple.com>
[iOS] REGRESSION: Tapping a <select> element does not show a menu on many websites
https://bugs.webkit.org/show_bug.cgi?id=228340
rdar://77137768
Reviewed by Wenson Hsieh.
Many sites add a touchend event listener to their select elements, that
is responsible for focusing the element. With the introduction of
asynchronous touch events, the single tap gesture recognizer can be
deferred to the point it occurs after the UIProcess is notified that an
element has been focused. This is problematic, since the UIProcess
creates and displays inputs peripherals in response to element focus,
but the gesture recognizer can dismiss presented peripherals via
`-[WKFormPeripheral endEditing]`. Consequently, many sites immediately
display and dismiss the input peripheral.
To fix, only call `-[WKFormPeripheral endEditing]` if the peripheral
was already being displayed once the tap gesture began. This ensures we
do not immediately display and dismiss peripherals.
Note that with the redesigned form controls, the call to `endEditing` is
unnecessary, as the presented views handle their own dismissal. However,
the logic is still needed for the old select control (using a keyboard
input view), to commit value changes. The old control is displayed on
apps linked against iOS 13 or earlier. This behavior is tested in
fast/forms/ios/select-picker-change-and-focus-another-select.html.
Test: fast/forms/ios/form-control-refresh/select/focus-select-in-touchend.html
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _singleTapIdentified:]):
(-[WKContentView _singleTapRecognized:]):
* UIProcess/ios/forms/WKFormPeripheral.h:
* UIProcess/ios/forms/WKFormPeripheralBase.h:
2021-07-27 Peng Liu <peng.liu6@apple.com>
Safari hangs when entering PiP from (element) fullscreen
https://bugs.webkit.org/show_bug.cgi?id=228332
Reviewed by Eric Carlson.
When a video element's ancestor element is in fullscreen and the video element
is entering picture-in-picture, `WKFullScreenWindowController` in the UI process
will notify the WebContent process that the ancestor element needs to exit fullscreen.
However, some sites call `document.webkitExitFullscreen()` to request the ancestor
element to exit fullscreen proactively. Both WebContent process and UI process will
try to do the same thing and may lead to a race condition.
That was not an issue before r274460 because `WebFullScreenManager::requestExitFullScreen()`
will ignore the request from the UI process if the WebContent process has already
started the steps to exit fullscreen.
This patch stops the UI process sending the exit fullscreen request if a WebContent
process has started the steps to exit fullscreen.
Manually tested.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController didEnterPictureInPicture]):
2021-07-27 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Start tracking resource uses for NativeImages and Fonts
https://bugs.webkit.org/show_bug.cgi?id=228224
Reviewed by Said Abou-Hallawa.
This patch extends the existing resource tracking HashMaps used in RemoteResourceCacheProxy to continue
to record what they were recording before, but also include this new resource use count information.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::~RemoteResourceCacheProxy):
(WebKit::RemoteResourceCacheProxy::cacheNativeImage):
(WebKit::RemoteResourceCacheProxy::cacheFont):
(WebKit::RemoteResourceCacheProxy::releaseNativeImage):
(WebKit::RemoteResourceCacheProxy::clearFontMap):
(WebKit::RemoteResourceCacheProxy::finalizeRenderingUpdateForFonts):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-07-27 Peng Liu <peng.liu6@apple.com>
The bundle path of downlevel Safari is wrong
https://bugs.webkit.org/show_bug.cgi?id=228339
Reviewed by Jer Noble.
Fix the bundle path. The correct path is "/Library/Apple/System/Library/StagedFrameworks/Safari".
* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::isFeatureFlagEnabled):
2021-07-27 Saagar Jha <saagar@saagarjha.com>
Fix WebProcess sandbox profile when ENABLE_SANDBOX_MESSAGE_FILTER is disabled
https://bugs.webkit.org/show_bug.cgi?id=228220
Reviewed by Per Arne Vollan.
A couple of new filters turn into empty lists when ENABLE_SANDBOX_MESSAGE_FILTER is NO;
we shouldn't be evaluating them at all, so we need to move the check out.
* WebProcess/com.apple.WebProcess.sb.in: Factor the conditional check out of the filters.
2021-07-26 Said Abou-Hallawa <said@apple.com>
Regulate the WebPage RenderingUpdates from the WebProcess to the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=227791
<rdar://78430639>
Reviewed by Simon Fraser.
This is the workflow to regulate the WebPage RenderingUpdates:
-- WebPage::finalizeRenderingUpdate() calls RemoteRenderingBackendProxy::
finalizeRenderingUpdate().
-- RemoteRenderingBackendProxy::finalizeRenderingUpdate() sends its
renderingUpdateID to GPUPProcess and asks it to process all the
pending DisplayList items.
-- RemoteRenderingBackend::finalizeRenderingUpdate) processes all the
pending items and sends the received renderingUpdateID back to the
WebProcess.
-- RemoteRenderingBackendProxy::didFinalizeRenderingUpdate() stores the
received didRenderingUpdateID.
-- RemoteRenderingBackendProxy::delayedRenderingUpdateCount() returns
'renderingUpdateID - didRenderingUpdateID' which is the number of
un-processed finalizeRenderingUpdate by GPUP.
-- WebPage::canTriggerRenderingUpdate() uses delayedRenderingUpdateCount()
to decides whether the current RenderingUpdate can be triggered or
should be rescheduled.
-- RenderingUpdateScheduler::displayRefreshFired() calls
WebPage::canTriggerRenderingUpdate() through the page chrome client.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::submit):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Shared/MonotonicObjectIdentifier.h: Copied from Source/WebKit/Shared/TransactionID.h.
(WebKit::MonotonicObjectIdentifier::MonotonicObjectIdentifier):
(WebKit::MonotonicObjectIdentifier::isHashTableDeletedValue const):
(WebKit::MonotonicObjectIdentifier::encode const):
(WebKit::MonotonicObjectIdentifier::decode):
(WebKit::MonotonicObjectIdentifier::operator== const):
(WebKit::MonotonicObjectIdentifier::operator> const):
(WebKit::MonotonicObjectIdentifier::operator>= const):
(WebKit::MonotonicObjectIdentifier::operator< const):
(WebKit::MonotonicObjectIdentifier::operator<= const):
(WebKit::MonotonicObjectIdentifier::operator!= const):
(WebKit::MonotonicObjectIdentifier::increment):
(WebKit::MonotonicObjectIdentifier::next const):
(WebKit::MonotonicObjectIdentifier::toUInt64 const):
(WebKit::MonotonicObjectIdentifier::operator bool const):
(WebKit::MonotonicObjectIdentifier::loggingString const):
(WebKit::MonotonicObjectIdentifier::hashTableDeletedValue):
(WebKit::MonotonicObjectIdentifier::isValidIdentifier):
(WebKit::operator<<):
* Shared/RenderingUpdateID.h: Added.
* Shared/TransactionID.h:
(WebKit::MonotonicObjectIdentifier::MonotonicObjectIdentifier): Deleted.
(WebKit::MonotonicObjectIdentifier::isHashTableDeletedValue const): Deleted.
(WebKit::MonotonicObjectIdentifier::encode const): Deleted.
(WebKit::MonotonicObjectIdentifier::decode): Deleted.
(WebKit::MonotonicObjectIdentifier::operator== const): Deleted.
(WebKit::MonotonicObjectIdentifier::operator> const): Deleted.
(WebKit::MonotonicObjectIdentifier::operator>= const): Deleted.
(WebKit::MonotonicObjectIdentifier::operator< const): Deleted.
(WebKit::MonotonicObjectIdentifier::operator<= const): Deleted.
(WebKit::MonotonicObjectIdentifier::operator!= const): Deleted.
(WebKit::MonotonicObjectIdentifier::increment): Deleted.
(WebKit::MonotonicObjectIdentifier::next const): Deleted.
(WebKit::MonotonicObjectIdentifier::toUInt64 const): Deleted.
(WebKit::MonotonicObjectIdentifier::operator bool const): Deleted.
(WebKit::MonotonicObjectIdentifier::loggingString const): Deleted.
(WebKit::MonotonicObjectIdentifier::hashTableDeletedValue): Deleted.
(WebKit::MonotonicObjectIdentifier::isValidIdentifier): Deleted.
(WebKit::operator<<): Deleted.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose):
(WebKit::RemoteRenderingBackendProxy::finalizeRenderingUpdate):
(WebKit::RemoteRenderingBackendProxy::didFinalizeRenderingUpdate):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::renderingUpdateID const):
(WebKit::RemoteRenderingBackendProxy::delayedRenderingUpdateCount const):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in:
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::cacheFont):
(WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate):
(WebKit::RemoteResourceCacheProxy::clearFontMap):
(WebKit::RemoteResourceCacheProxy::finalizeRenderingUpdateForFonts):
(WebKit::RemoteResourceCacheProxy::finalizeRenderingUpdate):
(WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate): Deleted.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::canTriggerRenderingUpdate const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::canTriggerRenderingUpdate const):
(WebKit::WebPage::finalizeRenderingUpdate):
* WebProcess/WebPage/WebPage.h:
2021-07-26 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS Monterey] Pressing Fn+E should present the emoji picker when editing
https://bugs.webkit.org/show_bug.cgi?id=228300
rdar://77558672
Reviewed by Tim Horton.
In macOS Monterey, the system-wide Fn+E key command presents the Emoji & Symbols UI as a popover. However, this
new key command currently does not work in editable contexts in both WebKit1 and WebKit2 views on macOS, where
we end up just inserting the character "e".
This is because, on both ports, we attempt to interpret NSEvents by calling back into AppKit to handle the
event, recording the selectors that *would've* been performed, and then using this information to build up a
list of WebCore::KeyCommand for the event (which are later converted into editing commands). In WebKit2, we
call into `-[NSTextInputContext handleEventByKeyboardLayout:]` to handle the event, and capture the resulting
calls back into `WKWebView` by storing entries in `m_collectedKeypressCommands` (something similar happens in
WebKit1). In the case of these new Fn commands, they are handled by the system before entering
NSTextInputContext, so NSTextInputContext ends up handling them as regular text insertion.
As an aside, the reason the meta (⌘) key doesn't encounter this problem is because meta, option, control and
shift are considered valid key bindings in NSKeyBindingManager, whereas the function key mask is specifically
excluded from this list for compability reasons. NSTextInputContext consults NSKeyBindingManager in order to
check whether the given NSEvent is a known key binding in `-handleEventByKeyboardLayout:`, so it fails to
acknowledge Fn+E as a key binding.
To work around this, we adopt new AppKit SPI added in rdar://81123724 to determine whether an NSEvent maps to
any main menu items and avoid handling "Fn-*" key events as text insertion if they already map to items in the
main menu.
Test: KeyboardEventTests.FunctionKeyCommand
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::collectKeyboardLayoutCommandsForEvent):
2021-07-26 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Add resource use counter infrastructure to RemoteResourceCache
https://bugs.webkit.org/show_bug.cgi?id=228222
Reviewed by Said Abou-Hallawa.
This patch adds the infrastructure for associating a counter with each resource in the RemoteResourceCache.
As the web process uses a resource during display list recording, it increments a counter, and as the GPU
process uses a resource, it increments a counter in the RemoteResourceCache. When the web process is done
with a resource, it sends a release message to the GPU process which crucially includes the web process's
counter. The GPU process has to then wait to actually delete the resource until its own use counter matches
the one it received from the web process. This patch implements this deferred deletion infrastructure
in the GPU process.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::ReplayerDelegate::recordResourceUse):
(WebKit::RemoteRenderingBackend::releaseRemoteResource): Pass the use count to the RemoteResourceCache.
* GPUProcess/graphics/RemoteRenderingBackend.h: Add the use count field.
* GPUProcess/graphics/RemoteRenderingBackend.messages.in: Ditto.
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::cacheImageBuffer): It's actually okay if there's already an resource cached.
That just means that the web process started using a resource again before the GPU process consumed all
commands that used it the first time. All we need to do is increment the open count.
(WebKit::RemoteResourceCache::cacheNativeImage): Ditto.
(WebKit::RemoteResourceCache::cacheFont): Ditto.
(WebKit::RemoteResourceCache::ensureResourceUseCounter):
(WebKit::RemoteResourceCache::maybeRemoveResource): This is called whenever it's possible for us to be in
situation where we should be removing a resource (aka whenever the use count increments). It checks to see
if we can remove the resource, and if it can, does so.
(WebKit::RemoteResourceCache::recordResourceUse): The callback that runs for each resource use during
replaying. It can't actually delete any resources, so instead it just records which resources had their
use counts incremented, and waits for prune() to actually call maybeRemoveResource().
(WebKit::RemoteResourceCache::prune): After the replay is complete, call maybeRemoveResource() on all the
resources which had their use counters touched.
(WebKit::RemoteResourceCache::releaseRemoteResource): Put the relevant resource into the state where we
are waiting for the use counters to match before we can delete the resource. Also, call maybeRemoveResource()
so it can be deleted immediately if the counters already match.
* GPUProcess/graphics/RemoteResourceCache.h: Add a new data structure to hold the use counters. There's
a big comment in here that describes what these fields mean.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): Send a dummy use count for now. This will be
implemented in a follow-up patch.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): Add the useCount parameter.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: Ditto.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::releaseNativeImage): Send a dummy use count for now. This will be
implemented in a follow-up patch.
(WebKit::RemoteResourceCacheProxy::clearFontMap): Ditto.
(WebKit::RemoteResourceCacheProxy::finalizeRenderingUpdateForFonts): Ditto.
2021-07-26 Jer Noble <jer.noble@apple.com>
REGRESSION: [iOS] ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::RemoteAudioHardwareListener::~RemoteAudioHardwareListener()
https://bugs.webkit.org/show_bug.cgi?id=228038
<rdar://problem/80705471>
Reviewed by Chris Dumez.
Remove RemoteAudioHardwareListener from the GPUProcessConnection messageMap when the connection closes.
* WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:
(WebKit::RemoteAudioHardwareListener::gpuProcessConnectionDidClose):
2021-07-26 Jer Noble <jer.noble@apple.com>
[Cocoa] WebKit is making GroupActivities API calls for all WebKit clients
https://bugs.webkit.org/show_bug.cgi?id=228299
<rdar://80802982>
Reviewed by Eric Carlson.
Tie registering for GroupActivities notifications to the MediaSessionCoordinatorEnabled
WebPreference, and make the default value for that preference depend on having the
"com.apple.developer.group-session.urlactivity" entitlement. All WebKit clients with
that entitlement will have the preference enabled by default; all other clients will
have that preference disabled by default.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultMediaSessionCoordinatorEnabled):
* Shared/WebPreferencesDefaultValues.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPageProxy::~WebPageProxy):
(WebKit::WebPageProxy::didCommitLoadForFrame):
2021-07-26 Jer Noble <jer.noble@apple.com>
REGRESSION: [iOS] ASSERTION FAILED: !m_useCount in WebKit::SandboxExtension::~SandboxExtension()
https://bugs.webkit.org/show_bug.cgi?id=228171
<rdar://problem/80926509>
Reviewed by Eric Carlson.
SandboxExtension expects to be revoked before it is destroyed, something that is done by
RemoteMediaPlayerProxy::invalidate(). However, invalidate() won't be called if the
RemoteMediaPlayerManagerProxy is destroyed before all its proxies are invalidated.
Ensure every RemoteMediaPlayerProxy contained by the RemoteMediaPlayerManagerProxy is
invalidated in RemoteMediaPlayerManagerProxy's destructor.
* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::~RemoteMediaPlayerManagerProxy):
* GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
2021-07-26 Alex Christensen <achristensen@webkit.org>
WKUserContentController.removeAllScriptMessageHandlers() doesn't release the message handlers
https://bugs.webkit.org/show_bug.cgi?id=228271
Reviewed by Sihui Liu.
Covered by an API test.
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2021-07-26 Per Arne <pvollan@apple.com>
The layout test fast/images/heic-as-background-image.html is a constant failure
https://bugs.webkit.org/show_bug.cgi?id=228195
<rdar://80334724>
Reviewed by Said Abou-Hallawa.
Call correct system function for required initialization.
No new tests, covered by existing test.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-07-26 Kate Cheney <katherine_cheney@apple.com>
Attribution context causes some performance regressions
https://bugs.webkit.org/show_bug.cgi?id=228294
Unreviewed followup to address Darin's comment regarding unnecessary
semi-colons.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(processPCMRequest):
(overrideAttributionContext):
2021-07-26 Kate Cheney <katherine_cheney@apple.com>
Attribution context causes some performance regressions
https://bugs.webkit.org/show_bug.cgi?id=228294
<rdar://problem/76663528>
Reviewed by Per Arne Vollan.
Attribution context is used by the networking stack for a variety of
purposes, but is not always needed and can negatively affect
performance. For these reasons, we should override it in some cases.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(overrideAttributionContext):
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2021-07-26 Jer Noble <jer.noble@apple.com>
[Cocoa] Playback stalls on bilibili.com
https://bugs.webkit.org/show_bug.cgi?id=228239
<rdar://80419477>
Reviewed by Eric Carlson.
Replace rate() -> effectiveRate().
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerRateChanged):
2021-07-26 Chris Dumez <cdumez@apple.com>
Make sure the ProcessAssertion gets destroyed on the main thread
https://bugs.webkit.org/show_bug.cgi?id=228281
<rdar://81048308>
Reviewed by Geoffrey Garen.
Follow-up to r279877 to make sure that the ProcessAssertion gets destroyed on the main thread in
ProcessAssertion::acquireAsync(), even if the completionHandler is null.
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::acquireAsync):
2021-07-26 Jer Noble <jer.noble@apple.com>
[iOS] All home screen web apps resume when any home screen web app is foregrounded
https://bugs.webkit.org/show_bug.cgi?id=228246
<rdar://72949281>
Reviewed by Eric Carlson.
Add a private WKPreference for setting the new WebPreference.
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _requiresPageVisibilityToPlayAudio]):
(-[WKPreferences _setRequiresPageVisibilityToPlayAudio:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2021-07-26 Philippe Normand <pnormand@igalia.com>
[GTK] MiniBrowser crashes when closed while capturing desktop
https://bugs.webkit.org/show_bug.cgi?id=228232
Reviewed by Adrian Perez de Castro.
Disconnect the WebView from the WebPageProxy just before the final GObject dispose call, in
order to avoid UIClient notifications on the being-disposed WebView.
* UIProcess/API/glib/WebKitUIClient.cpp:
(detachUIClientFromView):
* UIProcess/API/glib/WebKitUIClient.h:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewDispose):
2021-07-25 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Unified field is unselected after focusing URL bar if text was selected in a fixed position container
https://bugs.webkit.org/show_bug.cgi?id=228269
rdar://80556392
Reviewed by Tim Horton.
In Safari on iOS 15, if the selection (either ranged or caret) is inside a fixed position container when the
user taps on the unified field, we'll immediately clear the text selection inside the unified field upon
bringing up the keyboard. This happens because the tab pill in iOS 15 is lowered as the URL bar is focused,
which causes the web view to scroll slightly. This, in turn, induces a brief unstable scrolling tree state,
which then causes us to temporarily hide and show selection views while scrolling in unstable state (see
r209931) by calling `-deactivateSelection` and then `-activateSelection` on the text interaction assistant.
Calling `-[UIWKTextInteractionAssistant activateSelection]` then causes UIKit to dispatch a
UITextSelectionViewActivatedNotification; In the unified field, which is a UITextField subclass, UIKit code then
listens for this notification and responds to it by clearing the selection if the newly activated selection's
host view (WKContentView) is different than itself, thereby causing the bug.
To fix this, we simply make two (minor) adjustments to the logic for temporarily hiding and showing the
selection while performing an unstable scroll. See below for more details.
Test: editing/selection/ios/scrolling-with-fixed-selection-does-not-unselect-native-text-field.html
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView shouldHideSelectionWhenScrolling]):
Only hide and (later) restore the selection in non-editable text if the selection is ranged. This is because
caret selections in non-editable content are not user-visible anyways, so there's no need to temporarily
suppress the selection.
(-[WKContentView _updateChangedSelection:]):
Only attempt to show the selection views again if doing so doesn't cause us to steal first responder status away
from the existing first responder; otherwise, we'll wait until we `-becomeFirstResponder` to `-activateSelection`.
(-[WKContentView selectionInteractionAssistant]): Deleted.
2021-07-24 Devin Rousso <drousso@apple.com>
[Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
https://bugs.webkit.org/show_bug.cgi?id=228243
Reviewed by Wenson Hsieh.
* Platform/cocoa/PaymentAuthorizationPresenter.mm:
(WebKit::toPKPaymentErrorCode):
2021-07-24 Devin Rousso <drousso@apple.com>
[iOS] REGRESSION(r277505): `-[WKWebView underPageBackgroundColor]` also changes the scroll bar color
https://bugs.webkit.org/show_bug.cgi?id=228259
<rdar://problem/80116822>
Reviewed by Tim Horton.
If an application overrides the `-underPageBackgroundColor` with a dark color on a page that
has a light background color, the scroll bar will appear light to match the overridden value
of `-underPageBackgroundColor` instead of dark to match the page's background color.
Test: WKWebViewUnderPageBackgroundColor.MatchesScrollView
* UIProcess/API/ios/WKWebViewIOS.mm:
(baseScrollViewBackgroundColor):
(scrollViewBackgroundColor):
(-[WKWebView _updateScrollViewBackground]):
Add a flag to indicate whether the `underPageBackgroundColor` (which can be overridden by
API) or `pageExtendedBackgroundColor` should be used when calculating the value provided to
`-[UIScrollView setBackgroundColor:]` and `-[UIScrollView setIndicatorStyle:]`. The former
uses the `underPageBackgroundColor` since that is why that API exists and the latter uses
the ``pageExtendedBackgroundColor` since it is based on what is shown in the page, which is
what the scroll bar is drawn on top of.
2021-07-23 Alex Christensen <achristensen@webkit.org>
Make WKContentRuleListStore respond to same selectors as _WKUserContentExtensionStore
https://bugs.webkit.org/show_bug.cgi?id=228253
<rdar://81038849>
Reviewed by Brian Weinstein.
We have an unfortunate situation where an old framework is calling code in a new framework that is giving it a WKContentRuleListStore
where it expects a _WKUserContentExtensionStore. As one of several mitigations for this problem, make the selectors able to be called.
Luckily it doesn't do much with the results. It just checks if they're null or not, and it passes any errors along. I added tests that do this.
* UIProcess/API/Cocoa/WKContentRuleListStore.mm:
(-[WKContentRuleListStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[WKContentRuleListStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[WKContentRuleListStore removeContentExtensionForIdentifier:completionHandler:]):
2021-07-23 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r279751): WebContent process often crashes when hovering over content on apple.com
https://bugs.webkit.org/show_bug.cgi?id=228247
rdar://81010093
Reviewed by Tim Horton.
After r279751, the snapshot fallback codepath I added in `createShareableBitmap` to handle the edge case of
fully transparent images causes us to now take snapshots when hovering over fully transparent video elements,
and attempt to recognize text in them. This is because RenderVideo is a RenderImage subclass without a cached
image, so we'll end up going down the transparent renderer codepath instead of bailing with a null bitmap.
However, since CachedImages are null for video elements, before we even get to VisionKit, we end up crashing
with a nullptr-deref inside `WebPage::requestTextRecognition`, which assumes that `RenderImage::cachedImage()`
is non-null.
To address this, we make two minor adjustments (see below).
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
Limit the snapshotting fallback to non-media images (i.e. non-RenderMedia).
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestTextRecognition):
Make this robust in the case where CachedImage is null, to avoid the possibility for similar crashes in the
future.
2021-07-23 Robert Jenner <Jenner@apple.com>
Unreviewed, reverting r280205.
Broke multiple WebAuthn tests.
Reverted changeset:
"REGRESSION (r278877) [Cocoa] WebAuthn stopped working for
non-Safari browsers"
https://bugs.webkit.org/show_bug.cgi?id=228116
https://commits.webkit.org/r280205
2021-07-23 Per Arne <pvollan@apple.com>
[macOS] Reduce sandbox logging
https://bugs.webkit.org/show_bug.cgi?id=228236
Reviewed by Tim Horton.
To improve performance, remove some sandbox logging in the WebContent process' sandbox.
* WebProcess/com.apple.WebProcess.sb.in:
2021-07-23 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] It should be possible to select contact AutoFill text suggestions in email and username fields
https://bugs.webkit.org/show_bug.cgi?id=228237
rdar://77299680
Reviewed by Tim Horton.
After the changes in r278957, WKTextInputListViewController now presents modern Quickboard text input UI, as
well as contact AutoFill suggestions provided by Safari. For email and username fields (for which we currently
use PUICQuickboardController), this means that there's no longer any reason to prefer showing
PUICQuickboardController over WKTextInputListViewController, since both use modern text input UI (with support
for keychain AutoFill suggestions), but only the latter additionally supports contact AutoFill suggestions.
As such, we should change these to use WKTextInputListViewController instead of PUICQuickboardController. Note
that because contact AutoFill suggestions do not encompass passwords, it still makes more sense to pop directly
into PUICQuickboardController for password fields.
* Platform/spi/watchos/PepperUICoreSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView createQuickboardTextInputContext]):
Drive-by fix: additionally populate the placeholder of the text field in WKTextInputListViewController with
the input label text of the focused element (i.e., either placeholder text, the ARIA label, title, or text
content of an associated label).
(canUseQuickboardControllerFor):
2021-07-23 Richard Houle <rhoule@apple.com>
WebSocket traffic should be correctly assigned to either Developer or User.
https://bugs.webkit.org/show_bug.cgi?id=227564
<rdar://problem/79307301>
Reviewed by Kate Cheney.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::createWebSocketTask):
2021-07-23 Sihui Liu <sihui_liu@apple.com>
Generate simulated crash when UI process fails to get network process connection
https://bugs.webkit.org/show_bug.cgi?id=228203
Reviewed by Geoffrey Garen.
To help diagnose the issue that web process sometimes fails to get connection to the network process
(rdar://80760179), as UI process should have more information about it than web process.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2021-07-23 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Migrate the DisplayList::Replayer::Delegate from RemoteImageBuffer to RemoteRenderingBackend
https://bugs.webkit.org/show_bug.cgi?id=228219
Reviewed by Wenson Hsieh.
This is part 1 of https://bugs.webkit.org/show_bug.cgi?id=228216.
For this task, we need to count resource uses:
1. As the recorder in the web process records DisplayList items which reference resources, those uses need to increment a counter.
2. As the replayer in the GPU process replays DisplayList items which reference resources, those uses need to increment a parallel counter.
The most natural place for the counters to live is in RemoteResourceCacheProxy and RemoteResourceCache, respectively. These two classes
are accessible from the RemoteRenderingBackendProxy and RemoteRenderingBackend, respectively. The most natural interface between the
DisplayList classes like DisplayList::Recorder and DisplayList::Replayer and the higher level WebKit classes is to use their delegate
interfaces.
For 1 above, RemoteImageBufferProxy has access to the RemoteRenderingBackendProxy and is already a DisplayList::Recorder::Delegate, so
there's no problem there. However, for 2, messages are delivered first to the RemoteRenderingBackend, which is the place that has access to
the RemoteResourceCache. Making the RemoteRenderingBackend have the DisplayList::Replayer::Delegate would be a natural place to either
A) call the necessary function in the RemoteImageBuffer, or B) interact with the RemoteResourceCache to increment the necessary counter.
Indeed, this makes a lot of sense because, for 2 of the 3 delegate methods, RemoteImageBuffer just immediately turns around and forwards
the call to the RemoteRenderingBackend anyway. So, migrating this interface to RemoteRenderingBackend actually ends up making it a bit
simpler.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::apply):
(): Deleted.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::ReplayerDelegate::ReplayerDelegate):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::apply):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::didCreateMaskImageBuffer):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::didResetMaskImageBuffer):
(WebKit::RemoteRenderingBackend::submit):
* GPUProcess/graphics/RemoteRenderingBackend.h:
2021-07-22 Devin Rousso <drousso@apple.com>
[Live Text] [iOS] Analysis should also search for any App Clip codes
https://bugs.webkit.org/show_bug.cgi?id=228207
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView imageAnalysisGestureDidBegin:]):
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
2021-07-22 Aditya Keerthi <akeerthi@apple.com>
[iOS] Unable to open arxiv links on Chrome
https://bugs.webkit.org/show_bug.cgi?id=228205
rdar://78225849
Reviewed by Tim Horton.
-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:] currently
expects the width to be specified in pixels. However, the PDFKit SPI
used to snapshot a PDF expects a width in points. This led to WebKit
requesting extremely large snapshots, resulting in a crash in PDFKit.
To fix, use points instead of pixels in the PDF snapshotting path.
Also, ensure the scale factor of the returned image matches the
the scale used by PDFKit (the screen scale), as opposed to WebKit's
own "page" device scale factor, which can be overridden.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
* UIProcess/API/ios/WKWebViewIOS.mm:
2021-07-22 Brent Fulgham <bfulgham@apple.com>
REGRESSION (r278877) [Cocoa] WebAuthn stopped working for non-Safari browsers
https://bugs.webkit.org/show_bug.cgi?id=228116
<rdar://problem/80693607>
Reviewed by Per Arne Vollan.
We should not be using the PAC key to confirm a valid WebContent process is the source of
WebAuthn-related messages. Instead, we should confirm the message source is an Apple-signed
executable, and that the signining identity is for the WebContent process.
* Shared/Cocoa/CodeSigning.h: Renamed from Source/WebKit/Shared/mac/CodeSigning.h.
* Shared/Cocoa/CodeSigning.mm: Renamed from Source/WebKit/Shared/mac/CodeSigning.mm.
(WebKit::codeSigningIdentifier):
(WebKit::codeSigningIdentifierForCurrentProcess):
(WebKit::codeSigningIdentifierAndPlatformBinaryStatus): Added.
* Shared/Cocoa/XPCEndpoint.mm:
(WebKit::XPCEndpoint::XPCEndpoint): Update to use new method.
* SourcesCocoa.txt:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::messageSourceIsValidWebContentProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit:WebProcessProxy::getWebAuthnProcessConnection): Update for new message check name.
* UIProcess/WebProcessProxy.h:
* WebKit.xcodeproj/project.pbxproj:
2021-07-22 Brent Fulgham <bfulgham@apple.com>
REGRESSION (r277873, r280105): [macOS] Correct two sandbox typos (228201)
https://bugs.webkit.org/show_bug.cgi?id=228201
<rdar://problem/80983916>
Reviewed by Per Arne Vollan.
Correct two typos in the macOS Sandbox (WebContent process).
* WebProcess/com.apple.WebProcess.sb.in:
2021-07-22 Brady Eidson <beidson@apple.com>
Revert part of r279089 that was done a little bit too early.
<rdar://80663503> and https://bugs.webkit.org/show_bug.cgi?id=228174
Reviewed by Chris Dumez.
* Configurations/WebKit.xcconfig:
2021-07-22 Tim Horton <timothy_horton@apple.com>
REGRESSION (r279992): Crashes under RemoteLayerBackingStore::applyBackingStoreToLayer() in macCatalyst
https://bugs.webkit.org/show_bug.cgi?id=228181
rdar://80923581
Reviewed by Dan Bates.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
r279992 reorganized this code to determine the contents object and then
set it on the layer, instead of setting it directly; this means that the
lifetime of the contents object must be extended.
Interestingly, the common case (the CAMachPort case), as well as the
case I was actually adding in r279992 both were safe, because of the use
of autorelease. (macCatalyst uses IOSurface as layer contents directly,
without CAMachPort, so uses the one path that r279992 broke).
It is unnecessary to use autorelease; instead just store the contents
object in a RetainPtr until it is set.
2021-07-22 Megan Gardner <megan_gardner@apple.com>
Avoid Quick Note overlay when scrolling to show a highlight
https://bugs.webkit.org/show_bug.cgi?id=228172
Reviewed by Wenson Hsieh and Tim Horton.
When scrolling to show the selected highlight after clicking on one in the QuickNote overlay,
make sure to avoid the Quick Note overlay, so that the user can actually see the highlight.
This required calculating more information about the selection rect for iOS, and also piping through
information to have the selection rect be the entire rect, rather that just the caret and the end of selection.
* Platform/spi/Cocoa/SynapseSPI.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView adjustScrollRect:]):
(-[WKWebView _scrollToRect:origin:minimumScrollDistance:]):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::appHighlightsNoteOverlayRect):
* UIProcess/WebPageProxy.h:
2021-07-22 Philippe Normand <pnormand@igalia.com>
[GLib] Expose API to access/modify capture devices states
https://bugs.webkit.org/show_bug.cgi?id=227902
Reviewed by Carlos Garcia Campos.
Introduce new GLib API (and corresponding GObject properties):
webkit_web_view_get_camera_capture_state
webkit_web_view_get_microphone_capture_state
webkit_web_view_set_camera_capture_state
webkit_web_view_set_microphone_capture_state
webkit_web_view_get_display_capture_state
webkit_web_view_set_display_capture_state
webkit_user_media_permission_is_for_display_device
This can be useful in Web browsers willing to indicate the status of the capture devices
currently in use by the WebView.
Covered by API tests.
* UIProcess/API/glib/WebKitUIClient.cpp:
* UIProcess/API/glib/WebKitUserMediaPermissionRequest.cpp:
(webkit_user_media_permission_is_for_display_device):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewMediaCaptureStateDidChange):
(webkitWebViewSetProperty):
(webkitWebViewGetProperty):
(webkit_web_view_class_init):
(webkitWebViewConfigureMediaCapture):
(webkit_web_view_get_camera_capture_state):
(webkit_web_view_set_camera_capture_state):
(webkit_web_view_get_microphone_capture_state):
(webkit_web_view_set_microphone_capture_state):
(webkit_web_view_get_display_capture_state):
(webkit_web_view_set_display_capture_state):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitUserMediaPermissionRequest.h:
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h:
* UIProcess/API/wpe/WebKitWebView.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2021-07-22 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Pass the full target point when selecting a snap offset
https://bugs.webkit.org/show_bug.cgi?id=228023
Reviewed by Frédéric Wang.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping):
(WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
2021-07-21 Chris Dumez <cdumez@apple.com>
RunningBoard kills the network process if it is still holding the "holding locked file" assertion upon suspension
https://bugs.webkit.org/show_bug.cgi?id=228148
Reviewed by Sihui Liu.
RunningBoard kills the network process if it is still holding the "holding locked file" assertion upon suspension
because our assertion type is "uninterruptible" and we don't release it when it gets invalidated. To address the
issue, we now use an "interruptible" assertion instead when holding locked files.
* NetworkProcess/ios/NetworkProcessIOS.mm:
(WebKit::NetworkProcess::setIsHoldingLockedFiles):
* UIProcess/ProcessAssertion.h:
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::assertionName const):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didSetAssertionType):
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::runningBoardNameForAssertionType):
(WebKit::runningBoardDomainForAssertionType):
2021-07-21 Alex Christensen <achristensen@webkit.org>
Add linkedOnOrAfter check for r269162
https://bugs.webkit.org/show_bug.cgi?id=228154
Reviewed by Geoffrey Garen.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID):
2021-07-21 Chris Dumez <cdumez@apple.com>
REGRESSION (r278916): Hitting ASSERT(!m_db.m_transactionInProgress) in SQLiteTransaction::begin()
https://bugs.webkit.org/show_bug.cgi?id=228151
<rdar://80231894>
Reviewed by Geoffrey Garen.
Because it is hard to keep track of whether or not a transaction has already been started in
ResourceLoadStatisticsDatabaseStore code and because passing a transaction as parameter adds
a lot of function overloads, I decided to switch to another approach. I added a
beginTransactionIfNecessary() member function that begins a transaction if there isn't one
already going on. This way, we can safely ask to begin a transaction within the scope of
a function (if we're about to do several write statements), without having to worry about
whether or not our caller already started a transaction.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
(WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::merge):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
(WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
(WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
(WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearTopFrameUniqueRedirectsToSinceSameSiteStrictEnforcement):
(WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
(WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForAllButCookieDataRemoval):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
(WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
(WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
(WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
(WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
(WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::beginTransactionIfNecessary):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2021-07-21 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Allow the user to configure the MemoryPressureHandler inside the web process
https://bugs.webkit.org/show_bug.cgi?id=222738
Reviewed by Carlos Garcia Campos.
Add a new API type WebKitMemoryPressureSettings that can be used to configure the behavior
of the MemoryPressureHandler. Add a property to WebKitWebContext that can be used to pass
new settings to it, and store them inside its API::ProcessPoolConfiguration. Those settings
will be set to new web processes during the platform initialization stage.
* PlatformGTK.cmake:
* PlatformWPE.cmake:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/glib/WebKitMemoryPressureSettings.cpp: Added.
(webkit_memory_pressure_settings_new):
(webkit_memory_pressure_settings_copy):
(webkit_memory_pressure_settings_free):
(webkit_memory_pressure_settings_set_memory_limit):
(webkit_memory_pressure_settings_get_memory_limit):
(webkit_memory_pressure_settings_set_conservative_threshold):
(webkit_memory_pressure_settings_get_conservative_threshold):
(webkit_memory_pressure_settings_set_strict_threshold):
(webkit_memory_pressure_settings_get_strict_threshold):
(webkit_memory_pressure_settings_set_kill_threshold):
(webkit_memory_pressure_settings_get_kill_threshold):
(webkit_memory_pressure_settings_set_poll_interval):
(webkit_memory_pressure_settings_get_poll_interval):
(webkitMemoryPressureSettingsGetMemoryPressureHandlerConfiguration):
* UIProcess/API/glib/WebKitMemoryPressureSettingsPrivate.h: Added.
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextSetProperty):
(webkitWebContextConstructed):
(webkit_web_context_class_init):
* UIProcess/API/gtk/WebKitAutocleanups.h:
* UIProcess/API/gtk/WebKitMemoryPressureSettings.h: Added.
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/webkit2.h:
* UIProcess/API/wpe/WebKitAutocleanups.h:
* UIProcess/API/wpe/WebKitMemoryPressureSettings.h: Added.
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
* UIProcess/API/wpe/webkit.h:
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-07-21 Aditya Keerthi <akeerthi@apple.com>
Crash in -[WKWebView takeSnapshotWithConfiguration:completionHandler:] when taking empty snapshots
https://bugs.webkit.org/show_bug.cgi?id=228134
rdar://80146087
Reviewed by Chris Dumez.
r279006 made it so that taking empty snapshots would no longer crash due
to division by zero, or assertions on the size of the returned image.
However, the change introduced a new crash, as a result of a deallocated
completionHandler. r279006 move-captured the completion handler. However,
since completionHandler is an Objective-C block, and WebKit is built
without ARC, the move does not retain the block. Consequently, the
method can call a deallocated completion handler.
To fix, capture the local handler variable already available in the
method, which retains the completion handler using makeBlockPtr.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2021-07-21 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Theme scrollbar css is no longer respected
https://bugs.webkit.org/show_bug.cgi?id=228145
Reviewed by Michael Catanzaro.
Fix a fontName -> themeName typo.
* WebProcess/gtk/GtkSettingsManagerProxy.cpp:
(WebKit::GtkSettingsManagerProxy::applySettings):
2021-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r267763): [SOUP] After network process crash, all cookies are lost until browser is restarted
https://bugs.webkit.org/show_bug.cgi?id=228128
Reviewed by Adrian Perez de Castro.
Cookies configuration is no longer stored to be sent again to the new network process after a crash.
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const): Encode cookieAcceptPolicy.
(WebKit::NetworkSessionCreationParameters::decode): Decode cookieAcceptPolicy.
* NetworkProcess/NetworkSessionCreationParameters.h: Add cookieAcceptPolicy.
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup): Set cookie accept policy on NetworkStorageSession.
* UIProcess/API/glib/WebKitCookieManager.cpp:
(webkit_cookie_manager_set_persistent_storage): Use WebsiteDataStore API to cache the given values.
(webkit_cookie_manager_set_accept_policy): Ditto.
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
(WebKit::WebsiteDataStore::platformSetNetworkParameters): Set cached cookie settings to network session parameters.
(WebKit::WebsiteDataStore::setCookiePersistentStorage): Cache the given value and notify the cookie manager.
(WebKit::WebsiteDataStore::setHTTPCookieAcceptPolicy): Ditto.
* UIProcess/soup/WebCookieManagerProxySoup.cpp:
(WebKit::WebCookieManagerProxy::getCookiePersistentStorage const): Deleted.
2021-07-20 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Add SPI for internal clients to consult whether or not viewport quirks should be enabled
https://bugs.webkit.org/show_bug.cgi?id=228123
rdar://80397679
Reviewed by Dan Bernstein.
Rename the SPI added in r280119 from `-_needsSiteSpecificQuirks` to `-_needsSiteSpecificViewportQuirks`, to
clarify its intent (and importantly, to differentiate it from the existing WKPreferences SPI of the same name).
This distinction is important because this readonly property acts as a hint for WebKit clients to augment
certain viewport behaviors, whereas the readwrite WKPreferences property is a way for clients to indicate that
WebKit should opt in or out of site-specific quirks (unless overridden by Web Inspector).
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _needsSiteSpecificViewportQuirks]):
(-[WKWebView _needsSiteSpecificQuirks]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetStateAfterProcessTermination):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
2021-07-20 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Add SPI for internal clients to consult whether or not viewport quirks should be enabled
https://bugs.webkit.org/show_bug.cgi?id=228123
rdar://80397679
Reviewed by Tim Horton.
Add support for an SPI property on WKWebView that indicates whether site-specific quirks should be enabled.
For now, this flag is only updated whenever we commit a mainframe load, which is sufficient for the purposes of
Safari to determine whether or not to use quirked viewport behaviors for tab pill behavior.
If needed in the future, this property should probably:
1. Support KVO, and...
2. Change eagerly when the option is toggled via Web Inspector.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _needsSiteSpecificQuirks]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetStateAfterProcessTermination):
Maintain a corresponding flag on the WebPageProxy in the UI process, which starts out as `true` and is reset
if the web process terminates.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
Add plumbing to propagate changes in the boolean flag to the UI process.
(WebKit::WebPage::didCommitLoad):
Update the flag on WebPage.
* WebProcess/WebPage/WebPage.h:
2021-07-20 Kyle Piddington <kpiddington@apple.com>
REGRESSION(ANGLE+METAL): WebGL2 content low frame rate
https://bugs.webkit.org/show_bug.cgi?id=228012
Reviewed by Dean Jackson.
Add Additional rules, allowing shared events to work in Webkit
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-07-20 Sihui Liu <sihui_liu@apple.com>
Completion handler of NetworkProcess::prepareToSuspend may not be invoked promptly
https://bugs.webkit.org/show_bug.cgi?id=228119
Reviewed by Chris Dumez.
WebResourceLoadStatisticsStore and StorageManagerSet dispatch task to suspend background thread on suspension.
When the task is finished on background thread, it dispatches a reply task to main thread. When all replies are
received, network process replies prepareToSuspend message. With our current implementation, if network process
receives messages in order { PrepareToSuspend, ProcessDidResume, PrepareToSuspend },
WebResourceLoadStatisticsStore and StorageManagerSet may dispatch two suspend tasks to background thread and
get suspended in the first task. In this case, the second PrepareToSuspend message will not be replied, and
UI process will be waiting on reply for the latest PrepareToSuspend message to release assertion. To solve this,
background thread should only execute latest suspend task by checking task identifier.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WTF_GUARDED_BY_LOCK):
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
(WebKit::WebResourceLoadStatisticsStore::suspend):
(WebKit::WebResourceLoadStatisticsStore::resume):
(): Deleted.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::suspendIDBServers):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::suspend):
(WebKit::StorageManagerSet::resume):
* NetworkProcess/WebStorage/StorageManagerSet.h:
(WebKit::StorageManagerSet::WTF_GUARDED_BY_LOCK):
(): Deleted.
2021-07-20 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Silence telemetry on MSC_mach_wait_until
https://bugs.webkit.org/show_bug.cgi?id=228112
<rdar://problem/78965631>
Reviewed by Per Arne Vollan.
We are processing a lot of telemetry for MSC_mach_wait_until in cases where a block with failure is the correct behavior.
Silencing the warning to reduce CPU and network traffic related to generating and de-duping telemetry on this call.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-07-20 Kate Cheney <katherine_cheney@apple.com>
IBeam cursor is horizontal in Mail compose window
https://bugs.webkit.org/show_bug.cgi?id=228107
<rdar://problem/80636912>
Reviewed by Wenson Hsieh.
Recently we added support for vertical writing mode for the IBeam
cursor in WebKit. This added a new parameter isHorizontalWritingMode
which defaults to false. This causes the IBeam to appear horizontal in
cases where WebPage::populateCaretContext is not called, regressing expected
behavior.
This patch changes isHorizontalWritingMode to isVerticalWritingMode
to fix this, while still allowing support for vertical writing mode.
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView pointerInteraction:styleForRegion:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::populateCaretContext):
2021-07-20 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Propagate GtkSettings to web process
https://bugs.webkit.org/show_bug.cgi?id=227854
Reviewed by Carlos Garcia Campos.
There's a number of properties in GtkSettings that web process uses:
- gtk-cursor-blink
- gtk-cursor-blink-time
- gtk-font-name
- gtk-primary-button-warps-slider
- gtk-theme-name
- gtk-xft-antialias
- gtk-xft-dpi
- gtk-xft-hinting
- gtk-xft-hintstyle
- gtk-xft-rgba
While we do propagate gtk-theme-name, we don't do it for any of the other settings.
This means that they can only be fetched from XSettings/GSettings/settings portal
by GTK itself, but if the app changes them or if they are changed from inspector,
web processes won't see that.
Introduce GtkSettingsManager as a specific place that listens to preferences
changes and notifies the web process, where GtkSettingsManagerProxy updates
GtkSettings on that side. Keep the dark mode preference separate since there's
existing cross-platform infrastructure for it.
Apply settings after reinitializing as well, it was only done after initialization
so failed with PSON.
* PlatformGTK.cmake:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/gtk/GtkSettingsState.cpp: Added.
(WebKit::GtkSettingsState::encode const):
(WebKit::GtkSettingsState::decode):
* Shared/gtk/GtkSettingsState.h: Added.
* Shared/gtk/NativeWebTouchEventGtk.cpp:
* SourcesGTK.txt:
* UIProcess/API/gtk/PageClientImpl.cpp:
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSetToplevelOnScreenWindow):
(webkitWebViewBaseRoot):
(webkitWebViewBaseUnroot):
(webkitWebViewBaseConstructed):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/gtk/GtkSettingsManager.cpp: Added.
(WebKit::GtkSettingsManager::singleton):
(WebKit::GtkSettingsManager::themeName const):
(WebKit::GtkSettingsManager::fontName const):
(WebKit::GtkSettingsManager::xftAntialias const):
(WebKit::GtkSettingsManager::xftHinting const):
(WebKit::GtkSettingsManager::xftHintStyle const):
(WebKit::GtkSettingsManager::xftRGBA const):
(WebKit::GtkSettingsManager::xftDPI const):
(WebKit::GtkSettingsManager::cursorBlink const):
(WebKit::GtkSettingsManager::cursorBlinkTime const):
(WebKit::GtkSettingsManager::primaryButtonWarpsSlider const):
(WebKit::GtkSettingsManager::settingsDidChange):
(WebKit::GtkSettingsManager::GtkSettingsManager):
* UIProcess/gtk/GtkSettingsManager.h: Added.
(WebKit::GtkSettingsManager::settingsState const):
* UIProcess/gtk/WebPageProxyGtk.cpp:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
(WebKit::WebPage::reinitializeWebPage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
* WebProcess/gtk/GtkSettingsManagerProxy.cpp: Added.
(WebKit::GtkSettingsManagerProxy::singleton):
(WebKit::GtkSettingsManagerProxy::GtkSettingsManagerProxy):
(WebKit::GtkSettingsManagerProxy::settingsDidChange):
(WebKit::GtkSettingsManagerProxy::applySettings):
* WebProcess/gtk/GtkSettingsManagerProxy.h: Added.
* WebProcess/gtk/GtkSettingsManagerProxy.messages.in: Added.
2021-07-20 Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
[GTK][WPE] Fix compilation when ATK is not used
https://bugs.webkit.org/show_bug.cgi?id=228077
Reviewed by Carlos Garcia Campos.
Guard ATK only inside implementations, so the code is more readable.
Also changed guard from ATK to GTK platform showEmojiPicker().
No new tests needed.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree):
2021-07-19 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Tapping images on twitter.com should not toggle tab bar visibility
https://bugs.webkit.org/show_bug.cgi?id=228086
rdar://79667219
Reviewed by Geoffrey Garen.
Treat taps over elements that are explicitly marked draggable and also respond to click events as "meaningful"
with respect to the private UIDelegate method `-_webView:didTapAtPoint:withResult:`. In doing this, we use the
combination of responding to drags and clicks as a proxy for content that probably results in some meaningful
interaction when tapped.
Test: fast/events/ios/meaningful-click-when-tapping-draggable-content.html
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isProbablyMeaningfulClick):
2021-07-19 Sihui Liu <sihui_liu@apple.com>
Implement IDBTransaction.commit()
https://bugs.webkit.org/show_bug.cgi?id=227815
<rdar://problem/80651270>
Reviewed by Brady Eidson.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::commitTransaction):
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/IndexedDB/WebIDBServer.messages.in:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::commitTransaction):
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
2021-07-19 Wenson Hsieh <wenson_hsieh@apple.com>
Revert a debug assertion that was added in r280019
https://bugs.webkit.org/show_bug.cgi?id=228051
Reviewed by Tim Horton.
Several existing (non-accessibility-related) editing tests appear to hit this debug assertion that was added in
r280019, which indicates that it's currently possible to call `-selectionDidChange:` without a balanced call to
`-selectionWillChange:`, even before the changes in r280019.
For the time being, replace this assertion with a FIXME referencing a followup bug to investigate why this is
the case: https://webkit.org/b/228083. Thankfully, since the decrementing of `_selectionChangeNestingLevel` is
idempotent once the level reaches 0, no other changes are needed to ensure that we don't end up with underflow
in `_selectionChangeNestingLevel`.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView endSelectionChange]):
2021-07-19 Patrick Angle <pangle@apple.com>
[Cocoa] Web Inspector: Service workers can't be inspected in Safari Technology Preview
https://bugs.webkit.org/show_bug.cgi?id=228001
Reviewed by Per Arne Vollan.
For inspecting targets in the WebProcess, like Service Workers, we read the `ShowDevelopMenu` default on Cocoa
platforms to determine if remote inspection should be allowed, but the sandbox broker bundle identifier used to
read that preference is different for Safari Technology Preview. We need to read the preference with the
appropriate sandbox broker bundle identifier when the host application is Safari Technology Preview.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::shouldEnableRemoteInspector):
2021-07-19 Patrick Angle <pangle@apple.com>
[Cocoa] Web Inspector: REGRESSION(r271294) Service workers on iOS can't be inspected
https://bugs.webkit.org/show_bug.cgi?id=227971
Reviewed by Per Arne Vollan.
r271294 fixed inspecting Service Workers on macOS, but in the process broke inspecting Service Workers on iOS.
For iOS, previously a flag was set to mark RemoteInspector as needing to wait for a Sandbox Extension handle,
but after r271294 this flag will no longer be cleared properly, as the handle is acquired and consumed prior to
the point in initialization that iOS was special cased to wait for the handle. To resolve this, we now set the
flag once based on whether we were able to acquire a handle, which due to the changes in r270326 will already
have been done by the time we are initializing a WebProcess.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-07-19 Tim Horton <timothy_horton@apple.com>
Fix the build.
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::nameForBackingStoreType):
2021-07-18 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] [AX] Keyboard text candidates don't update when changing selection using Switch Control
https://bugs.webkit.org/show_bug.cgi?id=228051
rdar://79944295
Reviewed by Tim Horton.
Add support for updating text candidates by calling into UIKeyboardImpl when changing the selection via
accessibility UI (e.g. when using Switch Control). To achieve this, we add a new EditorState flag that indicates
whether or not the EditorState change was triggered by accessibility; in WKContentView, we then consult this
flag and call `-beginSelectionChange/-endSelectionChange` in the case where the updated editor state change was
triggered by accessibility and we're also not already in the scope of another selection change or gesture-based
selection change.
Note that the latter part of the check is critical in order to avoid deadlocks in UIKeyboardTaskQueue; see
r246013, r246425 and r246665, which introduced and later reverted a similar mechanism for updating
UIKeyboardImpl, but after every selection change.
* Shared/EditorState.cpp:
(WebKit::EditorState::encode const):
(WebKit::EditorState::decode):
(WebKit::operator<<):
* Shared/EditorState.h:
Add the new boolean flag, `triggeredByAccessibilitySelectionChange`.
* UIProcess/WebPageProxy.cpp:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView beginSelectionChange]):
(-[WKContentView endSelectionChange]):
Add a new `unsigned` flag, `_selectionChangeNestingLevel`, that lets us know if we're expecting an eventual call
to `-endSelectionChange`. See `-_selectionChanged` below for more details. Note that we don't need to reset
`_selectionChangeNestingLevel` to 0 when cleaning up the interaction after web process termination, because
the completion handlers that contain all the balanced calls to `-endSelectionChange` should be invoked after
such an event anyways.
(-[WKContentView _selectionChanged]):
If the `triggeredByAccessibilitySelectionChange` bit is set on the incoming (post layout data) EditorState and:
(1) UIKit isn't in the middle of handling a gesture that modifies the selection, and...
(2) We aren't expecting a call to `-endSelectionChange`.
...then we force UIKeyboardImpl to reload its UI (text suggestions, B/I/U state, etc.) using the incoming
EditorState. This allows accessibility-driven selection changes using Switch Control to behave like gesture-
based selection changes.
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::willChangeSelectionForAccessibility):
(WebKit::WebEditorClient::didChangeSelectionForAccessibility):
Implement a couple of client hooks in WebKit2 so that we set a boolean flag on WebPage,
`m_isChangingSelectionForAccessibility`, to `true` over the scope of an AX-driven selection change. See related
AX changes in WebCore for more details.
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::hasPendingEditorStateUpdate const):
Add a helper method so that we can conveniently check whether we have a pending editor state update to flush,
since the previous boolean flag is now a tri-state enum (`m_pendingEditorStateUpdateStatus`).
(WebKit::WebPage::editorState const):
(WebKit::WebPage::willCommitLayerTree):
(WebKit::WebPage::sendEditorStateUpdate):
(WebKit::WebPage::scheduleFullEditorStateUpdate):
If we're in the scope of an accessibility selection change, transition `m_pendingEditorStateUpdateStatus` to
`ScheduledDuringAccessibilitySelectionChange`; otherwise, just use `Scheduled`.
(WebKit::WebPage::flushPendingEditorStateUpdate):
Refactor `m_hasPendingEditorStateUpdate` so that it now captures three states:
(1) We haven't scheduled an editor state update yet.
(2) We've scheduled an editor state update that was not triggered by accessibility.
(3) We've scheduled an editor state update that was triggered by accessibility.
The distinction between (2) and (3) allows us to populate EditorState's new
`triggeredByAccessibilitySelectionChange` flag.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::willChangeSelectionForAccessibility):
(WebKit::WebPage::didChangeSelectionForAccessibility):
2021-07-16 Kate Cheney <katherine_cheney@apple.com>
WKWebView javascript injection doesn't work if app includes WKAppBoundDomains
https://bugs.webkit.org/show_bug.cgi?id=227589
<rdar://problem/80327452>
Reviewed by Brent Fulgham.
Apps should not have to specify localhost in their Info.plist in order
to load local content in app-bound mode. This patch adds a check for
localhost or a loopback IP address and forces an app into app-bound
mode in this case.
Since all layout tests use localhost and 127.0.0.1 as test domains,
this patch also adds a check for enableInAppBrowserPrivacyForTesting()
which determines if we are running layout tests and does not trigger
this check in that case so we can test other behavior.
* UIProcess/WebPageProxy.cpp:
(WebKit::shouldTreatURLProtocolAsAppBound):
(WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
2021-07-16 Alex Christensen <achristensen@webkit.org>
Prevent HSTS tracking mitigation for top level navigation requests
https://bugs.webkit.org/show_bug.cgi?id=227936
Reviewed by Brady Eidson.
Use NSURLRequest.URL as the first party for cookies for HSTS purposes during redirects instead of NSURLRequest.mainDocumentURL,
which hasn't been updated because CFNetwork doesn't know that this is the main document request and when redirected, the main document URL also changes.
Covered by API tests, which will start covering this case once rdar://80550123 is integrated.
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration allowsHSTSWithUntrustedRootCertificate]):
(-[_WKWebsiteDataStoreConfiguration setAllowsHSTSWithUntrustedRootCertificate:]):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::allowsHSTSWithUntrustedRootCertificate const):
(WebKit::WebsiteDataStoreConfiguration::setAllowsHSTSWithUntrustedRootCertificate):
2021-07-16 Alex Christensen <achristensen@webkit.org>
Network access prevention SPI should prevent preconnecting, and it should first allow injected bundle to change request
https://bugs.webkit.org/show_bug.cgi?id=228044
<rdar://72995136>
Reviewed by Tim Horton.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::preconnectTo):
2021-07-16 John Wilander <wilander@apple.com>
PCM: Add early return when unlinkable token is used and add more happy path Web Inspector logging
https://bugs.webkit.org/show_bug.cgi?id=228039
<rdar://problem/80705989>
Reviewed by Kate Cheney.
There's a missing return after an accepted unlinkable token transaction. The
attribution object is therefore moved and stored twice.
This patch also adds more Web Inspector logging to the happy path for better
developer feedback.
No new tests.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
Add the missing return.
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
Add Web Inspector logging.
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
Add Web Inspector logging.
(WebKit::PrivateClickMeasurementManager::handleAttribution):
Add Web Inspector logging.
2021-07-16 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r277820): Can't scroll up and down using trackpad in Mail message viewer when in Slide Over
https://bugs.webkit.org/show_bug.cgi?id=228033
rdar://80663917
Reviewed by Tim Horton.
This started happening after the changes in r277820, since UIHoverGestureRecognizer contained several internal
facilities in UIKit for avoiding failure dependencies to other (non-hover) gestures. After removing the
subclass, various UIKit gestures now attempt to add failure requirements to WKMouseGestureRecognizer, thereby
linking WKMouseGestureRecognizer to other gestures in the gesture dependency graph.
This means that all gestures connected to the same subgraph as WKMouseGestureRecognizer are unable to be reset
until WKMouseGestureRecognizer transitions to either Ended or Failed state; however, since this only happens
once the trackpad goes into idle state, these subgraph-connected gestures can effectively only recognize once
per trackpad interaction (resetting only after the trackpad goes idle). Since scroll view pan gesture
recognizers are indirectly connected to WKMouseGestureRecognizer in Slide Over mode, this manifests in scrolling
being unresponsive after an initial scroll gesture has ended.
To address this, we subclass UIHoverGestureRecognizer once again, and (unfortunately) also restore the IPI
override for `-_shouldReceiveTouch:forEvent:recognizerView:`, to ensure that we're still able to detect and
dispatch `mousedown` and `mousemove` events.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
(-[WKContentView gestureRecognizer:shouldReceivePress:]):
Remove a couple of delegate overridees here, which are now unnecessary since WKMouseGestureRecognizer is a
UIHoverGestureRecognizer once again.
* UIProcess/ios/WKMouseGestureRecognizer.h:
* UIProcess/ios/WKMouseGestureRecognizer.mm:
(-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
2021-07-16 Kate Cheney <katherine_cheney@apple.com>
macOS Safari network sessions not being marked as being from a browser
https://bugs.webkit.org/show_bug.cgi?id=228028
<rdar://problem/80648664>
Reviewed by Brent Fulgham.
Move WebKitAdditions to open source to communicate full web browser
status to the networking stack. In the macOS case, we don't have
a full browser entitlement, so we should check for Safari.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::SessionWrapper::initialize):
The name com.apple.WebKit.InAppBrowser is not the most accurate name,
but changing it would require syncing with other parts of the network
stack. We should do this in a separate bug.
2021-07-16 Tim Horton <timothy_horton@apple.com>
Adopt BifurcatedGraphicsContext for backing store + display list RemoteLayerBackingStore
https://bugs.webkit.org/show_bug.cgi?id=226425
<rdar://77929299>
Reviewed by Sam Weinig.
Instead of "display list backed RemoteLayerBackingStore" being its own
backing store type, we make "includes a display list" a separate bit.
This way, we can paint both a bitmap (IOSurface or CG bitmap, all
exactly as it normally is), and also carry a sidecar display list.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::ensureBackingStore):
(WebKit::RemoteLayerBackingStore::encode const):
(WebKit::RemoteLayerBackingStore::decode):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::supportsPartialRepaint):
We can't partially repaint the display list, and require its rendering
to match the painted backing store, so disable partial repaint entirely
if display lists are being used.
(WebKit::RemoteLayerBackingStore::display):
(WebKit::RemoteLayerBackingStore::drawInContext):
Adopt BifurcatedGraphicsContext in order to paint into the aforementioned
bitmap and display list simultaneously.
A future patch may abstract this into a new ImageBuffer type
instead of polluting RemoteLayerBackingStore with it.
Leave a temporary workaround for a CoreAnimation bug, which can be
disabled via `defaults write`, but is enabled by default.
(WebKit::layerContentsForBufferHandle):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
(WebKit::RemoteLayerBackingStore::Buffer::discard):
* UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h:
* UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm:
(-[WKCompositingLayer _setWKContents:withDisplayList:]):
(-[WKCompositingLayer _setWKContentsDisplayList:]): Deleted.
(-[WKCompositingLayer _wkContentsDisplayList]): Deleted.
Pass the display list data to CoreAnimation alongside the bitmap.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::updateBackingStore):
2021-07-16 Megan Gardner <megan_gardner@apple.com>
Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
https://bugs.webkit.org/show_bug.cgi?id=227914
Reviewed by Tim Horton.
In order to correctly avoid the note overlay that can potentially obscure the web view,
we need to pipe the scrolling through the UI process. This patch does that work
and will be followed up shortly by one that does the actual work of overlay avoidance.
For iOS, this just uses the main frame UI Scrolling that we already use, but for
mac, we need to do the last scroll in the web process after adjusting it with the overlay
information.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestScrollToRect):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::requestScrollToRect):
(WebKit::WebPageProxy::scrollToRect):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::scrollToRect):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestScrollToRect):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::requestScrollToRect):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::scrollMainFrameToRevealRect const):
(WebKit::WebChromeClient::scrollRectIntoView const): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::scrollToRect):
2021-07-16 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] PSON: accessibility doesn't work after a cross site navigation
https://bugs.webkit.org/show_bug.cgi?id=228021
Reviewed by Adrian Perez de Castro.
The provisional page is not handling the BindAccessibilityTree message and we never embed the new web process
plug into the UI process socket.
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::bindAccessibilityTree): Save the a11y plug ID.
(WebKit::ProvisionalPageProxy::didReceiveMessage): Handle BindAccessibilityTree message.
* UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::accessibilityPlugID): Returns the a11y plug ID.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToProvisionalPage): If the provisional page has a plug ID, bind the a11y tree.
2021-07-15 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] WKMouseGestureRecognizer should not have failure requirements on WKDeferringGestureRecognizer
https://bugs.webkit.org/show_bug.cgi?id=228013
rdar://80342462
Reviewed by Tim Horton.
Avoid adding a gesture failure requirement between any WKDeferringGestureRecognizers and
WKMouseGestureRecognizer; It doesn't make sense to claim that WKMouseGestureRecognizer should only recognize
once active touch events have been handled by the web page. Under normal circumstances, this gesture failure
requirement is actually completely benign, since touch events should never be received by
WKMouseGestureRecognizer in the first place, and when using a trackpad, deferring gesture recognizers are not
triggered.
However, if an app were to (hypothetically) swizzle out `-gestureRecognizer:shouldReceiveTouch:` to force
WKMouseGestureRecognizer to receive normal (non-trackpad) touch events, this could cause nearly all gesture
recognizers in the window to become unresponsive, since WKMouseGestureRecognizer would be stuck in Changed state
long after other gestures in the same subgraph have transitioned to Ended or Failed state, thereby preventing
all of these gestures from being reset to Possible state.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
2021-07-15 Jean-Yves Avenard <jya@apple.com>
[Wk1] media/media-source/media-webm-opus-partial.html is a consistent failure (Enable VP8/VP9/Vorbis/Opus in WebKitLegacy)
https://bugs.webkit.org/show_bug.cgi?id=228005
rdar://80346720
Reviewed by Jer Noble.
* Shared/WebPreferencesDefaultValues.cpp:
* Shared/WebPreferencesDefaultValues.h: Don't make webm parser conditional on VP9
being enabled; it's used with other codecs too and is codec-agnostic to start with.
2021-07-15 Jean-Yves Avenard <jya@apple.com>
[MSE] sequence mode is broken if GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=227864
<rdar://problem/80445041>
Reviewed by Jer Noble.
When the source buffer's mode is set to sequence, the timestampOffset attribute
should be updated after each appendBuffer operation. However, when the GPU process
is enabled, the timestampOffset calculations are all done in the GPU process and
its result wasn't communicated back to the WebContent process leading its value
to always be 0 on read.
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): Add value of
the potentially updated timestamp offset back to the content process.
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: Add extra timestampOffset
parameter.
2021-07-15 Chris Dumez <cdumez@apple.com>
Add initial support for BroadcastChannel behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227924
Reviewed by Sam Weinig.
Add initial support for BroadcastChannel behind a runtime flag, off by default:
- https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts
Both Firefox and Blink have been supporting BroadcastChannel for a long time.
The implementation is complete and spec-compliant. It works both in Window and Worker environments,
in WebKit1 and WebKit2. However, the feature is off-by-default because of privacy concerns that have
not been addresssed yet:
- https://github.com/whatwg/html/issues/5803
We should be able to add partioning to address the privacy concerns and ship this later on. In the mean
time though, having a working BroadcastChannel implementation in the context of layout tests is already
very useful because a lot of Web-Platform-Tests are relying on it to test other Web features. This means
better test coverage for WebKit.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* NetworkProcess/Downloads/DownloadManager.cpp:
* NetworkProcess/NetworkBroadcastChannelRegistry.cpp: Added.
(WebKit::NetworkBroadcastChannelRegistry::registerChannel):
(WebKit::NetworkBroadcastChannelRegistry::unregisterChannel):
(WebKit::NetworkBroadcastChannelRegistry::postMessage):
(WebKit::NetworkBroadcastChannelRegistry::removeConnection):
* NetworkProcess/NetworkBroadcastChannelRegistry.h: Added.
(WebKit::NetworkBroadcastChannelRegistry::GlobalBroadcastChannelIdentifier::operator== const):
* NetworkProcess/NetworkBroadcastChannelRegistry.messages.in: Added.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
(WebKit::NetworkConnectionToWebProcess::didClose):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::broadcastChannelRegistry):
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didReceiveMessage):
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp: Added.
(WebKit::networkProcessConnection):
(WebKit::WebBroadcastChannelRegistry::registerChannel):
(WebKit::WebBroadcastChannelRegistry::unregisterChannel):
(WebKit::WebBroadcastChannelRegistry::postMessage):
(WebKit::WebBroadcastChannelRegistry::postMessageToRemote):
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h: Added.
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.messages.in: Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::broadcastChannelRegistry):
2021-07-15 Sihui Liu <sihui_liu@apple.com>
Do not abort ongoing IDB transaction synchronously on non-imminent PrepareToSuspend message
https://bugs.webkit.org/show_bug.cgi?id=227778
<rdar://problem/80602557>
Reviewed by Chris Dumez.
Currently we abort IDB transactions and suspend IDB thread synchronously in NetworkProcess::prepareToSuspend.
As UI process does not know the file locking state in network process now (because network process tracks
the state and takes the assertion by itself), UI process may send non-imminent PrepareToSuspend more often,
and we may abort transaction too aggressively (e.g. UI process may send the message as soon as app is in
background). To fix the possible regression of data loss, we will schedule a task with 5s delay to abort
transactions after prepareToSuspend. In this case, transactions finished in 5s can have a chance to finish.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::suspendIDBServers):
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
(WebKit::NetworkProcess::createWebIDBServer):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/ios/NetworkProcessIOS.mm:
(WebKit::NetworkProcess::setIsHoldingLockedFiles):
* UIProcess/ProcessAssertion.h:
(WebKit::ProcessAssertion::setPrepareForInvalidationHandler):
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKRBSAssertionDelegate dealloc]):
(-[WKRBSAssertionDelegate assertionWillInvalidate:]):
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::~ProcessAssertion):
(WebKit::ProcessAssertion::processAssertionWillBeInvalidated):
2021-07-15 Megan Gardner <megan_gardner@apple.com>
Rename scrollRectIntoView to scrollContainingScrollViewsToRevealRect for clarity.
https://bugs.webkit.org/show_bug.cgi?id=227995
Reviewed by Tim Horton.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::scrollContainingScrollViewsToRevealRect const):
(WebKit::WebChromeClient::scrollRectIntoView const): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
2021-07-15 Brent Fulgham <bfulgham@apple.com>
[macOS] Expand GPU sandbox to support multi-target AirPlay
https://bugs.webkit.org/show_bug.cgi?id=227972
<rdar://problem/76029596>
Reviewed by Eric Carlson.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-07-15 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Can't click links with touchscreen
https://bugs.webkit.org/show_bug.cgi?id=226679
Reviewed by Michael Catanzaro.
Currently, when we emulate mouse events for touch, we send events with touch
pointer type, however the way we do it doesn't really match how touch type
events are supposed to behave: for example, we won't send a press event until
a finger release, and will then send both together. And touch pointer type
events are also supposed to support multitouch (or at least they do in iOS),
while with this scheme they really can't.
Not only all of this produces weird results for pointer events, but the actual
mouse emulation doesn't really work as intended. For example, when tapping
empty space on the page, and then a link, the latter won't do anything.
Meanwhile, it's possible to accidentally open a link while pinch zooming.
Switch back to emulating mouse pointer type events for now, as it was before
the rewrite to avoid this. Touch pointer type events don't work properly
anyway.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseTouchRelease):
(webkitWebViewBaseTouchDragUpdate):
(webkitWebViewBaseTouchDragEnd):
2021-07-15 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, mid-July 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=227981
Unreviewed non-unified build fixes.
* UIProcess/ProcessAssertion.cpp: Add missing wtf/RunLoop.h header.
2021-07-14 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r279912 (239661@main); Adopt HAVE(SYSTEM_STATUS) macro.
* GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
(WebKit::GPUConnectionToWebProcess::setCaptureAttributionString):
* Platform/spi/ios/SystemStatusSPI.h:
2021-07-14 Michael Saboff <msaboff@apple.com>
[macOS] Add new entitlement to limit process to a single JIT region
https://bugs.webkit.org/show_bug.cgi?id=227956
Reviewed by Mark Lam.
This macOS entitlement limits a process to a single JIT region.
This matches the behavior on iOS.
* Scripts/process-entitlements.sh:
2021-07-14 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Dump basic RemoteRenderingBackend state when taking system diagnostics
https://bugs.webkit.org/show_bug.cgi?id=227917
Reviewed by Tim Horton.
Make it possible to diagnose issues where the GPU Process is stuck (e.g. failing to acknowledge context flushes
from the web process) by dumping information about the states of all RemoteRenderingBackends in the GPU process.
See comments below for more detail.
* GPUProcess/GPUConnectionToWebProcess.h:
(WebKit::GPUConnectionToWebProcess::remoteRenderingBackendMap const):
Expose this const getter, so that GPUProcess can iterate over remote rendering backends when collecting
diagnostic information in `additionalStateForDiagnosticReport()`.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcess.h:
* GPUProcess/cocoa/GPUProcessCocoa.mm: Added.
(WebKit::GPUProcess::additionalStateForDiagnosticReport const):
Override this method and return a dictionary containing information about each RemoteRenderingBackend for all
GPUConnectionToWebProcesses. This is an example of a state dictionary:
```
{
"RemoteRenderingBackend states" = {
<WP ID> = {
<RRB ID> = FinishedReplayingDisplayList;
};
};
}
```
Importantly, this reveals RemoteRenderingBackends that are stuck waiting for newly created display list item
buffers, missing cached resources, or destination image buffers (essentially a special case of "missing cached
resources"), and also cases where display list playback infinitely loops or otherwise hangs.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
(WebKit::RemoteRenderingBackend::setNextItemBufferToRead):
(WebKit::RemoteRenderingBackend::lastKnownState const):
(WebKit::RemoteRenderingBackend::updateLastKnownState):
Add a state flag to RemoteRenderingBackend, so that it can remember its last known state. This state is updated
when entering or exiting the main display list processing loop (`wakeUpAndApplyDisplayList`); if we're about to
go to sleep with pending wakeup arguments, then we'll set the last known state to one of the `WaitingFor_______`
states.
This state is wrapped in an Atomic, since it's only updated from the rendering backend's background queue, but
it's only read from within the OS state handler block on the main queue.
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackendState.h: Added.
Add a new 8-bit enum representing the state of a RemoteRenderingBackend. See above for more details.
(WebKit::name):
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout):
Add fault logging in the case where we've reached the maximum number of timeouts while waiting for a display
list context flush. Importantly, we include the remote rendering backend's identifier here to make it easier to
correlate with information from GPU Process state dumping above.
2021-07-14 Devin Rousso <drousso@apple.com>
[iOS] REGRESSION(r279720): changing Subtitles to Off doesn't hide them or do anything
https://bugs.webkit.org/show_bug.cgi?id=227937
<rdar://problem/79069662>
Reviewed by Eric Carlson.
r279720 made it so that `CaptionUserPreferencesMediaAF::setCaptionDisplayMode` no longer
directly modifies `kMACaptionAppearanceDomainUser` in the WebProcess, using a cached value
as a way of preventing the WebProcess from trying to read back that value after it's set,
instead having the UIProcess send `Messages::WebProcess::SetMediaAccessibilityPreferences`
whenever this changes to update that cached value. Unfortunately, because the WebProcess
needs to read this value immediately after changing it, this IPC round trip causes the
WebProcess to read the old value, which results in no observable changes. In order to fix
this, notify `CaptionUserPreferences` that `captionPreferencesChanged` when the above IPC
message is received (which will also handle cases when the value changes outside WebKit).
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::setMediaAccessibilityPreferences):
Make sure to also update every `CaptionUserPreferences` once the cached preference values
are saved so that any active media can update accordingly.
2021-07-14 Eric Carlson <eric.carlson@apple.com>
[iOS] Dynamically set capture attribution
https://bugs.webkit.org/show_bug.cgi?id=227871
rdar://70241665
Reviewed by Jer Noble.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): Initialize m_captureOrigin.
(WebKit::GPUConnectionToWebProcess::updateCaptureOrigin): Update.
(WebKit::GPUConnectionToWebProcess::setCaptureAttributionString const): Non-Cocoa stub.
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::updateCaptureOrigin): Call same method in WebProcessConnection,
if it exists.
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm: Added.
(WebKit::GPUConnectionToWebProcess::setCaptureAttributionString): Set the attribution
string to "[domain] in [application]".
* Platform/spi/ios/SystemStatusSPI.h: Added.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: Allow "com.apple.systemstatus.activityattribution"
to be looked up.
* Scripts/process-entitlements.sh: Add the entitlements required to use the
SystemStatus SPI.
* SourcesCocoa.txt:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::startProducingData): Fail capture
if setCaptureAttributionString returns false.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
(WebKit::UserMediaCaptureManagerProxy::ConnectionProxy::setCaptureAttributionString):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::updateCaptureOrigin): Call gpuProcess.updateCaptureOrigin
so the capture origin is correct when capture begins.
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeMainDocument): Update the capture origin.
(WebKit::WebPageProxy::willStartCapture): Ditto.
(WebKit::WebPageProxy::gpuProcessExited): Drive-by - update local variable names
to make their purpose clearer.
* WebKit.xcodeproj/project.pbxproj:
2021-07-13 Wenson Hsieh <wenson_hsieh@apple.com>
[WK2] Push OS state dumping logic down from WebProcess to AuxiliaryProcess
https://bugs.webkit.org/show_bug.cgi?id=227916
Reviewed by Tim Horton.
Refactor state dumping registration code in preparation for supporting state dumping in the GPU process on Cocoa
platforms when triggering system diagnostics. The logic that currently lives in
`WebProcess::registerWithStateDumper` is comprised of two parts: (1) code that calls `os_state_add_handler` with
a `os_state_data_t` provider, and (2) code that builds a dictionary containing diagnostic information specific
to the web process.
Since GPUProcess will require only the former, we hoist logic for (1) into the superclass (AuxiliaryProcess) so
that both GPUProcess and WebProcess can invoke it, and refactor (2) to be a virtual method that may be
overridden by subclasses to provide process-specific information.
* Shared/AuxiliaryProcess.h:
(WebKit::AuxiliaryProcess::additionalStateForDiagnosticReport const):
* Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::AuxiliaryProcess::registerWithStateDumper):
Additionally make this take the title string that will be used to label the state data, to avoid the need for a
second subclassing method to provide the title.
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::additionalStateForDiagnosticReport const):
Pull logic for collecting diagnostic information in the web process out into a separate helper method.
(WebKit::WebProcess::platformInitializeProcess):
(WebKit::WebProcess::registerWithStateDumper): Deleted.
2021-07-13 Alex Christensen <achristensen@webkit.org>
REGRESSION(r279069): http/tests/websocket/tests/hybi/too-long-payload.html is a constant timeout when using NSURLSESSION_WEBSOCKET
https://bugs.webkit.org/show_bug.cgi?id=227923
<rdar://80343436>
Reviewed by Chris Dumez.
We need to add a large maximum frame size that was first introduced to WebKit in r91243
Covered by existing tests.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::createWebSocketTask):
2021-07-13 Peng Liu <peng.liu6@apple.com>
[GPUP] RemoteMediaPlayerProxy may not send the latest "naturalSize" to MediaPlayerPrivateRemote
https://bugs.webkit.org/show_bug.cgi?id=227894
Reviewed by Jer Noble.
When a `MediaPlayerPrivateMediaSourceAVFObjC` in the GPU process changes its `naturalSize`,
the new value will be sent to the WebContent process in the IPC message
`MediaPlayerPrivateRemote::SizeChanged`. However, `RemoteMediaPlayerProxy` won't update
`m_cachedState.naturalSize`. So the next `MediaPlayerPrivateRemote::UpdateCachedState`
message will use the old `naturalSize` and the WebContent process will drop the correct value
after receiving the message.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerSizeChanged):
2021-07-13 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r279647.
<rdar://80519938>
Introduced a crash
Reverted changeset:
"XPC services should release their os transaction when given a
SIGTERM signal"
https://bugs.webkit.org/show_bug.cgi?id=227747
https://commits.webkit.org/r279647
2021-07-13 Kate Cheney <katherine_cheney@apple.com>
Unreviewed iOS/tvOS/watchOS build fix.
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
2021-07-13 Chris Dumez <cdumez@apple.com>
Regression(r279601) ProcessAssertion may get destroyed on a background thread
https://bugs.webkit.org/show_bug.cgi?id=227875
<rdar://76972252>
Reviewed by Geoffrey Garen.
r279601 added an internal WorkQueue to ProcessAssertion, so that we could acquire the RunningBoard assertion
asynchronously on the background queue. When dispatching to the background queue, we capture |protectedThis|,
which means that ProcessAssertion may now get destroyed on the background queue. To address the isuse, we
now make sure to dispatch |protectedThis| back to the main thread in acquireAsync().
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::acquireAsync):
2021-07-13 Kate Cheney <katherine_cheney@apple.com>
Allow layout tests to specify app initiated loads or not
https://bugs.webkit.org/show_bug.cgi?id=227825
<rdar://problem/80355582>
Reviewed by Brent Fulgham.
Tests: http/tests/app-privacy-report/app-attribution-load-url.html
http/tests/app-privacy-report/app-attribution-ping-load.html
http/tests/app-privacy-report/app-attribution-post-request.html
http/tests/app-privacy-report/app-attribution-preflight-async.html
http/tests/app-privacy-report/app-attribution-preflight-sync.html
http/tests/app-privacy-report/app-attribution-speculative-revalidation.html
http/tests/app-privacy-report/user-attribution-load-url.html
http/tests/app-privacy-report/user-attribution-ping-load.html
http/tests/app-privacy-report/user-attribution-post-request.html
http/tests/app-privacy-report/user-attribution-preflight-async.html
http/tests/app-privacy-report/user-attribution-preflight-sync.html
http/tests/app-privacy-report/user-attribution-speculative-revalidation.html
Add a parameter to the WebView configuration that allows a test to
override the default NSURLRequest attribution value. We don't need
this to be dynamic per-test, so we can store it in the configuration.
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::appInitiatedOverrideValueForTesting const):
(API::PageConfiguration::setAppInitiatedOverrideValueForTesting):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(toWKAttributionOverrideTesting):
(toAttributionOverrideTesting):
(-[WKWebViewConfiguration _setAppInitiatedOverrideValueForTesting:]):
(-[WKWebViewConfiguration _appInitiatedOverrideValueForTesting]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setLastNavigationWasAppInitiated):
2021-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Expose support for client certificate auth
https://bugs.webkit.org/show_bug.cgi?id=200805
Reviewed by Michael Catanzaro.
Add new API to handle certificate and pin certificate authentication requests.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::createRequest):
(WebKit::NetworkDataTaskSoup::completeAuthentication):
(WebKit::NetworkDataTaskSoup::cancelAuthentication):
(WebKit::NetworkDataTaskSoup::authenticate):
(WebKit::NetworkDataTaskSoup::continueAuthenticate):
(WebKit::NetworkDataTaskSoup::requestCertificateCallback):
(WebKit::NetworkDataTaskSoup::requestCertificatePasswordCallback):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<AuthenticationChallenge>::encode):
(IPC::ArgumentCoder<AuthenticationChallenge>::decode):
* Shared/glib/ArgumentCodersGLib.cpp:
(IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::encode):
(IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::decode):
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<Credential>::encodePlatformData):
(IPC::ArgumentCoder<Credential>::decodePlatformData):
* UIProcess/API/glib/WebKitAuthenticationRequest.cpp:
(webkit_authentication_request_get_certificate_pin_flags):
* UIProcess/API/glib/WebKitCredential.cpp:
(webkit_credential_new_for_certificate_pin):
(webkit_credential_new_for_certificate):
(webkit_credential_get_certificate):
* UIProcess/API/gtk/WebKitAuthenticationRequest.h:
* UIProcess/API/gtk/WebKitCredential.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewAuthenticate):
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitAuthenticationRequest.h:
* UIProcess/API/wpe/WebKitCredential.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2021-07-13 Myles C. Maxfield <mmaxfield@apple.com>
Fix the Apple Internal iOS build
Unreviewed.
* WebProcess/cocoa/WebProcessCocoa.mm:
2021-07-12 Tim Horton <timothy_horton@apple.com>
Make WebKit's UserInterfaceIdiom operate in terms of the exceptions, not the rule
https://bugs.webkit.org/show_bug.cgi?id=227885
<rdar://problem/79987158>
Reviewed by Wenson Hsieh.
No new tests, no change in behavior.
In general, we consider the macOS/iPad behavior the "normal" WebKit behavior,
and exceptions to that for iPhone or Watch are just that: exceptions.
To bring the code in line with this understanding, make places that
we make decisions based on UIUserInterfaceIdiom take macOS/iPad behavior
as the default, and make iPhone/Watch the special cases.
* Shared/UserInterfaceIdiom.h:
* Shared/UserInterfaceIdiom.mm:
(WebKit::currentUserInterfaceIdiomIsPhoneOrWatch):
(WebKit::setCurrentUserInterfaceIdiomIsPhoneOrWatch):
Also, lump iPod Touch in with iPhone when checking based on device class.
(WebKit::updateCurrentUserInterfaceIdiom):
(WebKit::currentUserInterfaceIdiomIsPadOrMac): Deleted.
(WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): Deleted.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/ios/WebPreferencesDefaultValuesIOS.mm:
(WebKit::defaultTextAutosizingUsesIdempotentMode):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::registerNotificationObservers):
* UIProcess/ios/SmartMagnificationController.mm:
(WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
(-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
(-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
(-[WKContentView _zoomToRevealFocusedElement]):
(-[WKContentView _elementTypeRequiresAccessoryView:]):
(-[WKContentView _updateAccessory]):
(-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(WebKit::WebDataListSuggestionsDropdownIOS::show):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::desktopClassBrowsingSupported):
* UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
(-[WKAirPlayRoutePicker show:fromRect:]):
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
(-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl initWithView:]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectMultiplePicker configurePresentation]):
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::userInterfaceIdiomDidChange):
2021-07-12 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Turn on `USE(OS_STATE)` when building with a non-Apple-internal SDK
https://bugs.webkit.org/show_bug.cgi?id=227884
Reviewed by Tim Horton.
Instead of directly importing <os/state_private.h>, introduce a new SPI header (OSStateSPI.h) that simply
includes <os/state_private.h> on internal builds, and falls back to function declarations when using the non-
internal SDK.
* Platform/spi/Cocoa/OSStateSPI.h: Added.
* WebKit.xcodeproj/project.pbxproj:
Drive-by fix: additionally restore the minimum `objectVersion` to 52 rather than 54. This was unintentionally
bumped in r279133.
* WebProcess/cocoa/WebProcessCocoa.mm:
2021-07-12 Garrett Davidson <garrett_davidson@apple.com>
_WKWebAuthenticationPanel escapes slashes in origin
https://bugs.webkit.org/show_bug.cgi?id=227724
rdar://80232742
Reviewed by Kate Cheney.
Tell NSJSONSerialization not to try to escapes slashes, like those in the scheme of an origin.
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(produceClientDataJson):
2021-07-12 Chris Fleizach <cfleizach@apple.com>
AX: Make WebKit observe spatial audio accessibility settings
https://bugs.webkit.org/show_bug.cgi?id=227848
Reviewed by Sam Weinig.
Allow mac and iOS to read from accessibility domains.
Allow mac sandbox to read from com.apple.Accessibility.
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* UIProcess/Cocoa/PreferenceObserver.mm:
(-[WKPreferenceObserver init]):
2021-07-12 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r279835.
Newly added assertions are wrong
Reverted changeset:
"Regression(r279601) ProcessAssertion may get destroyed on a
background thread"
https://bugs.webkit.org/show_bug.cgi?id=227875
https://commits.webkit.org/r279835
2021-07-12 Chris Dumez <cdumez@apple.com>
Regression(r279601) ProcessAssertion may get destroyed on a background thread
https://bugs.webkit.org/show_bug.cgi?id=227875
<rdar://76972252>
Reviewed by Geoffrey Garen.
r279601 added an internal WorkQueue to ProcessAssertion, so that we could acquire the RunningBoard assertion
asynchronously on the background queue. When dispatching to the background queue, we capture |protectedThis|,
which means that ProcessAssertion may now get destroyed on the background queue. ProcessAssertion is a main
thread object and destroying it on a non-main thread can lead to crashes.
* UIProcess/ProcessAssertion.h:
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::~ProcessAssertion):
2021-07-12 Jer Noble <jer.noble@apple.com>
[Cocoa] Incorrect deprecation declaration for -[WKWebView closeAllMediaPresentations:]
https://bugs.webkit.org/show_bug.cgi?id=227860
<rdar://80376777>
Reviewed by Sam Weinig.
In r277645, we added a deprecation declaration for -closeAllMediaPresentations:completion, but
that API was never shipped in a release. The actual shipped API, -closeAllMediaPresentations,
was removed entirely, leading to bincompat crashes when binaries built against older SDKs are
run against newer OSs.
Correct the deprecated API declaration, and re-add support for -closeAllMediaPresentations.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView closeAllMediaPresentations]):
2021-07-12 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Make a few additional adjustments to support system minimum layout margins
https://bugs.webkit.org/show_bug.cgi?id=227859
rdar://80113612
Reviewed by Tim Horton.
Make a couple of minor adjustments to deal with the fact that `-contentInset` includes system content insets
(specifically, `-_contentScrollInset`) on watchOS, due to method swizzling that happens in PepperUICore. See
changes below for more detail.
Test: fast/viewport/watchos/viewport-with-system-minimum-layout-margins.html
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _computedContentInset]):
Only apply `-safeAreaInsets` on top of `-contentInset` when computing the total scroll view content inset on
watchOS (as opposed to applying both `-safeAreaInsets` and `-_contentScrollInset`); this is because
`-contentInset` on watchOS is actually equivalent to `-_effectiveContentInset` on other iOS-family platforms, so
additionally adding `-_contentScrollInset` here would result in the scroll content inset being double-counted.
* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView setContentInset:]):
(-[WKScrollView _setContentScrollInsetInternal:]):
(-[WKScrollView _updateContentScrollInset]):
In the case where the WebKit client explicitly sets the scroll view's content insets using `-[WKScrollView
setContentInset:]`, set a flag (`_contentInsetWasExternallyOverridden`) and immediately revert any internally
specified `-_contentScrollInset` on WKScrollView. Due to the swizzled implementation of `-[UIScrollView
contentInset]` described above, it's practically impossible for any client to use `-setContentInset:` correctly
when there is a nonzero `-_contentScrollInset` on watchOS, so preferable to simply get out of the way of the
client in this scenario.
In the context of _SFNanoBrowserViewController, this ensures that scroll view content inset adjustment logic in
Safari doesn't inadvertently cause horizontal content insets to increase by `-_contentScrollInset` every time
`-[WKScrollView setContentInset:]` is invoked by the client.
2021-07-12 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Touch navigation gesture triggers kinetic scrolling when cancelling
https://bugs.webkit.org/show_bug.cgi?id=227701
Reviewed by Michael Catanzaro.
Make sure an event that has finished a navigation swipe gesture isn't propagated
to the page triggering kinetic scrolling.
Move the navigation swipe ending from drag-end to swipe signal handler, since
that's where kinetic scrolling is handled and we can stop it.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseTouchDragEnd):
(webkitWebViewBaseTouchSwipe):
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
2021-07-12 Alexander Mikhaylenko <alexm@gnome.org>
[GTK][WPE] Support drawing scrollbar corner
https://bugs.webkit.org/show_bug.cgi?id=227868
Reviewed by Michael Catanzaro.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::paintControlForLayerInContext):
Update the paintScrollCorner() call.
2021-07-12 Imanol Fernandez <ifernandez@igalia.com>
Cross platform compilation of PlatformXRSystem and PlatformXRSystemProxy
https://bugs.webkit.org/show_bug.cgi?id=226919
Reviewed by Dean Jackson.
PlatformXRSystem and PlatformXRSystemProxy are only compiled in Cocoa platform while WPE uses OpenXR,
which only has code in WebCore. In order to run WebKit based WebXR on non-cocoa VR Standalone devices
we also need to split the code and IPC messages between UIProcess/WebProcess.
The existing PlatformXRSystem/PlatformXRSystemProxy pattern fits very well to the VR standalone scenario.
This patch ensures that the existing code can be used in more platforms other than Cocoa.
Tested by WebXR WPT.
* CMakeLists.txt:
* DerivedSources.make:
* PlatformMac.cmake:
* Shared/XR/XRDeviceIdentifier.h: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h.
* Shared/XR/XRDeviceInfo.cpp: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm.
* Shared/XR/XRDeviceInfo.h: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceInfo.h.
* Shared/XR/XRDeviceProxy.cpp: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm.
* Shared/XR/XRDeviceProxy.h: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceProxy.h.
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: Add include to fix compilation error
* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/Cocoa/PlatformXRCoordinator.mm: Copied from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
* UIProcess/WebPageProxy.h:
* UIProcess/XR/PlatformXRCoordinator.h: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h.
* UIProcess/XR/PlatformXRSystem.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm.
* UIProcess/XR/PlatformXRSystem.h: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h.
* UIProcess/XR/PlatformXRSystem.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::xrSystemProxy):
* WebProcess/WebPage/WebPage.h:
* WebProcess/XR/PlatformXRSystemProxy.cpp: Renamed from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm.
* WebProcess/XR/PlatformXRSystemProxy.h: Renamed from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h.
* WebProcess/XR/PlatformXRSystemProxy.messages.in: Renamed from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in.
2021-07-11 Wenson Hsieh <wenson_hsieh@apple.com>
Remove an unused deprecated private UI delegate method
https://bugs.webkit.org/show_bug.cgi?id=227861
Reviewed by Tim Horton.
`-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is replaced with `-_webView:didTapAtPoint:withResult:`;
the old SPI is no longer required for either binary or source compatibility after rdar://79700201.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didTapAtPoint):
2021-07-10 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Canvas drawing never releases any fonts
https://bugs.webkit.org/show_bug.cgi?id=227376
<rdar://problem/79741186>
Reviewed by Said Abou-Hallawa.
We have a frame counter which makes sure that fonts which haven't been used in n frames get released.
However, we currently only update the frame counter when we release fonts.
This means that the frame counter stays 0 forever. And we never release any fonts.
The fix is just to increment the frame counter even if we don't release any fonts.
No new tests because there is no architectural behavior change.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate):
(WebKit::RemoteResourceCacheProxy::clearFontMap):
(WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate):
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
(WebKit::RemoteResourceCacheProxy::releaseMemory):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-07-10 Chris Dumez <cdumez@apple.com>
Unreviewed follow-up to r279802 to address review feedback from Sam Weinig.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::buildList):
2021-07-09 Chris Dumez <cdumez@apple.com>
[ITP] Improve ResourceLoadStatisticsDatabaseStore's buildList() and use it in more places
https://bugs.webkit.org/show_bug.cgi?id=227843
Reviewed by Sam Weinig.
Improve ResourceLoadStatisticsDatabaseStore's buildList() and use it in more places.
buildList() now works with String types (RegistrableDomain in this particular case) and
can take any container type in parameter.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::buildList):
(WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
(WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
2021-07-09 Jer Noble <jer.noble@apple.com>
[Cocoa] Allow the UIProcess to set logging parameters in the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=227822
Reviewed by Eric Carlson.
For release builds, logLevelString() will return an empty string. Instead, do the same thing
for GPUProcessProxy as we do for WebProcessPool: have a platform-specific initialization
function that, for Cocoa ports, reads log strings from NSUserDefaults.
Drive-by fix: Include <optional> in WKContentPicker.h to work around a unified build error.
* SourcesCocoa.txt:
* UIProcess/Cocoa/GPUProcessProxyCocoa.mm: Added.
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/Cocoa/WKContactPicker.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/GPU/GPUProcessProxy.h:
* WebKit.xcodeproj/project.pbxproj:
2021-07-09 Chris Dumez <cdumez@apple.com>
Validate keys in ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources() before using them with HashMap
https://bugs.webkit.org/show_bug.cgi?id=227842
Reviewed by Kate Cheney.
Validate keys in ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources() before using them with HashMap,
to avoid potential crashes. We do not support storing (or looking up) a key with value 0 in a HashMap whose key type
is 'unsigned'.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
2021-07-09 Jer Noble <jer.noble@apple.com>
[Cocoa] Make Coordinator playback commands more precise
https://bugs.webkit.org/show_bug.cgi?id=227756
Reviewed by Eric Carlson.
Pass through new {play,pause}AtHostTime() and supports{Play,Pause}AtHostTime() methods
to and from the GPU process.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::getConfiguration):
(WebKit::RemoteMediaPlayerProxy::playAtHostTime):
(WebKit::RemoteMediaPlayerProxy::pauseAtHostTime):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::playAtHostTime):
(WebKit::MediaPlayerPrivateRemote::pauseAtHostTime):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h:
(WebKit::RemoteMediaPlayerConfiguration::encode const):
(WebKit::RemoteMediaPlayerConfiguration::decode):
2021-07-09 Youenn Fablet <youenn@apple.com>
Use nw_parameters_allow_sharing_port_with_listener if available
https://bugs.webkit.org/show_bug.cgi?id=227835
<rdar://80312536>
Reviewed by Eric Carlson.
Use nw_parameters_allow_sharing_port_with_listener to allow running local loop connections.
Covered by existing tests running on platforms supporting nw_parameters_allow_sharing_port_with_listener.
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
* Platform/spi/Cocoa/NWParametersSPI.h:
2021-07-09 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Touchscreen navigation swipe doesn't work when the page scrolls horizontally
https://bugs.webkit.org/show_bug.cgi?id=227691
Reviewed by Michael Catanzaro.
When the page scrolls horizontally, we have a separate code path for events that
WebCore didn't handle and which are considered safe to use to start a swipe
gesture. Unfortunately, that code relies on the NativeWebWheelEvents containing a
GdkEvent, which is only the case for actual scroll events, but not synthesized
scroll events on touchscreen, and the needed info (input source type and a proper
timestamp instead of the truncated one wallTimeForEventTime() produces) is not
stored in NativeWebWheelEvent.
While we don't have GdkEvents for every situation we synthesize wheel events in,
we do have them for touchscreen gestures. They aren't GdkScrollEvents, but that
isn't a problem - the only things we use that are specific to GdkScrollEvent are
scroll deltas and whether it's a scroll stop event, and that's also stored in
NativeWebWheelEvent, and we only need GdkEvent for the time and input source type,
where the event type doesn't really matter.
Since touch GdkEvents are controlled via event sequences rather than stop/propagate
return values, don't try and propagate them if web process has returned them: we've
already claimed their sequence before sending them to web process, so they will be
of no use to other widgets.
* Shared/NativeWebWheelEvent.h:
* Shared/gtk/NativeWebWheelEventGtk.cpp:
(WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
Add a GdkEvent parameter to the remaining constructor.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseZoomBegin):
(webkitWebViewBaseTouchDragBegin):
(webkitWebViewBaseTouchDragUpdate):
(webkitWebViewBaseTouchSwipe):
(webkitWebViewBaseSynthesizeWheelEvent):
Split into versions with and without a GdkEvent parameter.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2021-07-08 Adam Mazander <mazander@apple.com>
WebContent: Silence report of AppSupport denial
https://bugs.webkit.org/show_bug.cgi?id=227375
Reviewed by Brent Fulgham.
Manual testing confirms AppSupport does not need access to WebContent. Simplified.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-07-08 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Tapping "Done" in Scribble when focusing an editable element should dismiss Quickboard
https://bugs.webkit.org/show_bug.cgi?id=227817
rdar://79931134
Reviewed by Tim Horton and Devin Rousso.
After using PUICQuickboardMessageViewController's PUICTextInput-based mode for presenting Scribble UI, we fail
to dismiss PUICQuickboardMessageViewController underneath `-dismissAllInputViewControllers:`, since Quickboard
is not the top-most view controller (instead, it ends up being PUICQuickboardRemoteViewController). As a result,
the call to `-dismissViewControllerAnimated:completion:` on the fullscreen input view controller ends up being
dropped on the floor.
Prior to adopting PUICQuickboardMessageViewController and remote text input on watchOS, this worked because the
delegate method `-quickboard:textEntered:` would only be invoked after the front-most view controller was done
dismissing, such that calling `-dismissViewControllerAnimated:completion:` on the fullscreen input view
controller would (correctly) dismiss it.
We can address this by checking whether the fullscreen input view controller itself has a presented view
controller in `-dismissAllInputViewControllers:`, and dismissing that first if necessary.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dismissAllInputViewControllers:]):
2021-07-08 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Expose SPI to opt out of Extensible SSO authentication
https://bugs.webkit.org/show_bug.cgi?id=227729
<rdar://problem/75647892>
Reviewed by Tim Horton.
WKWebView clients should be able to disable Extensible SSO authentication flows, so exposing the internal
mechanism as SPI. This is especially important for use cases where a WKWebView will be used to load content
without being attached to a Window, since a Window is required to present the Extensible SSO authentication
UI. Without a Window, WebKit will wait for a Window to be attached causing loads to timeout. By adopting this
API, developers can opt out of Extensible SSO, allowing loads to fail quickly rather than waiting for a timeout.
Tested by a new TestWebKitAPI test case: SOAuthorizationRedirect.DisableSSO
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _extensibleSSOEnabled]): Add getter for new preference.
(-[WKPreferences _setExtensibleSSOEnabled:]): Add setter.
* UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
(WebKit::NavigationSOAuthorizationSession::shouldStartInternal): Add new logging so developers can see when a WKWebView
without a Window is attempting to participate in Extensible SSO flows.
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
(WebKit::PopUpSOAuthorizationSession::initSecretWebView): Switch from SPI to API.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction): Ditto.
* UIProcess/WebPageProxy.h:
2021-07-08 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Selection is misaligned on some images on twitter.com
https://bugs.webkit.org/show_bug.cgi?id=227775
rdar://77142364
Reviewed by Tim Horton.
See WebCore ChangeLog for more details.
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.h:
(WebKit::createShareableBitmap):
Add an option to handle the scenario where the image renderer is fully transparent by falling back to a frame-
level snapshot, using the bounds of the image renderer.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestTextRecognition):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::imagePositionInformation):
(WebKit::elementPositionInformation):
2021-07-08 Kate Cheney <katherine_cheney@apple.com>
Clean up App Privacy Report code
https://bugs.webkit.org/show_bug.cgi?id=227326
<rdar://problem/79696849>
Reviewed by Brent Fulgham.
Rename App Privacy Report code to better align with the code's purpose
of attributing loads to the app or not. The default value should
be app initiated based on the documentation, so this patch also adjusts
the default value as needed.
This also adopts the new NSURLRequest attribution API and removes
the deprecated _isNonAppInitiated SPI.
Covered by existing layout and API tests.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
(WebKit::NetworkProcess::appPrivacyReportTestingData):
(WebKit::NetworkProcess::clearAppPrivacyReportTestingData):
(WebKit::NetworkProcess::appBoundNavigationData): Deleted.
(WebKit::NetworkProcess::clearAppBoundNavigationData): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
(WebKit::NetworkResourceLoader::isAppBound):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::appPrivacyReportTestingData):
(WebKit::NetworkSession::appBoundNavigationTestingData): Deleted.
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::loadFromNetwork):
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::controlClient):
(WebKit::WebSWServerConnection::createFetchTask):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::updateAppInitiatedValue):
(WebKit::WebSWServerToContextConnection::updateAppBoundValue): Deleted.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourceInfo::isAppInitiated const):
(WebKit::NetworkCache::SubresourceInfo::setIsAppInitiated):
(WebKit::NetworkCache::SubresourceInfo::isAppBound const): Deleted.
(WebKit::NetworkCache::SubresourceInfo::setIsAppBound): Deleted.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/AppPrivacyReport.h:
(WebKit::AppPrivacyReportTestingData::setDidPerformSoftUpdate):
(WebKit::AppPrivacyReportTestingData::clearAppPrivacyReportTestingData):
(WebKit::AppPrivacyReportTestingData::didLoadAppInitiatedRequest):
(WebKit::AppPrivacyReportTestingData::encode const):
(WebKit::AppPrivacyReportTestingData::decode):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData):
(IPC::ArgumentCoder<WebCore::ResourceRequest>::decodePlatformData):
* Shared/NavigatingToAppBoundDomain.h:
(WebKit::AppBoundNavigationTestingData::setDidPerformSoftUpdate): Deleted.
(WebKit::AppBoundNavigationTestingData::clearAppBoundNavigationDataTesting): Deleted.
(WebKit::AppBoundNavigationTestingData::updateAppBoundNavigationTestingData): Deleted.
(WebKit::AppBoundNavigationTestingData::encode const): Deleted.
(WebKit::AppBoundNavigationTestingData::decode): Deleted.
(): Deleted.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didLoadAppInitiatedRequest:]):
(-[WKWebView _didLoadNonAppInitiatedRequest:]):
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]): Deleted.
Removed now that we no longer need to test attribution context, that
is all it was used for.
(-[WKWebView _didLoadAppBoundRequest:]): Deleted.
(-[WKWebView _didLoadNonAppBoundRequest:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _lastNavigationWasAppInitiated:]):
(-[WKWebView _appPrivacyReportTestingData:]):
(-[WKWebView _clearAppPrivacyReportTestingData:]):
(-[WKWebView _lastNavigationWasAppBound:]): Deleted.
(-[WKWebView _appBoundNavigationData:]): Deleted.
(-[WKWebView _clearAppBoundNavigationData:]): Deleted.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setLastNavigationWasAppInitiated):
(WebKit::WebPageProxy::lastNavigationWasAppInitiated):
(WebKit::WebPageProxy::setLastNavigationWasAppBound): Deleted.
(WebKit::WebPageProxy::lastNavigationWasAppBound): Deleted.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::preconnectTo):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::preconnectTo):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::appPrivacyReportTestingData):
(WebKit::WebPageProxy::clearAppPrivacyReportTestingData):
(WebKit::WebPageProxy::appBoundNavigationData): Deleted.
(WebKit::WebPageProxy::clearAppBoundNavigationData): Deleted.
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResource):
(WebKit::WebLoaderStrategy::preconnectTo):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::updateAppInitiatedValue):
(WebKit::WebSWContextManagerConnection::startFetch):
(WebKit::WebSWContextManagerConnection::updateAppBoundValue): Deleted.
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::createDocumentLoader):
(WebKit::WebPage::lastNavigationWasAppInitiated):
(WebKit::WebPage::lastNavigationWasAppBound): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::setLastNavigationWasAppInitiated):
(WebKit::WebPage::setLastNavigationWasAppBound): Deleted.
* WebProcess/WebPage/WebPage.messages.in:
2021-07-08 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Too easy to trigger navigation swipe on touchscreen
https://bugs.webkit.org/show_bug.cgi?id=226745
Reviewed by Michael Catanzaro.
ViewGestureController uses both x and y deltas to figure out whether to proceed
with a swipe, in the cross-platform part of the code. However, that was optimized
out during the touch handling rewrite, bring it back.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseHandleWheelEvent):
(webkitWebViewBaseScroll):
(webkitWebViewBaseTouchDragUpdate):
(webkitWebViewBaseTouchDragEnd):
* UIProcess/ViewGestureController.h:
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
(WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
(WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
(WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
2021-07-08 Garrett Davidson <garrett_davidson@apple.com>
_WKWebAuthenticationPanel is returning the wrong operation type in clientDataJSON
https://bugs.webkit.org/show_bug.cgi?id=227726
rdar://80073404
Reviewed by Kate Cheney.
The -getAssertion:... method was passing the wrong _WKWebAuthenticationType to produceClientDataJSON().
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]):
2021-07-08 Per Arne <pvollan@apple.com>
Set Caption preferences in the UI process
https://bugs.webkit.org/show_bug.cgi?id=227742
<rdar://79040526>
Reviewed by Eric Carlson.
Subclass the Caption user preferences delegate, which will send messages to the UI process, requesting to set the preferences.
* SourcesCocoa.txt:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::setCaptionDisplayMode):
(WebKit::WebProcessProxy::setCaptionLanguage):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp: Added.
(WebKit::WebCaptionPreferencesDelegate::setDisplayMode):
(WebKit::WebCaptionPreferencesDelegate::setPreferredLanguage):
* WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h: Added.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-07-07 Tim Horton <timothy_horton@apple.com>
Add WKHoverPlatter and some knobs to tweak its appearance
https://bugs.webkit.org/show_bug.cgi?id=227735
<rdar://problem/79198262>
Reviewed by Sam Weinig.
* Configurations/WebKit.xcconfig:
* Platform/spi/ios/PrototypeToolsSPI.h: Added.
* SourcesCocoa.txt:
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView rootContentView]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpInteraction]):
(-[WKContentView cleanUpInteraction]):
Install and uninstall the platter alongside the gestures that drive it.
(-[WKContentView mouseGestureRecognizerChanged:]):
(-[WKContentView hoverGestureRecognizerChanged:]):
When the gesture recognizers fire, also update the hover point.
(-[WKContentView positionInformationForHoverPlatter:withRequest:completionHandler:]):
* UIProcess/ios/WKHoverPlatter.h: Added.
* UIProcess/ios/WKHoverPlatter.mm: Added.
(createBaseAnimation):
(addAnimation):
(setAdditionalPlatterLayerProperties):
(addAdditionalIncomingAnimations):
(addAdditionalDismissalAnimations):
(-[WKHoverPlatter initWithView:delegate:]):
(-[WKHoverPlatter invalidate]):
(-[WKHoverPlatter hoverPoint]):
(-[WKHoverPlatter setHoverPoint:]):
(-[WKHoverPlatter requestPositionInformationForCurrentHoverPoint]):
(-[WKHoverPlatter didReceivePositionInformation:]):
(-[WKHoverPlatter dismissPlatterWithAnimation:]):
(-[WKHoverPlatter didFinishAnimationForShadow:]):
(-[WKHoverPlatter clearLayers]):
Animate the platter in and out, and optionally between states, as the hover point moves.
Use the TextIndicator's geometry information, but not its snapshot; we use a
CAPortalLayer for the platter instead. A future patch will avoid taking the snapshot
entirely, since we call setHoverPoint (and thus generate a TextIndicator) a *lot*
when moving the mouse around, and all those snapshots add up.
* UIProcess/ios/WKHoverPlatterParameters.h: Added.
* UIProcess/ios/WKHoverPlatterParameters.mm: Added.
(-[PTSliderRow integerMinValue:maxValue:]):
(-[WKHoverPlatterParameters setDefaultValues]):
(+[WKHoverPlatterParameters settingsControllerModule]):
(+[WKHoverPlatterDomain rootSettings]):
(+[WKHoverPlatterDomain domainGroupName]):
(+[WKHoverPlatterDomain domainName]):
(+[WKHoverPlatterDomain rootSettingsClass]):
Add some knobs, with reasonable defaults, for experimentation.
* WebKit.xcodeproj/project.pbxproj:
2021-07-07 John Wilander <wilander@apple.com>
PCM: Add error logging for CryptoKit operations
https://bugs.webkit.org/show_bug.cgi?id=227731
<rdar://80221057>
Reviewed by Brent Fulgham.
Resolves three FIXMEs for error logging in PCM's CryptoKit operations.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
2021-07-07 Devin Rousso <drousso@apple.com>
Extremely jumpy window resizing in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=167529
<rdar://problem/77568931>
Reviewed by Tim Horton.
Instead of computing the `m_pendingTopContentInset` inside `updateContentInsetsIfAutomatic`,
wait to do it until we're actually dispatching the value to the WebProcess, as it's possible
for the former to happen while still inside a layout, which could result in the wrong value.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
(WebKit::WebViewImpl::topContentInset const):
(WebKit::WebViewImpl::setTopContentInset):
(WebKit::WebViewImpl::scheduleSetTopContentInsetDispatch): Added.
(WebKit::WebViewImpl::dispatchSetTopContentInset):
Still keep `m_pendingTopContentInset` so that manual calls to `setTopContentInset` can also
be batched with `updateContentInsetsIfAutomatic`, each taking precedence over the other if
called later.
2021-07-07 Chris Dumez <cdumez@apple.com>
Unreviewed follow-up to r279601 to address some assertions on the bots.
Because we call makeWeakPtr() on a ProcessAssertion from a background queue, we have to
make sure the ProcessAssertion's WeakPtrFactory gets initialized eagerly on the main
thread, to avoid races and assertions in debug.
* UIProcess/ProcessAssertion.h:
2021-07-07 Chris Dumez <cdumez@apple.com>
[ITP] Potential assertion hit in ResourceLoadStatisticsDatabaseStore::clearUserInteraction()
https://bugs.webkit.org/show_bug.cgi?id=227763
<rdar://80231894>
Reviewed by Darin Adler.
ResourceLoadStatisticsDatabaseStore::clearUserInteraction() was starting a SQLite transaction
but one of its callers already starts one, causing us to hit this assertion (recursive
transactions are not supported).
To address the issue, add an overload that takes in an SQLiteTransaction, when the call
site already started a transaction.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
(WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2021-07-07 Christopher Reid <chris.reid@sony.com>
[PlayStation] Don't assume 4KB block size when estimating Network Cache disk usage
https://bugs.webkit.org/show_bug.cgi?id=227502
Reviewed by Chris Dumez.
Network Cache disk usage can underestimate the real disk usage on platforms
with file blocks larger than 4 KB.
Adding call to FileSystem::getVolumeFileBlockSize to use the FileSystem's
block size in the estimation.
* NetworkProcess/cache/NetworkCacheStorage.cpp:
* NetworkProcess/cache/NetworkCacheStorage.h:
2021-07-07 Fujii Hironori <Hironori.Fujii@sony.com>
[Cairo] Merge PlatformContextCairo into GraphicsContextCairo
https://bugs.webkit.org/show_bug.cgi?id=227721
Reviewed by Don Olmstead.
* Shared/API/c/cairo/WKImageCairo.cpp:
* Shared/cairo/ShareableBitmapCairo.cpp:
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
2021-07-07 Alex Christensen <achristensen@webkit.org>
XPC services should release their os transaction when given a SIGTERM signal
https://bugs.webkit.org/show_bug.cgi?id=227747
<rdar://72430454>
Reviewed by Geoff Garen.
Apparently when you shut down your computer, processes are given a SIGTERM signal and expected to release their os_transaction_t
to indicate that they can now be terminated "cleanly".
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
2021-07-07 Alex Christensen <achristensen@webkit.org>
Use more Span
https://bugs.webkit.org/show_bug.cgi?id=227606
Reviewed by Darin Adler.
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::decodeRecordHeader):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::readOrigin):
(WebKit::CacheStorage::decodeCachesNames):
* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::Data::mapToFile const):
(WebKit::NetworkCache::computeSHA1):
* NetworkProcess/cache/NetworkCacheData.h:
(WebKit::NetworkCache::Data::span const):
* NetworkProcess/cache/NetworkCacheDataCocoa.mm:
(WebKit::NetworkCache::Data::apply const):
* NetworkProcess/cache/NetworkCacheDataCurl.cpp:
(WebKit::NetworkCache::Data::apply const):
* NetworkProcess/cache/NetworkCacheDataGLib.cpp:
(WebKit::NetworkCache::Data::apply const):
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::decodeStorageRecord):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::decodeRecordMetaData):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord):
* UIProcess/API/APIContentRuleListStore.cpp:
(API::getData):
(API::decodeContentRuleListMetaData):
(API::writeDataToFile):
2021-07-07 Chris Dumez <cdumez@apple.com>
[macOS] Suspend WebProcesses that are in the process cache
https://bugs.webkit.org/show_bug.cgi?id=227269
<rdar://problem/79639863>
Reviewed by Geoffrey Garen.
Suspend WebProcesses that are in the process cache on macOS to make sure they use no CPU.
The suspension happens 30 seconds after the process enters the cache, giving the WebProcess
time to finish whatever clean up it needs to do before suspending.
* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::CachedProcess::CachedProcess):
(WebKit::WebProcessCache::CachedProcess::~CachedProcess):
(WebKit::WebProcessCache::CachedProcess::takeProcess):
(WebKit::WebProcessCache::suspensionTimerFired):
* UIProcess/WebProcessCache.h:
(WebKit::WebProcessCache::CachedProcess::isSuspended const):
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::platformSuspendProcess):
(WebKit::WebProcessProxy::platformResumeProcess):
2021-07-06 Ryosuke Niwa <rniwa@webkit.org>
Deploy smart pointers in EventHandler and UserInputBridge
https://bugs.webkit.org/show_bug.cgi?id=227481
<rdar://problem/79906757>
Reviewed by Wenson Hsieh and Chris Dumez.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::contextMenuAtPointInWindow):
(WebKit::handleContextMenuEvent):
2021-07-06 Devin Rousso <drousso@apple.com>
Provide SPI for clients to override just the contextmenu preview instead of the entire `UIContextMenuConfiguration`
https://bugs.webkit.org/show_bug.cgi?id=227603
<rdar://problem/78832586>
Reviewed by Wenson Hsieh.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]):
This allows Safari to remove some custom contextmenu code and use WebKit's default actions.
2021-07-06 Sihui Liu <sihui_liu@apple.com>
WebIDBServer created after NetworkProcess::prepareToSuspend is not suspended correctly
https://bugs.webkit.org/show_bug.cgi?id=227650
Reviewed by Chris Dumez.
We created WebIDBServer on receiving AddIDBConnection message from web process, to make sure WebIDBServer's
thread is launched only when it is needed. Now WebIDBServer uses WorkQueue, which uses thread from thread pool,
we can go back to ensure WebIDBServer at when connection to web process is needed. By doing this, it's less
likely WebIDBServer is created after NetworkProcess::prepareToSuspend. To make it more safe, this patch also
sets m_shouldSuspendIDBServer on NetworkProcess::prepareToSuspend. If the value is true, WebIDBServer is
suspended after creation.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::addIDBConnection): Deleted.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
(WebKit::NetworkProcess::createWebIDBServer):
* NetworkProcess/NetworkProcess.h:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
2021-07-06 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Extraneous spaces when copying or translating Chinese and Japanese text in WebKit
https://bugs.webkit.org/show_bug.cgi?id=227674
rdar://79669807
Reviewed by Tim Horton.
When injecting Live Text into images, we currently assume that all pieces of recognized text from VisionKit are
separated by spaces. Upon selecting Japanese or Chinese text, this causes text selections to include extraneous
spaces between words.
To fix this, we add a bit for each TextRecognitionWordData, to indicate whether that word should be followed by
whitespace in the image overlay. When converting VKWKTextInfo into TextRecognitionWordData, we then set this bit
to `true` only if the word is the first on a line of text that is preceded by another line, or there exists
whitespace between the word and the previous word on the same line.
* Platform/cocoa/TextRecognitionUtilities.mm:
(WebKit::makeTextRecognitionResult):
2021-07-06 Alex Christensen <achristensen@webkit.org>
Make Caches::writeRecord and Caches::readRecord more robust
https://bugs.webkit.org/show_bug.cgi?id=221620
Reviewed by Youenn Fablet.
I saw null dereferenced in EWS, and everywhere else we check m_storage for null.
Some events happen during teardown. No reason to crash.
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::writeRecord):
(WebKit::CacheStorage::Caches::readRecord):
2021-07-06 Chris Dumez <cdumez@apple.com>
[iOS] Have ProcessAssertion take the RunningBoard assertion asynchronously by default
https://bugs.webkit.org/show_bug.cgi?id=225324
<rdar://76972252>
Reviewed by Geoffrey Garen.
Have ProcessAssertion take the RunningBoard assertion asynchronously (on a background thread) by
default as we have evidence that doing so on the main thread is bad for performance and may
negatively impact launch time.
When constructing a ProcessAssertion, the caller can now indicate if it wants the assertion to be
taken asynchronously (default) or not. Bug 227552 is an example of a case where we still want to
take the assertion synchronously (because we're not on the main thread and we need to make sure
we have the assertion before proceeding).
The caller can also provide a completion handler that will get called once the RunningBoard is
taken. Note that the RunningBoard async API ([RBSAssertion acquireWithInvalidationHandler]) does
not provide a way for us to know when the assertion is taken. For this reason, ProcessAssertion
keeps using the RunningBoard sync API ([RBSAssertion acquireWithError:]) but calls in on a
background queue.
For the UIProcess's background task though, we don't need to know when the assertion is taken
so we can use the RunningBoard async API.
Note that the previous iteration of this patch had a bug where the ProcessThrottler would release
its previous assertion before the new one is taken (asynchronously) when changing the assertion
type (e.g. foreground to background). This is addressed in this patch. ProcessThrottler now passes
an acquisition handler when constructing the ProcessAssertion and only releases its previous
assertion once the acquisition handler for the new one is taken.
* NetworkProcess/Downloads/DownloadMap.cpp:
(WebKit::DownloadMap::add):
* NetworkProcess/Downloads/DownloadMap.h:
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
* UIProcess/Downloads/DownloadProxyMap.cpp:
(WebKit::DownloadProxyMap::createDownloadProxy):
* UIProcess/Downloads/DownloadProxyMap.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::setWebProcessHasUploads):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/ProcessAssertion.cpp:
(WebKit::ProcessAssertion::ProcessAssertion):
* UIProcess/ProcessAssertion.h:
(WebKit::ProcessAssertion::create):
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::setAssertionType):
* UIProcess/ProcessThrottler.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::updateAudibleMediaAssertions):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::updateAudibleMediaAssertions):
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/ProcessAssertionIOS.mm:
(assertionsWorkQueue):
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
(-[WKProcessAssertionBackgroundTaskManager assertion:didInvalidateWithError:]):
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::acquireAsync):
(WebKit::ProcessAssertion::acquireSync):
(WebKit::ProcessAssertion::~ProcessAssertion):
(WebKit::ProcessAssertion::processAssertionWasInvalidated):
(WebKit::ProcessAssertion::isValid const):
2021-07-06 Sihui Liu <sihui_liu@apple.com>
Don't interrupt database for WebResourceLoadStatisticsStore if it will not be suspended
https://bugs.webkit.org/show_bug.cgi?id=227708
Reviewed by Geoffrey Garen.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::suspend):
2021-07-06 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r279597.
Broke build
Reverted changeset:
"Make Caches::writeRecord and Caches::readRecord more robust"
https://bugs.webkit.org/show_bug.cgi?id=221620
https://commits.webkit.org/r279597
2021-07-06 Alex Christensen <achristensen@webkit.org>
Make Caches::writeRecord and Caches::readRecord more robust
https://bugs.webkit.org/show_bug.cgi?id=221620
Reviewed by Youenn Fablet.
I saw null dereferenced in EWS, and everywhere else we check m_storage for null.
Some events happen during teardown. No reason to crash.
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::writeRecord):
(WebKit::CacheStorage::Caches::readRecord):
2021-07-06 Alex Christensen <achristensen@webkit.org>
loadSimulatedRequest: should do same delegate callbacks as loadHTMLString and loadData
https://bugs.webkit.org/show_bug.cgi?id=227599
Reviewed by Chris Dumez.
Share more code with loadData and loadHTMLString to prevent such errors.
Before this change we set SubstituteData.failingURL, which in FrameLoader::PolicyChecker::checkNavigationPolicy
makes it behave more like _loadAlternateHTMLString which doesn't call decidePolicyForNavigationAction and does
add a back/forward entry. We want it to behave more like loadHTMLString, which does call decidePolicyForNavigationAction
and doesn't add a back/forward entry. Except we do want it to add a back/forward entry. This patch is to accomplish that.
In order to continue making a back/forward list item with loadSimulatedRequest, we need to use
WebCore::SubstituteData::SessionHistoryVisibility::Visible for its calls and also API::SubstituteData
needs to remember that we initially used that for when we go back to a back/forward list item from
that data. In order to keep binary compatibility with existing apps, loadData and loadHTMLString
need to continue using WebCore::SubstituteData::SessionHistoryVisibility::Hidden.
Covered by existing and new API tests.
* Shared/LoadParameters.cpp:
(WebKit::LoadParameters::encode const):
(WebKit::LoadParameters::decode):
* Shared/LoadParameters.h:
* UIProcess/API/APINavigation.cpp:
(API::SubstituteData::SubstituteData):
* UIProcess/API/APINavigation.h:
(API::SubstituteData::SubstituteData):
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::loadData):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadData):
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::loadSimulatedRequest):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadDataImpl):
(WebKit::WebPage::loadData):
(WebKit::WebPage::loadAlternateHTML):
(WebKit::WebPage::loadSimulatedRequestAndResponse):
* WebProcess/WebPage/WebPage.h:
2021-07-06 Per Arne <pvollan@apple.com>
Collect Accessibility preferences on a background queue
https://bugs.webkit.org/show_bug.cgi?id=227617
<rdar://80055168>
Reviewed by Brent Fulgham.
To avoid blocking the main thread of the UI process, collect Media Accessibility preferences on a background thread,
and send them to the WebContent process(es).
* Shared/AccessibilityPreferences.cpp:
(IPC::ArgumentCoder<WebKit::AccessibilityPreferences>::encode):
(IPC::ArgumentCoder<WebKit::AccessibilityPreferences>::decode):
* Shared/AccessibilityPreferences.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::accessibilityPreferences):
(WebKit::WebProcessPool::setMediaAccessibilityPreferences):
(WebKit::WebProcessPool::mediaAccessibilityPreferencesChangedCallback):
(WebKit::WebProcessPool::registerNotificationObservers):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityPreferencesDidChange):
(WebKit::WebProcess::setMediaAccessibilityPreferences):
2021-07-06 Youenn Fablet <youenn@apple.com>
REGRESSION: [iOS] ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::RemoteRemoteCommandListener::~RemoteRemoteCommandListener()
https://bugs.webkit.org/show_bug.cgi?id=226248
<rdar://problem/78481758>
Reviewed by Eric Carlson.
Make sure to remove message receiver on the same gpu process connection it was added.
Also make sure to recreate remote command listener every time we use a new connection.
Do the same thing for RemoteAudioHardwareListener.
Also make sure to remove message receiver in RemoteRenderingBackendProxy::gpuProcessConnectionDidClose
Covered by existing tests.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose):
* WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:
(WebKit::RemoteAudioHardwareListener::RemoteAudioHardwareListener):
(WebKit::RemoteAudioHardwareListener::~RemoteAudioHardwareListener):
* WebProcess/GPU/media/RemoteAudioHardwareListener.h:
* WebProcess/GPU/media/RemoteRemoteCommandListener.cpp:
(WebKit::RemoteRemoteCommandListener::RemoteRemoteCommandListener):
(WebKit::RemoteRemoteCommandListener::~RemoteRemoteCommandListener):
(WebKit::RemoteRemoteCommandListener::ensureGPUProcessConnection):
(WebKit::RemoteRemoteCommandListener::gpuProcessConnectionDidClose):
(WebKit::RemoteRemoteCommandListener::updateSupportedCommands):
* WebProcess/GPU/media/RemoteRemoteCommandListener.h:
2021-07-06 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r279495.
Seems to have caused a ~2% PLT5 regression
Reverted changeset:
"[macOS] Suspend WebProcesses that are in the process cache"
https://bugs.webkit.org/show_bug.cgi?id=227269
https://commits.webkit.org/r279495
2021-07-06 Alexander Mikhaylenko <alexm@gnome.org>
[GTK4] Navigation swipe doesn't work when the page scrolls horizontally
https://bugs.webkit.org/show_bug.cgi?id=226173
Reviewed by Michael Catanzaro.
There was a chunk of code that was never ported to GTK4. Port it.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
2021-07-06 Youenn Fablet <youenn@apple.com>
NetworkRTCUDPSocketCocoa should update the port of its m_address field
https://bugs.webkit.org/show_bug.cgi?id=227622
Reviewed by Eric Carlson.
Make sure we set the port to m_address field as this is used for setting up nw_connections.
Then notify WebProcess to proceed. This will ensure that we create a nw_connection with the right listening port.
Also fix the value given to nw_parameters_set_is_third_party_web_content.
Set local address reuse to true with nw_parameters_set_reuse_local_address so that listeners and connections can share the same address and port.
This does not always work so, we temporarily resort to use a 0 port instead of m_address.port() when setting up nw_connections.
Manually tested.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::doSocketTaskOnRTCNetworkThread):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h:
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoa::setListeningPort):
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::setListeningPort):
2021-07-06 Youenn Fablet <youenn@apple.com>
UserMediaCaptureManagerProxy::SourceProxy destructor should remove itself as observer before invalidating its ring buffer storage
https://bugs.webkit.org/show_bug.cgi?id=227683
Reviewed by Eric Carlson.
Covered by existing tests.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy):
Previously, we were invalidating the ring buffer storage before removing the source proxy as audio observer.
This created the risk for the ring buffer to be recreated before the end of SourceProxy destructor.
To fix this, we invalidate the storage just after stopping observing.
2021-07-05 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Navigation swipe gesture can be triggered with mouse
https://bugs.webkit.org/show_bug.cgi?id=227678
Reviewed by Carlos Garcia Campos.
Originally, the navigation swipe gesture had a few checks to only make it possible to
trigger it with a touchpad or touchscreen, with an exception for simulated swipes
where we couldn't set the source easily.
During the rewrite in https://bugs.webkit.org/show_bug.cgi?id=212324, the check got
dropped, but it has a good reason to be there: not all devices are capable of
performing a gesture. Touchpads and touchscreens should be fine, trackpoints are
finicky, though can still technically work, but mouse are a no-go. While they can
start a swipe, they will never end it and the gesture will get stuck.
So, add the check back. Don't bother with the scroll direction this time though, while
that check made sense when it got added, at some point since then all scroll events
had GDK_SCROLL_SMOOTH direction and just set their deltas to (1, 0), (-1, 0), (0, 1)
or (0, -1), so that check stopped working, and the source type check should filter
mouse events anyway.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseHandleWheelEvent):
(webkitWebViewBaseScroll):
(webkitWebViewBaseTouchDragUpdate):
(webkitWebViewBaseTouchDragEnd):
* UIProcess/ViewGestureController.h:
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
(WebKit::isTouchEvent):
(WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
(WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
2021-07-05 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Kinetic scrolling interferes with gestures
https://bugs.webkit.org/show_bug.cgi?id=226680
Reviewed by Michael Catanzaro.
Simulate scroll events that would stop scrolling when we're starting any touch
gesture. Since we don't have a way to do that on touchpad yet, just stop it when
starting a zoom or a navigation swipe gesture instead.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::navigationGestureDidBegin):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseZoomBegin):
(webkitWebViewBaseTouchDragBegin):
(webkitWebViewBaseConstructed):
2021-07-04 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
https://bugs.webkit.org/show_bug.cgi?id=227666
rdar://80094962
Reviewed by Tim Horton.
The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
taps that were handled as meaningful clicks as well.
To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
result of the tap was "meaningfully" handled.
To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.
Tests: fast/events/ios/did-not-handle-meaningful-click.html
fast/events/ios/meaningful-click-when-focusing-body.html
fast/events/ios/meaningful-click-when-playing-media.html
fast/events/ios/non-meaningful-click-when-tapping-document.html
* Shared/ios/TapHandlingResult.h: Added.
Add a new C++ enum type to represent the tap handling result type (see description above).
* UIProcess/API/APIUIClient.h:
(API::UIClient::didTapAtPoint):
(API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
* UIProcess/API/ios/WKWebViewIOS.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(wkTapHandlingResult):
Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _didTapAtPoint:withResult:]):
(-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didTapAtPoint):
Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
they have a chance to adopt the new SPI.
(WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
and a flag indicating how the tap was handled by web content.
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didTapAtPoint):
(WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didTapAtPoint):
(WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).
(WebKit::WebPage::attemptSyntheticClick):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::commitPotentialTapFailed):
2021-07-02 Chris Dumez <cdumez@apple.com>
Unreviewed attempt to fix Mac Catalyst build.
* NetworkProcess/ios/NetworkProcessIOS.mm:
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
* NetworkProcess/mac/NetworkProcessMac.mm:
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
2021-07-02 Chris Dumez <cdumez@apple.com>
Unreviewed Mac Catalyst build fix after r279514.
* NetworkProcess/ios/NetworkProcessIOS.mm:
2021-07-02 Chris Dumez <cdumez@apple.com>
Take a process assertion in the network process when holding locked files
https://bugs.webkit.org/show_bug.cgi?id=227552
Reviewed by Sihui Liu.
Take a process assertion in the network process when holding locked files. Previously, we'd
send an IPC to the UIProcess and the UIProcess would take the assertion on behalf of the
network process. However, our previous approach was racy and could cause the network process
to still get suspended while still holding locked files (which would get it killed).
We have evidence that the network process is getting killed a lot for this reason
(rdar://79787123).
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
Call setIsHoldingLockedFiles() when the "isHoldingLockedFiles" state changes instead of sending
an IPC to the UIProcess. setIsHoldingLockedFiles() takes care of taking or releasing a
RunningBoard assertion.
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
Stop calling setSuspended() on the WebSQLiteDatabaseTracker. The purpose was to avoid sending
the SetIsHoldingLockedFiles IPC to the UIProcess after receiving the PrepareToSuspend IPC.
However, it is now acceptable to take a process assertion after PrepareToSuspend IPC has been
received.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/ios/NetworkProcessIOS.mm:
(WebKit::NetworkProcess::setIsHoldingLockedFiles):
When setIsHoldingLockedFiles(true) gets called, we take a runningboard assertion to prevent
suspension. Note that setIsHoldingLockedFiles(true) gets on the storage thread (which started
the SQLite transaction) so we take the assertion synchronously to make sure we cannot get
suspended during a SQLite transaction.
When setIsHoldingLockedFiles(false) gets called, we release the runningboard assertion.
* Shared/WebSQLiteDatabaseTracker.cpp:
(WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
(WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
(WebKit::WebSQLiteDatabaseTracker::setIsSuspended):
(WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction):
(WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
(WebKit::WebSQLiteDatabaseTracker::setIsHoldingLockedFiles):
* Shared/WebSQLiteDatabaseTracker.h:
Update WebSQLiteDatabaseTracker so that it called its isHoldingLockedFilesHandler lambda
directly on the storage thread when the first transaction starts, instead of dispatching
to the main thread. Dispatching to the main thread would be racy as it would mean taking
the process assertion asynchronously (on the main thread), after the SQLite transaction
has begun on the storage thread.
As a result, of this change, I am not using the HysterisActivity class anymore and using
my own thread-safe hysteresis activity using RunLoop::dispatchAfter() with an integer
and a lock.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessDidTerminate):
(WebKit::NetworkProcessProxy::sendProcessDidResume):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
Drop the SetIsHoldingLockedFiles IPC and its handling on UIProcess side since the network
process now takes the assertion by itself.
2021-07-02 Chris Dumez <cdumez@apple.com>
Regression(r278786) LocalStorageDatabase's transaction may be remain active when process gets suspended
https://bugs.webkit.org/show_bug.cgi?id=227632
Reviewed by Geoffrey Garen.
After r278786, LocalStorageDatabase has a SQL transaction that gets committed with a 500ms delay on the
storage thread. When the network process would receive the PrepareToSuspend IPC, it would suspend / hang
the storage thread, which would prevent the SQL transaction from getting committed and we would suspend
with a locked file and get killed. We now make sure to flush local storage to disk (i.e. commit that
transaction) before we suspend / hang the storage thread.
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::waitUntilSyncingLocalStorageFinished):
(WebKit::StorageManagerSet::flushLocalStorage):
(WebKit::StorageManagerSet::suspend):
* NetworkProcess/WebStorage/StorageManagerSet.h:
2021-07-02 Brady Eidson <beidson@apple.com>
WebPageProxy::setAppHighlightsVisibility might send message from a background thread, ASSERTing
<rdar://80056481> and https://bugs.webkit.org/show_bug.cgi?id=227607
Reviewed by Chris Dumez.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setAppHighlightsVisibility):
(WebKit::WebPageProxy::setUpHighlightsObserver): The callback we get here is often on a background thread.
So bounce it to main.
2021-07-02 Philippe Normand <pnormand@igalia.com>
[GTK] Add new revision variable in pkgconfig file
https://bugs.webkit.org/show_bug.cgi?id=227629
Reviewed by Michael Catanzaro.
Include SVN_REVISION as revision variable, useful for apps to know on which upstream SVN
revision their WebKitGTK-based app is built on.
* gtk/webkit2gtk-web-extension.pc.in:
* gtk/webkit2gtk.pc.in:
2021-07-02 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279494.
https://bugs.webkit.org/show_bug.cgi?id=227628
Broke api test
TestWebKitAPI.WKWebView.LoadSimulatedRequestUpdatesBackForwardList
Reverted changeset:
"loadSimulatedRequest: should do same delegate callbacks as
loadHTMLString and loadData"
https://bugs.webkit.org/show_bug.cgi?id=227599
https://commits.webkit.org/r279494
2021-07-02 Antoine Quint <graouts@webkit.org>
REGRESSION (r279477): WebKit_iosmac failed to build in : ModelElementControllerCocoa.mm:58:24: member reference type 'WebKit::WebPageProxy' is not a pointer; did you mean to use '.'?
https://bugs.webkit.org/show_bug.cgi?id=227612
<rdar://problem/80054936>
Reviewed by Alan Bujtas.
* UIProcess/Cocoa/ModelElementControllerCocoa.mm:
(WebKit::ModelElementController::takeModelElementFullscreen):
2021-07-01 Chris Dumez <cdumez@apple.com>
[macOS] Suspend WebProcesses that are in the process cache
https://bugs.webkit.org/show_bug.cgi?id=227269
Reviewed by Geoffrey Garen.
Suspend WebProcesses that are in the process cache on macOS to make sure they use no CPU.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setIsInProcessCache):
(WebKit::WebProcessProxy::platformSuspendProcess):
(WebKit::WebProcessProxy::platformResumeProcess):
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::platformSuspendProcess):
(WebKit::WebProcessProxy::platformResumeProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setIsInProcessCache):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
2021-07-01 Alex Christensen <achristensen@webkit.org>
loadSimulatedRequest: should do same delegate callbacks as loadHTMLString and loadData
https://bugs.webkit.org/show_bug.cgi?id=227599
Reviewed by Chris Dumez.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadSimulatedRequestAndResponse):
2021-07-01 Youenn Fablet <youenn@apple.com>
Disable relay for UDP sockets when not needed
https://bugs.webkit.org/show_bug.cgi?id=227253
Reviewed by Eric Carlson.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createUDPSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h:
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::create):
(WebKit::NetworkRTCUDPSocketCocoa::createUDPSocket):
(WebKit::NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa):
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::RTCSocketFactory::RTCSocketFactory):
(WebKit::RTCSocketFactory::CreateUdpSocket):
(WebKit::LibWebRTCProvider::createSocketFactory):
* WebProcess/Network/webrtc/LibWebRTCProvider.h:
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::createUdpSocket):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
2021-07-01 Wenson Hsieh <wenson_hsieh@apple.com>
Selecting or dragging images that contain recognizable text is difficult in Mail compose
https://bugs.webkit.org/show_bug.cgi?id=227544
Reviewed by Devin Rousso.
Long pressing images in editable content on iOS initiates dragging, and a tap-and-half gesture over the image
selects the entire image. Both of these are common interactions for image attachments in Mail compose that
take precedence over new Live Text interactions, so there's no advantage to triggering image analysis on images
in editable content.
Avoid doing this extra work by adjusting `-imageAnalysisGestureDidBegin:` to bail early if the image is inside
editable content.
Tests: ImageAnalysisTests.DoNotAnalyzeImagesInEditableContent
ImageAnalysisTests.HandleImageAnalyzerError
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
Add an `isContentEditable` flag.
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _imageAnalysisGestureRecognizer]):
Add a testing hook to return the gesture recognizer used to trigger image analysis.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView imageAnalysisGestureRecognizer]):
(-[WKContentView imageAnalysisGestureDidBegin:]):
Pull logic for avoiding image analysis out into a separate lambda, and add a check for `isContentEditable`.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::positionInformation):
Populate the `isContentEditable` flag based on whether or not the node found by the position information request
is editable.
2021-07-01 Antoine Quint <graouts@webkit.org>
[Model] Restrict IPC calls to ARKit SPI availability and runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227581
Reviewed by Tim Horton.
Guard all IPC calls related to <model> by the most appropriate platform-specific flag
and also ensure that those calls don't do anything unless the runtime flag is also
enabled.
* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/Cocoa/ModelElementControllerCocoa.mm:
(WebKit::ModelElementController::takeModelElementFullscreen):
(WebKit::ModelElementController::modelElementDidCreatePreview):
* UIProcess/ModelElementController.cpp:
* UIProcess/ModelElementController.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::takeModelElementFullscreen):
(WebKit::WebPageProxy::modelElementDidCreatePreview):
(WebKit::WebPageProxy::modelElementPreviewDidObtainContextId):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::modelElementDidCreatePreview const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::modelElementPreviewDidObtainContextId):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
2021-07-01 Per Arne <pvollan@apple.com>
[macOS] Fix sandbox violations related to IOKit filtering
https://bugs.webkit.org/show_bug.cgi?id=227572
<rdar://78354215>
Reviewed by Brent Fulgham.
* WebProcess/com.apple.WebProcess.sb.in:
2021-07-01 Aditya Keerthi <akeerthi@apple.com>
[iOS] <select> menus should scroll to the selected option
https://bugs.webkit.org/show_bug.cgi?id=227562
<rdar://problem/77887668>
Reviewed by Wenson Hsieh.
Before iOS 15, <select> pickers were implemented using UIPickerView on
iPhone and UITableView on iPad. Both these views gave WebKit the ability
to scroll the view to the currently selected option.
In iOS 15, <select> options are displayed in a context menu. WebKit does
not have access to the menu's view hierarchy, and must rely on UIKit to
perform the scrolling behavior.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker createMenu]):
Adopt UIMenuOptionsSingleSelection to obtain UIKit behaviors for popup menus.
2021-07-01 Jer Noble <jer.noble@apple.com>
[Mac] Adopt async GroupActivity.sessions() iterable instead of GroupSessionObserver
https://bugs.webkit.org/show_bug.cgi?id=227548
<rdar://78240035>
Reviewed by Sam Weinig.
Rather than adopting GroupSessionObserver, which requires Combine, GroupActivity.sessions()
uses AsyncSequence, a new Swift 5.5 feature, to allow clients to be notified that new
sessions are avaliable.
* UIProcess/Cocoa/GroupActivities/WKGroupSession.swift:
(WKGroupSessionObserver.incomingSessionsTask):
(WKGroupSessionObserver.receivedSession(_:)):
(WKGroupSessionObserver.cancellables): Deleted.
(WKGroupSessionObserver.recievedSession(_:)): Deleted.
2021-07-01 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
<rdar://problem/79859045>
Unreviewed, post commit fix.
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h:
(WTF::HashTraits<rtc::SocketAddress>::constructDeletedValue):
(WTF::HashTraits<rtc::SocketAddress>::isDeletedValue):
No need to set all deleted value slots, instead just rely on scope id being equal to numeric_limits<int>::min.
Also ensure we do not add an empty/deleted address to the map.
2021-07-01 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
Reviewed by Eric Carlson.
Migrate UDP socket handling from WebRTC physical socket server to nw API for Cocoa ports.
For each UDP socket opened, we open a nw_listener that will listen to inbound connections.
On inbound connection, we receive a nw_connection that we store in a address -> connection map.
Whenever sending a packet, we look at the remote address.
If needed, we create a nw_connection to that particular remote address and store it in the address -> connection map.
We then use the pre-existing or newly created nw_connection to send the packet.
Make sure to cancel NW connection in case of failure before releasing the socket.
Covered by existing tests
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createUDPSocket):
(WebKit::NetworkRTCProvider::createClientTCPSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
(WebKit::NetworkRTCProvider::setPlatformTCPSocketsEnabled):
(WebKit::NetworkRTCProvider::setPlatformUDPSocketsEnabled):
* NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.h.
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm: Renamed from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm.
(WebKit::tcpSocketQueue):
(WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket):
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
(WebKit::NetworkRTCTCPSocketCocoa::close):
(WebKit::NetworkRTCTCPSocketCocoa::setOption):
(WebKit::NetworkRTCTCPSocketCocoa::createMessageBuffer):
(WebKit::NetworkRTCTCPSocketCocoa::sendTo):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h: Added.
(WTF::DefaultHash<rtc::SocketAddress>::hash):
(WTF::DefaultHash<rtc::SocketAddress>::equal):
(WTF::HashTraits<rtc::SocketAddress>::emptyValue):
(WTF::HashTraits<rtc::SocketAddress>::constructDeletedValue):
(WTF::HashTraits<rtc::SocketAddress>::isDeletedValue):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm: Added.
(WebKit::NetworkRTCUDPSocketCocoaConnections::create):
(WebKit::NetworkRTCUDPSocketCocoaConnections::WTF_GUARDED_BY_LOCK):
(WebKit::udpSocketQueue):
(WebKit::NetworkRTCUDPSocketCocoa::createUDPSocket):
(WebKit::NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa):
(WebKit::NetworkRTCUDPSocketCocoa::~NetworkRTCUDPSocketCocoa):
(WebKit::NetworkRTCUDPSocketCocoa::close):
(WebKit::NetworkRTCUDPSocketCocoa::setOption):
(WebKit::NetworkRTCUDPSocketCocoa::sendTo):
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::close):
(WebKit::NetworkRTCUDPSocketCocoaConnections::setOption):
(WebKit::processUDPData):
(WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
(WebKit::NetworkRTCUDPSocketCocoaConnections::setupNWConnection):
(WebKit::NetworkRTCUDPSocketCocoaConnections::sendTo):
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::setConnection):
2021-07-01 Carlos Garcia Campos <cgarcia@igalia.com>
[Cairo] Simplify GraphicsContextCairo creation
https://bugs.webkit.org/show_bug.cgi?id=227575
Reviewed by Žan Doberšek.
Use the new GraphicsContextCairo constructors.
* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::incorporateUpdate):
2021-07-01 Jer Noble <jer.noble@apple.com>
[Mac] (Re-)enable GroupActivities after upstreaming
https://bugs.webkit.org/show_bug.cgi?id=227546
Reviewed by Eric Carlson.
Fix some build errors exposed by enabling GroupActivities.
* UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.mm:
2021-06-30 Antoine Quint <graouts@webkit.org>
[Model] [macOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227530
<rdar://problem/79968206>
Reviewed by Dean Jackson.
On macOS, ASVInlinePreview requires an instance in both the WebProcess and the UIProcess to exist with a matching UUID.
On the WebKit side, in the UIProcess, we receive a message from the WebProcess when the ASVInlinePreview in that process
was created with its generated UUID. We provide this to the ModelElementController, set the remote connection up and load
the file. When those tasks complete successfully we message back the WebProcess with the UUID and the provided ElementContext
to talk back to the HTMLModelElement instance that initiated the message to the UIProcess in the first place.
* UIProcess/Cocoa/ModelElementControllerCocoa.mm:
(WebKit::ModelElementController::modelElementDidCreatePreview):
* UIProcess/ModelElementController.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::modelElementDidCreatePreview):
(WebKit::WebPageProxy::modelElementPreviewDidObtainContextId):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::modelElementDidCreatePreview const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::modelElementDidCreatePreview):
(WebKit::WebPage::modelElementPreviewDidObtainContextId):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-06-30 Chris Dumez <cdumez@apple.com>
Regression(r278737): WebContent crash when calling [WKWebView loadHTMLString:] with an invalid URL
https://bugs.webkit.org/show_bug.cgi?id=227560
<rdar://79815425>
Reviewed by Alex Christensen.
Make sure the parsed URL is valid in WebPage::loadData() before getting its protocol and calling
LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler() with it. Passing a null String
to LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler() causes crashes.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadData):
2021-06-30 Megan Gardner <megan_gardner@apple.com>
Add ID and versioning support for AppHighlights
https://bugs.webkit.org/show_bug.cgi?id=227279
Reviewed by Tim Horton.
Reformat the storage of Highlight Data to allow for accurate deletion of active
highlights, as well as making them more robust and future-proof.
Also found an issue with creating SharedBuffers from the memory map, in that the ipcHandle size
should be used instead of the sharedMemory->size().
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreAppHighlightsAndScrollToIndex):
2021-06-30 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r279405.
Casued 50+ webrtc crashes on Big Sur Debug
Reverted changeset:
"[Cocoa] Migrate WebRTC UDP socket handling to NW API"
https://bugs.webkit.org/show_bug.cgi?id=227210
https://commits.webkit.org/r279405
2021-06-30 Tim Horton <timothy_horton@apple.com>
Fix the build.
* UIProcess/ios/ProcessAssertionIOS.mm:
2021-06-30 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] [Live Text] "Text from Camera" should not be shown in callout bar when selecting text
https://bugs.webkit.org/show_bug.cgi?id=227535
rdar://79936981
Reviewed by Devin Rousso.
Match new system behavior in rdar://79758142 by not showing the "Text from Camera" item in the callout bar when
the selection is a (non-collapsed) range.
Test: WebKit.CaptureTextFromCamera
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
2021-06-30 Antoine Quint <graouts@webkit.org>
[Model] [iOS] Add support for displaying <model> in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=227443
<rdar://problem/79859937>
Reviewed by Sam Weinig.
Displaying a model element in fullscreen requires making some calls on the ASVInlinePreview object
created by a WKModelView. We send the content layer ID we receive through an IPC call from the
WebProcess to the new ModelElementController. We then look at the remote layer tree for a node
matching that ID and find its related UIView. If we find a WKModelView, as expected, we can carry
on and call -[ASVInlinePreview createFullscreenInstanceWithInitialFrame:previewOptions:completionHandler:]
to enter fullscreen using the presentingViewController provided by the UI client, and then observe
when we exit fullscreen using -[ASVInlinePreview observeDismissFullscreenWithCompletionHandler:]
to make sure the presenting view controller is removed.
* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/Cocoa/ModelElementControllerCocoa.mm: Added.
(WebKit::ModelElementController::takeModelElementFullscreen):
* UIProcess/ModelElementController.cpp: Added.
(WebKit::ModelElementController::ModelElementController):
* UIProcess/ModelElementController.h: Added.
(WebKit::ModelElementController::page):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::takeModelElementFullscreen):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::takeModelElementFullscreen const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::takeModelElementFullscreen):
* WebProcess/WebPage/WebPage.h:
2021-06-30 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r276969.
Causes previous assertion to get released before the new one
is taken (asynchronously)
Reverted changeset:
"[iOS] Use async API to take RunningBoard assertions"
https://bugs.webkit.org/show_bug.cgi?id=225324
https://commits.webkit.org/r276969
2021-06-30 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r279155.
Caused a PLT5 regression
Reverted changeset:
"[macOS] Suspend WebProcesses that are in the process cache"
https://bugs.webkit.org/show_bug.cgi?id=227269
https://commits.webkit.org/r279155
2021-06-30 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
Reviewed by Eric Carlson.
Migrate UDP socket handling from WebRTC physical socket server to nw API for Cocoa ports.
For each UDP socket opened, we open a nw_listener that will listen to inbound connections.
On inbound connection, we receive a nw_connection that we store in a address -> connection map.
Whenever sending a packet, we look at the remote address.
If needed, we create a nw_connection to that particular remote address and store it in the address -> connection map.
We then use the pre-existing or newly created nw_connection to send the packet.
Make sure to cancel NW connection in case of failure before releasing the socket.
Covered by existing tests
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createUDPSocket):
(WebKit::NetworkRTCProvider::createClientTCPSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
(WebKit::NetworkRTCProvider::setPlatformTCPSocketsEnabled):
(WebKit::NetworkRTCProvider::setPlatformUDPSocketsEnabled):
* NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.h.
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm: Renamed from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm.
(WebKit::tcpSocketQueue):
(WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket):
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
(WebKit::NetworkRTCTCPSocketCocoa::close):
(WebKit::NetworkRTCTCPSocketCocoa::setOption):
(WebKit::NetworkRTCTCPSocketCocoa::createMessageBuffer):
(WebKit::NetworkRTCTCPSocketCocoa::sendTo):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h: Added.
(WTF::DefaultHash<rtc::SocketAddress>::hash):
(WTF::DefaultHash<rtc::SocketAddress>::equal):
(WTF::HashTraits<rtc::SocketAddress>::emptyValue):
(WTF::HashTraits<rtc::SocketAddress>::constructDeletedValue):
(WTF::HashTraits<rtc::SocketAddress>::isDeletedValue):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm: Added.
(WebKit::NetworkRTCUDPSocketCocoaConnections::create):
(WebKit::NetworkRTCUDPSocketCocoaConnections::WTF_GUARDED_BY_LOCK):
(WebKit::udpSocketQueue):
(WebKit::NetworkRTCUDPSocketCocoa::createUDPSocket):
(WebKit::NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa):
(WebKit::NetworkRTCUDPSocketCocoa::~NetworkRTCUDPSocketCocoa):
(WebKit::NetworkRTCUDPSocketCocoa::close):
(WebKit::NetworkRTCUDPSocketCocoa::setOption):
(WebKit::NetworkRTCUDPSocketCocoa::sendTo):
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::close):
(WebKit::NetworkRTCUDPSocketCocoaConnections::setOption):
(WebKit::processUDPData):
(WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
(WebKit::NetworkRTCUDPSocketCocoaConnections::setupNWConnection):
(WebKit::NetworkRTCUDPSocketCocoaConnections::sendTo):
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::setConnection):
2021-06-28 Antoine Quint <graouts@webkit.org>
[Model] [iOS] Add support for manipulating <model> inline
https://bugs.webkit.org/show_bug.cgi?id=227448
<rdar://problem/79863579>
Reviewed by Tim Horton.
ASVInlinePreview instances allow for UITouch and UIEvent objects to be forwarded in order to manipulate
the object inline. We create a UIGestureRecognizer subclass that is attached to WKModelView and forwards
touchesBegan: and similar UIResponder messages over to the ASVInlinePreview managed by the WKModelView.
This allows multiple <model> elements to be manipulated at once.
We will add support for disallowing such interaction with an attribute and/or a call to preventDefault()
at a later time.
* SourcesCocoa.txt:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(WebKit::collectDescendantViewsAtPoint):
(-[UIView _web_findDescendantViewAtPoint:withEvent:]):
* UIProcess/ios/WKModelInteractionGestureRecognizer.h: Added.
* UIProcess/ios/WKModelInteractionGestureRecognizer.mm: Added.
(-[WKModelInteractionGestureRecognizer touchesBegan:withEvent:]):
(-[WKModelInteractionGestureRecognizer touchesMoved:withEvent:]):
(-[WKModelInteractionGestureRecognizer touchesEnded:withEvent:]):
(-[WKModelInteractionGestureRecognizer touchesCancelled:withEvent:]):
* UIProcess/ios/WKModelView.h:
* UIProcess/ios/WKModelView.mm:
(-[WKModelView initWithModel:]):
* WebKit.xcodeproj/project.pbxproj:
2021-06-29 Cameron McCormack <heycam@apple.com>
Don't null check destination in the RemoteRenderingBackend::nextDestinationImageBufferAfterApply main loop
https://bugs.webkit.org/show_bug.cgi?id=227475
Reviewed by Wenson Hsieh.
We already null check it and return early as part of the
MESSAGE_CHECK_WITH_RETURN_VALUE call just above.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
2021-06-24 Jer Noble <jer.noble@apple.com>
Loading WebM hangs if server sends only small amount of data
https://bugs.webkit.org/show_bug.cgi?id=226217
<rdar://problem/78709010>
Reviewed by Eric Carlson.
Test: http/tests/media/video-webm-stall.html
Adopt FigThread{Un,}RegisterAbortAction() when blocking against track parsing.
CoreMedia will attempt to abort reads during AVPlayer teardown, but because the parsing
thread is blocked on a Condition variable in WebKit code, the abort request has no effect.
Adopt methods from CoreMedia to run code during an abort request, and wrap these calls in a
stack-based object. The new AbortAction object takes a Condition variable to notify during
an abort, and its aborted() state can be queried by the Condition's predicate.
Drive-by Fix: enable running an unsigned MTFormatReaderPlugin in the GPU process for
engineering builds.
* Configurations/BaseTarget.xcconfig:
* GPUProcess/mac/GPUProcessMac.mm:
(WebKit::GPUProcess::initializeProcess):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::AbortAction::AbortAction):
(WebKit::AbortAction::~AbortAction):
(WebKit::AbortAction::aborted const):
(WebKit::AbortAction::action):
(WebKit::MediaFormatReader::copyProperty):
(WebKit::MediaFormatReader::copyTrackArray):
2021-06-29 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Check GApplication has a valid ID before trying to create the flatpack info
https://bugs.webkit.org/show_bug.cgi?id=227344
Reviewed by Michael Catanzaro.
Show a warning if GApplication is used but app ID is nullptr.
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::createFlatpakInfo):
2021-06-29 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Bubblewrap: allow to set DBus proxy logging per proxy
https://bugs.webkit.org/show_bug.cgi?id=227447
Reviewed by Michael Catanzaro.
It's currently global using env var WEBKIT_ENABLE_DBUS_PROXY_LOGGING. Add WEBKIT_ENABLE_A11Y_DBUS_PROXY_LOGGING
to enable logging only on a11y bus.
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::XDGDBusProxyLauncher::launch):
(WebKit::bindA11y):
(WebKit::bubblewrapSpawn):
2021-06-29 Youenn Fablet <youenn@apple.com>
Remove RemoteAudioMediaStreamTrackRenderer and RemoteAudioMediaStreamTrackRendererManager
https://bugs.webkit.org/show_bug.cgi?id=227438
Reviewed by Eric Carlson.
Remove code no longer enabled.
This code was obsoleted by RemoteAudioMediaStreamTrackRendererInternalUnitManager and friends.
Update GPUProcess to not exit if RemoteAudioMediaStreamTrackRendererInternalUnitManager has some units,
like was done by RemoteAudioMediaStreamTrackRendererManager.
* DerivedSources.make:
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
(WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess):
(WebKit::GPUConnectionToWebProcess::allowsExitUnderMemoryPressure const):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::audioMediaStreamTrackRendererQueue): Deleted.
* GPUProcess/GPUProcess.h:
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: Removed.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: Removed.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: Removed.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp:
(WebKit::renderCallback):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::Unit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::start):
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.h:
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::hasUnits):
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: Removed.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: Removed.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in: Removed.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: Removed.
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: Removed.
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererIdentifier.h: Removed.
2021-06-28 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r279310): Occasional crash when focusing login fields on iPad with a software keyboard
https://bugs.webkit.org/show_bug.cgi?id=227472
rdar://79876040
Reviewed by Tim Horton.
I added a mechanism in r279310 to defer calling `-[WKContentView _setSuppressSoftwareKeyboard:NO]` until we've
gotten a response from the web process containing an up-to-date autocorrection context. However, in the case
where the WKWebView client sets `_suppressSoftwareKeyboard` to `YES` and then immediately to `NO` underneath the
scope of a call to `-_webView:willStartInputSession:`, we'll end up calling into `-_setSuppressSoftwareKeyboard:`
inside the scope of `-requestAutocorrectionContextWithCompletionHandler:`, when we've received an
autocorrection context while sync-waiting. This is problematic because it breaks UIKeyboardTaskQueue's state,
since the call to `-_setSuppressSoftwareKeyboard:` will attempt to enqueue a new task after the previous task's
context has already returned execution to the parent.
To fix this, we instead invoke `self._suppressSoftwareKeyboard = NO;` *before* calling the completion block in
`-_handleAutocorrectionContext:`. This allows the request for an autocorrection context underneath
`-_setSuppressSoftwareKeyboard:` to be handled (and completed) as a child task of the previous task, which keeps
UIKeyboardTaskQueue in a valid state.
Test: fast/forms/ios/suppress-software-keyboard-while-focusing-input.html
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _handleAutocorrectionContext:]):
2021-06-28 Dana Estra <destra@apple.com>
Refactor MacOS keyboard scrolling and use KeyboardScroll struct
https://bugs.webkit.org/show_bug.cgi?id=226986
Reviewed by Tim Horton.
In addition to notes underneath, changed usage of WebKit::KeyboardScroll, WebKit::ScrollingIncrement, and WebKit::ScrollingDirection to
WebCore::KeyboardScroll, WebCore::ScrollGranularity, and WebCore::ScrollDirection, respectively.
* UIProcess/ios/WKKeyboardScrollingAnimator.h:
* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator parameters]):
Deleted. Now lives in WebCore/KeyboardScroll.h.
(unitVector):
Deleted. Now lives in WebCore/KeyboardScroll.h.
(perpendicularAbsoluteUnitVector):
(boxSide):
(-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
(-[WKKeyboardScrollingAnimator beginWithEvent:]):
(farthestPointInDirection):
(-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::handleEditingKeyboardEvent):
(WebKit::WebPage::performNonEditingBehaviorForSelector):
Added switch that removes selectors that are now handled by
EventHandler when EventHandlerDrivenSmoothKeyboardScrolling
is enabled.
2021-06-28 Chris Dumez <cdumez@apple.com>
NetworkProcessProxy::networkProcessDidTerminate() should copy process pools before iterating over them
https://bugs.webkit.org/show_bug.cgi?id=227468
Reviewed by Alex Christensen.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessDidTerminate):
2021-06-28 Sihui Liu <sihui_liu@apple.com>
Nullptr crash in ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement
https://bugs.webkit.org/show_bug.cgi?id=227462
rdar://50772934
Reviewed by Chris Dumez.
Return early if statement cannot be created.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
(WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement):
2021-06-28 Brent Fulgham <bfulgham@apple.com>
REGRESSION (r279305) [Mac DEBUG] 4 SOAuthorizationRedirect Tests are Crashing with Assert: !m_sheetWindow
https://bugs.webkit.org/show_bug.cgi?id=227454
<rdar://problem/79871423>
Reviewed by Kate Cheney.
The new assertion is wrong in the case that the app is hidden. When minimized (or hidden) we need to remember
to dismiss the sheet once Cocoa restores the app to visible state. So the m_sheetWindow may still exist after
returning from 'dismissViewController'. We should assert that either m_sheetWindow is nullptr, or that both
m_sheetWindow and m_sheetWindowWillCloseObserver exist.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::becomeCompleted):
2021-06-28 Kate Cheney <katherine_cheney@apple.com>
I-beam pointer is vertical for vertical text
https://bugs.webkit.org/show_bug.cgi?id=227414
<rdar://problem/77564647>
Reviewed by Tim Horton.
Pass the orientation from the renderer to the WKContentView. Rename
caretHeight to caretLength now that we use it to calculate the I-beam
size for vertical text.
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView pointerInteraction:styleForRegion:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::populateCaretContext):
2021-06-28 Per Arne <pvollan@apple.com>
Pass correct value of AX per app settings to the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=227441
<rdar://problem/79857797>
Reviewed by Brent Fulgham.
Pass value of type AXValueState instead of a boolean value for per app AX settings.
* Shared/AccessibilityPreferences.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::accessibilityPreferences):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityPreferencesDidChange):
2021-06-28 Alex Christensen <achristensen@webkit.org>
RELEASE_ASSERT hit in NetworkSessionCocoa::removeWebSocketTask when using WKWebViewConfiguration._attributedBundleIdentifier
https://bugs.webkit.org/show_bug.cgi?id=227420
<rdar://79609212>
Reviewed by Brady Eidson.
WKWebViewConfiguration._attributedBundleIdentifier makes us use a SessionSet per WKWebView.
When the WKWebView is destroyed with an open WebSocket, there's a race condition between the
NetworkSessionCocoa::removeWebPageNetworkParameters message coming from the UI process and the
NetworkConnectionToWebProcess::didClose message coming from the closing of the web process, which
calls NetworkSessionCocoa::removeWebSocketTask which currently expects the WebSocketTask to still
be there. Instead, keep a WeakPtr<SessionSet> and don't remove it if the SessionSet's map is gone.
I wrote an API test that hits this condition sometimes when HAVE_NSURLSESSION_WEBSOCKET is true.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::removeWebSocketTask):
* NetworkProcess/NetworkSocketChannel.cpp:
(WebKit::NetworkSocketChannel::~NetworkSocketChannel):
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
(WebKit::SessionSet::create):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::sessionSetForPage):
(WebKit::NetworkSessionCocoa::sessionSetForPage const):
(WebKit::SessionSet::initializeEphemeralStatelessSessionIfNeeded):
(WebKit::SessionSet::isolatedSession):
(WebKit::NetworkSessionCocoa::createWebSocketTask):
(WebKit::NetworkSessionCocoa::addWebSocketTask):
(WebKit::NetworkSessionCocoa::removeWebSocketTask):
(WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded): Deleted.
(WebKit::NetworkSessionCocoa::SessionSet::isolatedSession): Deleted.
* NetworkProcess/cocoa/WebSocketTaskCocoa.h:
(WebKit::WebSocketTask::sessionSet):
* NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
(WebKit::WebSocketTask::WebSocketTask):
2021-06-28 Jean-Yves Avenard <jya@apple.com>
Not all uses of AudioToolbox framework use soft linking
https://bugs.webkit.org/show_bug.cgi?id=227250
<rdar://problem/79606090>
Reviewed by Eric Carlson.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):
* Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp:
(WebKit::createWrapper):
(WebKit::wrapperStorage):
(WebKit::wrapperVTable):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::copyProperty):
* Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp:
(WebKit::MediaSampleByteRange::MediaSampleByteRange):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm:
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
* WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):
2021-06-28 Kimmo Kinnunen <kkinnunen@apple.com>
Possible build breakage after r279221 in some unified build configurations
https://bugs.webkit.org/show_bug.cgi?id=227440
Unreviewed build fix.
Add missing #import <wtf/MachSendRight.h> since
the code use MachSendRight. The code happens to work on default configuration
due to unified build.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2021-06-27 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279322.
https://bugs.webkit.org/show_bug.cgi?id=227434
Reverted changeset:
"Not all uses of AudioToolbox framework use soft linking"
https://bugs.webkit.org/show_bug.cgi?id=227250
https://commits.webkit.org/r279322
2021-06-27 Jean-Yves Avenard <jya@apple.com>
Not all uses of AudioToolbox framework use soft linking
https://bugs.webkit.org/show_bug.cgi?id=227250
<rdar://problem/79606090>
Reviewed by Eric Carlson.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):
* Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp:
(WebKit::createWrapper):
(WebKit::wrapperStorage):
(WebKit::wrapperVTable):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::copyProperty):
* Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp:
(WebKit::MediaSampleByteRange::MediaSampleByteRange):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm:
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
* WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):
2021-06-27 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, fix the iOS build after rdar://76781873
Remove support for `-[UIResponder _insertTextFromCamera:]` in WebKit2, now that UIKit only supports the public
API version (`-[UIResponder captureTextFromCamera:]`).
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView _insertTextFromCameraForWebView:]): Deleted.
2021-06-27 Antoine Quint <graouts@webkit.org>
[Model] [iOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227392
<rdar://problem/79770136>
Reviewed by Tim Horton.
Add a new WKModelView class which manages an ASVInlinePreview and displays its layer.
The current incarnation of the ASVInlinePreview SPI requires a URL to a file to specify
the resource, so we write a file to the temporary directory added in 279267 with the data
wrapped in the Model object passed through the remote layer tree. Ultimately we will be
able to use an SPI that does not require a file and instead will allow data to be passed
directly, this is purely for a temporary experimentation.
* Platform/Logging.h:
* SourcesCocoa.txt:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* UIProcess/ios/WKModelView.h: Added.
* UIProcess/ios/WKModelView.mm: Added.
(-[WKModelView preview]):
(-[WKModelView initWithFrame:]):
(-[WKModelView initWithCoder:]):
(-[WKModelView initWithModel:]):
(-[WKModelView createFileForModel:]):
(-[WKModelView layoutSubviews]):
(-[WKModelView updateBounds]):
* WebKit.xcodeproj/project.pbxproj:
2021-06-26 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Safari sometimes hangs under sync IPC in `-[WKWebView _setSuppressSoftwareKeyboard:]`
https://bugs.webkit.org/show_bug.cgi?id=227424
rdar://79745385
Reviewed by Tim Horton.
When activating streamlined AutoFill, Safari calls UIKit SPI (`-_setSuppressSoftwareKeyboard:`) on WKWebView to
ensure that the normal software keyboard doesn't briefly appear instead of the AutoFill input view; after
requesting AutoFill credentials, Safari then stops suppressing the software keyboard by setting the SPI property
back to NO. In WebKit, we override `-[WKWebView _setSuppressSoftwareKeyboard:]`, such that WKContentView's
keyboard suppression state follows the web view's state (this is necessary, since WKContentView is the actual
`-firstResponder` when editing focused text inputs). However, when changing software keyboard suppression from
YES to NO, UIKit reloads input views and (in the process) calls into
`-requestAutocorrectionContextWithCompletionHandler:`, which then makes a sync IPC call into the web process.
To avoid this sync IPC call, we refactor the implementation of `-[WKWebView _setSuppressSoftwareKeyboard:]`,
such that we don't immediately attempt to unsuppress the software keyboard by calling into WKContentView.
Instead, we asynchronously request an autocorrection context from the web process, and then call
`-[WKContentView _setSuppressSoftwareKeyboard:NO]` after the autocorrection context request completes (using
the last known autocorrection context data in the UI process rather than making a sync IPC call).
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setSuppressSoftwareKeyboard:]):
Call into `-updateSoftwareKeyboardSuppressionStateFromWebView` below.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
Invoke `-unsuppressSoftwareKeyboardUsingLastAutocorrectionContextIfNeeded` to ensure that we stop software
keyboard suppression if the web process terminates while we're waiting for autocorrection context data to
arrive.
(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
(-[WKContentView _handleAutocorrectionContext:]):
(-[WKContentView updateSoftwareKeyboardSuppressionStateFromWebView]):
Add a new helper that keeps WKContentView's software keyboard suppression state in sync with the WKWebView's
software keyboard suppression state. In the case where we're supressing the software keyboard, we can simply
call into `-[WKContentView _setSuppressSoftwareKeyboard:]` right away, since UIKit won't try to request an
autocorrection context.
However, in the case where we're unsuppressing the software keyboard, set a new flag, don't immediately forward
the call to WKContentView. Instead, set the `_unsuppressSoftwareKeyboardAfterNextAutocorrectionContextUpdate`
flag to YES and call into WebPageProxy to request an updated autocorrection context. Upon receiving the response
in `-[WKContentView _handleAutocorrectionContext:]`, we then unset the flag and unsuppress the software keyboard
(crucially, using `_lastAutocorrectionContext` instead of making a synchronous call back to the web content
process).
(-[WKContentView unsuppressSoftwareKeyboardUsingLastAutocorrectionContextIfNeeded]):
2021-06-25 Brent Fulgham <bfulgham@apple.com>
[macOS] Add logging and clean up AppSSO flows
https://bugs.webkit.org/show_bug.cgi?id=227379
Reviewed by Kate Cheney.
This patch adds detailed logging to understand the flows through the AppSSO authentication code,
and adds clean-up code in more places to ensure that the modal sheet used by AppSSO is dismissed
in cases where the authentication has completed (or failed).
* UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
(WebKit::NavigationSOAuthorizationSession::shouldStartInternal): Adds new logging.
(WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow): Ditto.
(WebKit::NavigationSOAuthorizationSession::pageActiveURLDidChangeDuringWaiting const): Ditto.
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
(WebKit::PopUpSOAuthorizationSession::shouldStartInternal): Adds new logging.
(WebKit::PopUpSOAuthorizationSession::fallBackToWebPathInternal): Ditto.
(WebKit::PopUpSOAuthorizationSession::abortInternal): Ditto.
(WebKit::PopUpSOAuthorizationSession::completeInternal): Ditto.
(WebKit::PopUpSOAuthorizationSession::close): Ditto.
(WebKit::PopUpSOAuthorizationSession::initSecretWebView): Ditto.
* UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm:
(WebKit::RedirectSOAuthorizationSession::fallBackToWebPathInternal): Adds new logging.
(WebKit::RedirectSOAuthorizationSession::abortInternal): Ditto.
(WebKit::RedirectSOAuthorizationSession::completeInternal): Ditto.
(WebKit::RedirectSOAuthorizationSession::beforeStart): Ditto.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm:
(WebKit::SOAuthorizationCoordinator::tryAuthorize): Adds new logging.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h:
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::stateString const): Added.
(WebKit::SOAuthorizationSession::~SOAuthorizationSession): Add new logging, and ensure modal sheet is dismissed.
(WebKit::SOAuthorizationSession::becomeCompleted): Added new logging.
(WebKit::SOAuthorizationSession::shouldStart): Ditto.
(WebKit::SOAuthorizationSession::start): Ditto.
(WebKit::SOAuthorizationSession::continueStartAfterGetAuthorizationHints): Ditto.
(WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy): Ditto.
(WebKit::SOAuthorizationSession::fallBackToWebPath): Add new logging, and ensure modal sheet is dismissed.
(WebKit::SOAuthorizationSession::abort): Ditto.
(WebKit::SOAuthorizationSession::complete): Ditto.
(WebKit::SOAuthorizationSession::presentViewController): Added new logging, and dismiss modal if an existing
view is in place.
(WebKit::SOAuthorizationSession::dismissModalSheetIfNecessary): Added.
(WebKit::SOAuthorizationSession::dismissViewController): Use new helper function.
* UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
(WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal): Adds new logging.
(WebKit::SubFrameSOAuthorizationSession::abortInternal): Ditto.
(WebKit::SubFrameSOAuthorizationSession::completeInternal): Ditto.
(WebKit::SubFrameSOAuthorizationSession::beforeStart): Ditto.
(WebKit::SubFrameSOAuthorizationSession::didFinishLoad): Ditto.
(WebKit::SubFrameSOAuthorizationSession::loadRequestToFrame): Ditto.
* UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm:
(-[WKSOAuthorizationDelegate authorization:presentViewController:withCompletion:]): Adds new logging.
(-[WKSOAuthorizationDelegate authorizationDidNotHandle:]): Ditto.
(-[WKSOAuthorizationDelegate authorizationDidCancel:]): Ditto.
(-[WKSOAuthorizationDelegate authorizationDidComplete:]): Ditto.
(-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPAuthorizationHeaders:]): Ditto.
(-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPResponse:httpBody:]): Ditto.
(-[WKSOAuthorizationDelegate authorization:didCompleteWithError:]): Ditto.
(-[WKSOAuthorizationDelegate setSession:]): Ditto.
2021-06-25 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Web process sometimes crashes under findDataDetectionResultElementInImageOverlay
https://bugs.webkit.org/show_bug.cgi?id=227412
rdar://79588091
Reviewed by Devin Rousso.
Speculatively fix the crash by ensuring that the hit-tested text node inside an image overlay is inside the
shadow root of the element responding to click events, and that the element responding to click events contains
an image overlay.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::elementPositionInformation):
2021-06-25 Per Arne <pvollan@apple.com>
[macOS] Add missing methods to IOKit filter
https://bugs.webkit.org/show_bug.cgi?id=227398
<rdar://79487528>
Reviewed by Brent Fulgham.
Add missing methods to the IOAccelerator IOKit filter on macOS.
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-25 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r279208.
https://bugs.webkit.org/show_bug.cgi?id=227381
Broke the Apple Windows build.
Reverted changeset:
"Not all uses of AudioToolbox framework use soft linking"
https://bugs.webkit.org/show_bug.cgi?id=227250
https://trac.webkit.org/changeset/279208
2021-06-25 Peng Liu <peng.liu6@apple.com>
Explicitly invalidate WKFullScreenViewController after a video exits fullscreen
https://bugs.webkit.org/show_bug.cgi?id=227372
Reviewed by Eric Carlson.
Since `WKFullScreenWindowController` owns `WKFullScreenViewController`,
we had better let `WKFullScreenWindowController` manage the life cycle
of `WKFullScreenViewController`.
* UIProcess/ios/fullscreen/WKFullScreenViewController.h:
* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController initWithWebView:]):
(-[WKFullScreenViewController invalidate]):
(-[WKFullScreenViewController dealloc]):
(-[WKFullScreenViewController showUI]):
(-[WKFullScreenViewController hideUI]):
(-[WKFullScreenViewController videoControlsManagerDidChange]):
(-[WKFullScreenViewController setAnimatingViewAlpha:]):
(-[WKFullScreenViewController setPrefersStatusBarHidden:]):
(-[WKFullScreenViewController setPrefersHomeIndicatorAutoHidden:]):
(-[WKFullScreenViewController setPlaying:]):
(-[WKFullScreenViewController setPictureInPictureActive:]):
(-[WKFullScreenViewController setAnimating:]):
(-[WKFullScreenViewController _manager]):
(-[WKFullScreenViewController _effectiveFullscreenInsets]):
(-[WKFullScreenViewController _cancelAction:]):
(-[WKFullScreenViewController _togglePiPAction:]):
(-[WKFullScreenViewController _touchDetected:]):
(-[WKFullScreenViewController _statusBarFrameDidChange:]):
(-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
(-[WKFullScreenViewController _showPhishingAlert]):
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController _completedExitFullScreen]):
2021-06-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279266.
https://bugs.webkit.org/show_bug.cgi?id=227402
Causes crash loop
Reverted changeset:
"Remove references to order files"
https://bugs.webkit.org/show_bug.cgi?id=227377
https://trac.webkit.org/changeset/279266
2021-06-25 Zan Dobersek <zdobersek@igalia.com>
[GLib] Guard Cairo inclusions in shared GLib API implementation files
https://bugs.webkit.org/show_bug.cgi?id=227370
Reviewed by Philippe Normand.
For cross-port GLib API implementation, different Cairo inclusions are
moved into appropriate build guards tha match the build guards where
Cairo is then used.
* UIProcess/API/glib/WebKitFaviconDatabase.cpp:
* UIProcess/API/glib/WebKitProtocolHandler.cpp:
(WebKit::WebKitProtocolHandler::handleGPU):
* UIProcess/API/glib/WebKitWebView.cpp:
2021-06-24 Antoine Quint <graouts@webkit.org>
[Model] Create a sandbox extension for a temporary directory to store model resources
https://bugs.webkit.org/show_bug.cgi?id=227359
Reviewed by Tim Horton.
The SPIs we will use to render <model> resources expect a file URL to load and render the model.
Before we adopt these SPIs, we extend the sandbox to allow writing to a temporary directory where
we will store these resources.
* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::defaultModelElementCacheDirectory):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resolvedModelElementCacheDirectory const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::modelElementCacheDirectory const):
(WebKit::WebsiteDataStoreConfiguration::setModelElementCacheDirectory):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
2021-06-24 Sihui Liu <sihui_liu@apple.com>
Remove references to order files
https://bugs.webkit.org/show_bug.cgi?id=227377
rdar://76070556
Reviewed by Mark Lam.
* Configurations/WebKit.xcconfig:
2021-06-24 Chris Dumez <cdumez@apple.com>
REGRESSION: (r279244) [ Mac ] http/tests/workers/service/postmessage-after-terminate.https.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=227380
<rdar://problem/79748648>
Unreviewed, drop protector added in r279244 inside establishServiceWorkerContext() as it is what caused this test
to time out. I am not sure why this is happening yet but I am doing this partial revert to get us back in a good
state.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::establishServiceWorkerContext):
2021-06-24 Venky Dass <yaranamavenkataramana@apple.com>
Crash in WebFrameLoaderClient::dispatchDidStartProvisionalLoad after provisionalLoader is gone.
https://bugs.webkit.org/show_bug.cgi?id=226979
Reviewed by Ryosuke Niwa.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
2021-06-24 Said Abou-Hallawa <said@apple.com>
[GPU Process] RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate() may fire if GPUP is relaunched
https://bugs.webkit.org/show_bug.cgi?id=227229
<rdar://79147947>
Reviewed by Myles C. Maxfield.
When the GPUP is relaunched remoteResourceCacheWasDestroyed() clears
m_fontIdentifierToLastRenderingUpdateVersionMap but it does not reset
m_numberOfFontsUsedInCurrentRenderingUpdate. This will make it always
greater than m_fontIdentifierToLastRenderingUpdateVersionMap.size().
And this is why the assertion fires.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
2021-06-24 Alex Christensen <achristensen@webkit.org>
Fix WKDownloadDelegate header doc
https://bugs.webkit.org/show_bug.cgi?id=227378
Reviewed by Brady Eidson.
This removes the following sentence:
"If this is a download of a blob URL, response will be null."
This was correct in an earlier iteration of the implementation of this API, but is now incorrect
and verified by the WKDownload.BlobResponse API test.
* UIProcess/API/Cocoa/WKDownloadDelegate.h:
2021-06-24 Kate Cheney <katherine_cheney@apple.com>
WKWebView loadSimulatedRequest does not set attribution value for url requests within html content
https://bugs.webkit.org/show_bug.cgi?id=227266
<rdar://problem/79316911>
Reviewed by Brent Fulgham.
We currently pass the attribution value from the main NSURLRequest
passed into WebPageProxy::loadRequest by setting a value on the WebPage
document loader that gets passed to all requests initiated by that main
navigation. This patch adds the same functionality for
WebPageProxy::loadSimulatedRequest, which could initiate URL requests
from HTML content.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadSimulatedRequest):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadSimulatedRequestAndResponse):
2021-06-24 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Automatically apply system minimum layout margins as scroll view content insets
https://bugs.webkit.org/show_bug.cgi?id=227178
rdar://76784095
Reviewed by Tim Horton.
Respect `-[UIViewController systemMinimumLayoutMargins]` on watchOS by treating them in a similar way as safe
area insets, such that we avoid laying out parts of the web page within these margins unless the page's meta
viewport specifies `viewport-fit=cover`. On watch, avoiding these layout margins is crucial.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _computedObscuredInsetForSafeBrowsingWarning]):
(-[WKWebView _contentInsetsFromSystemMinimumLayoutMargins]):
Add a helper method to compute the amount of additional content inset we need to apply to the scroll view in
order for content to fit within WKWebView's view controller's `-systemMinimumLayoutMargins`. Note that this
accounts for cases where the web view's frame is already inset relative to the view controller's content view.
(-[WKWebView _computedObscuredInset]):
(-[WKWebView _computedContentInset]):
Unconditionalize a few codepaths that apply obscured and content insets by consulting
`-_scrollViewSystemContentInset`.
(-[WKWebView _computedUnobscuredSafeAreaInset]):
On watchOS, we augment safe area insets, such that they include `_contentInsetsFromSystemMinimumLayoutMargins`
as well.
(-[WKWebView activeViewLayoutSize:]):
(-[WKWebView _updateScrollViewContentInsetsIfNecessary]):
Add a helper method that (on watchOS only) updates WKScrollView's content scroll insets such that the web page
fits inside `-systemMinimumLayoutMargins`. See WKScrollView changes below for more details.
(-[WKWebView _updateVisibleContentRects]):
(-[WKWebView _setAvoidsUnsafeArea:]):
Update scroll view content insets on watchOS if the `viewport-fit` state changes. Additionally make sure that we
also update the active layout size if the insets actually change (without this tweak, when dynamically adding
`viewport-fit=cover`, we'll end up in a state where the content size is still narrow to account for the old
content scroll insets, but the new content scroll insets are set, so the web page apears misaligned relative to
the scroll view).
* UIProcess/ios/WKScrollView.h:
* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView _setContentScrollInset:]):
(-[WKScrollView _setContentScrollInsetInternal:]):
Add an internal method for setting `-[UIScrollView _contentScrollInset]` that defers to the embedding client.
This means WKWebView clients that use `webView.scrollView.contentScrollInset = myInset;` will override the above
behavior in `-_updateScrollViewContentInsetsIfNecessary`, but otherwise, the content scroll insets will be
automatically computed and set in order to avoid minimum layout margins if needed.
Note that this also returns a `BOOL` indicating whether the inset was updated.
(-[WKScrollView _updateContentScrollInset]):
2021-06-24 Chris Dumez <cdumez@apple.com>
Improve release logging in WebProcessProxy
https://bugs.webkit.org/show_bug.cgi?id=227374
Reviewed by Geoffrey Garen.
Improve release logging in WebProcessProxy:
- Add more logging
- Use more consistent logging format to faciliate grep'ing
- Always include pointer and PID in the logging
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::enableProcessTermination):
(WebKit::WebProcessPool::disableProcessTermination):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::~WebProcessProxy):
(WebKit::WebProcessProxy::setIsInProcessCache):
(WebKit::WebProcessProxy::setWebsiteDataStore):
(WebKit::WebProcessProxy::addProvisionalPageProxy):
(WebKit::WebProcessProxy::removeProvisionalPageProxy):
(WebKit::WebProcessProxy::processWillShutDown):
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
(WebKit::WebProcessProxy::removeWebPage):
(WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
(WebKit::WebProcessProxy::gpuProcessExited):
(WebKit::WebProcessProxy::didClose):
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
(WebKit::WebProcessProxy::didBecomeUnresponsive):
(WebKit::WebProcessProxy::didBecomeResponsive):
(WebKit::WebProcessProxy::didFinishLaunching):
(WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
(WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
(WebKit::WebProcessProxy::fetchWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::WebProcessProxy::requestTermination):
(WebKit::WebProcessProxy::sendPrepareToSuspend):
(WebKit::WebProcessProxy::sendProcessDidResume):
(WebKit::WebProcessProxy::didSetAssertionType):
(WebKit::WebProcessProxy::updateAudibleMediaAssertions):
(WebKit::WebProcessProxy::setIsHoldingLockedFiles):
(WebKit::WebProcessProxy::processTerminated):
(WebKit::WebProcessProxy::didExceedActiveMemoryLimit):
(WebKit::WebProcessProxy::didExceedInactiveMemoryLimit):
(WebKit::WebProcessProxy::didExceedCPULimit):
(WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
(WebKit::WebProcessProxy::incrementSuspendedPageCount):
(WebKit::WebProcessProxy::decrementSuspendedPageCount):
(WebKit::WebProcessProxy::processPoolIfExists const):
(WebKit::WebProcessProxy::startBackgroundActivityForFullscreenInput):
(WebKit::WebProcessProxy::endBackgroundActivityForFullscreenInput):
(WebKit::WebProcessProxy::establishServiceWorkerContext):
(WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion):
(WebKit::WebProcessProxy::registerServiceWorkerClientProcess):
(WebKit::WebProcessProxy::unregisterServiceWorkerClientProcess):
(WebKit::WebProcessProxy::disableServiceWorkers):
(WebKit::WebProcessProxy::enableServiceWorkers):
2021-06-24 Chris Dumez <cdumez@apple.com>
Add release logging in the WebPage constructor / destructor
https://bugs.webkit.org/show_bug.cgi?id=227361
Reviewed by Geoffrey Garen.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::~WebPage):
2021-06-24 Per Arne <pvollan@apple.com>
[macOS] Fix incorrect version check in the WebContent process' sandbox
https://bugs.webkit.org/show_bug.cgi?id=227346
<rdar://79589961>
Reviewed by Alexey Proskuryakov.
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-24 Brent Fulgham <bfulgham@apple.com>
[iOS] Allow network-outbound logging for internal builds
https://bugs.webkit.org/show_bug.cgi?id=227332
<rdar://problem/79669627>
Reviewed by Per Arne Vollan.
We allow network-outbound for /private/var/run/syslog in the WebContent process for debugging
purposes on internal OS images. We should do the same for our other processes to avoid noisy logging.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2021-06-24 Kimmo Kinnunen <kkinnunen@apple.com>
Using a video as a source for a WebGL texture is slow and hangs on iOS 15
https://bugs.webkit.org/show_bug.cgi?id=227081
Reviewed by Eric Carlson.
In current form, media is decoded in GPU process and WebGL is processed
in Web process.
Video frame transfer from GPU process to Web process would fail when
WebGL tried to copy the video frame to a texture. The failure was
artificial, due to use of WebCore::IOSurface as a unneeeded helper
to convert CVPixelBufferRef to a cross-process object.
The failure would occur when AVPlayerItemVideoOutput
would generate a CVPixelBufferRef without color space information. Creating
WebCore::IOSurface out of this would fail. WebCore::IOSurface
has always a color space. The failure is not significant, as WebCore::IOSurface
was only used as a convenience.
This would cause performance regression when WebGL would
fall back to software conversion fallback. This callback did work
as it obtains the image through "get last frame as native image"
API.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
Use the correct type of object in the IPC messages:
Function `PixelBufferForCurrentTime` returns `CVPixelBufferRef`
so use that type instead of `MachPort`. It is an implementation
detail of `CVPixelBufferRef` encode/decode how the object
transfer is implemented.
The type of transfer must be RetainPtr<CVPixelBufferRef> as that
is how the IPC system operates wrt input, output and "storage"
types. This is the same as with IPC support for RefPtr<> types.
No tests as Sources/WebKit is not unit-testable ATM.
* GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTime):
Change the receive side according to the message type change.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(class_template_headers):
Add support for RetainPtr in the IPC message language.
* Scripts/webkit/messages_unittest.py:
* Scripts/webkit/tests/Makefile:
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
(IPC::jsValueForArguments):
(IPC::messageArgumentDescriptions):
* Scripts/webkit/tests/MessageNames.cpp:
(IPC::description):
(IPC::receiverName):
(IPC::isValidMessageName):
* Scripts/webkit/tests/MessageNames.h:
* Scripts/webkit/tests/TestWithCVPixelBuffer.messages.in: Added.
* Scripts/webkit/tests/TestWithCVPixelBufferMessageReceiver.cpp: Added.
(WebKit::TestWithCVPixelBuffer::didReceiveMessage):
(WebKit::TestWithCVPixelBuffer::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithCVPixelBufferMessages.h: Copied from Source/WebKit/Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h.
(Messages::TestWithCVPixelBuffer::messageReceiverName):
(Messages::TestWithCVPixelBuffer::SendCVPixelBuffer::name):
(Messages::TestWithCVPixelBuffer::SendCVPixelBuffer::SendCVPixelBuffer):
(Messages::TestWithCVPixelBuffer::SendCVPixelBuffer::arguments const):
(Messages::TestWithCVPixelBuffer::ReceiveCVPixelBuffer::name):
(Messages::TestWithCVPixelBuffer::ReceiveCVPixelBuffer::arguments const):
* Scripts/webkit/tests/TestWithCVPixelBufferMessagesReplies.h: Copied from Source/WebKit/Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h.
* Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h:
Add code generation examples for IPC implemetation regarding transferring
RetainPtr<CVPixelBufferRef>.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<RetainPtr<CVPixelBufferRef>>::encode):
(IPC::ArgumentCoder<RetainPtr<CVPixelBufferRef>>::decode):
* Shared/WebCoreArgumentCoders.h:
Move the CVPixelBufferRef transfer code from IOSurface
to the IPC layer.
The encode function must be of type RetainPtr<CVPixelBufferRef> instead of
CVPixelBufferRef, in contrast to existing RetainPtr<CF*> types.
The existing RetainPtr<CF*> types are not used as IPC message inputs,
only as subobjects. The IPC message language does not have concept of
encode type differing from decode type.
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime):
Change the send side according to the message type change.
2021-06-24 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Remove ENABLE_SCROLL_SNAP compile-time option
https://bugs.webkit.org/show_bug.cgi?id=227067
Reviewed by Simon Fraser.
Remove compile-time ENABLE_SCROLL_SNAP configuration option.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateScrollingNode>::encode):
(ArgumentCoder<ScrollingStateScrollingNode>::decode):
(WebKit::dump):
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView scrollViewWillBeginDragging:]):
(-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(-[WKWebView _updateVisibleContentRects]):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::resetStateAfterProcessExited):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
2021-06-24 Michael Catanzaro <mcatanzaro@gnome.org>
REGRESSION(r272882): [WPE][GTK] xdg-dbus-proxy may not be mounted in sandbox
https://bugs.webkit.org/show_bug.cgi?id=227294
Reviewed by Adrian Perez de Castro.
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
2021-06-23 Said Abou-Hallawa <said@apple.com>
REGRESSION(r278970): A CATransaction commitHandler should not execute a client callback
https://bugs.webkit.org/show_bug.cgi?id=227318
<rdar://79625962>
Reviewed by Tim Horton.
In takeSnapshotWithConfiguration() we call callSnapshotRect() inside the
callback of [CATransaction addCommitHandler].
callSnapshotRect() calls the client callback which may call directly or
indirectly addCommitHandler. But it is prohibited by CA to add a commit
handler while processing a registered commit handler.
The fix is to postpone calling callSnapshotRect() till CATransaction
processes all its commit handler callbacks.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2021-06-23 Jean-Yves Avenard <jya@apple.com>
Not all uses of AudioToolbox framework use soft linking
https://bugs.webkit.org/show_bug.cgi?id=227250
<rdar://problem/79606090>
Reviewed by Eric Carlson.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):
* Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp:
(WebKit::createWrapper):
(WebKit::wrapperStorage):
(WebKit::wrapperVTable):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::copyProperty):
* Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp:
(WebKit::MediaSampleByteRange::MediaSampleByteRange):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm:
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
* WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):
2021-06-23 Wenson Hsieh <wenson_hsieh@apple.com>
Add a delegate SPI to allow arbitrary gestures to ignore preventDefault() with active touch events
https://bugs.webkit.org/show_bug.cgi?id=227311
rdar://79624236
Reviewed by Tim Horton.
Add a UI delegate hook to allow internal clients to (easily) introduce gesture recognizers on WKWebView that are
capable of recognizing even if active touch events are prevented by the page. This allows Safari to stop
overriding an internal method on WKWebView, `-_isNavigationSwipeGestureRecognizer:`.
Testing this requires the ability to simulate touch events (through HID event dispatch) in API tests.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _touchEventsMustRequireGestureRecognizerToFail:]):
Note that we only consult the delegate here for gestures that are added directly to WKWebView. This is because
we already avoid deferring gestures that are added *above* WKWebView, and it's unnecessary to allow clients to
avoid deferring gestures that are internal to WebKit (i.e. added on WKContentView).
(-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]):
(-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
2021-06-23 Martin Robinson <mrobinson@igalia.com>
[iOS 15 Regression]: scroll position resets when using scroll snap
https://bugs.webkit.org/show_bug.cgi?id=226816
<rdar://problem/79081301>
Reviewed by Simon Fraser.
To improve scrolling fluidity on iOS, have any sort of momentum scroll trigger directional
scroll snapping. This means that any momentum scroll will move to the next or previous scroll
position and not snap back. This improves behavior on tesla.com and also on the scroll
snapping demo on the WebKit page.
Tests: fast/scrolling/ios/scroll-snap-with-momentum-scroll-in-main-frame.html
fast/scrolling/ios/scroll-snap-with-momentum-scroll-in-overflow-scroll-area.html
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Pass the current scroll offset to
the RemoteScrollingCoordinatorProxy. Passing a value for this offset is the trigger for directional scroll
snapping.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Update method definitions.
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping): Pass the current offset.
(WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const): Ditto.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Enable
directional scroll snapping for RenderLayers.
2021-06-23 Jer Noble <jer.noble@apple.com>
[Cocoa] Make the hostTime parameter to playSession a Monotonic time
https://bugs.webkit.org/show_bug.cgi?id=226515
Reviewed by Youenn Fablet.
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]):
(-[WKMediaSessionCoordinatorHelper playSessionWithCompletion:]):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::playSession):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::playSession):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.messages.in:
2021-06-23 Kate Cheney <katherine_cheney@apple.com>
Migrate App Privacy Report code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=227045
<rdar://problem/74333287>
Reviewed by Alex Christensen.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(processPCMRequest):
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(contextString): Deleted.
This patch deletes the contextString function because it is no longer
needed now that CFNetwork sets the attribution context based on the
main document URL, and it seemed silly to migrate code from
WebKitAdditions just to delete it immediately. This also moves the
processPCMRequest function declaration from WebKitAdditions so we can
remove NETWORK_DATA_TASK_COCOA_ADDITIONS.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::isActingOnBehalfOfAFullWebBrowser):
(WebKit::NetworkSessionCocoa::removeNetworkWebsiteData):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setLastNavigationWasAppBound):
2021-06-23 Aditya Keerthi <akeerthi@apple.com>
[iOS] Adopt new date picker presentation SPI
https://bugs.webkit.org/show_bug.cgi?id=227221
<rdar://problem/77930086>
Reviewed by Wenson Hsieh.
In native applications, tapping on a compact UIDatePicker presents an
inline picker using _UIDatePickerOverlayPresentation. To avoid
maintaining our own presentation logic, and to better match the native
presentation, use _UIDatePickerOverlayPresentation when tapping on a
date/time input in WebKit.
Covered by existing tests.
* Platform/spi/ios/UIKitSPI.h:
Declare the SPI rather than importing the header directly, as the
_UIDatePickerOverlayAnchor enum is not available in all SDKs with
the header.
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePickerViewController initWithDatePicker:]):
(-[WKDateTimePickerViewController setDelegate:]):
(-[WKDateTimePicker initWithView:datePickerMode:]):
Create the UIDatePicker here so it can be shared by the old context menu
presentation and the new overlay presentation.
(-[WKDateTimePicker handleDatePickerPresentationDismissal]):
(-[WKDateTimePicker removeDatePickerPresentation]):
`accessoryDone` eventually removes the presentation. If the date picker
is already being dismissed, do not dismiss it without an animation.
For programmatic dismissal (using blur()) this method is called prior to
`accessoryDone`, in which case we force dismissal without animation.
(-[WKDateTimePicker dateTimePickerViewControllerDidPressResetButton:]):
(-[WKDateTimePicker dateTimePickerViewControllerDidPressDoneButton:]):
(-[WKDateTimePicker showDateTimePicker]):
(-[WKDateTimePicker datePickerChanged:]):
(-[WKDateTimePicker reset:]):
(-[WKDateTimePicker done:]):
(-[WKDateTimePicker dealloc]):
(-[WKDateTimePicker _timeZoneOffsetFromGMT:]):
(-[WKDateTimePicker dateFormatterForPicker]):
(-[WKDateTimePicker _dateChangedSetAsNumber]):
(-[WKDateTimePicker _dateChangedSetAsString]):
(-[WKDateTimePicker setDateTimePickerToInitialValue]):
(-[WKDateTimePicker controlBeginEditing]):
(-[WKDateTimePicker controlEndEditing]):
(-[WKDateTimePicker calendarType]):
(-[WKDateTimePicker hour]):
(-[WKDateTimePicker minute]):
(-[WKDateTimePicker setHour:minute:]):
2021-06-23 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279104.
https://bugs.webkit.org/show_bug.cgi?id=227292
Made various layout tests very flaky
Reverted changeset:
"[GPU Process] RELEASE_ASSERT in
RemoteResourceCacheProxy::didFinalizeRenderingUpdate() may
fire if GPUP is relaunched"
https://bugs.webkit.org/show_bug.cgi?id=227229
https://trac.webkit.org/changeset/279104
2021-06-22 Megan Gardner <megan_gardner@apple.com>
Message dropped when restoring webpages.
https://bugs.webkit.org/show_bug.cgi?id=227278
Reviewed by Tim Horton.
The message to initialize the state of highlightVisibility is dropped sometimes, but
fortunately, there is no need to pass the current state when initializing the
HighlightObserver, as WebPageProxy::creationParameters will obtain the correct
highlight state on initialization after r279078.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setUpHighlightsObserver):
2021-06-22 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] [macOS] Add an internal option to disable inline text selection in images
https://bugs.webkit.org/show_bug.cgi?id=227265
rdar://79460142
Reviewed by Tim Horton.
Refactor Live Text and Visual Look Up logic, such that the ability to select text inside of images is behind an
internal feature flag that can be toggled at runtime. When Live Text is disabled, we'll unconditionally show the
"Look Up" context menu action using the more generic title "Quick Look". This "Quick Look" action is then
retitled to either "Look Up in Quick Look" or "Select Text in Quick Look" once image analysis completes.
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
Rename ContextMenuItemTagLookUpImage to ContextMenuItemTagQuickLookImage.
* UIProcess/Cocoa/QuickLookPreviewActivity.h: Copied from Source/WebKit/UIProcess/mac/WKQuickLookPreviewController.h.
Move this enum out of WKQuickLookPreviewController.h, such that we can use and import it in non-Cocoa headers
and implementation files.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::computeHasImageAnalysisResults):
Rename `computeHasVisualSearchResults` to `computeHasImageAnalysisResults`, and allow it to take a flag to
indicate whether or not it should request text recognition results or visual search results. We use this for the
"Quick Look" context menu action when inline text selection is disabled, in order to retitle the item to "Select
Text in Quick Look".
(WebKit::WebViewImpl::computeHasVisualSearchResults): Deleted.
* UIProcess/PageClient.h:
(WebKit::PageClient::computeHasImageAnalysisResults):
(WebKit::PageClient::computeHasVisualSearchResults): Deleted.
* UIProcess/WebContextMenuProxy.h:
(WebKit::WebContextMenuProxy::quickLookPreviewActivity const):
Add a flag to WebContextMenuProxy to determine what initial activity to use when presenting the QuickLook
preview panel after selecting the ContextMenuItemTagQuickLookImage item.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
(WebKit::WebPageProxy::computeHasImageAnalysisResults):
(WebKit::WebPageProxy::computeHasVisualSearchResults): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::computeHasImageAnalysisResults):
(WebKit::PageClientImpl::computeHasVisualSearchResults): Deleted.
* UIProcess/mac/WKQuickLookPreviewController.h:
* UIProcess/mac/WKQuickLookPreviewController.mm:
* UIProcess/mac/WebContextMenuProxyMac.h:
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::menuItemIdentifier):
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
Add logic to either remove and reinsert the "Look Up" context menu action (if inline text selection in images is
enabled), or to promote the "Quick Look" context menu action to either "Select Text in Quick Look" or "Look Up
in Quick Look" in the case where inline text selection in images is disabled.
Note that when inline text selection in images is disabled, we'll first check for visual search results before
checking for text. This is because visual search results will take precedence over text selection (i.e., we'll
show "Look Up in Quick Look" even if both visual search results and text is present), so we can avoid performing
text analysis in the case where we already found visual search results.
(WebKit::WebContextMenuProxyMac::insertOrUpdateQuickLookImageItem):
(WebKit::WebContextMenuProxyMac::updateQuickLookContextMenuItemTitle):
Add a helper method to find and update the title of the NSMenuItem corresponding to
ContextMenuItemTagQuickLookImage. See `getContextMenuFromItems` above for more details.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::handleContextMenuQuickLookImage):
(WebKit::WebPageProxy::handleContextMenuLookUpImage): Deleted.
Rename this to `handleContextMenuQuickLookImage`, and have it take an argument to indicate whether the QuickLook
panel should start out in Visual Look Up mode.
* WebKit.xcodeproj/project.pbxproj:
2021-06-22 Chris Dumez <cdumez@apple.com>
[macOS] Suspend WebProcesses that are in the process cache
https://bugs.webkit.org/show_bug.cgi?id=227269
Reviewed by Geoffrey Garen.
Suspend WebProcesses that are in the process cache on macOS to make sure they use no CPU.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setIsInProcessCache):
(WebKit::WebProcessProxy::platformSuspendProcess):
(WebKit::WebProcessProxy::platformResumeProcess):
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::platformSuspendProcess):
(WebKit::WebProcessProxy::platformResumeProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setIsInProcessCache):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
2021-06-22 Jer Noble <jer.noble@apple.com>
Further unreviewed build fix after r279133: remove even more things.
* UIProcess/WebPageProxy.cpp:
2021-06-22 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r279133: remove unnecessary includes and defines after upstreaming.
* UIProcess/WebPageProxy.cpp:
2021-06-22 Per Arne Vollan <pvollan@apple.com>
[macOS] Deny mach-lookup to the service 'com.apple.print.normalizerd'
https://bugs.webkit.org/show_bug.cgi?id=227248
<rdar://problem/79600557>
Reviewed by Brent Fulgham.
Deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebKit processes on macOS.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::gpuMachServices):
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-22 Fujii Hironori <Hironori.Fujii@sony.com>
[GLib] Rewrite NetworkCache::Data::adoptMap without FileSystem::MappedFileData::leakHandle and munmap
https://bugs.webkit.org/show_bug.cgi?id=227017
Reviewed by Carlos Garcia Campos.
FileSystem::MappedFileData class wraps file mapping APIs like mmap
and munmap in cross-platform manner. NetworkCache::Data::adoptMap
shouldn't use FileSystem::MappedFileData::leakHandle and munmap.
* NetworkProcess/cache/NetworkCacheDataGLib.cpp:
(WebKit::NetworkCache::MapWrapper::~MapWrapper):
(WebKit::NetworkCache::Data::adoptMap):
2021-06-07 Jer Noble <jer.noble@apple.com>
[Cocoa] Upstream GroupActivitiesCoordinator
https://bugs.webkit.org/show_bug.cgi?id=226757
Reviewed by Eric Carlson.
Upstream the backing objects for a GroupActivities-based MediaSessionCoordinator.
* SourcesCocoa.txt:
* UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.h: Added.
* UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.mm: Added.
(-[WKGroupActivitiesCoordinatorDelegate initWithParent:]):
(-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssuePlayCommand:completionHandler:]):
(-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssuePauseCommand:completionHandler:]):
(-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssueSeekCommand:completionHandler:]):
(-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssueBufferingCommand:completionHandler:]):
(-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssuePrepareTransitionCommand:]):
(WebKit::GroupActivitiesCoordinator::create):
(WebKit::GroupActivitiesCoordinator::GroupActivitiesCoordinator):
(WebKit::GroupActivitiesCoordinator::~GroupActivitiesCoordinator):
(WebKit::GroupActivitiesCoordinator::sessionStateChanged):
(WebKit::GroupActivitiesCoordinator::identifier const):
(WebKit::GroupActivitiesCoordinator::join):
(WebKit::GroupActivitiesCoordinator::leave):
(WebKit::GroupActivitiesCoordinator::seekTo):
(WebKit::GroupActivitiesCoordinator::play):
(WebKit::GroupActivitiesCoordinator::pause):
(WebKit::GroupActivitiesCoordinator::setTrack):
(WebKit::GroupActivitiesCoordinator::positionStateChanged):
(WebKit::GroupActivitiesCoordinator::readyStateChanged):
(WebKit::GroupActivitiesCoordinator::playbackStateChanged):
(WebKit::GroupActivitiesCoordinator::trackIdentifierChanged):
(WebKit::GroupActivitiesCoordinator::issuePlayCommand):
(WebKit::GroupActivitiesCoordinator::issuePauseCommand):
(WebKit::GroupActivitiesCoordinator::issueSeekCommand):
(WebKit::GroupActivitiesCoordinator::issueBufferingCommand):
(WebKit::GroupActivitiesCoordinator::issuePrepareTransitionCommand):
* UIProcess/Cocoa/GroupActivities/GroupActivitiesSession.h: Added.
(WebKit::GroupActivitiesSession::groupSession):
* UIProcess/Cocoa/GroupActivities/GroupActivitiesSession.mm: Added.
(WebKit::GroupActivitiesSession::create):
(WebKit::GroupActivitiesSession::GroupActivitiesSession):
(WebKit::GroupActivitiesSession::~GroupActivitiesSession):
(WebKit::GroupActivitiesSession::join):
(WebKit::GroupActivitiesSession::leave):
(WebKit::GroupActivitiesSession::state const):
(WebKit::GroupActivitiesSession::uuid const):
(WebKit::GroupActivitiesSession::fallbackURL const):
(WebKit::GroupActivitiesSession::addStateChangeObserver):
(WebKit::GroupActivitiesSession::addFallbackURLObserver):
* UIProcess/Cocoa/GroupActivities/GroupActivitiesSessionNotifier.h: Added.
* UIProcess/Cocoa/GroupActivities/GroupActivitiesSessionNotifier.mm: Added.
(WebKitSwiftLibrary):
(WebKit::GroupActivitiesSessionNotifier::sharedNotifier):
(WebKit::GroupActivitiesSessionNotifier::GroupActivitiesSessionNotifier):
(WebKit::GroupActivitiesSessionNotifier::sessionStateChanged):
(WebKit::GroupActivitiesSessionNotifier::addWebPage):
(WebKit::GroupActivitiesSessionNotifier::removeWebPage):
(WebKit::GroupActivitiesSessionNotifier::webPageURLChanged):
(WebKit::GroupActivitiesSessionNotifier::hasSessionForURL):
(WebKit::GroupActivitiesSessionNotifier::takeSessionForURL):
* UIProcess/Cocoa/GroupActivities/WKGroupSession.h: Added.
* UIProcess/Cocoa/GroupActivities/WKGroupSession.swift: Added.
(WKURLActivityWrapper.urlActivity):
(WKURLActivityWrapper.fallbackURL):
(WKGroupSessionWrapper.groupSession):
(WKGroupSessionWrapper.cancellables):
(WKGroupSessionWrapper.activity):
(WKGroupSessionWrapper.uuid):
(WKGroupSessionWrapper.wrapperSessionState(_:)):
(WKGroupSessionWrapper.state):
(WKGroupSessionWrapper.newActivityCallback):
(WKGroupSessionWrapper.stateChangedCallback):
(WKGroupSessionWrapper.join):
(WKGroupSessionWrapper.leave):
(WKGroupSessionWrapper.coordinate(_:)):
(WKGroupSessionWrapper.activityChanged(_:)):
(WKGroupSessionWrapper.stateChanged(_:)):
(WKGroupSessionObserver.newSessionCallback):
(WKGroupSessionObserver.cancellables):
(WKGroupSessionObserver.recievedSession(_:)):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPageProxy::~WebPageProxy):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* WebKit.xcodeproj/project.pbxproj:
2021-06-22 Peng Liu <peng.liu6@apple.com>
ASSERTION FAILED: videoFullscreenManager->client() == nullptr in WKFullScreenWindowController.mm
https://bugs.webkit.org/show_bug.cgi?id=227243
Reviewed by Eric Carlson.
`-[WKFullScreenWindowController windowDidExitFullScreen:]` needs to clear
its client like `-[WKFullScreenWindowController didExitPictureInPicture]` does.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController windowDidExitFullScreen:]):
2021-06-22 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r279083.
Broke Mac Builds
Reverted changeset:
"Migrate App Privacy Report code from WebKitAdditions"
https://bugs.webkit.org/show_bug.cgi?id=227045
https://commits.webkit.org/r279083
2021-06-22 Kimmo Kinnunen <kkinnunen@apple.com>
Functions dispatched to WorkQueue are sometimes destroyed in the calling thread due to block refcounting
https://bugs.webkit.org/show_bug.cgi?id=227160
Reviewed by Antti Koivisto.
As an example, remove one workaround mutability of dispatched function
and nullptr assignment that was needed for working around
WorkQueue::dispatch bug where the dispatched function was not always
destroyed in the queue.
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
(WebKit::MediaTrackReader::finalize):
2021-06-22 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Force a copy of font data when receiving it from the untrusted web process
https://bugs.webkit.org/show_bug.cgi?id=227247
<rdar://problem/70825675>
Reviewed by Maciej Stachowiak.
Sending a SharedBuffer across IPC is implemented by having the receiver map a shmem into its address space. On
the sender's side, the shmem still exists, and a compromised web process could scribble data into it after
sending it. So, when the GPU process receives the font data, we need to make a copy of it locally to make sure
the data can't change out from under us.
No new tests because there is no behavior change.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData):
2021-06-21 Said Abou-Hallawa <said@apple.com>
[GPU Process] RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate() may fire if GPUP is relaunched
https://bugs.webkit.org/show_bug.cgi?id=227229
<rdar://79147947>
Reviewed by Myles C. Maxfield.
1) Remove maximumUnusedFontCountToSkipRemoval because
'unusedFontCount < maximumUnusedFontCountToSkipRemoval' can't be true
since both unusedFontCount and maximumUnusedFontCountToSkipRemoval are
unsigned and maximumUnusedFontCountToSkipRemoval is equal to zero.
So they can only be equal and we can replace this by '!unusedFontCount'.
2) RemoteResourceCacheProxy::cacheFont() assumes if the font is cached in
m_fontIdentifierToLastRenderingUpdateVersionMap then it is also cached
in GPUP. We have to keep this assumption correct by removing the
corresponding entries from m_fontIdentifierToLastRenderingUpdateVersionMap.
3) RemoteResourceCacheProxy::didFinalizeRenderingUpdate() needs to reset
m_numberOfFontsUsedInCurrentRenderingUpdate and to increment
m_currentRenderingUpdateVersion in all its code branches.
4) If the GPUP is relaunched, we need to set
m_numberOfFontsUsedInCurrentRenderingUpdate to zero after we clear
m_fontIdentifierToLastRenderingUpdateVersionMap. Otherwise the
RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate()
will fire.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate):
(WebKit::RemoteResourceCacheProxy::clearFontMap):
(WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate):
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
(WebKit::RemoteResourceCacheProxy::releaseMemory):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-06-21 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] [WebKitLegacy] Non-actionable "Look Up" action appears when right clicking images
https://bugs.webkit.org/show_bug.cgi?id=227240
Reviewed by Devin Rousso.
Override the new client hook and return true.
* WebProcess/WebCoreSupport/WebContextMenuClient.h:
2021-06-21 Don Olmstead <don.olmstead@sony.com>
Non-unified build fixes late June 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=227241
Unreviewed non-unified build fixes.
* GPUProcess/GPUProcess.cpp:
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
* WebProcess/GPU/media/WebMediaStrategy.cpp:
(WebKit::WebMediaStrategy::createNowPlayingManager const):
2021-06-21 Don Olmstead <don.olmstead@sony.com>
Update signature of createVideoLayerRemote for PlayStation and GStreamer
https://bugs.webkit.org/show_bug.cgi?id=227242
Reviewed by Eric Carlson.
Followup on r278740 which changed the signature of createVideoLayerRemote. Updating the PlayStation and
GStreamer accordingly.
* WebProcess/GPU/media/gstreamer/VideoLayerRemoteGStreamer.cpp:
(WebKit::createVideoLayerRemote):
* WebProcess/GPU/media/playstation/VideoLayerRemotePlayStation.cpp:
(WebKit::createVideoLayerRemote):
2021-06-21 Chris Dumez <cdumez@apple.com>
Update TBA macros for iOS 15 / macOS 13
https://bugs.webkit.org/show_bug.cgi?id=227228
<rdar://78581134>
Reviewed by Alex Christensen.
* Configurations/WebKit.xcconfig:
* Shared/API/Cocoa/_WKFrameHandle.h:
* Shared/API/Cocoa/_WKRemoteObjectInterface.h:
* UIProcess/API/Cocoa/WKContentRuleListPrivate.h:
* UIProcess/API/Cocoa/WKDownload.h:
* UIProcess/API/Cocoa/WKDownloadDelegate.h:
* UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h:
* UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
* UIProcess/API/Cocoa/WKNavigationAction.h:
* UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
* UIProcess/API/Cocoa/WKNavigationDelegate.h:
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/API/Cocoa/_WKAppHighlight.h:
* UIProcess/API/Cocoa/_WKAppHighlightDelegate.h:
* UIProcess/API/Cocoa/_WKApplicationManifest.h:
* UIProcess/API/Cocoa/_WKAuthenticationExtensionsClientInputs.h:
* UIProcess/API/Cocoa/_WKAuthenticationExtensionsClientOutputs.h:
* UIProcess/API/Cocoa/_WKAuthenticatorAssertionResponse.h:
* UIProcess/API/Cocoa/_WKAuthenticatorAttachment.h:
* UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponse.h:
* UIProcess/API/Cocoa/_WKAuthenticatorResponse.h:
* UIProcess/API/Cocoa/_WKAuthenticatorSelectionCriteria.h:
* UIProcess/API/Cocoa/_WKAutomationDelegate.h:
* UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
* UIProcess/API/Cocoa/_WKDownload.h:
* UIProcess/API/Cocoa/_WKDownloadDelegate.h:
* UIProcess/API/Cocoa/_WKElementAction.h:
* UIProcess/API/Cocoa/_WKInspector.h:
* UIProcess/API/Cocoa/_WKInspectorConfiguration.h:
* UIProcess/API/Cocoa/_WKInspectorExtension.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialCreationOptions.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialDescriptor.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialEntity.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialParameters.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialRelyingPartyEntity.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialRequestOptions.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialUserEntity.h:
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
* UIProcess/API/Cocoa/_WKTextManipulationToken.h:
* UIProcess/API/Cocoa/_WKUserVerificationRequirement.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2021-06-21 Myles C. Maxfield <mmaxfield@apple.com>
Fix Apple internal build
Rubber-stamped by Megan Gardner.
* UIProcess/WebPageProxy.cpp:
2021-06-21 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
https://bugs.webkit.org/show_bug.cgi?id=227011
Reviewed by Don Olmstead.
* NetworkProcess/cache/NetworkCacheDataCurl.cpp:
(WebKit::NetworkCache::Data::tryCreateSharedMemory const): Added.
2021-06-21 Kate Cheney <katherine_cheney@apple.com>
Migrate App Privacy Report code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=227045
<rdar://problem/74333287>
Reviewed by Alex Christensen.
No new tests, covered by existing tests.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(contextString): Deleted.
This patch deletes the contextString function because it is no longer
needed now that CFNetwork sets the attribution context, and it seemed
silly to migrate code from WebKitAdditions just to delete it
immediately. This also moves the processPCMRequest function
declaration from WebKitAdditions so we can remove
NETWORK_DATA_TASK_COCOA_ADDITIONS.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::isActingOnBehalfOfAFullWebBrowser):
(WebKit::NetworkSessionCocoa::removeNetworkWebsiteData):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setLastNavigationWasAppBound):
2021-06-21 Chris Dumez <cdumez@apple.com>
[WK2] Don't process-swap on navigations within the same non-HTTP(s) protocol
https://bugs.webkit.org/show_bug.cgi?id=227220
Reviewed by Tim Horton.
Don't process-swap on navigations within the same non-HTTP(s) protocol. Trying to extract registrable domains
from non-HTTP(s) URLs does not make much sense and leads to unexpected process swaps.
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration setProcessSwapsOnNavigationWithinSameNonHTTPFamilyProtocol:]):
(-[_WKProcessPoolConfiguration processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
2021-06-21 Megan Gardner <megan_gardner@apple.com>
AppHighlights disappear on page reload
https://bugs.webkit.org/show_bug.cgi?id=227141
rdar://78190331
Reviewed by Devin Rousso.
When a page is reloaded, a new set of highlights is loaded, but the state of visibility of
the highlights is not preserved.
We need to preserve the state of highlights so they are correctly shown on reload.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::appHighlightsVisiblility const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
(WebKit::WebPage::setAppHighlightsVisibility):
(WebKit::m_lastNavigationWasAppBound): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::appHighlightsVisiblility const):
2021-06-21 Alex Christensen <achristensen@webkit.org>
Break ref cycle between API::HTTPCookieStore and WebKit::WebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=226992
Reviewed by Chris Dumez.
Covered by an API test.
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::HTTPCookieStore):
(API::HTTPCookieStore::filterAppBoundCookies):
(API::HTTPCookieStore::cookies):
(API::HTTPCookieStore::cookiesForURL):
(API::HTTPCookieStore::setCookies):
(API::HTTPCookieStore::deleteCookie):
(API::HTTPCookieStore::deleteAllCookies):
(API::HTTPCookieStore::setHTTPCookieAcceptPolicy):
(API::HTTPCookieStore::flushCookies):
(API::HTTPCookieStore::registerObserver):
(API::HTTPCookieStore::unregisterObserver):
* UIProcess/API/APIHTTPCookieStore.h:
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::complete):
2021-06-21 James Savage <james.savage@apple.com>
Upstream async support to Swift overlay.
https://bugs.webkit.org/show_bug.cgi?id=227006.
Reviewed by Alex Christensen.
* SwiftOverlay/Tests/JavaScriptToSwiftTypeConversions.swift:
(JavaScriptToSwiftConversions.testUsingSwiftAsync): Adds a simple test
for the Swift async interface.
* SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Removed
use of WebKitAdditions, which is needed both to prevent redefinition
errors and because they are no longer necessary.
* UIProcess/API/Cocoa/WebKitSwiftOverlay.swift:
(WKWebView.callAsyncJavaScript(_:arguments:in:contentWorld:)):
(WKWebView.pdf(_:)):
(WKWebView.evaluateJavaScript(_:in:contentWorld:)):
(WKWebView.find(_:configuration:)):
2021-06-21 Alex Christensen <achristensen@webkit.org>
Add log when creating NSURLSession that will not accept cookies
https://bugs.webkit.org/show_bug.cgi?id=226511
<rdar://77637158>
Reviewed by Chris Dumez.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::initializeStandardSessionsInSet):
2021-06-21 Alex Christensen <achristensen@webkit.org>
REGRESSION (r275496): WebSocket Message too long when message is larger than 1mb
https://bugs.webkit.org/show_bug.cgi?id=227030
<rdar://problem/79370994>
Reviewed by Youenn Fablet.
NSURLSession's WebSocket implementation currently has maximumMessageSize's default value at 1MB.
Our CFReadStream-based WebSocket implementation had no message size limitation, so set it to 0 to remove the limit.
Writing a test for this was tricky because our WebSocket LayoutTests use the deflate extension. I wrote an API test
that implements a simple WebSocket exchange and verifies each byte is what we expect.
The test used to fail using our NSURLSession-based WebSocket implementation but now passes everywhere.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::createWebSocketTask):
Set maximumMessageSize to 0, which, as documented in ws_options.h but unfortunately not yet in NSURLSession.h:
"means there is no receive limit."
This matches our behavior with the CFReadStream-based WebSocket implementation.
2021-06-20 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Rename WKVisualSearchPreviewController to WKQuickLookPreviewController
https://bugs.webkit.org/show_bug.cgi?id=227193
Reviewed by Sam Weinig.
Rename WKVisualSearchPreviewController to WKQuickLookPreviewController, with the intention of using this logic
to implement a new context menu action for opening images in a QuickLook preview panel. See below for more
details.
* SourcesCocoa.txt:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuLookUpImage): Deleted.
Move this into WebPageProxyMac.mm, since this is (1) only relevant to macOS, and (2) this logic now requires
WKQuickLookPreviewController.h, which WebPageProxyMac.mm already imports.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::acceptsPreviewPanelControl):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WKQuickLookPreviewController.h: Renamed from Source/WebKit/UIProcess/mac/WKVisualSearchPreviewController.h.
* UIProcess/mac/WKQuickLookPreviewController.mm: Renamed from Source/WebKit/UIProcess/mac/WKVisualSearchPreviewController.mm.
(-[WKQuickLookPreviewController initWithPage:imageData:title:imageURL:activity:]):
Add QuickLookPreviewActivity, a flag to indicate whether or not WKQuickLookPreviewController should
start with QLPreviewActivityVisualSearch or QLPreviewActivityNone. For the time being, we only use this helper
object for visual search, so we only pass in QuickLookPreviewActivity::VisualSearch.
(-[WKQuickLookPreviewController beginControl:]):
(-[WKQuickLookPreviewController endControl:]):
(-[WKQuickLookPreviewController closePanelIfNecessary]):
(-[WKQuickLookPreviewController isControlling:]):
(-[WKQuickLookPreviewController provideDataForItem:]):
(-[WKQuickLookPreviewController numberOfPreviewItemsInPreviewPanel:]):
(-[WKQuickLookPreviewController previewPanel:previewItemAtIndex:]):
(-[WKQuickLookPreviewController previewPanel:initialActivityForItem:]):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::beginPreviewPanelControl):
(WebKit::WebPageProxy::endPreviewPanelControl):
(WebKit::WebPageProxy::closeSharedPreviewPanelIfNecessary):
(WebKit::WebPageProxy::handleContextMenuLookUpImage):
(WebKit::WebPageProxy::showImageInQuickLookPreviewPanel):
(WebKit::WebPageProxy::showImageInVisualSearchPreviewPanel): Deleted.
* WebKit.xcodeproj/project.pbxproj:
2021-06-20 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Mouse events should only trigger text recognition if the cursor is moving
https://bugs.webkit.org/show_bug.cgi?id=227181
rdar://79469827
Reviewed by Tim Horton.
Populate the `deltaX` and `deltaY` members of the platform mouse event on iOS, when using a trackpad. This
allows the adjusted logic in EventHandler to apply to iPadOS when using a trackpad as well (see WebCore
ChangeLog for more information).
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
* UIProcess/ios/WKMouseGestureRecognizer.mm:
(-[WKMouseGestureRecognizer createMouseEventWithType:wasCancelled:]):
2021-06-18 Brent Fulgham <bfulgham@apple.com>
Clear state after process crash so that we know to re-issue sandbox extensions
https://bugs.webkit.org/show_bug.cgi?id=227103
<rdar://problem/77588760>
Reviewed by Tim Horton.
Follow-up patch that corrects a problem when switching between processes (for example, when
a provisional load moves to a committed load.) The parameters for the new process would fail
to pass the necessary sandbox extensions for the <attachment> element if they had been vended
to the provisional load. Instead, we should be checking if the new process has been given
the necessary extensions.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters): Use the new process, not the process state we are
copying from when deciding whether we need to extend sandbox powers to the new process.
2021-06-18 Peng Liu <peng.liu6@apple.com>
[iOS] Fullscreen video playback gets stuck after interacting with the playback controls
https://bugs.webkit.org/show_bug.cgi?id=227047
Reviewed by Eric Carlson.
When we scrub a playing video, the video element may enter a temporarily stalled
state - the player is still playing, but it does not have enough data. In WebKit,
the `rate` of the player will be 0. But we cannot set the rate of `WebAVPlayerController`
to 0 in this case, because AVKit will believe the video playback is paused when
its rate is 0. In r261587, we defined a magic rate (0.00000001f) for this case.
Unfortunately, with the changes in r275956, `WebAVPlayerController` will
align its `defaultPlaybackRate` with `rate` when `rate` is not 0. Under stress
tests, e.g., keep scrubbing a video, a video element will eventually enter a state
in which both `defaultPlaybackRate` and `rate` are the magic rate. And the video
appears to be stuck for users.
To fix the issue, this patch removes the magic rate and defines a new state: `stalled`.
A video will be in the stalled state when it is playing but does not have enough data.
WebKit will only change the rate of `WebAVPlayerController` when the video
is not stalled.
To avoid potential problems due to the conversions between "float" and "double"
back and forth, this patch updates the types of `playbackRate` and `defaultPlaybackRate`.
* Scripts/webkit/messages.py:
(headers_for_type):
* UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionModelContext::setDefaultPlaybackRate):
(WebKit::PlaybackSessionModelContext::setPlaybackRate):
(WebKit::PlaybackSessionModelContext::rateChanged):
(WebKit::PlaybackSessionManagerProxy::rateChanged):
(WebKit::PlaybackSessionManagerProxy::setDefaultPlaybackRate):
(WebKit::PlaybackSessionManagerProxy::setPlaybackRate):
* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
* WebProcess/cocoa/PlaybackSessionManager.h:
* WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionInterfaceContext::rateChanged):
(WebKit::PlaybackSessionManager::rateChanged):
2021-06-18 Zan Dobersek <zdobersek@igalia.com>
[WPE] Rework touch-based gesture controller
https://bugs.webkit.org/show_bug.cgi?id=226456
Reviewed by Alejandro G. Castro.
Rename WPE's ScrollGestureController to TouchGestureController since now
it also handles production of touch-based click events.
TouchGestureController now internally manages all the related state,
tracking the touch interaction and determining whether it progresses
into a scrolling gesture or whether, upon finishing, it should be
translated into a simple click event.
In PageClientImpl, any unhandled event is pushed into
TouchGestureController and a variant of different outcomes is returned.
No-event result is ignored, and click or axis events are dispatched as
appropriate.
In WPEView, where the touch events arrive into the engine, we keep the
shortcut where touch events are piped directly into the controller if
said controller is already gesturing scrolling behavior. In that case
the touch events are not dispatched into the engine, with the exception
of touch-up events which are, to provide matching closure for the
touch-down events.
* SourcesWPE.txt:
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithTouchEvent):
* UIProcess/API/wpe/TouchGestureController.cpp: Renamed from Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp.
(WebKit::TouchGestureController::handleEvent):
* UIProcess/API/wpe/TouchGestureController.h: Renamed from Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h.
(WebKit::TouchGestureController::gesturedEvent const):
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::View::View):
(WKWPE::m_backend):
* UIProcess/API/wpe/WPEView.h:
(WKWPE::View::touchGestureController const):
(WKWPE::View::scrollGestureController const): Deleted.
2021-06-18 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Add Timing-Allow-Origin checks to NetworkDataTaskSoup
https://bugs.webkit.org/show_bug.cgi?id=227008
<rdar://problem/79384792>
Reviewed by Adrian Perez de Castro.
Add missing TAO checks to Soup backend.
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::didSendRequest):
(WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
2021-06-17 Said Abou-Hallawa <said@apple.com>
[Cocoa] Disable hardware decoding in the WebProcess
https://bugs.webkit.org/show_bug.cgi?id=226869
<rdar://77548905>
Reviewed by Per Arne Vollan and Simon Fraser.
Restrict video decoders and disable hardware image decoders.
A temp extension is created for the service "com.apple.trustd.agent" to
allow temporarily calling FigPhotoSupportsHEVCHWDecode(). This function
needs access this service but we have recently closed access to it.
FigPhotoSupportsHEVCHWDecode() sets a local static variable by using the
service "com.apple.trustd.agent" when it is called for the first time.
Our purpose of calling it in this context is to initialize the static
variable only. And this is why we do not use its return value.
This solution is fragile. If MediaToolbox is changed such that it needs
'com.apple.trustd.agent' while decoding an image, the decoding will fail.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::restrictImageAndVideoDecoders):
(WebKit::WebProcess::initializeSandbox):
2021-06-17 Chris Dumez <cdumez@apple.com>
Enable some more release logging in for ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=227142
Reviewed by Eric Carlson.
Enable some more release logging in for ephemeral sessions, to faciliate debugging.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::isAlwaysOnLoggingAllowed const): Deleted.
* GPUProcess/GPUConnectionToWebProcess.h:
(WebKit::GPUConnectionToWebProcess::sessionID const):
* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::logger):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
(WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
(WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
(WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
(WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearTopFrameUniqueRedirectsToSinceSameSiteStrictEnforcement):
(WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
(WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForAllButCookieDataRemoval):
(WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentlyUpdatedTimestamp const):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
(WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
(WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
(WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::removeDataForDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
(WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
(WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
(WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateDataRecordsRemoved):
(WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectSubStatisticsCount):
(WebKit::ResourceLoadStatisticsDatabaseStore::getDomainStringFromDomainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const):
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainIDExistsInDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters):
(WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed):
(WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::WebURLSchemeTaskProxy::startLoading):
(WebKit::WebURLSchemeTaskProxy::stopLoading):
(WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
(WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
(WebKit::WebURLSchemeTaskProxy::didReceiveData):
(WebKit::WebURLSchemeTaskProxy::didComplete):
2021-06-17 Brent Fulgham <bfulgham@apple.com>
Clear state after process crash so that we know to re-issue sandbox extensions
https://bugs.webkit.org/show_bug.cgi?id=227103
<rdar://problem/77588760>
Reviewed by Per Arne Vollan.
We dynamically extend access to certain mach services when the ATTACHMENT_ELEMENT feature
is enabled. If a process with this feature activated crashes and WebKit relaunches it, we
don't grant the new process the same extensions because we believe they were already
previously sent.
This patch clears the state after a process crash so that it properly handles the restart case.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::shutDown): Clear state.
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): Clear state.
2021-06-17 Ben Nham <nham@apple.com>
Remove Mac-specific CPUTime functions
https://bugs.webkit.org/show_bug.cgi?id=227109
Reviewed by Yusuke Suzuki.
Permit calling thread_selfusage, since it is used by clock_gettime(CLOCK_THREAD_CPUTIME_ID, tp).
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-17 Chris Dumez <cdumez@apple.com>
Trying to take empty snapshots of the view should not cause crashes
https://bugs.webkit.org/show_bug.cgi?id=227133
Reviewed by Tim Horton.
Trying to take empty snapshots of the view should not cause crashes. We would previously
see crashes because:
1. We would end up doing divisions by zero
2. We would hit the ASSERT(size) in SharedMemory::allocate().
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2021-06-17 Kate Cheney <katherine_cheney@apple.com>
Storage Access quirks should prompt up to twice if a user does not allow storage access
https://bugs.webkit.org/show_bug.cgi?id=227099
<rdar://problem/79409843>
Reviewed by John Wilander.
We should allow storage access prompts twice per document for quirks
just like for non-quirk cases. Previously we were only presenting
the quirk prompt once per web content process if the user denied. This
patch removes this code and utilizes maxNumberOfTimesExplicitlyDeniedStorageAccess
instead.
* WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::hasDeniedCrossPageStorageAccess const): Deleted.
(WebKit::WebResourceLoadObserver::setHasDeniedCrossPageStorageAccess): Deleted.
* WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
2021-06-17 Tim Horton <timothy_horton@apple.com>
Adopt WKHoverGestureRecognizer
https://bugs.webkit.org/show_bug.cgi?id=227116
<rdar://79442027>
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpInteraction]):
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _removeDefaultGestureRecognizers]):
(-[WKContentView _addDefaultGestureRecognizers]):
(-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
(-[WKContentView gestureRecognizer:shouldReceivePress:]):
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKContentView setUpHoverGestureRecognizer]):
(-[WKContentView hoverGestureRecognizerChanged:]):
Plumb mouse events from WKHoverGestureRecognizer to the page.
2021-06-17 Alex Christensen <achristensen@webkit.org>
Fix crashes in ContentRuleListStore::lookupContentRuleList
https://bugs.webkit.org/show_bug.cgi?id=227100
<rdar://78816611>
Reviewed by Chris Dumez.
To be extra careful, instead of just assuming that moveFile will always succeed,
when moveFile fails, try to delete the legacy path (which has a ContentExtension- instead of ContentRuleList- prefix)
and fail the lookup. This will only happen in Safari, which was the only client of _WKUserContentExtensionStore.
The legacy file is not useful to us because in r275078 I incremented CurrentContentRuleListFileVersion so the bytes on disk
need to be recompiled anyways. Safari already has logic to recompile it. This was just an attempt to use what we have and
not leave anything behind.
Also, to be extra careful, try deleting a file before moving a file on top of it.
* UIProcess/API/APIContentRuleListStore.cpp:
compiledToFile:
(API::ContentRuleListStore::lookupContentRuleList):
2021-06-17 Alex Christensen <achristensen@webkit.org>
WKScriptMessageHandlerWithReply should raise an exception if replyHandler is called twice
https://bugs.webkit.org/show_bug.cgi?id=226863
Reviewed by Chris Dumez.
We currently dereference null inside CompletionHandlerWithFinalizer.
This makes it more obvious what is going on.
Related to rdar://78865409 but not solving it.
* UIProcess/API/Cocoa/WKUserContentController.mm:
2021-06-17 Per Arne <pvollan@apple.com>
[macOS] Close open connections
https://bugs.webkit.org/show_bug.cgi?id=227068
Reviewed by Brent Fulgham.
On macOS, close open connections in initializeSandboxParameters.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::initializeSandboxParameters):
2021-06-16 Garrett Davidson <garrett_davidson@apple.com>
Passkeys don't work in Simulator
https://bugs.webkit.org/show_bug.cgi?id=227076
<rdar://79366832>
Reviewed by Brent Fulgham.
Simulator does not support LAAccessControlOperationUseKeySign, so
-evaluateAccessControl:... returns an error. However, this check isn't actually necessary in
the simulator when using passkeys, so just skip it.
Tested registration and assertion in an app in Simulator.
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
2021-06-16 Said Abou-Hallawa <said@apple.com>
takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect()
https://bugs.webkit.org/show_bug.cgi?id=226257
<rdar://76411685>
Reviewed by Simon Fraser and Tim Horton.
This will ensure the latest IOSurfaces are pushed to backboardd before
taking the snapshot. Also we need create an implicit transaction to ensure
a commit will happen.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2021-06-16 Mark Lam <mark.lam@apple.com>
Adopt com.apple.security.cs.jit-write-allowlist on internal builds.
https://bugs.webkit.org/show_bug.cgi?id=222148
rdar://74284026
Reviewed by Per Arne Vollan.
* Scripts/process-entitlements.sh:
2021-06-16 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Reenable modern text input UI for non-numeric text input types
https://bugs.webkit.org/show_bug.cgi?id=226988
rdar://78102953
Reviewed by Tim Horton.
Refactor text input logic on watchOS such that we're able to present the new ("modern") UI for scribble text
input on watchOS 8, rather than legacy (in-process) scribble UI. Overall, this patch removes
WKQuickboardListViewController altogether. This had two subclasses: WKSelectMenuListViewController (used for
focused single and multiple select elements) and WKTextInputListViewController (used for text input types).
WKSelectMenuListViewController now inherits directly from PUICQuickboardListViewController, and
WKTextInputListViewController now inherits from PUICQuickboardMessageViewController; this inheritance from
PUICQuickboardMessageViewController instead of PUICQuickboardListViewController allows the
WKTextInputListViewController to show text suggestions using `-setMessages:` on
PUICQuickboardMessageViewController, instead of relying on custom WebKit code to insert text suggestions.
This means that we move the following pieces of functionality out of WKQuickboardListViewController, and into
either WKSelectMenuListViewController or WKTextInputListViewController:
1. Support for inserting and updating context views (i.e. the domain name header view in Quickboard) =>
WKTextInputListViewController.
2. Logic for determining whether or not we should show language selection UI => WKTextInputListViewController.
3. Support for laying out custom collection view cells in Quickboard => WKSelectMenuListViewController.
* Platform/spi/watchos/PepperUICoreSPI.h:
* SourcesCocoa.txt:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView createQuickboardTextInputContext]):
(-[WKContentView _createQuickboardController:]):
Refactor logic to create a PUICTextInputContext from the current focused element information out into a separate
helper method, `-createQuickboardTextInputContext`, and use it when both directly launching into
PUICQuickboardController and WKTextInputListViewController.
(canUseQuickboardControllerFor):
Remove a comment, now that we intend to continue using WKTextInputListViewController for non-keychain-AutoFill-
compatible text fields moving forward.
(-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
(-[WKContentView allowsLanguageSelectionForListViewController:]):
(-[WKContentView textInputContextForListViewController:]):
(-[WKContentView textContentTypeForTesting]):
(-[WKContentView viewController:inputContextViewHeightForSize:]): Deleted.
Remove this delegate method, which was (effectively) unused since we just ask for
`-inputContextViewForViewController:` from the input delegate anyways.
(-[WKContentView allowsLanguageSelectionMenuForListViewController:]): Deleted.
Rename this to `-allowsLanguageSelectionForListViewController:`.
(-[WKContentView textContentTypeForListViewController:]): Deleted.
Replace this with `-textInputContextForListViewController:`, which returns a whole PUICTextInputContext instead
of just a text content type.
(-[WKContentView textSuggestionsForListViewController:]): Deleted.
(-[WKContentView listViewController:didSelectTextSuggestion:]): Deleted.
Remove several delegate methods that are no longer needed.
* UIProcess/ios/forms/WKDatePickerViewController.h:
* UIProcess/ios/forms/WKDatePickerViewController.mm:
(-[WKDatePickerViewController viewWillAppear:]):
Remove some (defunct) logic for overriding the status bar when showing Quickboard input view controllers. This
status bar mechanism (which was previously used to show label text for form controls) hasn't worked since
watchOS 6, and we need to implement this in a way that doesn't use PUICStatusBarGlobalContextViewAssertion.
* UIProcess/ios/forms/WKQuickboardListViewController.mm: Removed.
* UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h.
* UIProcess/ios/forms/WKSelectMenuListViewController.h:
* UIProcess/ios/forms/WKSelectMenuListViewController.mm:
(-[WKSelectMenuItemCell topToLabelBaselineSpecValue]):
(-[WKSelectMenuItemCell baselineToBottomSpecValue]):
(-[WKSelectMenuCollectionViewItemCell topToLabelBaselineSpecValue]):
(-[WKSelectMenuCollectionViewItemCell baselineToBottomSpecValue]):
(-[WKSelectMenuListViewController initWithDelegate:]):
See above comment for more details.
* UIProcess/ios/forms/WKTextInputListViewController.h:
* UIProcess/ios/forms/WKTextInputListViewController.mm:
(-[WKTextInputListViewController initWithDelegate:]):
(-[WKTextInputListViewController reloadContextView]):
(-[WKTextInputListViewController updateContextViewIfNeeded]):
Move logic for showing and updating the context view out of WKQuickboardListViewController, and into
WKTextInputListViewController. See comments above.
(-[WKTextInputListViewController requiresNumericInput]):
(-[WKTextInputListViewController additionalTrayButtons]):
(-[WKTextInputListViewController updateTextSuggestions:]):
(-[WKTextInputListViewController headerContentViewHeight]):
(-[WKTextInputListViewController headerContentView]):
(-[WKTextInputListViewController shouldShowLanguageButton]):
(-[WKTextInputListViewController supportsDictationInput]):
(-[WKTextInputListViewController shouldShowTrayView]):
(-[WKTextInputListViewController shouldShowTextField]):
Override this and return YES for text input types that don't require an additional numeric input tray button.
This allows PUICQuickboardMessageViewController to show a native text field containing the input text inside
quickboard, which (when tapped) presents modern text input UI.
Since showing the text field is apparently mutually exclusive to showing a tray view, we additionally override
`-shouldShowTrayView` and return NO for non-numeric text inputs.
(-[WKTextInputListViewController supportsArouetInput]):
(-[WKTextInputListViewController viewDidLoad]): Deleted.
(-[WKTextInputListViewController willPresentArouetViewController:]): Deleted.
There's no need to override this delegate method anymore, since the PUICTextInputContext's `-initialText` is
sufficient to ensure that the scribble text input UI is prepopulated with the focused text field's initial text
content.
(-[WKTextInputListViewController reloadTextSuggestions]): Deleted.
Rename this to `-updateTextSuggestions:`, and make it take a list of UITextSuggestions. This makes the code a
bit easier to follow and allows us to remove the `-textSuggestionsForListViewController:` delegate method.
(-[WKTextInputListViewController didSelectListItemAtIndexPath:]): Deleted.
(-[WKTextInputListViewController didSelectListItem:]): Deleted.
(-[WKTextInputListViewController _didSelectListItem:]): Deleted.
(-[WKTextInputListViewController numberOfListItems]): Deleted.
(-[WKTextInputListViewController heightForListItem:width:]): Deleted.
(-[WKTextInputListViewController cellForListItem:]): Deleted.
(-[WKTextInputListViewController listItemCellReuseIdentifier]): Deleted.
(-[WKTextInputListViewController listItemCellClass]): Deleted.
(-[WKTextInputListViewController itemCellForListItem:forIndexPath:]): Deleted.
Remove all this code for showing text suggestions in Quickboard UI. Since WKTextInputListViewController is now a
subclass of PUICQuickboardMessageViewController, we can now simply use the `-messages` property of to populate
quickboard with text suggestions.
* UIProcess/ios/forms/WKTimePickerViewController.h:
* WebKit.xcodeproj/project.pbxproj:
2021-06-16 Chris Dumez <cdumez@apple.com>
Enable release logging in the network process for ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=227087
Reviewed by Geoffrey Garen.
Enable release logging in the network process for ephemeral sessions, to facilitate debugging. No domains
or other sensitive information is logged by WebKit.
* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::cancel):
(WebKit::Download::didReceiveData):
(WebKit::Download::didFinish):
(WebKit::Download::didFail):
* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/DownloadMonitor.cpp:
(WebKit::DownloadMonitor::applicationWillEnterForeground):
(WebKit::DownloadMonitor::applicationDidEnterBackground):
(WebKit::DownloadMonitor::timerFired):
* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::startPreflight):
(WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
(WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
(WebKit::NetworkCORSPreflightChecker::didReceiveResponse):
(WebKit::NetworkCORSPreflightChecker::didReceiveData):
(WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
(WebKit::NetworkCORSPreflightChecker::wasBlocked):
(WebKit::NetworkCORSPreflightChecker::cannotShowURL):
(WebKit::NetworkCORSPreflightChecker::wasBlockedByRestrictions):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::hasUploadStateChanged):
(WebKit::NetworkConnectionToWebProcess::didClose):
(WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
(WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
(WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
(WebKit::NetworkConnectionToWebProcess::loadPing):
(WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
(WebKit::NetworkConnectionToWebProcess::preconnectTo):
(WebKit::NetworkConnectionToWebProcess::serverToContextConnectionNoLongerNeeded):
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::continueCheckingRequest):
(WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
(WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
(WebKit::NetworkResourceLoader::startNetworkLoad):
(WebKit::NetworkResourceLoader::cleanup):
(WebKit::NetworkResourceLoader::convertToDownload):
(WebKit::NetworkResourceLoader::abort):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::didReceiveBuffer):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::didFailLoading):
(WebKit::NetworkResourceLoader::didBlockAuthenticationChallenge):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
(WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
(WebKit::NetworkResourceLoader::restartNetworkLoad):
(WebKit::NetworkResourceLoader::continueWillSendRequest):
(WebKit::NetworkResourceLoader::continueDidReceiveResponse):
(WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
(WebKit::NetworkResourceLoader::didReceiveMainResourceResponse):
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
(WebKit::NetworkResourceLoader::sendResultForCacheEntry):
(WebKit::NetworkResourceLoader::validateCacheEntry):
(WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
(WebKit::NetworkResourceLoader::logSlowCacheRetrieveIfNeeded):
(WebKit::NetworkResourceLoader::startWithServiceWorker):
(WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::loadRequest):
(WebKit::PingLoad::didReceiveChallenge):
(WebKit::PingLoad::didReceiveResponse):
(WebKit::PingLoad::didReceiveData):
(WebKit::PingLoad::didCompleteWithError):
(WebKit::PingLoad::wasBlocked):
(WebKit::PingLoad::cannotShowURL):
(WebKit::PingLoad::wasBlockedByRestrictions):
(WebKit::PingLoad::timeoutTimerFired):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
(WebKit::ServiceWorkerFetchTask::~ServiceWorkerFetchTask):
(WebKit::ServiceWorkerFetchTask::start):
(WebKit::ServiceWorkerFetchTask::contextClosed):
(WebKit::ServiceWorkerFetchTask::startFetch):
(WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
(WebKit::ServiceWorkerFetchTask::didReceiveResponse):
(WebKit::ServiceWorkerFetchTask::didFinish):
(WebKit::ServiceWorkerFetchTask::didFail):
(WebKit::ServiceWorkerFetchTask::didNotHandle):
(WebKit::ServiceWorkerFetchTask::cannotHandle):
(WebKit::ServiceWorkerFetchTask::cancelFromClient):
(WebKit::ServiceWorkerFetchTask::continueDidReceiveFetchResponse):
(WebKit::ServiceWorkerFetchTask::continueFetchTaskWith):
(WebKit::ServiceWorkerFetchTask::timeoutTimerFired):
(WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded):
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::createFetchTask):
(WebKit::WebSWServerConnection::startFetch):
(WebKit::WebSWServerConnection::scheduleJobInServer):
(WebKit::WebSWServerConnection::scheduleUnregisterJobInServer):
* NetworkProcess/cache/CacheStorageEngineConnection.cpp:
(WebKit::CacheStorageEngineConnection::open):
(WebKit::CacheStorageEngineConnection::remove):
(WebKit::CacheStorageEngineConnection::caches):
(WebKit::CacheStorageEngineConnection::retrieveRecords):
(WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
(WebKit::CacheStorageEngineConnection::putRecords):
(WebKit::CacheStorageEngineConnection::reference):
(WebKit::CacheStorageEngineConnection::dereference):
* NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
(WebKit::registerMDNSNameCallback):
(WebKit::NetworkMDNSRegister::registerMDNSName):
* NetworkProcess/webrtc/NetworkRTCMonitor.cpp:
(WebKit::NetworkRTCMonitor::startUpdatingIfNeeded):
(WebKit::NetworkRTCMonitor::stopUpdating):
(WebKit::NetworkRTCMonitor::onNetworksChanged):
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::NetworkRTCProvider):
(WebKit::NetworkRTCProvider::close):
(WebKit::NetworkRTCProvider::createSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
2021-06-16 Brent Fulgham <bfulgham@apple.com>
Sandbox profiles need to allow loading from /usr/appleinternal/lib on internal builds
https://bugs.webkit.org/show_bug.cgi?id=227079
<rdar://problem/79390957>
Reviewed by Per Arne Vollan.
We allow the specific directory "/usr/appleinternal/lib/sanitizers", but we actually need
access to "/usr/appleinternal/lib" in certain development environments.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-16 Alex Christensen <achristensen@webkit.org>
Clean up WebCookieManagerProxy
https://bugs.webkit.org/show_bug.cgi?id=227074
Reviewed by Brady Eidson.
Remove dead code. WKCookieManagerSetClient is deprecated and doesn't do anything, so we don't need a client here.
Use smart pointers instead of raw pointers to be on the safe side.
* Shared/API/APIObject.h:
* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/API/APIHTTPCookieStore.h:
* UIProcess/API/APIInspectorExtension.cpp:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::NetworkProcessProxy):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::registerObserver):
(WebKit::WebCookieManagerProxy::unregisterObserver):
(WebKit::WebCookieManagerProxy::cookiesDidChange):
(WebKit::WebCookieManagerProxy::initializeClient): Deleted.
(WebKit::WebCookieManagerProxy::setCookieObserverCallback): Deleted.
* UIProcess/WebCookieManagerProxy.h:
(WebKit::WebCookieManagerProxy::create): Deleted.
* UIProcess/WebCookieManagerProxy.messages.in:
* UIProcess/WebCookieManagerProxyClient.cpp: Removed.
* UIProcess/WebCookieManagerProxyClient.h: Removed.
* UIProcess/mac/WebCookieManagerProxyMac.mm: Removed.
* WebKit.xcodeproj/project.pbxproj:
2021-06-16 Alex Christensen <achristensen@webkit.org>
Clean up API::HTTPCookieStore
https://bugs.webkit.org/show_bug.cgi?id=227058
Reviewed by Anders Carlsson.
This removes code that has been unused since r267763.
I also use smart pointers instead of raw pointers just to be on the safe side.
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::~HTTPCookieStore):
(API::HTTPCookieStore::registerObserver):
(API::HTTPCookieStore::unregisterObserver):
(API::HTTPCookieStore::cookiesDidChange):
(API::HTTPCookieStore::cookieManagerDestroyed): Deleted.
* UIProcess/API/APIHTTPCookieStore.h:
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::generateListenerIdentifier): Deleted.
(WebKit::processPoolCreationListenerFunctionMap): Deleted.
(WebKit::WebProcessPool::registerProcessPoolCreationListener): Deleted.
(WebKit::WebProcessPool::unregisterProcessPoolCreationListener): Deleted.
(WebKit::WebProcessPool::notifyThisWebProcessPoolWasCreated): Deleted.
* UIProcess/WebProcessPool.h:
2021-06-16 Kimmo Kinnunen <kkinnunen@apple.com>
ANGLE Metal gl sync objects do not work in case of listener being needed
https://bugs.webkit.org/show_bug.cgi?id=227024
Reviewed by Per Arne Vollan.
Make MTLSharedEventListener instantiatable by adding IOKit messages
39 and 40 to IOSurfaceRootUserClientMessageFilter.
The MTLSharedEventListener init would fail, and ANGLE would fail to
make the shared event signal the event listener. This would cause
all glClientWaitSync calls to wait the full timeout time.
No new tests, WebGL2 sync object implementation does not support
non-zero timeout values that would be needed to detect the failure.
Standalone test-cases would need the test runner being sandboxed,
which is not implemented currently.
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-16 Per Arne <pvollan@apple.com>
Update Media Accessibility preferences in the WebContent process from the UI process
https://bugs.webkit.org/show_bug.cgi?id=227031
<rdar://78614882>
Reviewed by Eric Carlson.
Due to stricter sandboxing in the WebContent process, Media Accessibility preferences should be updated from the UI process.
The preferences for caption display mode and preferred caption languages will be sent to the WebContent process on process
startup and when the preference has been changed.
* Shared/AccessibilityPreferences.cpp:
(IPC::ArgumentCoder<WebKit::AccessibilityPreferences>::encode):
(IPC::ArgumentCoder<WebKit::AccessibilityPreferences>::decode):
* Shared/AccessibilityPreferences.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::accessibilityPreferences):
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityPreferencesDidChange):
2021-06-16 Martin Robinson <mrobinson@webkit.org>
Replace invalidSnapOffsetIndex with std::optional<unsigned>
https://bugs.webkit.org/show_bug.cgi?id=226654
Reviewed by Simon Fraser.
Use std::optional<unsigned> in order to represent the situation
where we do not have a snap point selected rather than UINT_MAX.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateScrollingNode>::decode):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::currentSnapPointIndicesDidChange):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::currentSnapPointIndicesDidChange):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping):
(WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling const):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange const):
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::currentSnapPointIndicesChangedForNode):
2021-06-15 Alex Christensen <achristensen@webkit.org>
Remove unused code on API::HTTPCookieStore
https://bugs.webkit.org/show_bug.cgi?id=227056
Reviewed by Brady Eidson.
The dust has settled a bit since r267763.
Let's clean up!
* SourcesCocoa.txt:
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::unregisterObserver):
(API::HTTPCookieStore::cookieManagerDestroyed):
(API::HTTPCookieStore::flushDefaultUIProcessCookieStore): Deleted.
(API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies): Deleted.
(API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore): Deleted.
(API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore): Deleted.
(API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore): Deleted.
(API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore): Deleted.
(API::HTTPCookieStore::deleteCookiesInDefaultUIProcessCookieStore): Deleted.
(API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore): Deleted.
* UIProcess/API/APIHTTPCookieStore.h:
* UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Removed.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKDownloadInternal.h:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleClickForDataDetectionResult):
* UIProcess/WebProcessPool.h:
* WebKit.xcodeproj/project.pbxproj:
2021-06-15 Said Abou-Hallawa <said@apple.com>
[GPU Process] ConcreteImageBuffer::baseTransform() returns incorrect transform for unaccelerated ImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=227044
<rdar://78642742>
Reviewed by Simon Fraser.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
2021-06-15 Jean-Yves Avenard <jya@apple.com>
REGRESSION: MSE: Netflix playback sometimes fails when going to "next episode" in series
https://bugs.webkit.org/show_bug.cgi?id=226952
rdar://77583769
Reviewed by Eric Carlson.
Following bug #225396, the remote/proxy MediaPlayer readyState became decoupled
from the currentTime. In the scenario where a time update was pushed from the
GPU to the WebContent process, followed by a change of readyState status; should
the HTMLMediaElement query the MediaPlayer's time in-between those two IPC calls,
it would be possible for the time to be incorrectly estimated as it assumed it
had progressed since it received the update.
Additionally, it was assumed that the only case where the time won't progress
was if the media element was explicitly paused. This was incorrect it could
have stalled due to the lack of data such as commonly happen with MSE.
We add in the time update IPC message a boolean indicating if the GPU's
MediaPlayer is either stalled or paused and that the time shouldn't advance.
While this new boolean appears redundant with the values of the cached
readyState/paused it differs in that timeIsProgressing is accurate at the
moment the time update is sent and received.
Test: media/media-source/media-source-seek-unbuffered.html
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerPausedOrStalled const): Add utility method.
(WebKit::RemoteMediaPlayerProxy::currentTimeChanged):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::currentMediaTime const):
(WebKit::MediaPlayerPrivateRemote::seek): Set the cached media time to the seek
value so that reading it back the time will provide accurate data.
(WebKit::MediaPlayerPrivateRemote::seekWithTolerance): same as with seek method.
(WebKit::MediaPlayerPrivateRemote::currentTimeChanged): Check if timeIsProgressing
is true and only estimate the time if we are certain playback has continued.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: add timeIsProgressing
to method.
2021-06-15 Chris Dumez <cdumez@apple.com>
Use more SQL transactions in ResourceLoadStatisticsDatabaseStore
https://bugs.webkit.org/show_bug.cgi?id=227034
Reviewed by Kate Cheney.
Use more SQL transactions in ResourceLoadStatisticsDatabaseStore, for performance.
I updated the code so that we start a SQL transaction whenever we do more than one
consecutive "write" statement.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
(WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting):
2021-06-15 Chris Dumez <cdumez@apple.com>
Reloading the view should be able to recover if the GPUProcess or NetworkProcess are hung
https://bugs.webkit.org/show_bug.cgi?id=227051
Reviewed by Geoffrey Garen.
Reloading the view should be able to get us out of bad state if the GPUProcess or NetworkProcess are hung.
This is useful as the first instinct of the user may be to reload the page if the page appears hung.
Before the change, if the page is in a bad state due to a hung GPUProcess or NetworkProcess and you'd
reload, the reload would hang indefinitely. After the change, we'll make sure that both processes
are still responsive when triggering the reload. If they are unresponsive, we kill them and the reload
is able to proceed.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::didReceiveMessage):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::mainThreadPing):
* Shared/AuxiliaryProcess.h:
* Shared/AuxiliaryProcess.messages.in:
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::checkForResponsiveness):
* UIProcess/AuxiliaryProcessProxy.h:
* UIProcess/GPU/GPUProcessProxy.messages.in:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reload):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::isResponsive):
(WebKit::WebProcessProxy::isResponsiveWithLazyStop):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* WebProcess/WebProcess.cpp:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
2021-06-15 Jonathan Bedard <jbedard@apple.com>
[watchOS 8] Support building WebKit
https://bugs.webkit.org/show_bug.cgi?id=227050
<rdar://problem/79365320>
Reviewed by Tim Horton.
Covered by existing tests.
* Platform/spi/watchos/PepperUICoreSPI.h: Add QuickboardController SPI.
2021-06-15 Chris Dumez <cdumez@apple.com>
Add basic detection of unresponsive Network / GPU Processes
https://bugs.webkit.org/show_bug.cgi?id=226994
Reviewed by Geoffrey Garen.
If a WebProcess A attempts to connect to the GPUProcess / NetworkProcess B and process B
fails to respond within 3 seconds, we consider process B as unresponsive and terminate
it. As a result, it will re-attempt to launch process B and connect to it again.
This helps in the following scenario:
1. User is in a tab and something looks broken due to the GPUProcess or NetworkProcess
becoming unresponsive
2. The user tries to reload the page in a new tab
Before this patch, the tab would be similarly broken / hung because the GPUProcess or
NetworkProcess would be unresponsive. After this patch, we would detect the process is
hung and kill it. As a result, the page would load correctly in a new tab (with a delay).
In a follow-up, I think we should consider doing the same thing when the user requests
a reload, so that we don't require opening a new tab to recover. However, this keeps
the patch small and is a decent first step.
* Shared/ProcessTerminationReason.h:
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::AuxiliaryProcessProxy):
(WebKit::AuxiliaryProcessProxy::didFinishLaunching):
(WebKit::AuxiliaryProcessProxy::shutDownProcess):
(WebKit::AuxiliaryProcessProxy::platformIsBeingDebugged const):
(WebKit::AuxiliaryProcessProxy::stopResponsivenessTimer):
(WebKit::AuxiliaryProcessProxy::startResponsivenessTimer):
(WebKit::AuxiliaryProcessProxy::mayBecomeUnresponsive):
(WebKit::AuxiliaryProcessProxy::didBecomeUnresponsive):
* UIProcess/AuxiliaryProcessProxy.h:
(WebKit::AuxiliaryProcessProxy::responsivenessTimer):
(WebKit::AuxiliaryProcessProxy::responsivenessTimer const):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::platformIsBeingDebugged const): Deleted.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::getGPUProcessConnection):
(WebKit::GPUProcessProxy::gpuProcessExited):
(WebKit::GPUProcessProxy::didBecomeUnresponsive):
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didBecomeUnresponsive):
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/ResponsivenessTimer.cpp:
(WebKit::ResponsivenessTimer::timerFired):
(WebKit::ResponsivenessTimer::mayBecomeUnresponsive const):
* UIProcess/ResponsivenessTimer.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::gpuProcessExited):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::didFinishLaunching):
(WebKit::WebProcessProxy::isResponsive const):
(WebKit::WebProcessProxy::processTerminated):
(WebKit::WebProcessProxy::platformIsBeingDebugged const): Deleted.
(WebKit::WebProcessProxy::mayBecomeUnresponsive): Deleted.
(WebKit::WebProcessProxy::stopResponsivenessTimer): Deleted.
(WebKit::WebProcessProxy::startResponsivenessTimer): Deleted.
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::responsivenessTimer): Deleted.
2021-06-15 Jonathan Bedard <jbedard@apple.com>
[Monterey] Support building WebKit (Follow-up)
https://bugs.webkit.org/show_bug.cgi?id=226846
<rdar://problem/79095148>
Unreviewed follow-up fix.
Covered by exisiting tests.
* WebKit.xcodeproj/project.pbxproj: Reset objectVersion.
2021-06-15 Brent Fulgham <bfulgham@apple.com>
[iOS] Permit access to 'platform-name'
https://bugs.webkit.org/show_bug.cgi?id=227032
<rdar://problem/79334360>
Reviewed by Per Arne Vollan.
Telemetry shows that some media code needs access to 'platform-name'. We allow this in the
WebContent process, but didn't include it in the GPU Process.
Make the WebContent and GPU Process consistent in this access. Also adopt the standard rule
for this used in the system sandbox, which restricts the access to the IOKit class family that
has this property.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-06-15 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Support transient zoom
https://bugs.webkit.org/show_bug.cgi?id=197002
Reviewed by Michael Catanzaro.
Speed up pinch zoom for AC mode. Reuse the same infrastructure as the
macOS implementation. Move the shared code to ViewGestureController.cpp
where possible.
Slightly adjust the shared code to support changing the gesture origin
during the gesture since we support it on both touchscreen and touchpad.
There's not much we can do for non-AC mode so just keep the current
behavior there, wrapping real-time zoom into transient zoom API so that
it's confined to the web process.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseZoomChanged):
(webkitWebViewBaseZoomEnd):
(webkitWebViewBaseConstructed):
(webkitWebViewBaseZoomBegin): Deleted.
* UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::adjustTransientZoom):
(WebKit::DrawingAreaProxyCoordinatedGraphics::commitTransientZoom):
* UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
* UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::scaledMagnificationOrigin):
Support changing origin during the gesture, cache the page scale factor
to accommodate non-AC mode doing real-time zooming instead of transient
zooming.
(WebKit::ViewGestureController::didCollectGeometryForMagnificationGesture):
(WebKit::ViewGestureController::prepareMagnificationGesture):
(WebKit::ViewGestureController::applyMagnification):
(WebKit::ViewGestureController::endMagnificationGesture):
(WebKit::ViewGestureController::magnification const):
Moved from ViewGestureControllerMac.mm.
* UIProcess/ViewGestureController.h:
* UIProcess/ViewGestureController.messages.in:
* UIProcess/WebPageProxy.h:
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::setMagnification):
(WebKit::ViewGestureController::endMagnification):
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::getCenterForZoomGesture): Deleted.
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::resistanceForDelta):
Make it a static private method instead of a function so that we can
keep using minMagnification and maxMagnification in it.
(WebKit::ViewGestureController::handleMagnificationGestureEvent):
(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
Set the initial scale and origin before calling scaledMagnificationOrigin().
(WebKit::resistanceForDelta): Deleted.
(WebKit::ViewGestureController::scaledMagnificationOrigin):
(WebKit::ViewGestureController::didCollectGeometryForMagnificationGesture):
(WebKit::ViewGestureController::endMagnificationGesture):
(WebKit::ViewGestureController::magnification const):
Moved to ViewGestureController.cpp.
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::flushPendingLayerChanges):
We only need to set the ApplyScrollingTreeLayerPositions flag when not
zooming, so add a parameter to do that.
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::adjustTransientZoom):
(WebKit::DrawingAreaCoordinatedGraphics::commitTransientZoom):
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::layerFlushTimerFired):
(WebKit::LayerTreeHost::forceRepaint):
Don't pass ApplyScrollingTreeLayerPositions when transient zoom is active.
(WebKit::LayerTreeHost::constrainTransientZoomOrigin const):
(WebKit::LayerTreeHost::layerForTransientZoom const):
(WebKit::LayerTreeHost::applyTransientZoomToLayers):
(WebKit::LayerTreeHost::adjustTransientZoom):
(WebKit::LayerTreeHost::commitTransientZoom):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::addTransactionCallbackID):
(WebKit::DrawingArea::commitTransientZoom):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
* WebProcess/WebPage/ViewGestureGeometryCollector.h:
* WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
Build CollectGeometryForMagnificationGesture for GTK as well.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::getCenterForZoomGesture): Deleted.
2021-06-15 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Harden WebAuthn process by restricting to browser-entitled processes
https://bugs.webkit.org/show_bug.cgi?id=226772
<rdar://problem/74721877>
Reviewed by Darin Adler.
We should ensure that any process attempting to launch the WebAuthn XPC service is entitled as a full web browser. We
should also ensure that the process requesting WebAuthn operations over WebKit CoreIPC is the WebContent process.
Tested by existing WebAuthn tests.
* Platform/Logging.h: Add WebAuthn category.
* Shared/Cocoa/DefaultWebBrowserChecks.mm:
(WebKit::isInWebKitChildProcess): Recognize 'com.apple.WebKit.WebAuthn' as a WebKit sub-process.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::hasCorrectPACEntitlement): Added.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getWebAuthnProcessConnection): Add a new MESSAGE_CHECK that the process requesting a WebAuthn
process connection is a WebContent process.
* UIProcess/WebProcessProxy.h:
* WebAuthnProcess/WebAuthnProcess.cpp:
(WebKit::WebAuthnProcess::platformInitializeWebAuthnProcess): Add some logging.
* WebAuthnProcess/WebAuthnProcess.h:
* WebAuthnProcess/ios/WebAuthnProcessIOS.mm:
(WebKit::WebAuthnProcess::platformInitializeWebAuthnProcess): Ensure that the application invoking the WebAuthn XPC service
is entitled as a default web browser.
* WebAuthnProcess/mac/WebAuthnProcessMac.mm:
(WebKit::WebAuthnProcess::platformInitializeWebAuthnProcess): Stub.
* WebProcess/WebProcess.cpp:
(WebKit::getWebAuthnProcessConnection):
(WebKit::WebProcess::ensureWebAuthnProcessConnection):
2021-06-15 Youenn Fablet <youenn@apple.com>
Caches::removeCacheEntry should check for m_storage
https://bugs.webkit.org/show_bug.cgi?id=227022
<rdar://79225216>
Reviewed by Antti Koivisto.
removeCacheEntry can be called asynchronoulsy in Cache::open for badly formatted content.
In that case, given this is done asynchronously, m_storage might be nullified.
Add a nullptr check to cope with this.
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::removeCacheEntry):
2021-06-15 Jonathan Bedard <jbedard@apple.com>
[iOS 15] Support building WebKit
https://bugs.webkit.org/show_bug.cgi?id=227002
<rdar://problem/79316598>
Reviewed by Tim Horton.
Covered by existing tests.
* Platform/spi/ios/UIKitSPI.h: Add _insertTextFromCamera.
2021-06-15 Eric Carlson <eric.carlson@apple.com>
[Mac] CoreMedia WrapperClass does not need alignment fixup
https://bugs.webkit.org/show_bug.cgi?id=226978
rdar://78864290
Reviewed by Geoffrey Garen and Dan Bernstein.
* Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
(WebKit::CoreMediaWrapped<Wrapped>::vTable): Don't add padding to WrapperClass,
it isn't necessary. static_assert CMBaseClass and WrapperClass alignment and
.version sizes.
2021-06-15 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] New snap containers always snap to the first scroll position
https://bugs.webkit.org/show_bug.cgi?id=226630
Reviewed by Simon Fraser.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Use invalidSnapOffsetIndex
instead of 0 to initialize the snap position.
2021-06-14 Alex Christensen <achristensen@webkit.org>
Pass PAL::SessionID by value instead of reference
https://bugs.webkit.org/show_bug.cgi?id=226983
Reviewed by Geoffrey Garen.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::newTestingSession):
(WebKit::NetworkProcess::ensureSession):
(WebKit::NetworkProcess::storageSession const):
(WebKit::NetworkProcess::findCacheEngine):
(WebKit::NetworkProcess::ensureCacheEngine):
(WebKit::NetworkProcess::removeCacheEngine):
(WebKit::NetworkProcess::flushCookies):
(WebKit::NetworkProcess::platformFlushCookies):
(WebKit::NetworkProcess::addWebPageNetworkParameters):
(WebKit::NetworkProcess::removeWebPageNetworkParameters):
(WebKit::NetworkProcess::countNonDefaultSessionSets):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::shouldLogCookieInformation):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/NetworkStorageSessionProvider.h:
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::makeUseDecision):
* NetworkProcess/cache/NetworkCache.h:
(WebKit::NetworkCache::Cache::sessionID const):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::flushCookies):
(WebKit::NetworkProcess::platformFlushCookies):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::flushCookies):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebProcessPool.h:
* WebProcess/Databases/WebDatabaseProvider.cpp:
(WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
* WebProcess/Databases/WebDatabaseProvider.h:
2021-06-14 Youenn Fablet <youenn@apple.com>
Accessing navigator.mediaDevices.enumerateDevices after granting permission
https://bugs.webkit.org/show_bug.cgi?id=226969
<rdar://problem/79286449>
Reviewed by Eric Carlson.
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::checkUsageDescriptionStringForType):
Check for NSCameraUsageDescription instead of NSMicrophoneUsageDescription for camera.
2021-06-14 Brent Fulgham <bfulgham@apple.com>
[iOS] Tighten the WebAuthn Sandbox
https://bugs.webkit.org/show_bug.cgi?id=226944
<rdar://problem/74721792>
Reviewed by Per Arne Vollan.
Revise the WebAuthn process sandbox to remove the many things originally copied from
the WebContent sandbox that are not needed.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
2021-06-14 Per Arne <pvollan@apple.com>
[iOS] Sync Accessibility preferences
https://bugs.webkit.org/show_bug.cgi?id=226738
<rdar://77922839>
Reviewed by Brent Fulgham.
Only attempt to modify Accessibility preferences if they have changed.
* Shared/AccessibilityPreferences.cpp: Replaced.
* Shared/AccessibilityPreferences.h: Replaced.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityPreferencesDidChange):
2021-06-13 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Quickboard UI for focused select elements should not allow the user to change the input language
https://bugs.webkit.org/show_bug.cgi?id=226958
Reviewed by Tim Horton.
Fix a couple of bugs around focused select element UI that were introduced in watchOS 7, due to changes in
PepperUICore. See below for details.
* UIProcess/ios/forms/WKQuickboardListViewController.mm:
(-[WKQuickboardListViewController initWithDelegate:]):
Drive-by fix: remove a `USE(APPLE_INTERNAL_SDK)` guard that was (seemingly) unintentionally added in r262854.
(-[WKQuickboardListViewController viewDidLoad]): Deleted.
Avoid hiding the list view controller's `-headerView` when focusing select elements. In watchOS 7, the accept
and cancel buttons are positioned inside the `-headerView`, so having this logic in the base class
(WKQuickboardListViewController) means that the Done button in select menus does not show up. In turn, this
means that currently, users who focus select elements must know to use the crown button to dismiss the select
menu.
For now, we move logic to the only other subclass of WKQuickboardListViewController,
WKTextInputListViewController. However, note that this too is going away in an upcoming patch that refactors
WKTextInputListViewController so that it directly subclasses PUICQuickboardMessageViewController
instead of PUICQuickboardListViewController.
* Platform/spi/watchos/PepperUICoreSPI.h:
Move a declaration of `-initWithDelegate:dictationMode:` from PUICDictationViewController to
PUICQuickboardListViewController (see the change in `-[WKQuickboardListViewController initWithDelegate:]` above).
* UIProcess/ios/forms/WKSelectMenuListViewController.mm:
(-[WKSelectMenuListViewController shouldShowLanguageButton]):
Since watchOS 7, the language button is now always shown by default in PUICQuickboardListViewController, with a
new subclassing hook to avoid showing it. It doesn't make sense to allow the user to change input languages when
choosing options in a select menu, so we implement this and always return `NO` here.
* UIProcess/ios/forms/WKTextInputListViewController.mm:
(-[WKTextInputListViewController viewDidLoad]):
2021-06-12 Wenson Hsieh <wenson_hsieh@apple.com>
Number pad button is missing its image when tapping on <input type=tel> in watchOS 8
https://bugs.webkit.org/show_bug.cgi?id=226955
Reviewed by Darin Adler.
After some recent PepperUICore changes, the Quickboard button for presenting the number pad when focusing a
telephone input on watchOS 8 is missing its icon image. To fix this, stop using deprecated SPI for creating
the list tray button, and instead use `+[PUICQuickboardListTrayButton buttonWithType:]` and `-setAction:` to
create and set up the button.
* Platform/spi/watchos/PepperUICoreSPI.h:
* UIProcess/ios/forms/WKTextInputListViewController.mm:
(-[WKTextInputListViewController additionalTrayButtons]):
2021-06-12 Peng Liu <peng.liu6@apple.com>
REGRESSION (r278374): [Big Sur] ASSERTION FAILED: !isInRoutingArbitrationForToken(token) in WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken()
https://bugs.webkit.org/show_bug.cgi?id=226787
Reviewed by Eric Carlson.
A WebContent process will resume a video element playback after the GPU process crashes
and restarts. During that process, the WebContent process will set category of the audio
session, and the UI process will be asked to begin routing arbitration with the new
category. However, the `SharedRoutingArbitrator` at the UI process will have stale
routing arbitrator tokens, which lead to the assertion failure.
To fix this issue, this patch cleans up the `SharedRoutingArbitrator` when the GPU
process crashes.
No new tests. Fix an API test:
- TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::gpuProcessExited):
2021-06-11 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r278754.
Caused 5 TestWebKitAPI.WKWebView.SnapshotImage* tests to time
out on iOS
Reverted changeset:
"takeSnapshotWithConfiguration() should wait for the next
flush before it does callSnapshotRect()"
https://bugs.webkit.org/show_bug.cgi?id=226257
https://commits.webkit.org/r278754
2021-06-11 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Clean up some VisionKitCore soft linking code in WebKit
https://bugs.webkit.org/show_bug.cgi?id=226941
Reviewed by Tim Horton.
Remove softlinking macros from several files in WebKit; instead, import and use the new PAL soft-linking helper
functions. Additionally, move a couple of staging forward declarations into the non-internal SDK section of the
VisionKitCore SPI header.
* Platform/cocoa/TextRecognitionUtilities.h:
* Platform/cocoa/TextRecognitionUtilities.mm:
(WebKit::isLiveTextEnabled):
(WebKit::isLiveTextAvailableAndEnabled):
Additionally replace `isLiveTextEnabled` with `isLiveTextAvailableAndEnabled`, and have it check for the
presence of the VisionKitCore framework in addition to whether the system feature flag is enabled (at least,
when building with the internal SDK).
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::ensureImageAnalyzer):
(WebKit::createImageAnalysisRequest):
(WebKit::WebViewImpl::requestTextRecognition):
(WebKit::WebViewImpl::computeHasVisualSearchResults):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpInteraction]):
(-[WKContentView actionSheetAssistant:shouldIncludeShowTextActionForElement:]):
(-[WKContentView actionSheetAssistant:shouldIncludeLookUpImageActionForElement:]):
(-[WKContentView imageAnalyzer]):
(-[WKContentView _setUpImageAnalysis]):
(-[WKContentView _tearDownImageAnalysis]):
(-[WKContentView createImageAnalysisRequest:image:imageURL:]):
(-[WKContentView imageAnalysisGestureDidBegin:]):
2021-06-11 Alex Christensen <achristensen@webkit.org>
Partition CrossOriginPreflightResultCache by SessionID
https://bugs.webkit.org/show_bug.cgi?id=226910
Reviewed by Youenn Fablet.
* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2021-06-11 Chris Dumez <cdumez@apple.com>
Enable more release logging in UIProcess/WebProcess for ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=226945
Reviewed by Geoffrey Garen.
Enable more release logging in UIProcess/WebProcess for ephemeral sessions, to facilitate
debugging.
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didClose):
(WebKit::WebProcessProxy::didFinishLaunching):
(WebKit::WebProcessProxy::fetchWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::WebProcessProxy::requestTermination):
* UIProcess/WebProcessProxy.h:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResource):
(WebKit::WebLoaderStrategy::scheduleLoad):
(WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
(WebKit::WebLoaderStrategy::networkProcessCrashed):
(WebKit::WebLoaderStrategy::loadDataURLSynchronously):
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
* WebProcess/Network/webrtc/WebRTCMonitor.cpp:
(WebKit::WebRTCMonitor::StartUpdating):
(WebKit::WebRTCMonitor::StopUpdating):
(WebKit::WebRTCMonitor::networksChanged):
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2021-06-11 Chris Dumez <cdumez@apple.com>
[WK2] Batch local storage database writes using transactions
https://bugs.webkit.org/show_bug.cgi?id=226938
Reviewed by Geoff Garen.
Batch local storage writes using transactions, to improve performance
and reduce disk writes. In this patch, we use a simple time-based
approach where we batch transactions happening in the same 500ms
period.
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase):
(WebKit::LocalStorageDatabase::startTransactionIfNecessary):
(WebKit::LocalStorageDatabase::removeItem):
(WebKit::LocalStorageDatabase::setItem):
(WebKit::LocalStorageDatabase::clear):
(WebKit::LocalStorageDatabase::close):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::ensureDatabase const):
2021-06-11 Alex Christensen <achristensen@webkit.org>
Don't include certificate info in WebURLSchemeTask::didReceiveResponse
https://bugs.webkit.org/show_bug.cgi?id=226939
<rdar://79178335>
Reviewed by Chris Dumez.
This call was introduced in r215384 but is unused since WKURLSchemeTask isn't used for HTTPS.
It is causing hangs sometimes, so let's drop it.
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didReceiveResponse):
2021-06-11 Jonathan Bedard <jbedard@apple.com>
[Monterey] Support building WebKit
https://bugs.webkit.org/show_bug.cgi?id=226846
<rdar://problem/79095148>
Reviewed by Tim Horton.
* Platform/cocoa/TextRecognitionUtilities.mm: Import VisionKitSPI.h.
* Platform/spi/Cocoa/VisionKitSPI.h: Added.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(setUpPageLoaderClient): Allow deprecated declarations.
(setUpPagePolicyClient): Ditto.
* UIProcess/API/Cocoa/WKConnection.mm:
(setUpClient): Allow deprecated declarations.
* UIProcess/API/Cocoa/WKProcessGroup.mm:
(setUpConnectionClient): Allow deprecated declarations.
(setUpInjectedBundleClient): Ditto.
(setUpHistoryClient): Ditto.
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]): Explicitly define second arugment
to avoid 'missing field' compilation error.
* UIProcess/Cocoa/WebViewImpl.mm: Import VisionKitSPI.h.
* UIProcess/ios/WKContentViewInteraction.mm: Ditto.
* WebKit.xcodeproj/project.pbxproj: Ditto.
2021-06-11 Chris Dumez <cdumez@apple.com>
Enable release logging in ephemeral sessions for parts of WebCore
https://bugs.webkit.org/show_bug.cgi?id=226929
Reviewed by Eric Carlson.
Enable release logging in ephemeral sessions for parts of WebCore, to facilitate debugging.
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest):
(WebKit::WebResourceLoader::didReceiveResponse):
(WebKit::WebResourceLoader::didReceiveData):
(WebKit::WebResourceLoader::didFinishResourceLoad):
(WebKit::WebResourceLoader::serviceWorkerDidNotHandle):
(WebKit::WebResourceLoader::didFailResourceLoad):
(WebKit::WebResourceLoader::didBlockAuthenticationChallenge):
(WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
(WebKit::WebResourceLoader::didReceiveResource):
* WebProcess/Network/WebResourceLoader.h:
2021-06-11 Chris Dumez <cdumez@apple.com>
Regression(r276653) We're going to disk more often for local storage operations
https://bugs.webkit.org/show_bug.cgi?id=226832
Reviewed by Darin Adler.
We're going to disk more often for local storage operations since r276653 because we no
longer keep items in memory. This results in a slightly increased power usage on one of
our benchmarks. As a first step to improve this, I am reintroducing a cache of the items
in memory, as long as the values are not too large (1Kb limit). We still go to disk to
look up values that are larger than 1Kb to avoid regressing memory usage.
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::openDatabase):
(WebKit::LocalStorageDatabase::items const):
(WebKit::LocalStorageDatabase::removeItem):
(WebKit::LocalStorageDatabase::item const):
(WebKit::LocalStorageDatabase::itemBypassingCache const):
(WebKit::LocalStorageDatabase::setItem):
(WebKit::LocalStorageDatabase::clear):
(WebKit::LocalStorageDatabase::close):
(WebKit::LocalStorageDatabase::databaseIsEmpty const):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
2021-06-11 Chris Dumez <cdumez@apple.com>
Enable WebProcess' release logging in ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=226927
Reviewed by Geoffrey Garen.
Enable WebProcess' release logging in ephemeral sessions, to faciliate debugging.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::networkProcessConnectionClosed):
(WebKit::WebProcess::prepareToSuspend):
(WebKit::WebProcess::markAllLayersVolatile):
(WebKit::WebProcess::cancelMarkAllLayersVolatile):
(WebKit::WebProcess::freezeAllLayerTrees):
(WebKit::WebProcess::unfreezeAllLayerTrees):
(WebKit::WebProcess::processDidResume):
(WebKit::WebProcess::grantUserMediaDeviceSandboxExtensions):
(WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::isAlwaysOnLoggingAllowed): Deleted.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::updateProcessName):
(WebKit::WebProcess::updateActivePages):
(WebKit::WebProcess::updateCPUMonitorState):
(WebKit::WebProcess::destroyRenderingResources):
(WebKit::WebProcess::updateFreezerStatus):
(WebKit::WebProcess::consumeAudioComponentRegistrations):
2021-06-11 Megan Gardner <megan_gardner@apple.com>
Rename AppHighlight group to QuickNote to correctly reflect feature.
https://bugs.webkit.org/show_bug.cgi?id=226888
Reviewed by Tim Horton.
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/API/c/WKContextMenuItemTypes.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
* UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
* UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _storeAppHighlight:]):
(-[WKWebView _addAppHighlightInNewGroup:originatedInApp:]):
(-[WKWebView _addAppHighlightInNewQuickNote:originatedInApp:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKAppHighlightDelegate.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createAppHighlightInSelectedRange):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView targetForAction:withSender:]):
(-[WKContentView setUpAppHighlightMenusIfNeeded]):
(-[WKContentView createHighlightForCurrentQuickNoteWithRange:]):
(-[WKContentView createHighlightForNewQuickNoteWithRange:]):
(-[WKContentView createHighlightInCurrentGroupWithRange:]): Deleted.
(-[WKContentView createHighlightInNewGroupWithRange:]): Deleted.
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::menuItemIdentifier):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::storeAppHighlight const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createAppHighlightInSelectedRange):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::highlightIsNewQuickNote const):
(WebKit::WebPage::highlightIsNewGroup const): Deleted.
* WebProcess/WebPage/WebPage.messages.in:
2021-06-11 Michael Catanzaro <mcatanzaro@gnome.org>
[GTK] Crash when dragging an account node above WebView
https://bugs.webkit.org/show_bug.cgi?id=226811
Reviewed by Adrian Perez de Castro.
When we receive empty drag data, this is indicated by length -1, not by 0.
* UIProcess/API/gtk/DropTargetGtk3.cpp:
(WebKit::DropTarget::dataReceived):
2021-06-11 Adrian Perez de Castro <aperez@igalia.com>
Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.33.2 release
* wpe/NEWS: Add release notes for 2.33.2.
2021-06-10 Said Abou-Hallawa <said@apple.com>
takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect()
https://bugs.webkit.org/show_bug.cgi?id=226257
<rdar://76411685>
Reviewed by Simon Fraser.
This will ensure the latest IOSurfaces are pushed to backboardd before
taking the snapshot.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2021-06-10 Chris Dumez <cdumez@apple.com>
Unreviewed macOS build fix.
Add some missing header includes.
* Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
* Shared/mac/MediaFormatReader/MediaSampleByteRange.h:
* Shared/mac/MediaFormatReader/MediaSampleCursor.h:
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
2021-06-10 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Can't open WebInspector UI since r277787
https://bugs.webkit.org/show_bug.cgi?id=226908
Reviewed by Don Olmstead.
r277787 (Bug 226001) changed the return type of
WebURLSchemeTask::request() from const WebCore::ResourceRequest&
to WebCore::ResourceRequest.
InspectorResourceURLSchemeHandler::platformStartTask shouldn't
hold the reference of the temporary object.
* UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.cpp:
(WebKit::InspectorResourceURLSchemeHandler::platformStartTask):
Changed the type of requestURL from auto& to auto to copy the URL.
2021-06-10 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Add a mechanism to regenerate text in an image element when it changes dimensions
https://bugs.webkit.org/show_bug.cgi?id=226858
rdar://77522786
Reviewed by Devin Rousso.
Push `m_elementsWithTextRecognitionResults` from `WebKit::WebPage` down to `WebCore::Page`. See WebCore
ChangeLog for more details.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::requestTextRecognition):
(WebKit::WebPage::updateWithTextRecognitionResult):
* WebProcess/WebPage/WebPage.h:
2021-06-10 Per Arne Vollan <pvollan@apple.com>
[iOS] Sync Accessibility preferences
https://bugs.webkit.org/show_bug.cgi?id=226738
<rdar://77922839>
Reviewed by Brent Fulgham.
Implement Per-App Accessibility preferences on iOS. The Per-App Accessibility preferences in the WebContent process
should reflect the values in the UI process. This is addressed by syncing the values between the two processes on
startup of the WebContent process, and when the values change.
* Platform/spi/Cocoa/AccessibilitySupportSPI.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::accessibilityPreferencesChangedCallback):
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::accessibilityPreferencesDidChange):
2021-06-10 Sihui Liu <sihui_liu@apple.com>
Regression(r278449): add null check for completionHandler in WebIDBServer::close
https://bugs.webkit.org/show_bug.cgi?id=226900
rdar://79160392
Reviewed by Chris Dumez.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::close):
2021-06-10 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Remote video layer should respect video gravity when resizing
https://bugs.webkit.org/show_bug.cgi?id=226784
Reviewed by Jer Noble.
Tested manually.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::prepareForPlayback): Pass specify video gravity
when creating remote layer.
(WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity): Remember gravity.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/VideoLayerRemote.h:
* WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.h:
* WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm:
(-[WKVideoLayerRemote videoGravity]):
(-[WKVideoLayerRemote setVideoGravity:]):
(-[WKVideoLayerRemote resizePreservingGravity]): Return true when in PiP, fullscreen,
or when video gravity is not "resize".
(-[WKVideoLayerRemote layoutSublayers]): Preserve aspect ration when appropriate.
(WebKit::createVideoLayerRemote):
2021-06-10 Alex Christensen <achristensen@webkit.org>
Move Timing-Allow-Origin checks to the network process
https://bugs.webkit.org/show_bug.cgi?id=226678
<rdar://problem/45227788>
Reviewed by Chris Dumez.
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::sendReplyToSynchronousRequest):
Pass complete metrics with sync xhr responses. Many of the tests use sync xhr.
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::didFailLoading):
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
2021-06-10 Alex Christensen <achristensen@webkit.org>
Origin is null in http requests when baseURL has custom scheme on iOS 15.0
https://bugs.webkit.org/show_bug.cgi?id=226760
Reviewed by Chris Dumez.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadData):
2021-06-10 Chris Fleizach <cfleizach@apple.com>
AX: TestWebKitAPI.WebKit.AccessibilityReduceMotion failing on iOS
https://bugs.webkit.org/show_bug.cgi?id=226758
<rdar://problem/78984253>
Reviewed by Alex Christensen.
For releases that don't have the accessibility update method, the direct setters need to be called
in order to update the cache.
* Platform/spi/Cocoa/AccessibilitySupportSPI.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::increaseContrastPreferenceKey):
(WebKit::setPreferenceValue):
2021-06-10 Aditya Keerthi <akeerthi@apple.com>
[iOS] VinylWall app crashes when tapping on 'format' dropdown menu in 'Add Record' menu
https://bugs.webkit.org/show_bug.cgi?id=226886
<rdar://problem/77207322>
Reviewed by Tim Horton.
The VinylWall app contains a WKWebView, and uses <select> to let users
choose options. With the new form controls on iOS, tapping on a <select>
presents a UIContextMenuInteraction, rather than a picker wheel or
popover. However, UIContextMenuInteraction is not supported on apps
linked against an SDK older than iOS 14, resulting in this crash.
To fix, perform a linked-on-or-after check before showing the new UI
for <select> and <input type=text> with a <datalist>. If the check
fails, fallback to the old UI. We already have this check in place for
other context menus in `-[WKContentView _shouldUseContextMenus]`, so we
reuse that method.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
(-[WKContentView _elementTypeRequiresAccessoryView:]):
(-[WKContentView _shouldUseContextMenusForFormControls]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(WebKit::WebDataListSuggestionsDropdownIOS::show):
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl initWithView:]):
2021-06-10 Tim Horton <timothy_horton@apple.com>
REGRESSION (r277820): Trackpad interaction in Web Content is not working on iOS or macCatalyst
https://bugs.webkit.org/show_bug.cgi?id=226892
<rdar://79080057>
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKMouseGestureRecognizer.h:
* UIProcess/ios/WKMouseGestureRecognizer.mm:
Stop inheriting from UIHoverGestureRecognizer; since r277820
removed our override of _shouldReceiveTouch, and the default implementation
always says NO, r277820 broke trackpad-origiating mouse events (but
left hover working, since that is not a touch).
2021-06-10 Chris Dumez <cdumez@apple.com>
Do some hardening in XPCServiceEventHandler()
https://bugs.webkit.org/show_bug.cgi?id=226860
<rdar://66837596>
Reviewed by Geoffrey Garen.
Do some hardening in XPCServiceEventHandler() to deal with unexpected values and add
some more logging as well.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* WebProcess/cocoa/HandleXPCEndpointMessages.h:
* WebProcess/cocoa/HandleXPCEndpointMessages.mm:
(WebKit::handleXPCEndpointMessages):
2021-06-10 Chris Dumez <cdumez@apple.com>
Enable WebPage's release logging in ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=226510
Reviewed by Eric Carlson.
Enable WebPage's release logging in ephemeral sessions. Our release logging doesn't contain
anything sensitive and not having this logging makes it hard to debug issues in apps using
ephemeral sessions.
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
* WebProcess/ApplePay/WebPaymentCoordinator.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
(WebKit::WebPage::close):
(WebKit::WebPage::freezeLayerTree):
(WebKit::WebPage::unfreezeLayerTree):
(WebKit::WebPage::layerVolatilityTimerFired):
(WebKit::WebPage::markLayersVolatile):
(WebKit::WebPage::cancelMarkLayersVolatile):
(WebKit::WebPage::touchEventSync):
(WebKit::WebPage::didReceivePolicyDecision):
(WebKit::WebPage::setIsTakingSnapshotsForApplicationSuspension):
(WebKit::WebPage::suspend):
(WebKit::WebPage::resume):
(WebKit::WebPage::runJavaScript):
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
(WebKit::WebPage::updatePreferences):
(WebKit::WebPage::registerURLSchemeHandler):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):
2021-06-10 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, early May 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=226763
Unreviewed non-unified build fixes.
* Shared/WebPageNetworkParameters.cpp: Add missing inclusion of the ArgumentCoders.h header.
2021-06-09 Megan Gardner <megan_gardner@apple.com>
Create SPI file for Synapse so external builds will work.
https://bugs.webkit.org/show_bug.cgi?id=226844
Reviewed by Tim Horton.
* Platform/spi/Cocoa/SynapseSPI.h: Added.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
* WebKit.xcodeproj/project.pbxproj:
2021-06-09 Michael Catanzaro <mcatanzaro@gnome.org>
[GTK] Duplicate WebKitWebView::show-option-menu confuses introspection, should use --warn-error when building gir
https://bugs.webkit.org/show_bug.cgi?id=222985
Reviewed by Adrian Perez de Castro.
WebKitWebView::show-option-menu has different parameters for GTK than it does for WPE. It
seems g-ir-scanner is taking the WPE documentation and merging it with the GTK parameters.
We can fix this by moving the introspection comment into platform-specific files.
Additionally, let's use --warn-error to turn warnings into errors to prevent this from ever
happening again, as we already do when generating introspection for JavaScriptCore.
* PlatformGTK.cmake:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_class_init):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(createShowOptionMenuSignal):
* UIProcess/API/wpe/WebKitWebViewWPE.cpp:
(createShowOptionMenuSignal):
2021-06-09 Peng Liu <peng.liu6@apple.com>
[iOS] UIDelegate::UIClient::fullscreenMayReturnToInline() is not called when a video exits fullscreen
https://bugs.webkit.org/show_bug.cgi?id=226785
Reviewed by Eric Carlson.
On iOS, `UIDelegate::UIClient::fullscreenMayReturnToInline()` is called when
a video exits picture-in-picture, but not when a video exits fullscreen.
This patch fixes that.
We cannot add a regression test for this patch before fixing webkit.org/b/212654.
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::exitFullscreen):
2021-06-09 Diego Pino Garcia <dpino@igalia.com>
[GTK] Do not depend on resources provided by the GNOME icon theme
https://bugs.webkit.org/show_bug.cgi?id=186767
Reviewed by Adrian Perez de Castro.
Covered by existing tests.
* PlatformGTK.cmake:
2021-06-09 Alexander Mikhaylenko <alexm@gnome.org>
[GTK4] Add support for navigation gestures
https://bugs.webkit.org/show_bug.cgi?id=212327
Reviewed by Michael Catanzaro.
Make ViewSnapshotStore store GdkTexture instead of Cairo surfaces
for GTK4. Split ViewSnapshotStoreGtk.cpp into GTK3 and GTK4 versions
since they don't have much in common.
When taking a view snapshot, render the web view into a texture.
When starting a navigation gesture, create a render node from
either the texture, or a fallback color, then render that instead
of using Cairo.
Implement the same dimming+shadow as in GTK3. This time don't bother
with CSS, the approach we used in GTK3 doesn't work anymore, and since
elements like scrollbars aren't themeable anyway it's not very important
to preserve that.
* SourcesGTK.txt:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseTakeViewSnapshot):
* UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
(WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
* UIProcess/ViewGestureController.h:
* UIProcess/ViewSnapshotStore.cpp:
(WebKit::ViewSnapshotStore::didAddImageToSnapshot):
(WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot):
* UIProcess/ViewSnapshotStore.h:
(WebKit::ViewSnapshot::estimatedImageSizeInBytes const):
(WebKit::ViewSnapshot::texture const):
(WebKit::ViewSnapshot::imageSizeInBytes const): Renamed to estimatedImageSizeInBytes().
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::snapshot):
(WebKit::ViewGestureController::removeSwipeSnapshot):
* UIProcess/gtk/ViewSnapshotStoreGtk3.cpp: Copied from Source/WebKit/UIProcess/gtk/ViewSnapshotStoreGtk.cpp.
(WebKit::ViewSnapshot::create):
(WebKit::ViewSnapshot::ViewSnapshot):
(WebKit::ViewSnapshot::hasImage const):
(WebKit::ViewSnapshot::clearImage):
(WebKit::ViewSnapshot::estimatedImageSizeInBytes const):
(WebKit::ViewSnapshot::size const):
* UIProcess/gtk/ViewSnapshotStoreGtk4.cpp: Renamed from Source/WebKit/UIProcess/gtk/ViewSnapshotStoreGtk.cpp.
(WebKit::ViewSnapshot::create):
(WebKit::ViewSnapshot::ViewSnapshot):
(WebKit::ViewSnapshot::hasImage const):
(WebKit::ViewSnapshot::clearImage):
(WebKit::ViewSnapshot::estimatedImageSizeInBytes const):
(WebKit::ViewSnapshot::size const):
2021-06-09 Chris Dumez <cdumez@apple.com>
Rely on SQLiteDatabase::setMaximumSize() for quota management in LocalStorageDatabase
https://bugs.webkit.org/show_bug.cgi?id=226788
Reviewed by Sihui Liu.
Rely on SQLiteDatabase::setMaximumSize() for quota management in LocalStorageDatabase.
It simplifies the code a bit.
No new test, covered by storage/domstorage/quota.html that is still passing.
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::openDatabase):
(WebKit::LocalStorageDatabase::removeItem):
(WebKit::LocalStorageDatabase::setItem):
(WebKit::LocalStorageDatabase::clear):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
2021-06-08 Alex Christensen <achristensen@webkit.org>
Move PrivacyStance code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=226774
Reviewed by Jer Noble.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(toPrivacyStance):
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2021-06-08 Sam Weinig <weinig@apple.com>
Adopt WTF::Span in SQLiteStatement
https://bugs.webkit.org/show_bug.cgi?id=226773
Reviewed by Alex Christensen.
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::addIcon):
Adopt new bindBlob() signature.
2021-06-08 Jean-Yves Avenard <jya@apple.com>
MediaPlayerPrivateRemote::didLoadingProgress should not send synchronous message to GPU process
https://bugs.webkit.org/show_bug.cgi?id=226761
rdar://78834312
Reviewed by Eric Carlson.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::didLoadingProgress): Forward call to the actual
proxied MediaPlayer.
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in: Make message async.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::didLoadingProgress const): This method should no
longer ever be called, but is required as it's pure-virtual.
(WebKit::MediaPlayerPrivateRemote::didLoadingProgressAsync const):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Add new didLoadingProgressAsync method.
2021-06-08 Megan Gardner <megan_gardner@apple.com>
Upstream AppHighlight Observer code
https://bugs.webkit.org/show_bug.cgi?id=226794
Reviewed by Tim Horton.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::appHighlightsVisibility):
(WebKit::WebPageProxy::setUpHighlightsObserver):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpAppHighlightMenusIfNeeded]):
2021-06-08 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Safari tab pill should toggle visibility when tapping on article text on adventure.com
https://bugs.webkit.org/show_bug.cgi?id=226775
rdar://78826820
Reviewed by Tim Horton and Devin Rousso.
Adjust the meaningful click heuristic to account for click event listeners added to the document node. See below
for more details.
Test: fast/events/ios/non-meaningful-click-when-tapping-document.html
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
(WebKit::isProbablyMeaningfulClick):
Remove a check for whether or not the clicked node is an Element; this existed because the call to
`rootViewBoundsForElement` below takes an Element rather than just a Node; however, this method doesn't do
anything that requires an Element instead of a Node, so we can just remove the check and refactor these static
methods to accept Nodes. This allows us to bail early if the clicked node is *either* the body or the document
node, instead of just the body.
(WebKit::WebPage::insertDroppedImagePlaceholders):
(WebKit::elementBoundsInFrame):
(WebKit::WebPage::rootViewBounds):
(WebKit::WebPage::absoluteInteractionBounds):
(WebKit::WebPage::rootViewInteractionBounds):
Drive-by refactoring: drop the `-ForElement` suffixes on these helper methods, and additionally make them accept
a Node instead of requiring an Element. This allows us to remove the `is<Element>()` check from the meaningful
click heuristic above.
Also deploy RefPtr in a few more places.
(WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
(WebKit::WebPage::focusedElementInformation):
(WebKit::WebPage::rootViewBoundsForElement): Deleted.
(WebKit::WebPage::absoluteInteractionBoundsForElement): Deleted.
(WebKit::WebPage::rootViewInteractionBoundsForElement): Deleted.
2021-06-08 Devin Rousso <drousso@apple.com>
[Payment Request] upstream new features
https://bugs.webkit.org/show_bug.cgi?id=226740
<rdar://problem/78963132>
Reviewed by Andy Estes.
- recurring line items (`HAVE_PASSKIT_RECURRING_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_RECURRING_LINE_ITEM`)
- deferred line items (`HAVE_PASSKIT_DEFERRED_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_DEFERRED_LINE_ITEM`)
- estimated shipping dates (`HAVE_PASSKIT_SHIPPING_METHOD_DATE_COMPONENTS_RANGE` and `ENABLE_APPLE_PAY_SHIPPING_METHOD_DATE_COMPONENTS_RANGE`)
- coupon code entry (`HAVE_PASSKIT_COUPON_CODE` and `ENABLE_APPLE_PAY_COUPON_CODE`)
- shipped vs in-store pickup (`HAVE_PASSKIT_SHIPPING_CONTACT_EDITING_MODE` and `ENABLE_APPLE_PAY_SHIPPING_CONTACT_EDITING_MODE`)
* Platform/cocoa/PaymentAuthorizationViewController.mm:
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didChangeCouponCode:handler:]): Added.
* Platform/ios/PaymentAuthorizationController.mm:
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didChangeCouponCode:handler:]): Added.
* Platform/cocoa/PaymentAuthorizationPresenter.h:
* Platform/cocoa/PaymentAuthorizationPresenter.mm:
(WebKit::toPKPaymentErrorCode):
(WebKit::PaymentAuthorizationPresenter::completeCouponCodeChange): Renamed from `WebKit::PaymentAuthorizationPresenter::completePaymentMethodModeChange`.
* Platform/cocoa/WKPaymentAuthorizationDelegate.h:
* Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
(-[WKPaymentAuthorizationDelegate completeCouponCodeChange:]): Added.
(toDateComponents): Added.
(toDateComponentsRange): Added.
(toShippingMethod):
(-[WKPaymentAuthorizationDelegate _didChangeCouponCode:completion:]): Added.
Add plumbing from/to PassKit for coupon code changes.
* Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
* Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::completeCouponCodeChange): Renamed from `WebKit::WebPaymentCoordinatorProxy::completePaymentMethodModeChange`.
(WebKit::WebPaymentCoordinatorProxy::presenterDidChangeCouponCode): Renamed from `WebKit::WebPaymentCoordinatorProxy::presenterDidChangePaymentMethodMode`.
(WebKit::WebPaymentCoordinatorProxy::canBegin const):
(WebKit::WebPaymentCoordinatorProxy::canCancel const):
(WebKit::WebPaymentCoordinatorProxy::canCompletePayment const):
(WebKit::WebPaymentCoordinatorProxy::canAbort const):
* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toNSDateComponents): Added.
(WebKit::toPKDateComponentsRange): Added.
(WebKit::toPKShippingMethod):
(WebKit::toPKShippingContactEditingMode): Added.
(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
(WebKit::WebPaymentCoordinatorProxy::platformCompleteCouponCodeChange): Renamed from `WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodModeChange`.
Convert PassKit objects to/from WebCore objects.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::ApplePaySessionPaymentRequest>::encode):
(IPC::ArgumentCoder<WebCore::ApplePaySessionPaymentRequest>::decode):
* WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
* WebProcess/ApplePay/WebPaymentCoordinator.h:
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::completeCouponCodeChange): Renamed from `WebKit::WebPaymentCoordinator::completePaymentMethodModeChange`.
(WebKit::WebPaymentCoordinator::didChangeCouponCode): Renamed from `WebKit::WebPaymentCoordinator::didChangePaymentMethodMode`.
Plumbing into/from WebCore.
2021-06-08 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r278609.
Broke builds with a linker error.
Reverted changeset:
"Update libwebrtc to M92"
https://bugs.webkit.org/show_bug.cgi?id=226494
https://commits.webkit.org/r278609
2021-06-08 Chris Dumez <cdumez@apple.com>
Reduce use of reinterpret_cast<> in the codebase
https://bugs.webkit.org/show_bug.cgi?id=226743
Reviewed by Darin Adler.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered):
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::addDataCue):
* GPUProcess/webrtc/RemoteMediaRecorder.cpp:
(WebKit::RemoteMediaRecorder::fetchData):
* NetworkProcess/cache/NetworkCacheDataCurl.cpp:
(WebKit::NetworkCache::Data::apply const):
* NetworkProcess/cache/NetworkCacheKey.cpp:
(WebKit::NetworkCache::hashString):
* NetworkProcess/soup/WebKitDirectoryInputStream.cpp:
(webkitDirectoryInputStreamRead):
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<CString>::encode):
(IPC::ArgumentCoder<String>::encode):
* Shared/API/c/cf/WKStringCF.mm:
(WKStringCopyCFString):
* Shared/API/c/cf/WKURLCF.mm:
(WKURLCopyCFURL):
* Shared/ShareableResource.cpp:
(WebKit::ShareableResource::wrapInSharedBuffer):
* Shared/SharedDisplayListHandle.h:
(WebKit::SharedDisplayListHandle::data const):
* Shared/WebCompiledContentRuleList.cpp:
(WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
* UIProcess/API/APIWebAuthenticationAssertionResponse.cpp:
(API::WebAuthenticationAssertionResponse::userHandle const):
* UIProcess/API/C/WKPage.cpp:
(dataFrom):
* UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm:
(WebKit::RedirectSOAuthorizationSession::completeInternal):
* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::sendWebInspectorEvent):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::createMessageQueue):
(WebKit::WebSocketChannel::didReceiveText):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
(WebKit::RTCDataChannelRemoteManager::sendData):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData):
* WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
(WebKit::NetscapePluginStream::sendJavaScriptStream):
2021-06-08 Devin Rousso <drousso@apple.com>
Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace`
https://bugs.webkit.org/show_bug.cgi?id=226756
Reviewed by Sam Weinig.
Don't wrap `PixelFormat` or `DestinationColorSpace` with `std::optional` as we want each
callsite to explicity configure them. This makes it easier to find where values for each
are used as there's no implicit behavior.
No behavior change. Followup after r278565.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSelectionSnapshot const):
2021-06-08 Jean-Yves Avenard <jya@apple.com>
[MSE] Rework handling of SourceBuffer's buffer full.
https://bugs.webkit.org/show_bug.cgi?id=226711
<rdar://problem/78937909>
Reviewed by Jer Noble.
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::evictCodedFrames):
(WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in: Remove capacity and
buffer full references from all methods; relying on the totalTrackBufferSizeInBytes
instead.
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::evictCodedFrames):
(WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
2021-06-08 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.2 release
* gtk/NEWS: Add release notes for 2.33.2.
2021-06-08 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Several timing tests failing since r278477
https://bugs.webkit.org/show_bug.cgi?id=226728
Reviewed by Michael Catanzaro.
responseBodyBytesReceived and responseBodyDecodedSize are expected to be always filled, and not only when
shouldCaptureExtraNetworkLoadMetrics() returns true.
Fixes: imported/w3c/web-platform-tests/navigation-timing/test_document_onload.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html
imported/w3c/web-platform-tests/resource-timing/cors-preflight.any.worker.html
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::createRequest):
2021-06-08 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r278391): [SOUP] Test fast/dom/webtiming.html is failing
https://bugs.webkit.org/show_bug.cgi?id=226726
Reviewed by Michael Catanzaro.
We need to set network metrics on response even for non HTTP loads now.
Fixes fast/dom/webtiming.html
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::resume):
(WebKit::NetworkDataTaskSoup::didSendRequest):
(WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
2021-06-07 Alex Christensen <achristensen@webkit.org>
Adopt SecTrustGetCertificateAtIndex replacement where available
https://bugs.webkit.org/show_bug.cgi?id=225893
Reviewed by Chris Dumez.
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::encodeNSError):
* UIProcess/Authentication/mac/WebCredentialMac.mm:
(WebKit::leafCertificate):
(WebKit::chain):
(WebKit::WebCredential::WebCredential):
2021-06-07 Alexey Shvayka <shvaikalesh@gmail.com>
Unreviewed, reland r276592 with a fix for put() override in prototype chain of a JSProxy
https://bugs.webkit.org/show_bug.cgi?id=226185
* WebProcess/Plugins/Netscape/JSNPObject.h:
2021-06-07 Wenson Hsieh <wenson_hsieh@apple.com>
Upstream WebKit support for Live Text
https://bugs.webkit.org/show_bug.cgi?id=226706
<rdar://problem/78933684>
Reviewed by Tim Horton.
See WebCore/ChangeLog for more details.
* Platform/cocoa/ImageExtractionUtilities.mm: Removed.
* Platform/cocoa/TextRecognitionUtilities.h: Renamed from Source/WebKit/Platform/cocoa/ImageExtractionUtilities.h.
* Platform/cocoa/TextRecognitionUtilities.mm: Added.
Rename ImageExtractionUtilities to TextRecognitionUtilities.
(WebKit::floatQuad):
(WebKit::floatQuads):
(WebKit::makeTextRecognitionResult):
(WebKit::isLiveTextEnabled):
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::TextRecognitionDataDetector>::encodePlatformData):
(IPC::ArgumentCoder<WebCore::TextRecognitionDataDetector>::decodePlatformData):
(IPC::ArgumentCoder<WebCore::ImageExtractionDataDetectorInfo>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<WebCore::ImageExtractionDataDetectorInfo>::decodePlatformData): Deleted.
* Shared/TextRecognitionUpdateResult.h: Renamed from Source/WebKit/Shared/ImageExtractionUpdateResult.h.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<TextRecognitionDataDetector>::encode):
(IPC::ArgumentCoder<TextRecognitionDataDetector>::decode):
(IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::encode): Deleted.
(IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/_WKElementAction.mm:
(+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
(+[_WKElementAction imageForElementActionType:]):
Note that we need to keep the _WKElementActionTypeRevealImage SPI symbol, to avoid breaking MobileMail.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuLookUpImage):
(WebKit::WebPageProxy::handleContextMenuRevealImage): Deleted.
Rename `handleContextMenuRevealImage` to `handleContextMenuLookUpImage`.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::ensureImageAnalyzer):
(WebKit::createImageAnalysisRequest):
(WebKit::WebViewImpl::requestTextRecognition):
(WebKit::WebViewImpl::computeHasVisualSearchResults):
Rename `computeCanRevealImage` to `computeHasVisualSearchResults`.
(WebKit::WebViewImpl::acceptsPreviewPanelControl):
* UIProcess/PageClient.h:
(WebKit::PageClient::requestTextRecognition):
(WebKit::PageClient::computeHasVisualSearchResults):
(WebKit::PageClient::requestImageExtraction): Deleted.
(WebKit::PageClient::computeCanRevealImage): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
(WebKit::WebPageProxy::requestTextRecognition):
(WebKit::WebPageProxy::computeHasVisualSearchResults):
(WebKit::WebPageProxy::updateWithTextRecognitionResult):
(WebKit::WebPageProxy::requestImageExtraction): Deleted.
(WebKit::WebPageProxy::computeCanRevealImage): Deleted.
(WebKit::WebPageProxy::updateWithImageExtractionResult): Deleted.
Rename `updateWithImageExtractionResult` to `updateWithTextRecognitionResult`.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestTextRecognition):
(WebKit::PageClientImpl::requestImageExtraction): Deleted.
Rename `requestImageExtraction` to `requestTextRecognition`.
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
(-[WKActionSheetAssistant defaultActionsForImageSheet:]):
(-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpInteraction]):
(-[WKContentView cleanUpInteraction]):
(-[WKContentView deferringGestures]):
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]):
(-[WKContentView gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]):
(-[WKContentView hasSelectablePositionAtPoint:]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView targetForAction:withSender:]):
(-[WKContentView _didStartProvisionalLoadForMainFrame]):
(-[WKContentView shouldDeferGestureDueToImageAnalysis:]):
(-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
(-[WKContentView _dragInteraction:prepareForSession:completion:]):
(-[WKContentView _endImageAnalysisGestureDeferral:]):
(-[WKContentView _doAfterPendingImageAnalysis:]):
(-[WKContentView _invokeAllActionsToPerformAfterPendingImageAnalysis:]):
(-[WKContentView presentVisualSearchPreviewControllerForImage:imageURL:title:imageBounds:appearanceActions:]):
(-[WKContentView previewController:frameForPreviewItem:inSourceView:]):
(-[WKContentView previewController:transitionImageForPreviewItem:contentRect:]):
(-[WKContentView previewControllerDidDismiss:]):
(-[WKContentView numberOfPreviewItemsInPreviewController:]):
(-[WKContentView previewController:previewItemAtIndex:]):
(-[WKContentView provideDataForItem:]):
(-[WKContentView actionSheetAssistant:shouldIncludeShowTextActionForElement:]):
(-[WKContentView actionSheetAssistant:showTextForImage:imageURL:title:imageBounds:]):
(-[WKContentView actionSheetAssistant:shouldIncludeLookUpImageActionForElement:]):
(-[WKContentView actionSheetAssistant:lookUpImage:imageURL:title:imageBounds:]):
(-[WKContentView imageAnalyzer]):
(-[WKContentView hasPendingImageAnalysisRequest]):
(-[WKContentView _setUpImageAnalysis]):
(-[WKContentView _tearDownImageAnalysis]):
(-[WKContentView _cancelImageAnalysis]):
(-[WKContentView createImageAnalysisRequest:image:imageURL:]):
(-[WKContentView createImageAnalysisRequest:image:]):
(-[WKContentView validateImageAnalysisRequestIdentifier:]):
(-[WKContentView requestTextRecognition:imageData:completionHandler:]):
(-[WKContentView imageAnalysisGestureDidBegin:]):
(-[WKContentView imageAnalysisGestureDidFail:]):
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
(-[WKContentView _insertTextFromCameraForWebView:]):
(-[WKContentView captureTextFromCameraForWebView:]):
(-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
(-[WKContentView continueContextMenuInteraction:]):
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
(-[WKContentView shouldDeferGestureDueToImageExtraction:]): Deleted.
(-[WKContentView _endImageExtractionGestureDeferral:]): Deleted.
(-[WKContentView _doAfterPendingImageExtraction:]): Deleted.
(-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction:]): Deleted.
* UIProcess/ios/WKImageAnalysisGestureRecognizer.h: Renamed from Source/WebKit/UIProcess/ios/WKImageExtractionGestureRecognizer.h.
* UIProcess/ios/WKImageAnalysisGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKImageExtractionGestureRecognizer.mm.
(-[WKImageAnalysisGestureRecognizer initWithImageAnalysisGestureDelegate:]):
(-[WKImageAnalysisGestureRecognizer setState:]):
Rename WKImageExtractionGestureRecognizer to WKImageAnalysisGestureRecognizer (along with all adjacent classes).
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::requestTextRecognition):
(WebKit::PageClientImpl::computeHasVisualSearchResults):
(WebKit::PageClientImpl::requestImageExtraction): Deleted.
(WebKit::PageClientImpl::computeCanRevealImage): Deleted.
* UIProcess/mac/WKVisualSearchPreviewController.h: Renamed from Source/WebKit/UIProcess/mac/WKImageExtractionPreviewController.h.
* UIProcess/mac/WKVisualSearchPreviewController.mm: Renamed from Source/WebKit/UIProcess/mac/WKImageExtractionPreviewController.mm.
(-[WKVisualSearchPreviewController initWithPage:imageData:title:imageURL:]):
(-[WKVisualSearchPreviewController beginControl:]):
(-[WKVisualSearchPreviewController endControl:]):
(-[WKVisualSearchPreviewController closePanelIfNecessary]):
(-[WKVisualSearchPreviewController isControlling:]):
(-[WKVisualSearchPreviewController provideDataForItem:]):
(-[WKVisualSearchPreviewController numberOfPreviewItemsInPreviewPanel:]):
(-[WKVisualSearchPreviewController previewPanel:previewItemAtIndex:]):
(-[WKVisualSearchPreviewController previewPanel:initialActivityForItem:]):
Rename `WKImageExtractionPreviewController` to `WKVisualSearchPreviewController`.
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::menuItemIdentifier):
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::beginPreviewPanelControl):
(WebKit::WebPageProxy::endPreviewPanelControl):
(WebKit::WebPageProxy::closeSharedPreviewPanelIfNecessary):
(WebKit::WebPageProxy::showImageInVisualSearchPreviewPanel):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::requestTextRecognition):
(WebKit::WebChromeClient::requestImageExtraction): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::requestTextRecognition):
(WebKit::WebPage::updateWithTextRecognitionResult):
(WebKit::WebPage::requestImageExtraction): Deleted.
(WebKit::WebPage::updateWithImageExtractionResult): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-06-07 Devin Rousso <drousso@apple.com>
Convert WebCore::SnapshotOptions into an enum class
https://bugs.webkit.org/show_bug.cgi?id=226730
Reviewed by Wenson Hsieh.
Convert `SnapshotOptions` into an `enum class SnapshotFlags` and create a container `struct
SnapshotOptions` that also allows for changing the `DestinationColorSpace` (defaults to sRGB)
and `PixelFormat` (defaults to BGRA8).
No behavior change.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSelectionSnapshot const):
2021-06-07 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Find-in-page should match text inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=226704
Reviewed by Tim Horton.
Add the `PaintAllContent` and `PaintBackgrounds` text indicator options when generating a TextIndicator for
selected content inside an image overlay. See WebCore/ChangeLog for more details.
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindIndicator):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::findTextIndicatorOptions):
(WebKit::FindIndicatorOverlayClientIOS::drawRect):
(WebKit::FindController::updateFindIndicator):
2021-06-07 Aditya Keerthi <akeerthi@apple.com>
[iOS] Unexpected scrolling when switching focus from a text input to a select element
https://bugs.webkit.org/show_bug.cgi?id=226657
<rdar://problem/78290515>
Reviewed by Tim Horton.
When switching focus from a text input to a select element, UIKit makes
deferred calls to `-[WKWebView inputView]` after the keyboard dismissal.
This method calls `-[WKContentView inputViewForWebView]`, which calls
`-[WKContentView _zoomToRevealFocusedElement]`. Consequently, these
methods can get invoked while the context menu (dropdown) is displayed
for a focused select element.
In this instance, the call should be idempotent, since the focused element
is fully visible in the viewport. However, since the context menu is visible
and overlaps the element, our logic incorrectly determines that the element
is obscured, leading to unexpected zooming/scrolling. To fix, we need to
correct the logic that determines the visible portion of the view.
Test: fast/forms/ios/form-control-refresh/select/focus-select-after-textfield.html
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
Always use the window to determine the portion of the webview that is
visible, rather than relying on the root view controller's top-most
full-screen view controller's view.
The old logic worked fine in most cases, since the root view controller
and the top-most full-screen view controller are almost always the same.
Furthermore, the root view controller's view usually takes up the entire
window.
However, when the context menu is on screen, the top-most full-screen
view controller is an internal UIKit view controller
(_UIContextMenuActionsOnlyViewController), and the associated view
is the context menu view. This exposed a flaw in the existing logic, as
visibility detection could be performed by intersecting with an
incorrect view. In general, the top-most full-screen view is not a
reliable way to determine the visible portion of the webview.
2021-06-07 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Signal "window-object-cleared" not emitted unless frame js context is get before
https://bugs.webkit.org/show_bug.cgi?id=221771
Reviewed by Michael Catanzaro.
This is because when FrameLoader::dispatchDidClearWindowObjectInWorld() is called, the JSWindowProxy for the
world hasn't been created yet, so it returns early. But we want to dispatch it always for worlds created by the
API, to ensure that WebKitScriptWorld::window-object-cleared is emmitted.
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Implement globalObjectIsAvailableForFrame() to force the
creation of the JavaScript context for existing WebKitScriptWorlds.
2021-06-06 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277464.
https://bugs.webkit.org/show_bug.cgi?id=226709
No longer necessary
Reverted changeset:
"Work around WebCore failing to build due to NDEBUG getting
undefined in release"
https://bugs.webkit.org/show_bug.cgi?id=225782
https://trac.webkit.org/changeset/277464
2021-06-06 Wenson Hsieh <wenson_hsieh@apple.com>
Turn TextIteratorBehaviorFlag into an enum class and wrap it in OptionSet
https://bugs.webkit.org/show_bug.cgi?id=226691
Reviewed by Darin Adler.
See WebCore/ChangeLog for more information.
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::plainTextForDisplay):
(WebKit::rangeNearPositionMatchesText):
2021-06-06 Jean-Yves Avenard <jya@apple.com>
[GPUP][MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize
https://bugs.webkit.org/show_bug.cgi?id=226034
rdar://78579904
Reviewed by Eric Carlson.
Cache the size of the remote source buffer's track size. We pass an extra
totalTrackBufferSizeInBytes argument to each method that could impact
a source buffer size.
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete):
(WebKit::RemoteSourceBufferProxy::removeCodedFrames):
(WebKit::RemoteSourceBufferProxy::evictCodedFrames):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::abort): Add comment explaining on why
getting an up to date totalTrackBufferSizeInBytes isn't necessary at this point.
(WebKit::SourceBufferPrivateRemote::removeCodedFrames):
(WebKit::SourceBufferPrivateRemote::evictCodedFrames):
(WebKit::SourceBufferPrivateRemote::clearTrackBuffers):
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete):
(WebKit::SourceBufferPrivateRemote::totalTrackBufferSizeInBytes const):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:
2021-06-06 David Kilzer <ddkilzer@apple.com>
Weak external symbols found in WebKit.framework with Release+Coverage configuration
<https://webkit.org/b/226668>
<rdar://problem/78890081>
Reviewed by Darin Adler.
* Configurations/WebKit.xcconfig:
(UNEXPORTED_SYMBOL_LDFLAGS):
- Remove std::function<> symbols as those were replaced
by WTF::Function<> a while ago.
* Shared/Cocoa/DefaultWebBrowserChecks.mm:
(WebKit::determineITPStateInternal):
(WebKit::doesParentProcessHaveITPEnabled):
- Switch to use TCCSoftLink.h.
* Shared/Cocoa/TCCSoftLink.h: Add.
* Shared/Cocoa/TCCSoftLink.mm: Add.
- Implement a single place for soft-linking to
TCC.framework.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getProcessIdentifier):
- Change ProcessIdentifier to WebCore::ProcessIdentifier
to fix the build since this source file no longer gets
`using namespace WebCore;` from another source file
after changes to SourcesCocoa.txt.
* SourcesCocoa.txt:
- Add DefaultWebBrowserChecks.mm since it no longer
contains any SOFT_LINK macros.
- Add new TCCSoftLink.mm file.
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::checkUsageDescriptionStringForType):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::isAXAuthenticated):
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
(-[WKActionSheetAssistant defaultActionsForImageSheet:]):
- Switch to use TCCSoftLink.h.
* WebKit.xcodeproj/project.pbxproj:
- Add TCCSoftLink.{h,mm} to the project.
- Remove DefaultWebBrowserChecks.mm from the
WebKit.framework target after adding it to
SourcesCocoa.txt.
2021-06-05 Chris Dumez <cdumez@apple.com>
Use `const uint8_t*` type more consistently to store bytes in WebKit
https://bugs.webkit.org/show_bug.cgi?id=226688
Reviewed by Darin Adler.
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::parseWebVTTCueData):
* GPUProcess/media/RemoteTextTrackProxy.h:
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::parseWebVTTCueData):
2021-06-05 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Dictionary lookup highlights in image overlays should include background content
https://bugs.webkit.org/show_bug.cgi?id=226686
Reviewed by Tim Horton.
Make a few minor adjustments to text indicator options on macOS when triggering Look Up.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::dictionaryPopupInfoForRange):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
Add both `PaintAllContent` and `PaintBackgrounds` options when creating text indicators, in the case where the
indicated range is inside an image overlay.
2021-06-05 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
https://bugs.webkit.org/show_bug.cgi?id=226669
Reviewed by Sam Weinig.
Adopt the new PAL softlinking header in a few places. See WebCore/ChangeLog for more details. Additionally, move
several softlinking header imports so that they're the last imported headers in a few sources.
* Platform/mac/MenuUtilities.mm:
(WebKit::actionForMenuItem):
(WebKit::menuItemForTelephoneNumber):
* Shared/Cocoa/DataDetectionResult.mm:
(WebKit::DataDetectionResult::decode):
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::decode):
* Shared/mac/WebHitTestResultData.mm:
(WebKit::WebHitTestResultData::platformDecode):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WKImmediateActionController _animationControllerForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):
2021-06-04 Chris Dumez <cdumez@apple.com>
Optimize a few call sites creating SharedBuffer objects
https://bugs.webkit.org/show_bug.cgi?id=226674
Reviewed by Darin Adler.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadDataInFrame):
(WebKit::WebPage::loadData):
(WebKit::WebPage::loadAlternateHTML):
(WebKit::WebPage::loadSimulatedRequestAndResponse):
2021-06-04 Chris Dumez <cdumez@apple.com>
FileSystem::readFromFile() should return data as `void*`
https://bugs.webkit.org/show_bug.cgi?id=226671
Reviewed by Darin Adler.
FileSystem::readFromFile() should return data as `void*` instead of `char*`. This is more flexible and
consistent with FileSystem::writeToFile().
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::read):
* Shared/PersistencyUtils.cpp:
(WebKit::createForFile):
2021-06-04 Alex Christensen <achristensen@webkit.org>
REGRESSION(r275765) When ignoring HSTS, sometimes loads fail
https://bugs.webkit.org/show_bug.cgi?id=226670
<rdar://problem/78066692>
Reviewed by Chris Dumez.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(setIgnoreHSTS):
Use the value passed in to the function instead of always false.
2021-06-04 Chris Dumez <cdumez@apple.com>
Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=226623
Reviewed by Darin Adler.
Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer. Also have SharedBuffer::data()
return a `const uint8_t*` instead of `const char*`. This is our preferred type to store bytes.
* Platform/IPC/SharedBufferCopy.h:
(IPC::SharedBufferCopy::data const):
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::streamDidReceiveData):
(WebKit::PluginControllerProxy::manualStreamDidReceiveData):
* Shared/PersistencyUtils.cpp:
(WebKit::writeToDisk):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::tryConvertToShareableResourceHandle):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didComplete):
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveData):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::createMessageQueue):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
(WebKit::RTCDataChannelRemoteManager::sendData):
(WebKit::RTCDataChannelRemoteManager::receiveData):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveRawData):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h:
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::parsePostBuffer):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::streamDidReceiveData):
(WebKit::NetscapePlugin::manualStreamDidReceiveData):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
(WebKit::NetscapePluginStream::didReceiveData):
(WebKit::NetscapePluginStream::sendJavaScriptStream):
(WebKit::NetscapePluginStream::deliverData):
(WebKit::NetscapePluginStream::deliverDataToFile):
* WebProcess/Plugins/Netscape/NetscapePluginStream.h:
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveData):
(WebKit::PDFPlugin::streamDidReceiveData):
(WebKit::PDFPlugin::manualStreamDidReceiveData):
* WebProcess/Plugins/Plugin.h:
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::streamDidReceiveData):
(WebKit::PluginProxy::manualStreamDidReceiveData):
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::Stream::didReceiveData):
(WebKit::PluginView::manualLoadDidReceiveData):
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::committedLoad):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::bufferForType):
2021-06-04 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Meaningful click heuristic should account for media state changes
https://bugs.webkit.org/show_bug.cgi?id=226655
rdar://78330664
Reviewed by Tim Horton and Devin Rousso.
Teach the "meaningful click" heuristic about changes to media element state flags. See comments below for more
details.
Test: fast/events/ios/meaningful-click-when-playing-media.html
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::isPlayingMediaDidChange):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::isPlayingMediaDidChange):
Refactor some logic here so that the WebChromeClient calls into WebPage, which then sends an IPC message to the
UI process and additionally calls into a private method for platform-specific logic (see WebPageIOS.mm).
* WebProcess/WebPage/WebPage.h:
Replace `m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick` with another flag,
`m_currentSyntheticClickMayNotBeMeaningful`, that is initially set to `true` at the beginning of
`WebPage::completeSyntheticClick`, and consulted after the events have been dispatched to see if anything has
set it to `false` (currently, this includes only playing media state changes and handled click events by the
page). If the flag is set to `false`, we then consider the click to have been "meaningful", with respect to the
`-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` UI delegate method.
(WebKit::WebPage::platformIsPlayingMediaDidChange):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent):
(WebKit::WebPage::platformIsPlayingMediaDidChange):
Make these set `m_currentSyntheticClickMayNotBeMeaningful` to `false`.
2021-06-04 Ryosuke Niwa <rniwa@webkit.org>
Store MediaPlayer using WeakPtr in MediaPlayerPrivateRemote
https://bugs.webkit.org/show_bug.cgi?id=224421
Unreviewed. Address Darin's post commit commnet.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::load):
(WebKit::MediaPlayerPrivateRemote::networkStateChanged):
(WebKit::MediaPlayerPrivateRemote::setReadyState):
(WebKit::MediaPlayerPrivateRemote::readyStateChanged):
(WebKit::MediaPlayerPrivateRemote::volumeChanged):
(WebKit::MediaPlayerPrivateRemote::muteChanged):
(WebKit::MediaPlayerPrivateRemote::timeChanged):
(WebKit::MediaPlayerPrivateRemote::durationChanged):
(WebKit::MediaPlayerPrivateRemote::rateChanged):
(WebKit::MediaPlayerPrivateRemote::playbackStateChanged):
(WebKit::MediaPlayerPrivateRemote::engineFailedToLoad):
(WebKit::MediaPlayerPrivateRemote::characteristicChanged):
(WebKit::MediaPlayerPrivateRemote::sizeChanged):
(WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable):
(WebKit::MediaPlayerPrivateRemote::renderingModeChanged):
(WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
(WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::removeRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack):
(WebKit::MediaPlayerPrivateRemote::removeRemoteTextTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack):
(WebKit::MediaPlayerPrivateRemote::removeRemoteVideoTrack):
(WebKit::MediaPlayerPrivateRemote::currentPlaybackTargetIsWirelessChanged):
(WebKit::MediaPlayerPrivateRemote::mediaPlayerKeyNeeded):
(WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged):
(WebKit::MediaPlayerPrivateRemote::initializationDataEncountered):
(WebKit::MediaPlayerPrivateRemote::resourceNotSupported):
(WebKit::MediaPlayerPrivateRemote::activeSourceBuffersChanged):
(WebKit::MediaPlayerPrivateRemote::getRawCookies const):
2021-06-04 Chris Dumez <cdumez@apple.com>
Flaky crash under UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy() on the bots
https://bugs.webkit.org/show_bug.cgi?id=226653
Reviewed by Eric Carlson.
The SourceProxy destructor was taking care of calling invalidate() on the SharedRingBufferStorage
before destroying the CARingBuffer on the main thread, to avoid having SourceProxy::storageChanged()
called in the middle of destruction. However, the background thread may still be running at this
point and may reconstruct the RingBuffer right after the invalidate call, causing us to crash
because storageChanged() still gets called in the middle on destruction.
To address the issue, we now make sure to stop the rendering thread before we proceed with the
destruction and invalidate the SharedRingBufferStorage's storage change handler.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy):
2021-06-04 Ryosuke Niwa <rniwa@webkit.org>
Store MediaPlayer using WeakPtr in MediaPlayerPrivateRemote
https://bugs.webkit.org/show_bug.cgi?id=224421
Reviewed by Eric Carlson.
Made MediaPlayerPrivateRemote::m_player a WeakPtr.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
(WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
(WebKit::MediaPlayerPrivateRemote::load):
(WebKit::MediaPlayerPrivateRemote::networkStateChanged):
(WebKit::MediaPlayerPrivateRemote::setReadyState):
(WebKit::MediaPlayerPrivateRemote::readyStateChanged):
(WebKit::MediaPlayerPrivateRemote::volumeChanged):
(WebKit::MediaPlayerPrivateRemote::muteChanged):
(WebKit::MediaPlayerPrivateRemote::timeChanged):
(WebKit::MediaPlayerPrivateRemote::durationChanged):
(WebKit::MediaPlayerPrivateRemote::rateChanged):
(WebKit::MediaPlayerPrivateRemote::playbackStateChanged):
(WebKit::MediaPlayerPrivateRemote::engineFailedToLoad):
(WebKit::MediaPlayerPrivateRemote::characteristicChanged):
(WebKit::MediaPlayerPrivateRemote::sizeChanged):
(WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable):
(WebKit::MediaPlayerPrivateRemote::renderingModeChanged):
(WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
(WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::removeRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack):
(WebKit::MediaPlayerPrivateRemote::removeRemoteTextTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack):
(WebKit::MediaPlayerPrivateRemote::removeRemoteVideoTrack):
(WebKit::MediaPlayerPrivateRemote::currentPlaybackTargetIsWirelessChanged):
(WebKit::MediaPlayerPrivateRemote::mediaPlayerKeyNeeded):
(WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged):
(WebKit::MediaPlayerPrivateRemote::initializationDataEncountered):
(WebKit::MediaPlayerPrivateRemote::resourceNotSupported):
(WebKit::MediaPlayerPrivateRemote::activeSourceBuffersChanged):
(WebKit::MediaPlayerPrivateRemote::getRawCookies const):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
2021-06-04 Wenson Hsieh <wenson_hsieh@apple.com>
Remove the unused `sourceElementID` argument in `Document::updateIsPlayingMedia` and related code
https://bugs.webkit.org/show_bug.cgi?id=226650
Reviewed by Chris Dumez.
Remove more unused code. See WebCore/ChangeLog for more details.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isPlayingMediaDidChange):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::isPlayingMediaDidChange):
* WebProcess/WebCoreSupport/WebChromeClient.h:
2021-06-04 Alex Christensen <achristensen@webkit.org>
Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
https://bugs.webkit.org/show_bug.cgi?id=226629
Reviewed by Brady Eidson.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2021-06-04 Alex Christensen <achristensen@webkit.org>
Make attributedBundleIdendifier a property for WKWebViewConfiguration instead of _WKWebsiteDataStoreConfiguration
https://bugs.webkit.org/show_bug.cgi?id=226548
<rdar://78737547>
Reviewed by Brady Eidson.
We have been putting properties to go into the NSURLSessionConfiguration on the _WKWebsiteDataStoreConfiguration.
This has been ok so far, but now we have an application that needs to run networking attributed to different applications
but sharing the data storage in the same process. We now do what we should've done long ago: put these non-storage-related
properties on the WKWebViewConfiguration.
I introduce WebPageNetworkParameters which currently has only one member, but will soon have more.
I made it so that if multiple WKWebViews with the same data store have the same attributedBundleIdendifier, they share an NSURLSession.
Otherwise, they get their own NSURLSession in a different SessionSet.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::addWebPageNetworkParameters):
(WebKit::NetworkProcess::removeWebPageNetworkParameters):
(WebKit::NetworkProcess::countNonDefaultSessionSets):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::addWebPageNetworkParameters):
(WebKit::NetworkSession::removeWebPageNetworkParameters):
(WebKit::NetworkSession::countNonDefaultSessionSets const):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
(WebKit::NetworkSessionCocoa::initializeNSURLSessionsInSet):
(WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded):
(WebKit::NetworkSessionCocoa::addWebPageNetworkParameters):
(WebKit::NetworkSessionCocoa::removeWebPageNetworkParameters):
(WebKit::NetworkSessionCocoa::countNonDefaultSessionSets const):
(WebKit::NetworkSessionCocoa::attributedBundleIdentifier const): Deleted.
(WebKit::NetworkSessionCocoa::initializeStandardSessionsInSet): Deleted.
* Shared/WebPageNetworkParameters.cpp: Added.
(WebKit::WebPageNetworkParameters::encode const):
(WebKit::WebPageNetworkParameters::decode):
* Shared/WebPageNetworkParameters.h: Added.
(WebKit::WebPageNetworkParameters::WebPageNetworkParameters):
(WebKit::WebPageNetworkParameters::isHashTableDeletedValue const):
(WebKit::WebPageNetworkParameters::hash const):
(WebKit::WebPageNetworkParameters::operator== const):
(WebKit::WebPageNetworkParameters::attributedBundleIdentifier const):
(WTF::DefaultHash<WebKit::WebPageNetworkParameters>::hash):
(WTF::DefaultHash<WebKit::WebPageNetworkParameters>::equal):
* Sources.txt:
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::setAttributedBundleIdentifier):
(API::PageConfiguration::attributedBundleIdentifier const):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setAttributedBundleIdentifier:]):
(-[WKWebViewConfiguration _attributedBundleIdentifier]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _countNonDefaultSessionSets:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration setAttributedBundleIdentifier:]): Deleted.
(-[_WKWebsiteDataStoreConfiguration attributedBundleIdentifier]): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::~WebPageProxy):
(WebKit::WebPageProxy::initializeWebPage):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::countNonDefaultSessionSets):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::setSourceApplicationSecondaryIdentifier):
(WebKit::WebsiteDataStoreConfiguration::attributedBundleIdentifier const): Deleted.
(WebKit::WebsiteDataStoreConfiguration::setAttributedBundleIdentifier): Deleted.
* WebKit.xcodeproj/project.pbxproj:
2021-06-04 Chris Dumez <cdumez@apple.com>
Avoid wasteful large allocation in SpeechRecognitionRemoteRealtimeMediaSource::setStorage()
https://bugs.webkit.org/show_bug.cgi?id=226644
Reviewed by Eric Carlson.
Avoid wasteful large allocation in SpeechRecognitionRemoteRealtimeMediaSource::setStorage().
setStorage() was setting m_buffer's size to the same size as the RingBuffer (2*sampleRate),
only to resize it to the size of the rendering quantum (512) later in
SpeechRecognitionRemoteRealtimeMediaSource::remoteAudioSamplesAvailable().
* UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp:
(WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage):
2021-06-04 Alex Christensen <achristensen@webkit.org>
Pass NetworkLoadParameters to NetworkDataTaskCocoa constructor
https://bugs.webkit.org/show_bug.cgi?id=226628
Reviewed by Sam Weinig.
No change in behavior. Just pass a parameters object instead of splitting them into separate parameters.
* NetworkProcess/NetworkActivityTracker.h:
(WebKit::NetworkActivityTracker::getPlatformObject const):
(WebKit::NetworkActivityTracker::getPlatformObject): Deleted.
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(WebKit::NetworkDataTaskCocoa::didReceiveResponse):
2021-06-04 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Long pressing images on 9gag.com fails to present context menus
https://bugs.webkit.org/show_bug.cgi?id=226625
rdar://78136095
Reviewed by Megan Gardner.
Make some small adjustments to context menu logic to allow the context menu to appear when long pressing images
that are inside links (anchor elements) with JavaScript URLs. See below for more details.
Test: fast/events/touch/ios/long-press-on-image-in-javascript-link.html
* UIProcess/ios/WKActionSheetAssistant.mm:
(isJavaScriptURL):
Pull logic that checks for "javascript" URL schemes into a separate helper function, and use it below.
(-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]):
(-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
(-[WKActionSheetAssistant defaultActionsForImageSheet:]):
Add `_WKElementActionTypeCopy` for image sheets, even when the target URL is a JavaScript URL; even if the image
is inside a JavaScript URL, we should be capable of triggering the "Copy" action by copying the image data and
the image URL, rather than the JavaScript URL. The change in `WebPage::performActionOnElement` below ensures
that we don't end up copying the JavaScript URL.
(-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
Make another minor adjustment to share the imageURL instead of the target URL in the case where the target is a
JavaScript URL.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]):
Avoid bailing early with `continueWithContextMenuConfiguration(nil);` in the case where we're long pressing an
image inside a JavaScript link.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::performActionOnElement):
Push the JavaScript URL check in `defaultActionsForImageSheet` down into `WebPage::performActionOnElement`, when
copying an image. This tweak allows us to still show the Copy action for images in JavaScript URLs, but just
copy the image and image URL instead of the JavaScript URL.
2021-06-04 Michael Catanzaro <mcatanzaro@gnome.org>
Fix more GCC warnings
https://bugs.webkit.org/show_bug.cgi?id=226193
Reviewed by Adrian Perez de Castro.
Remove redundant WTFMove that's triggering GCC's -Wredundant-move.
* Platform/IPC/ArgumentCoder.h:
(IPC::ArgumentCoder::decode):
2021-06-04 Jan-Michael Brummer <jan.brummer@tabos.org>
[GTK][WPE] Expose setCORSDisablingPatterns
https://bugs.webkit.org/show_bug.cgi?id=219995
Reviewed by Carlos Garcia Campos.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_set_cors_allowlist):
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebView.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2021-06-03 Sihui Liu <sihui_liu@apple.com>
Make WebIDBServer use WorkQueue instead of Thread
https://bugs.webkit.org/show_bug.cgi?id=226589
Reviewed by Chris Dumez.
This matches other storage manager classes and makes management of thread lifetime much easier. We used to
destroy WebIDBServer aggressively (when there is no connection or task left) to ensure thread of WebIDBServer
does not stay around idly, and that led us to create new WebIDBServer for new task right after destroying
WebIDBServer and before databases are properly closed in some cases, which can caused issues like database is
locked during new task. With WorkQueue, we don't need to manage the threads, and we can close WebIDBServer
when session is destroyed.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::create):
(WebKit::WebIDBServer::WebIDBServer):
(WebKit::WebIDBServer::~WebIDBServer):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::addConnection):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::postTask):
(WebKit::WebIDBServer::postTaskReply):
(WebKit::WebIDBServer::close):
(WebKit::m_closeCallback): Deleted.
(WebKit::WebIDBServer::dispatchToThread): Deleted.
(WebKit::WebIDBServer::tryClose): Deleted.
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didClose):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::createWebIDBServer):
2021-06-03 Chris Dumez <cdumez@apple.com>
stopMakingViewBlankDueToLackOfRenderingUpdate logging shows even if we never made the view blank
https://bugs.webkit.org/show_bug.cgi?id=226616
Reviewed by Tim Horton.
stopMakingViewBlankDueToLackOfRenderingUpdate logging was showing even if we never made the view blank.
This was confusing so this fix makes the logging conditional.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
(WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit):
* UIProcess/WebPageProxy.h:
2021-06-03 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in [WKShareSheet presentWithParameters]
https://bugs.webkit.org/show_bug.cgi?id=226611
<rdar://77736001>
Reviewed by Ryosuke Niwa.
The code in [WKShareSheet presentWithParameters] was passing WebCore::RawFile objects to another thread.
This wasn't safe since WebCore::RawFile contains a WTF::String and a SharedBuffer, both of which are not
thread safe. Fix this by creating an isolated copy of the fileName String and converting the SharedBuffer
to a NSData before passing them to the background thread.
Also rewrite the code from ObjC to C++ because I felt it was clearer and less error-prone.
* UIProcess/Cocoa/WKShareSheet.mm:
(appendFilesAsShareableURLs):
(-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
2021-06-03 Matt Mokary <mmokary@apple.com>
Add a way to specify origin and destination of app highlight
https://bugs.webkit.org/show_bug.cgi?id=226607
Reviewed by Megan Gardner.
Expose a method for adding app highlights which allows the caller to specify origin and destination of the new
highlight. Update the existing method, which specifies originatedInApp: true, newGroup: false, to use this new
method.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _addAppHighlight]):
(-[WKWebView _addAppHighlightInNewGroup:originatedInApp:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
2021-06-03 Jean-Yves Avenard <jya@apple.com>
Add MediaSessionCoordinator test to ensure that disconnection on the private side is properly handled.
https://bugs.webkit.org/show_bug.cgi?id=226568
rdar://problem/78801408
Reviewed by Eric Carlson.
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]): Carry on required
change as coordinatorStateChanged is now pure virtual.
(-[WKMediaSessionCoordinatorHelper coordinatorStateChanged:]):
2021-06-03 Chris Dumez <cdumez@apple.com>
[Hardening] Stop storing raw pointers inside WebIDBServer::m_connections
https://bugs.webkit.org/show_bug.cgi?id=226595
Reviewed by Ryosuke Niwa.
Stop storing raw pointers inside WebIDBServer::m_connections and use a WeakHashSet instead.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::addConnection):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::close):
(WebKit::WebIDBServer::tryClose):
* NetworkProcess/IndexedDB/WebIDBServer.h:
* Platform/IPC/Connection.h:
2021-06-03 Chris Dumez <cdumez@apple.com>
Move protector earlier in NetworkProcessProxy::networkProcessDidTerminate()
https://bugs.webkit.org/show_bug.cgi?id=226594
Reviewed by Geoffrey Garen.
Move protector earlier in NetworkProcessProxy::networkProcessDidTerminate() as it seems unsafe
to do some of the earlier operations before protected |this|.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessDidTerminate):
2021-06-03 Chris Dumez <cdumez@apple.com>
Stop storing Ref<IPC::Connection> in RTCDataChannelRemoteManagerProxy::m_webProcessConnections
https://bugs.webkit.org/show_bug.cgi?id=226596
Reviewed by Eric Carlson.
Stop storing Ref<IPC::Connection> in RTCDataChannelRemoteManagerProxy::m_webProcessConnections.
Keeping the IPC::Connection alive always carries the chance of leaking if we fail to properly
clear the HashMap. We can simply store an IPC::Connection::UniqueID and use that ID to send the
IPC on the background thread.
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp:
(WebKit::RTCDataChannelRemoteManagerProxy::registerConnectionToWebProcess):
(WebKit::RTCDataChannelRemoteManagerProxy::sendData):
(WebKit::RTCDataChannelRemoteManagerProxy::close):
(WebKit::RTCDataChannelRemoteManagerProxy::changeReadyState):
(WebKit::RTCDataChannelRemoteManagerProxy::receiveData):
(WebKit::RTCDataChannelRemoteManagerProxy::detectError):
(WebKit::RTCDataChannelRemoteManagerProxy::bufferedAmountIsDecreasing):
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h:
2021-06-03 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Image extraction preview panel should automatically close when the web view is unparented
https://bugs.webkit.org/show_bug.cgi?id=226588
rdar://77062762
Reviewed by Tim Horton.
Refactor some logic for presenting the preview panel. See below for more details.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleProcessSwapOrExit):
(WebKit::WebViewImpl::viewDidMoveToWindow):
When the web view is removed from the view hierarchy (i.e. when the view is moved to a `nil` window), call into
`closeSharedPreviewPanelIfNecessary` to dismiss the shared preview panel if we're currently controlling its
presentation for the purposes of image extraction.
(WebKit::WebViewImpl::beginPreviewPanelControl):
(WebKit::WebViewImpl::endPreviewPanelControl):
Add more plumbing into WebPageProxy to begin and end preview panel control; this allows us to avoid having to
expose a separate method to reset WebPageProxy's `m_imageExtractionPreviewController` and call it from
WebViewImpl.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
Additionally call into `closeSharedPreviewPanelIfNecessary` when committing main frame navigation. We also
refactor a bit of logic here so that we fold several pieces of similar "reset" logic into a single if statement.
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WKImageExtractionPreviewController.h:
* UIProcess/mac/WKImageExtractionPreviewController.mm:
(-[WKImageExtractionPreviewController beginControl:]):
(-[WKImageExtractionPreviewController endControl:]):
(-[WKImageExtractionPreviewController closePanelIfNecessary]):
(-[WKImageExtractionPreviewController isControlling:]):
Move logic for assigning, removing, and checking the QLPreviewPanel's `-delegate` and `-dataSource` into helper
methods on WKImageExtractionPreviewController. Doing this allows us to consolidate more of the QuickLookUI-
specific logic inside WKImageExtractionPreviewController and WebPageProxy, but also (and more importantly)
prevents us from having to `#import <pal/spi/mac/QuickLookMacSPI.h>` inside `WebPageProxyMac.mm`, which results
in nullability errors when calling into `-[NSApplication stopSpeaking:]`.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::beginPreviewPanelControl):
(WebKit::WebPageProxy::endPreviewPanelControl):
(WebKit::WebPageProxy::closeSharedPreviewPanelIfNecessary):
2021-06-03 Chris Fleizach <cfleizach@apple.com>
AX: macOS WebContent can't read prefs from com.apple.Accessibility
https://bugs.webkit.org/show_bug.cgi?id=226528
Reviewed by Per Arne Vollan.
Some accessibility preferences on macOS use libAccessibility.
WebContent should process these on iOS & macOS.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::setPreferenceValue):
2021-06-03 Chris Dumez <cdumez@apple.com>
StorageArea should be able to send its IPC directly from the background thread
https://bugs.webkit.org/show_bug.cgi?id=226583
Reviewed by Alex Christensen.
Update StorageArea so that it does its IPC sending straight from the storage thread, instead of
hopping to the main thread to do so.
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::clear):
(WebKit::StorageArea::dispatchEvents const):
2021-06-03 Carlos Garcia Campos <cgarcia@igalia.com>
[GLIB] imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse_mixed_content.html is failing since r277493
https://bugs.webkit.org/show_bug.cgi?id=225904
Reviewed by Michael Catanzaro.
Set secureConnectionStart to WebCore::reusedTLSConnectionSentinel in case of reused TLS connection.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::didStartRequest):
2021-06-02 Rob Buis <rbuis@igalia.com>
Split FillInlinePath/StrokeInlinePath
https://bugs.webkit.org/show_bug.cgi?id=225687
Reviewed by Wenson Hsieh.
Adjust to new display list item types.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
2021-06-02 Chris Dumez <cdumez@apple.com>
Stop using a RefPtr<IPC::Connection> as HashMap key in DisplayLink
https://bugs.webkit.org/show_bug.cgi?id=226561
Reviewed by Simon Fraser.
Stop using a RefPtr<IPC::Connection> as HashMap key in DisplayLink. Using a RefPtr as key is suboptimal
and could leak to memory leaks. The reason this needed a RefPtr<IPC::Connection> was because we needed
to send IPC from a background thread. To support this, I have added a static IPC::Connection::send()
function that takes an IPC::Connection::UniqueID and that is thread safe. The function looks up the
IPC::Connection from its UniqueID and sends the IPC while still holding the lock.
As a result, DisplayLink can use IPC::Connection::UniqueID as key instead.
Note that I am planning to use the new static IPC::Connection::send() in other cases where we could
send IPC directly from a background thread instead of having to hop to the main thread to look up
the IPC::Connection from its UniqueID. StorageArea::dispatchEvents() is an example of where this will
be useful.
* Platform/IPC/Connection.cpp:
(IPC::Connection::Connection):
(IPC::Connection::~Connection):
* Platform/IPC/Connection.h:
(IPC::Connection::send):
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::addObserver):
(WebKit::DisplayLink::removeObserver):
(WebKit::DisplayLink::removeObservers):
(WebKit::DisplayLink::removeInfoForConnectionIfPossible):
(WebKit::DisplayLink::incrementFullSpeedRequestClientCount):
(WebKit::DisplayLink::decrementFullSpeedRequestClientCount):
(WebKit::DisplayLink::setPreferredFramesPerSecond):
(WebKit::DisplayLink::notifyObserversDisplayWasRefreshed):
* UIProcess/mac/DisplayLink.h:
2021-06-02 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Show data detector context menu on long press inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=226559
<rdar://problem/78789078>
Reviewed by Tim Horton.
Add additional support for data detectors that appear inside image overlays on iOS.
* Shared/ImageExtractionUpdateResult.h: Added.
Turn the `bool` propagated back to the UI process when calling `updateWithImageExtractionResult` into a separate
three-state enum instead; see changes below for more details.
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
Make some minor adjustments to `InteractionInformationAtPosition`:
- Add `dataDetectorBounds`, which determines the bounds in root view coordinates of the data detector result
corresponding to the hit-tested element.
- Encode and decode `dataDetectorResults`, even if `isDataDetectorLink` is `false`. Unless the data detector
is inside an image overlay, this (effectively) has no impact, since `dataDetectorResults` was previously
only set if `isDataDetectorLink` was true.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateWithImageExtractionResult):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dataDetectionContextForPositionInformation:]):
Let `dataDetectorResults` take precedence over regular `bounds` when returning the context for the data
detector menu configuration.
(-[WKContentView positionInformationHasImageOverlayDataDetector]):
Add a helper method that returns `YES` in the case where the currently cached position information object
contains a text data detection result inside an image overlay.
(-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]):
Use `dataDetectorBounds` instead of `bounds` when creating a fallback targeted preview for a data detection
result in an image overlay.
(-[WKContentView continueContextMenuInteraction:]):
(-[WKContentView continueContextMenuInteractionWithDataDetectors:]):
Adjust these codepaths so that we'll continue through to the data detector case instead of bailing early in the
case where both `isImageOverlayText` is set, and `dataDetectionResults` exist.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::findDataDetectionResultElementInImageOverlay):
Add a static helper to locate a data detector element underneath the given point, inside the given element's
image overlay in the user agent shadow root. Note that we check each of the element's bounds instead of using
a hit-test because we normally just hit-test to the text containers instead of the data detector containers.
(WebKit::WebPage::updateWithImageExtractionResult):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::dataDetectorLinkPositionInformation):
(WebKit::dataDetectorImageOverlayPositionInformation):
Add a static helper function to populate the given `InteractionInformationAtPosition`, if it's over a data
detection result inside an image overlay.
(WebKit::elementPositionInformation): Call the above helper function.
2021-06-02 Alex Christensen <achristensen@webkit.org>
Fix WPT test resource-timing/cross-origin-redirects.html
https://bugs.webkit.org/show_bug.cgi?id=190523
<rdar://45227788>
Reviewed by Brady Eidson.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::clearRequest):
(WebKit::NetworkDataTaskSoup::resume):
(WebKit::NetworkDataTaskSoup::didSendRequest):
(WebKit::NetworkDataTaskSoup::dispatchDidCompleteWithError):
(WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
(WebKit::NetworkDataTaskSoup::networkEvent):
(WebKit::NetworkDataTaskSoup::didStartRequest):
(WebKit::NetworkDataTaskSoup::didRestart):
2021-06-02 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Clean up notification_center message filters
https://bugs.webkit.org/show_bug.cgi?id=226555
<rdar://problem/77164076>
Reviewed by Per Arne Vollan.
We initially had two groups of mach-message-send filter rules for 'com.apple.system.notification_center' so we could
collect telemetry on a group of messages. Now that we have removed all the messages we do not need, there is no reason
to maintain two separate sets.
This patch just combines the two sets into a single list so we can easily conditionalize it for different OS releases
if needed.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-06-02 Jer Noble <jer.noble@apple.com>
REGRESSION(r276993): 5 TestWebKitAPI.AudioRoutingArbitration (api-tests) are constant failures
https://bugs.webkit.org/show_bug.cgi?id=226104
<rdar://77998049>
Reviewed by Eric Carlson.
In r276993, AudioSessionRoutingArbitration was moved from being initiated in the WebContent process
and dispatched to the UIProcess, to being dispatched to the GPU process. However two problems occurred:
1) The UIProcess no longer knows about routing arbitration, which is reasonable for the feature, but
breaks an API test that queries arbitration status in the UIProcess.
2) A sandbox violation causes routing arbitration to fail in the GPU process regardless.
We could open up the sandbox to allow routing arbitration to succeed (and come up with a way to push
state changes up to the UIProcess for testing purposes), but it's not technically necessary for
arbitration to occur there. Instead, just revert to the status-quo-ante behavior of having arbitration
take place in the UIProcess, and just add a new set of messages from the GPUConnoctionToWebProcess to
the GPUProcessConnection to facilitate arbitration.
Drive-by fix: AudioSessionRoutingArbitrator is a supplement to WebProcess, and as such it's created
at WebProcess creation time. However, it also causes an AudioSession to be created by attempting to
add itself as a client. This is bad on iOS, where it could cause hangs due to AVAudioSession calls.
So, add a mechanism to be notified when an AudioSession eventually does get created, and add the
arbitrator as a client then.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
* GPUProcess/mac/LocalAudioSessionRoutingArbitrator.cpp:
(WebKit::LocalAudioSessionRoutingArbitrator::create):
(WebKit::LocalAudioSessionRoutingArbitrator::LocalAudioSessionRoutingArbitrator):
(WebKit::LocalAudioSessionRoutingArbitrator::processDidTerminate):
(WebKit::LocalAudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory):
(WebKit::LocalAudioSessionRoutingArbitrator::leaveRoutingAbritration):
* GPUProcess/mac/LocalAudioSessionRoutingArbitrator.h:
* GPUProcess/media/RemoteAudioSessionProxyManager.h:
(WebKit::RemoteAudioSessionProxyManager::session):
* UIProcess/GPU/GPUProcessProxy.h:
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::beginRoutingArbitrationWithCategory):
(WebKit::GPUProcessConnection::endRoutingArbitration):
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/GPUProcessConnection.messages.in:
* WebProcess/cocoa/AudioSessionRoutingArbitrator.cpp:
(WebKit::AudioSessionRoutingArbitrator::AudioSessionRoutingArbitrator):
* WebProcess/cocoa/AudioSessionRoutingArbitrator.h:
2021-06-02 Jer Noble <jer.noble@apple.com>
REGRESSION(r277217?): ASSERTION FAILED: Unhandled message RemoteLegacyCDMSession_SendError to 10 assertionFailureDueToUnreachableCode
https://bugs.webkit.org/show_bug.cgi?id=226545
<rdar://78001450>
Reviewed by Eric Carlson.
Add message handlers for RemoteLegacyCDMProxy and RemoteLegacyCDMSessionProxy.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::dispatchMessage):
(WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
2021-06-02 Per Arne <pvollan@apple.com>
[iOS] Fix IOKit sandbox violations
https://bugs.webkit.org/show_bug.cgi?id=226546
<rdar://78523469>
Reviewed by Tim Horton.
Fix IOKit sandbox violations in the WebContent process on iOS.
* Configurations/SandboxProfiles.xcconfig:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebKit.xcodeproj/project.pbxproj:
2021-06-02 Chris Dumez <cdumez@apple.com>
Drop Checked::safeGet()
https://bugs.webkit.org/show_bug.cgi?id=226537
Reviewed by Geoffrey Garen.
Drop Checked::safeGet() and replace with uses of Checked::operator T() or Checked::value().
safeGet() is a bit akward, having both a return value and an out-parameter.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::updateSpellingUIWithGrammarString):
2021-06-02 Garrett Davidson <garrett_davidson@apple.com>
[Cocoa] _WKAuthenticatorAssertionResponse should specify the attachment type used
https://bugs.webkit.org/show_bug.cgi?id=225519
<rdar://problem/76554090>
Reviewed by Brent Fulgham.
Have WebAuthn authenticators start passing back their attachment type, and plumb
it up through to the calling process.
* UIProcess/API/Cocoa/_WKAuthenticatorAssertionResponse.mm:
(-[_WKAuthenticatorAssertionResponse initWithClientDataJSON:rawId:extensions:authenticatorData:signature:userHandle:attachment:]):
(-[_WKAuthenticatorAssertionResponse initWithClientDataJSON:rawId:extensions:authenticatorData:signature:userHandle:]): Deleted.
* UIProcess/API/Cocoa/_WKAuthenticatorAssertionResponseInternal.h:
* UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponse.mm:
(-[_WKAuthenticatorAttestationResponse initWithClientDataJSON:rawId:extensions:attestationObject:attachment:]):
(-[_WKAuthenticatorAttestationResponse initWithClientDataJSON:rawId:extensions:attestationObject:]): Deleted.
* UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponseInternal.h:
* UIProcess/API/Cocoa/_WKAuthenticatorResponse.h:
* UIProcess/API/Cocoa/_WKAuthenticatorResponse.mm:
(-[_WKAuthenticatorResponse initWithClientDataJSON:rawId:extensions:attachment:]):
(-[_WKAuthenticatorResponse initWithClientDataJSON:rawId:extensions:]): Deleted.
* UIProcess/API/Cocoa/_WKAuthenticatorResponseInternal.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(authenticatorAttachmentToWKAuthenticatorAttachment):
(wkAuthenticatorAttestationResponse):
(-[_WKWebAuthenticationPanel makeCredentialWithChallenge:origin:options:completionHandler:]):
(wkAuthenticatorAssertionResponse):
(-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]):
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticatorInternal::getExistingCredentials):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived):
(WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
(WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
(WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
(WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
* WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:
(WebKit::WebAuthnConnectionToWebProcess::handleRequest):
* WebAuthnProcess/WebAuthnConnectionToWebProcess.h:
* WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in:
2021-06-02 Chris Dumez <cdumez@apple.com>
Use Checked aliases instead of Checked<T, RecordOverflow>
https://bugs.webkit.org/show_bug.cgi?id=226535
Reviewed by Keith Miller.
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::numBytesForSize):
* Shared/ShareableBitmap.h:
* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::calculateBytesPerRow):
(WebKit::ShareableBitmap::calculateBytesPerPixel):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::calculateBytesPerRow):
(WebKit::ShareableBitmap::calculateBytesPerPixel):
* Shared/win/ShareableBitmapDirect2D.cpp:
(WebKit::ShareableBitmap::calculateBytesPerRow):
(WebKit::ShareableBitmap::calculateBytesPerPixel):
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::updateSpellingUIWithGrammarString):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::calculateSafeBackendSize):
2021-06-01 Darin Adler <darin@apple.com>
Remove <wtf/Optional.h>
https://bugs.webkit.org/show_bug.cgi?id=226437
Reviewed by Chris Dumez.
* <many files>: Removed include of <wtf/Optional.h>.
2021-06-01 Chris Dumez <cdumez@apple.com>
Rename Checked::unsafeGet() to Checked::value()
https://bugs.webkit.org/show_bug.cgi?id=226514
Reviewed by Darin Adler.
Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this
function isn't really unsafe since it will crash if the value has overflowed. Also add an
`operator T()` to implicitly convert a Checked to its underlying type without needing to
call value().
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::setItem):
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::put):
* Platform/IPC/ArgumentCoders.h:
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::Connection::sendOutgoingMessage):
(IPC::createMessageDecoder):
* Platform/IPC/cocoa/MachMessage.cpp:
(IPC::MachMessage::create):
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::Handle::encode const):
(WebKit::ShareableBitmap::create):
(WebKit::ShareableBitmap::createShareable):
* Shared/ShareableBitmap.h:
(WebKit::ShareableBitmap::bytesPerRow const):
(WebKit::ShareableBitmap::sizeInBytes const):
* Shared/ShareableResource.cpp:
(WebKit::ShareableResource::create):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::calculateBytesPerRow):
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::createCGImage const):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::copyTrackArray):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::copySampleLocation const):
* WebProcess/GPU/graphics/DisplayListWriterHandle.cpp:
(WebKit::DisplayListWriterHandle::advance):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow):
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::frameBytesAtIndex const):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::increaseBufferedAmount):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestEvasionRectsAboveSelection):
(WebKit::WebPage::updateSelectionWithDelta):
2021-06-01 Dana Estra <destra@apple.com>
Adopt Reveal for phone numbers
https://bugs.webkit.org/show_bug.cgi?id=226383
rdar://78482517
Reviewed by Tim Horton.
Manually tested by selecting text containing phone numbers in Safari and viewing dropdown menu.
Switch to Reveal framework to show a dropdown menu for telephone numbers with more options.
* Platform/mac/MenuUtilities.mm:
(-[WKEmptyPresenterHighlightDelegate revealContext:rectsForItem:]):
(WebKit::menuForTelephoneNumber):
2021-06-01 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r278253.
Revert changes to WebKitTests.swift as this is Swift's Optional<> not WTF's.
* SwiftOverlay/Tests/WebKitTests.swift:
(WebKitTests.testWKPDFConfigurationRect):
2021-06-01 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r278253.
Revert changes to ObjectiveCBlockConversions.swift and this is Swift's Optional<> not WTF's.
* SwiftOverlay/SwiftOverlay/ObjectiveCBlockConversions.swift:
(ObjCBlockConversion.boxingNilAsAnyForCompatibility(_:Error:Error:)):
2021-06-01 Chris Dumez <cdumez@apple.com>
REGRESSION (iOS 14.5): Can't go back and render previous page properly after "location.href"
https://bugs.webkit.org/show_bug.cgi?id=226323
<rdar://problem/78623536>
Reviewed by Alex Christensen.
A while back, we did an optimization to allow several WebPage objects associated with the
same WebPageProxy to live in the same WebProcess. This allowed us to reuse a process from
a SuspendedPageProxy for a forward navigation, without destroying the SuspendedPageProxy.
However, this added quite a bit of complexity and this broke some same-process back/forward
navigations like in this bug. In particular, it is really hard to get do our history
management right (with the current model) if there is more than more WebPage in a process
for the same WebPageProxy.
To address issues, we go back to the older model with one WebPage per WebProcess for a
given WebPageProxy. To achieve this, we make sure to destroy of SuspendedPageProxy objects
for the current page and destination process before we process-swap (like we used to do).
* UIProcess/WebBackForwardCache.cpp:
(WebKit::WebBackForwardCache::removeEntriesForPageAndProcess):
* UIProcess/WebBackForwardCache.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2021-06-01 Sihui Liu <sihui_liu@apple.com>
Resume WebIDBServer when it is about to be closed
https://bugs.webkit.org/show_bug.cgi?id=226502
rdar://78691498
Reviewed by Chris Dumez.
We started to acquire m_serverLock in WebIDBServer::close() in r278179 to stop database activities on the main
thread. However, m_serverLock may already be held for suspension, and WebIDBServer::close() may be called
before resume(). We need to resume WebIDBServer so m_serverLock can be acquired for stopping database activities.
This also makes sure background thread is resumed before WebIDBServer is removed from NetworkProcess.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::~WebIDBServer):
(WebKit::WebIDBServer::close):
2021-06-01 Chris Dumez <cdumez@apple.com>
Enable WebPageProxy's release logging in ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=226342
Reviewed by Geoff Garen.
Enable WebPageProxy's release logging in ephemeral sessions. Our release logging doesn't
contain anything sensitive and not having this logging makes it hard to debug issues in
apps using ephemeral sessions.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::shouldStart):
(WebKit::SOAuthorizationSession::start):
(WebKit::SOAuthorizationSession::continueStartAfterGetAuthorizationHints):
(WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy):
(WebKit::SOAuthorizationSession::fallBackToWebPath):
(WebKit::SOAuthorizationSession::abort):
(WebKit::SOAuthorizationSession::complete):
(WebKit::SOAuthorizationSession::presentViewController):
(WebKit::SOAuthorizationSession::dismissViewController):
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::processDidTerminate):
(WebKit::ProvisionalPageProxy::cancel):
(WebKit::ProvisionalPageProxy::loadData):
(WebKit::ProvisionalPageProxy::loadRequest):
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
(WebKit::ProvisionalPageProxy::didCreateContextInWebProcessForVisibilityPropagation):
(WebKit::ProvisionalPageProxy::didCreateContextInGPUProcessForVisibilityPropagation):
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::isAlwaysOnLoggingAllowed const):
* UIProcess/WebPageProxy.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPageProxy::~WebPageProxy):
(WebKit::WebPageProxy::launchProcess):
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::swapToProvisionalPage):
(WebKit::WebPageProxy::launchProcessForReload):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::tryClose):
(WebKit::WebPageProxy::tryCloseTimedOut):
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::loadData):
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::loadSimulatedRequest):
(WebKit::WebPageProxy::loadAlternateHTML):
(WebKit::WebPageProxy::loadWebArchiveData):
(WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
(WebKit::WebPageProxy::stopLoading):
(WebKit::WebPageProxy::reload):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::tryRestoreScrollPosition):
(WebKit::WebPageProxy::updateActivityState):
(WebKit::WebPageProxy::updateThrottleState):
(WebKit::WebPageProxy::clearAudibleActivity):
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
(WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit):
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::commitProvisionalPage):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::suspend):
(WebKit::WebPageProxy::resume):
(WebKit::WebPageProxy::restoreFromSessionState):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::didExplicitOpenForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::willPerformClientRedirectForFrame):
(WebKit::WebPageProxy::didCancelClientRedirectForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
(WebKit::WebPageProxy::didPerformClientRedirectShared):
(WebKit::WebPageProxy::didPerformServerRedirectShared):
(WebKit::WebPageProxy::closePage):
(WebKit::WebPageProxy::processDidBecomeUnresponsive):
(WebKit::WebPageProxy::processDidBecomeResponsive):
(WebKit::WebPageProxy::resetStateAfterProcessTermination):
(WebKit::WebPageProxy::dispatchProcessDidTerminate):
(WebKit::WebPageProxy::tryReloadAfterProcessTermination):
(WebKit::WebPageProxy::requestStorageSpace):
(WebKit::WebPageProxy::updateReportedMediaCaptureState):
(WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive):
(WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground):
(WebKit::WebPageProxy::logger):
* UIProcess/WebPageProxy.h:
2021-06-01 Per Arne <pvollan@apple.com>
[iOS] Preprocess the WebContent sandbox
https://bugs.webkit.org/show_bug.cgi?id=226301
<rdar://problem/78575178>
Reviewed by Geoffrey Garen.
Run the WebContent sandbox through the preprocessor on iOS.
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Removed.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: Copied from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.
* WebKit.xcodeproj/project.pbxproj:
2021-06-01 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Try harder to find initial WebKitWebView size
https://bugs.webkit.org/show_bug.cgi?id=226320
Reviewed by Michael Catanzaro.
Currently we base the viewport size on the drawing area size. The
drawing area is created with an initial size based on the viewport
size, which will be (0, 0) because the drawing area is still null
by that point.
Then, later, during the widget allocation, the drawing area receives
its proper size.
There are 2 issues here. First, this approach guarantees that the
initial viewport size will always be (0, 0), and then there's no
guarantee the widget will be allocated any time soon - for example,
while GtkNotebook in GTK3 does allocate children that aren't currently
visible, GtkStack doesn't (and that means that GtkNotebook in GTK4 and
HdyTabView don't either). This leads to a situation where a page opened
in background will load with 0, 0 size and if a page depends on that,
it won't load correctly.
The first issue can be fixed by basing the viewport size on the view
allocation as well, and then if the widget isn't allocated, we instead
try to use the size of a parent as an estimation, so that the initial
size is at least not 0 even if not fully accurate.
See https://gitlab.gnome.org/GNOME/epiphany/-/issues/1532
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::viewSize):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseGetViewSize):
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2021-05-30 Dean Jackson <dino@apple.com>
[WebXR] Send recommendedResolution using DeviceProxy
https://bugs.webkit.org/show_bug.cgi?id=226402
<rdar://problem/78635475>
Reviewed by Tim Horton.
Add a recommendedResolution field to DeviceInfo and send
it across processes using the XRDeviceProxy.
* Shared/Cocoa/XRDeviceInfo.h:
* Shared/Cocoa/XRDeviceInfo.mm:
(WebKit::XRDeviceInfo::encode const):
(WebKit::XRDeviceInfo::decode):
* Shared/Cocoa/XRDeviceProxy.h:
* Shared/Cocoa/XRDeviceProxy.mm:
(WebKit::XRDeviceProxy::XRDeviceProxy):
2021-05-30 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] UI process crashes when deallocating WKWebView in a script message handler during an active touch event
https://bugs.webkit.org/show_bug.cgi?id=226426
rdar://75425319
Reviewed by Darin Adler.
It's possible for the UI process to crash upon being notified that asynchronous, active touch events have been
handled in the web process via the async IPC replay block in `WebPageProxy::handlePreventableTouchEvent()`. This
happens if the client posts a message from the web process to UI process while handling an active touch event
and deallocates the WKWebView currently handling the touch event in the script message handler.
This is because the async replay block inside `WebPageProxy::handlePreventableTouchEvent()` strongly captures a
reference to the `WebPageProxy`, thus keeping it alive; however, the `WebPageProxy`'s weak pointer to the page
client is nulled out, which causes `WebPageProxy::pageClient()` to crash with a null dereference.
To fix this, we weakly capture `WebPageProxy` instead and return early if it has already been destroyed by the
time we process the completion handler, and also add a null check for `m_pageClient` before attempting to call
into it. Note that it's unnecessary to call into `doneDeferringTouch(Start|End)` to unblock any deferred
gestures here, because the process of destroying the content view will call `-cleanUpInteraction` and remove all
deferring gestures from the view, regardless of whether they're still in Possible state.
Test: TouchEventTests.DestroyWebViewWhileHandlingTouchEnd
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handlePreventableTouchEvent):
2021-05-30 Darin Adler <darin@apple.com>
Remove WTF::Optional synonym for std::optional, using that class template directly instead
https://bugs.webkit.org/show_bug.cgi?id=226433
Reviewed by Chris Dumez.
* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
* Scripts/webkit/tests: Regenerated expected results, by running the command "python
Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?)
2021-05-28 Darin Adler <darin@apple.com>
Clients of optional should use has_value instead of relying on hasValue macro
https://bugs.webkit.org/show_bug.cgi?id=226395
Reviewed by Chris Dumez.
* Platform/IPC/ArgumentCoders.h: Use std::optional; there was no hasValue
in here and I edited it by mistake, but we want to do this eventually.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed using namespace WebCore.
(IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData): Use has_value.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Ditto.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::decodeImage): Changed idiom to not call hasValue.
(IPC::ArgumentCoder<Ref<Font>>::decode): Ditto.
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::finishParsing): Use has_value.
(WebKit::MediaFormatReader::copyProperty): Ditto.
(WebKit::MediaFormatReader::copyTrackArray): Ditto.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Do not call hasValue.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration encodeWithCoder:]): Changed idiom to not use hasValue.
* UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::setState): Use has_value.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::AutomationCommandError::toProtocolString): Changed idiom to not use hasValue.
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::determineDataOwner const): Use has_value.
* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::sendWebInspectorEvent): Changed idiom to not use hasValue.
* UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints): Ditto.
* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::addSourceBuffer): Use has_value.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters): Ditto.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::notifyPreferencesChanged): Changed idiom to not
call hasValue.
2021-05-28 Wenson Hsieh <wenson_hsieh@apple.com>
Web process terminates when attempting to log in on bankid.no
https://bugs.webkit.org/show_bug.cgi?id=226411
rdar://77419432
Reviewed by Chris Dumez.
See WebCore ChangeLog for more details.
* GPUProcess/graphics/RemoteImageBuffer.h:
Implement the new display list replayer delegate hooks and plumb the calls over to the RemoteRenderingBackend.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::submit):
Keep track of `m_currentMaskImageBuffer` by implementing the methods below, and use this when initializing our
DisplayList::Replayer if needed.
(WebKit::RemoteRenderingBackend::didCreateMaskImageBuffer):
(WebKit::RemoteRenderingBackend::didResetMaskImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.h:
2021-05-28 Don Olmstead <don.olmstead@sony.com>
[Cocoa] HDR variants in HLS playlists not selected when screen is HDR
https://bugs.webkit.org/show_bug.cgi?id=226349
<rdar://76963977>
Unreviewed build fix after r278204.
Update the method signature of RemoteMediaPlayerProxy::prepareForPlayback for non-Cocoa
platforms.
* GPUProcess/media/gstreamer/RemoteMediaPlayerProxyGStreamer.cpp:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
* GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
* GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
2021-05-28 Sihui Liu <sihui_liu@apple.com>
Regression(r278179): m_serverLock is still held after WebIDBServer is destroyed
https://bugs.webkit.org/show_bug.cgi?id=226389
Reviewed by Chris Dumez.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::close):
2021-05-28 Matt Gilligan <matthew_gilligan@apple.com>
Prevent resetting scroll position in unnecessary cases during page load
https://bugs.webkit.org/show_bug.cgi?id=226338
rdar://75334651
Reviewed by Simon Fraser.
When WKWebView's scroll view has a refresh control and is rubber banding along the top
edge, don't cancel scrolling animations or reset contentOffset within valid range due to
the page load. This can cause flickering during dragging and can prevent the bounce
animation from finishing.
Test: ScrollViewInsetTests.PreserveContentOffsetForRefreshControl
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _didCommitLoadForMainFrame]):
Avoid calling -_stopScrollingAndZoomingAnimations when rubber banding for a refresh control
to prevent cancelling a bounce animation.
(-[WKWebView _restoreScrollAndZoomStateForTransaction:]):
(-[WKWebView _didCommitLayerTree:]):
Don't adjust content offset to be within valid range when rubber banding for a refresh
control, or the scroll position will be reset while dragging or bouncing.
(-[WKWebView _scrollViewIsRubberBandingForRefreshControl]):
Return whether _scrollView has a refresh control and is rubber banding along the top edge.
* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView _setContentSizePreservingContentOffsetDuringRubberband:]):
When the refresh control is dismissing, the scroll view will be rubber banding but not
dragging or bouncing. Treat a non-nil refreshControl as a hint that the scroll view might
be rubber banding.
2021-05-28 Jer Noble <jer.noble@apple.com>
[Cocoa] Hang in WebM format reader when loading content from https://powerrangers.fandom.com/
https://bugs.webkit.org/show_bug.cgi?id=226128
<rdar://77645877>
Reviewed by Eric Carlson.
When creating a format reader, MediaToolbox will query for various properties including ones about
MetadataFormat and MetadataKeySpace. We don't support those properties, but we still block until
tracks are loaded before answering that we don't support them. Instead, just return early unless
the query is for the one property which we do support, Duration.
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::copyProperty):
2021-05-28 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Adjust logic when determining whether to enable image extraction actions in the callout bar
https://bugs.webkit.org/show_bug.cgi?id=226387
rdar://76781788
Reviewed by Tim Horton and Devin Rousso.
Call into the superclass (which contains additional restrictions beyond our `isContentEditable` check on the
editor state), and additionally refactor this helper function to take a selector and return whether or not it is
one of the image extraction action selectors (as opposed to returning the selector itself).
See Radar for more details.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
2021-05-28 Sam Weinig <weinig@apple.com>
Add stub implementation of CA separated portal bits for GraphicsLayer
https://bugs.webkit.org/show_bug.cgi?id=226343
Reviewed by Simon Fraser.
Plumbs isSeparatedPortal and isDescendentOfSeparatedPortal bits through GraphicsLayer.
Renames setSeparated to setIsSeparated for consistency.
Currently unused, but getting the bits in is big enough that its helpful
to land on its own.
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
(WebKit::RemoteLayerTreeTransaction::RemoteLayerTreeTransaction): Deleted.
(WebKit::RemoteLayerTreeTransaction::~RemoteLayerTreeTransaction): Deleted.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setIsSeparated):
(WebKit::PlatformCALayerRemote::isSeparatedPortal const):
(WebKit::PlatformCALayerRemote::setIsSeparatedPortal):
(WebKit::PlatformCALayerRemote::isDescendentOfSeparatedPortal const):
(WebKit::PlatformCALayerRemote::setIsDescendentOfSeparatedPortal):
(WebKit::PlatformCALayerRemote::setSeparated): Deleted.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2021-05-28 Jer Noble <jer.noble@apple.com>
[Cocoa] HDR variants in HLS playlists not selected when screen is HDR
https://bugs.webkit.org/show_bug.cgi?id=226349
<rdar://76963977>
Reviewed by Eric Carlson.
An existing test, http/tests/media/hls/hls-hdr-switch.html, should have caught this regression,
but is not currently functional as it depends on PHP, which has been removed.
The preferredDynamicRangeMode needs to be piped over from WebContent -> GPU process.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setPreferredDynamicRangeMode):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
* Scripts/webkit/messages.py:
(headers_for_type):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
(WebKit::MediaPlayerPrivateRemote::setPreferredDynamicRangeMode):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2021-05-28 Zan Dobersek <zdobersek@igalia.com>
[WPE] Correctly compute wheel event phase for 2D axis events
https://bugs.webkit.org/show_bug.cgi?id=226370
Reviewed by Adrian Perez de Castro.
2D-capable wpe_input_axis_event objects don't have usable axis and delta
values set on the base struct, but keep all that information on the more
detailed wpe_input_axis_2d_event struct.
For such events, the correct phase then has to be special-cased,
otherwise the default determination marks both axes as inactive and only
PhaseEnded events are dispatched into the engine.
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
2021-05-28 Eric Carlson <eric.carlson@apple.com>
[GPUP] [Video/Audio/Text]TrackPrivateRemote.h should use startTimeVariance
https://bugs.webkit.org/show_bug.cgi?id=226355
rdar://77326202
Reviewed by Jer Noble.
Test: http/tests/media/hls/hls-webvtt-seek-backwards.html
* WebProcess/GPU/media/AudioTrackPrivateRemote.h: Use configuration.startTimeVariance.
* WebProcess/GPU/media/TextTrackPrivateRemote.h: Ditto.
* WebProcess/GPU/media/VideoTrackPrivateRemote.h: Ditto.
2021-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Implement NetworkDataTask::setPriority
https://bugs.webkit.org/show_bug.cgi?id=226371
Reviewed by Adrian Perez de Castro.
To update the soup message priority. In HTTP/2 soup can send a priority frame to prioritize the associated
stream.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::setPriority):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Add debug logging around some shared display list codepaths
https://bugs.webkit.org/show_bug.cgi?id=226356
Reviewed by Simon Fraser.
Add logging around the shared display list processing logic between the web and GPU processes. This is the basic
set of log messages I've used in the past to triage crashes and hangs while optimizing MotionMark performance,
and should be sufficient for some basic debugging around display list code around RemoteRenderingBackend(Proxy).
* GPUProcess/graphics/RemoteImageBuffer.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
Log when wakeup messages are sent by the web process and received by the GPU process.
* GPUProcess/graphics/RemoteRenderingBackend.h:
* Platform/Logging.h:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout):
Log when synchronous flushes are performed, as well as whether they time out.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::sendWakeupMessage):
(WebKit::RemoteRenderingBackendProxy::createItemBuffer):
Log whenever new display list shared memory is created, and also when display lists are reused (additionally
logging the remaining capacity on reused display lists).
2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Show context menu when clicking on data detection results in image overlays
https://bugs.webkit.org/show_bug.cgi?id=226274
rdar://75504956
Reviewed by Tim Horton and Aditya Keerthi.
Implement a WebKit2 client hook to handle a click over a data detection result by using the Reveal framework to
collect and present a context menu. See below for more details.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<DataDetectorElementInfo>::encode):
(IPC::ArgumentCoder<DataDetectorElementInfo>::decode):
* Shared/WebCoreArgumentCoders.h:
Add encoding and decoding support for DataDetectorElementInfo.
* SourcesCocoa.txt:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleClickForDataDetectionResult):
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::view const):
Add a helper method to grab the view (either a WKView or WKWebView) from a WebViewImpl.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleClickForDataDetectionResult):
Create and present a new WKRevealItemPresenter using the DDScannerResult.
(WebKit::WebViewImpl::didFinishPresentation):
* UIProcess/PageClient.h:
(WebKit::PageClient::handleClickForDataDetectionResult):
Add more plumbing through the UI process to handle clicking on a data detection result.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::handleClickForDataDetectionResult):
* UIProcess/mac/WKRevealItemPresenter.h: Added.
* UIProcess/mac/WKRevealItemPresenter.mm: Added.
Add a helper class that takes an RVItem and is capable of presenting a context menu for the item, on behalf of
WebViewImpl. For the time being, this is only used on macOS (and thus, directly holds a WeakPtr to a
WebViewImpl). However, we may want to use this in the future for Mac Catalyst as well, in which case we should
make this work via a generic WKRevealItemPresenterDelegate protocol instead.
(-[WKRevealItemPresenter initWithWebViewImpl:item:frame:menuLocation:]):
(-[WKRevealItemPresenter showContextMenu]):
(-[WKRevealItemPresenter _callDidFinishPresentationIfNeeded]):
Call out to the WebViewImpl to reset its current reveal item presenter after we've finished presentation. This
happens either after we've dismissed the context menu (if no item is highlighted), or after we've finished
highlighting the item.
(-[WKRevealItemPresenter revealContext:rectsForItem:]):
(-[WKRevealItemPresenter revealContext:shouldUseDefaultHighlightForItem:]):
(-[WKRevealItemPresenter revealContext:startHighlightingItem:]):
(-[WKRevealItemPresenter revealContext:stopHighlightingItem:]):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::handleClickForDataDetectionResult):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::handleClickForDataDetectionResult):
* WebProcess/WebPage/WebPage.h:
2021-05-27 Darin Adler <darin@apple.com>
Next step toward using std::optional directly instead of through WTF::Optional typedef
https://bugs.webkit.org/show_bug.cgi?id=226280
Reviewed by Chris Dumez.
* <many files>: Accept the renaming done by do-webcore-rename.
2021-05-27 Devin Rousso <drousso@apple.com>
[iOS] contextmenu hints don't follow scrolling inside `<iframe>`
https://bugs.webkit.org/show_bug.cgi?id=226055
Reviewed by Tim Horton.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didScroll]):
(-[WKContentView _removeContainerForContextMenuHintPreviews]):
(-[WKContentView _updateFrameOfContainerForContextMenuHintPreviewsIfNeeded]): Added.
(-[WKContentView _updateTargetedPreviewScrollViewUsingContainerScrollingNodeID:]): Added.
(-[WKContentView _createTargetedContextMenuHintPreviewForFocusedElement]): Added.
(-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]): Added.
(-[WKContentView overridePositionTrackingViewForTargetedPreviewIfNecessary:containerScrollingNodeID:]): Deleted.
Save the `UIScrollView` containing the target of the contextmenu. Whenever any view is
scrolled, adjust the `frame` of the `_contextMenuHintContainerView` so that the contextmenu
hint moves by the amount of scrolling that's happened since the contextmenu hint was shown.
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollView const): Added.
`ScrollingTreeFrameScrollingNodeRemoteIOS` also has a corresponding `UIScrollView`.
* Platform/spi/ios/UIKitSPI.h:
Remove declaration for no-longer-used SPI.
2021-05-27 Brent Fulgham <bfulgham@apple.com>
[iOS] Silence reports about 'com.apple.runningboard'
https://bugs.webkit.org/show_bug.cgi?id=226357
<rdar://problem/76144219>
Reviewed by Per Arne Vollan.
We blocked access to 'com.apple.runningboard' from the WebContent process in Bug 209933 (about a year ago). Since
then, the only telemetry we have received has been for a benign Accessibility call that fails closed in way that
does not impact the features of the Accessibility Framework used inside the WebContent process.
We should silence this report to avoid spending time symbolicating and generating traces.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-05-27 Sihui Liu <sihui_liu@apple.com>
Abandon pending tasks on background thread when WebIDBServer is closed
https://bugs.webkit.org/show_bug.cgi?id=226295
Reviewed by Chris Dumez.
When WebIDBServer is closed, it means there is no open connection to client, so we don't need to handle pending
tasks. We can ditch them by killing the CrossThreadQueue. For ongoing task, it can be blocked on quota check, so
let's just stop database activities on the main thread to make sure database lock is released.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::close):
* NetworkProcess/IndexedDB/WebIDBServer.h:
2021-05-27 Alex Christensen <achristensen@webkit.org>
Revert r277344
https://bugs.webkit.org/show_bug.cgi?id=225602
<rdar://78411776>
It caused more sandbox issues. We are going to see if we can just remove the connection killing, but first we revert the cause of problems.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::terminateWithReason):
2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com>
Refactor some data detector code in WebCore::Frame
https://bugs.webkit.org/show_bug.cgi?id=226267
Reviewed by Andy Estes and Devin Rousso.
See WebCore/ChangeLog for more details.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::removeDataDetectedLinks):
(WebKit::WebPage::detectDataInAllFrames):
Use DataDetectionResultsStorage instead of setting the array of scanner results directly on Frame.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::dataDetectorLinkPositionInformation):
2021-05-27 Tim Horton <timothy_horton@apple.com>
Introduce BifurcatedGraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=226318
Reviewed by Sam Weinig.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::create):
2021-05-27 Adrian Perez de Castro <aperez@igalia.com>
Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.33.1 release
* wpe/NEWS: Add release notes for 2.33.1
2021-05-27 Peng Liu <peng.liu6@apple.com>
Calling -[WKWebView _closeAllMediaPresentations] crashes
https://bugs.webkit.org/show_bug.cgi?id=226305
Reviewed by Chris Dumez.
Provide an empty completion handler to fix a crash.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _closeAllMediaPresentations]):
2021-05-27 Alexander Mikhaylenko <alexm@gnome.org>
[GTK4] Navigation swipe snapshot always times out
https://bugs.webkit.org/show_bug.cgi?id=226332
Reviewed by Michael Catanzaro.
Enable ViewGestureGeometryCollector for GTK4 as well.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):
(WebKit::WebPage::mainFrameDidLayout):
* WebProcess/WebPage/WebPage.h:
2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Add validation when reading DisplayListSharedMemoryHeader::waitingStatus in DisplayListReaderHandle
https://bugs.webkit.org/show_bug.cgi?id=226306
rdar://78118900
Reviewed by Chris Dumez.
Store this waiting status (an enum class with three valid states) as a raw `uint8_t` in shared memory, rather
than an `enum class`. This allows us to verify that this value indicates a valid waiting status (using
`isValidEnum`) upon reading this flag in the GPU process, and perform a `MESSAGE_CHECK` in the case where it is
invalid.
* GPUProcess/graphics/DisplayListReaderHandle.h:
(WebKit::DisplayListReaderHandle::startWaiting):
(WebKit::DisplayListReaderHandle::stopWaiting):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
* Shared/SessionState.cpp:
(WebKit::PageState::decode):
* Shared/SessionState.h:
Drive-by fix: remove a non-templated declaration of `isValidEnum()`. This is necessary in order to use
`WTF::isValidEnum` without the explicit WTF namespace prefix inside `DisplayListReaderHandle`, since WTF's
declaration of `isValidEnum` clashes with this declaration.
Instead of using this separate method for validating the enum, simply encode and decode the
`shouldOpenExternalURLsPolicy` enum using << and >> operators, respectively; this ensures that the decoded value
of `shouldOpenExternalURLsPolicy` is either valid, or the result will be WTF::nullopt if decoding fails or
results in an invalid enum.
* Shared/SharedDisplayListHandle.h:
* WebProcess/GPU/graphics/DisplayListWriterHandle.h:
(WebKit::DisplayListWriterHandle::tryToResume):
2021-05-27 Alexander Mikhaylenko <alexm@gnome.org>
Transient quarter display with a HiDPI /4k screen and a 200% scaling
https://bugs.webkit.org/show_bug.cgi?id=219202
Reviewed by Adrian Perez de Castro.
Set the root layer transformation before syncing animations and not after.
This way we avoid having the first frame use the wrong scale on hidpi.
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
2021-05-26 Chris Dumez <cdumez@apple.com>
Leverage the new Vector(const T*, size_t) constructor
https://bugs.webkit.org/show_bug.cgi?id=226304
Reviewed by Darin Adler.
Leverage the new Vector(const T*, size_t) constructor in existing code.
* Platform/IPC/ArrayReference.h:
(IPC::ArrayReference::vector const):
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(vectorFromNSData):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::setIconForPageURL):
* UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
(WebKit::WebCore::convertBytesToVector):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptForExtension):
* UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
(WebKit::reportReceived):
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticatorInternal::toVector):
(WebKit::LocalAuthenticatorInternal::aaguidVector):
* UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
(WebKit::NfcConnection::transact const):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didComplete):
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::WebURLSchemeTaskProxy::didReceiveData):
2021-05-26 Tim Horton <timothy_horton@apple.com>
Fix the ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER) build
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::create):
Missed one GraphicsContext!
2021-05-26 Jean-Yves Avenard <jya@apple.com>
Make MediaSession readystate enums all lowercase
https://bugs.webkit.org/show_bug.cgi?id=226213
<rdar://problem/78437011>
Reviewed by Eric Carlson.
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]):
2021-05-26 Don Olmstead <don.olmstead@sony.com>
[CMake] Support USE_ANGLE_EGL on additional platforms
https://bugs.webkit.org/show_bug.cgi?id=224888
<rdar://problem/77280211>
Reviewed by Ken Russell.
Use the ANGLE library targets when applicable.
* CMakeLists.txt:
2021-05-26 Chris Dumez <cdumez@apple.com>
Add release logging in WebPage::runJavaScriptInFrameInScriptWorld()
https://bugs.webkit.org/show_bug.cgi?id=226286
Reviewed by Geoffrey Garen.
Add release logging in WebPage::runJavaScriptInFrameInScriptWorld(). We have logging on UIProcess side but not on
WebProcess side. It makes it hard to determine if the WebProcess processed the request to run JS or not.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
2021-05-25 Lauro Moura <lmoura@igalia.com>
Unreviewed, another GCC8 build fix after r278035
https://bugs.webkit.org/show_bug.cgi?id=211674
Missed from previous patch.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::decode):
2021-05-25 Lauro Moura <lmoura@igalia.com>
Unreviewed, fix GCC8 build after r278035
Avoid "...from initializer list would use explicit constructor ..." errors
in GCC8 when initializing std::optional.
* Shared/SandboxExtension.h:
(WebKit::SandboxExtension::HandleArray::decode):
2021-05-25 Julian Gonzalez <julian_a_gonzalez@apple.com>
_WKRemoteObjectRegistry should not call completion handlers if block signatures don't match or can't be found
https://bugs.webkit.org/show_bug.cgi?id=226189
Reviewed by Chris Dumez.
_WKRemoteObjectRegistry already enforces completion handlers to not be nil,
so complete that enforcement by dropping invocations where block signatures aren't available
or don't match. This has not reproduced but completes our hardening efforts.
* Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
(-[_WKRemoteObjectRegistry _invokeMethod:]):
2021-05-25 Tim Horton <timothy_horton@apple.com>
Virtualize GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=226170
Reviewed by Simon Fraser.
* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
* Shared/win/ShareableBitmapDirect2D.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::incorporateUpdate):
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _drawPreview:]):
* UIProcess/win/BackingStoreDirect2D.cpp:
* UIProcess/win/WebPopupMenuProxyWin.cpp:
(WebKit::WebPopupMenuProxyWin::paint):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::paintControlForLayerInContext):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::pdfSnapshotAtSize):
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::drawPagesToPDFImpl):
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
(WebKit::WebPrintOperationGtk::renderPage):
2021-05-25 Don Olmstead <don.olmstead@sony.com>
[PlayStation] Update usage of libWPE API
https://bugs.webkit.org/show_bug.cgi?id=226231
Reviewed by Ross Kirsling.
Update to use 1.6.0+ API version.
* UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp:
(WKPageHandleWheelEvent):
2021-05-24 Darin Adler <darin@apple.com>
Switch from WTF::Optional to std::optional
https://bugs.webkit.org/show_bug.cgi?id=211674
Reviewed by Chris Dumez.
* Platform/IPC/ArgumentCoder.h:
(IPC::ArgumentCoder::decode): Add a WTFMove. Turns out this was not needed
to get compiling with std::optional, but it's a good idea for performance.
This is one of those cases where it looks like the return value optimization
would work, but it doesn't because the return value doesn't exactly match
the local variable's type.
* Shared/TouchBarMenuData.h: Remove some overzealous use of explicit that
was preventing some files from compiling with the stricter std::optional
constructor rules, while it did not prevent compiling with WTF::Optional.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::switchToBrowsingContext): Removed an unused
lambda capture and local variable. Not clear how this is related to
std::optional, but showed up as a compiler warning.
2021-05-25 Matt Mokary <mmokary@apple.com>
Ensure app highlight visibility observer is initialized before adding a new highlight
https://bugs.webkit.org/show_bug.cgi?id=226214
rdar://78173370
Reviewed by Wenson Hsieh.
The app highlight visibility observer is initialized before restoring highlights, but was not initialized
before adding a new one. It must be initialized before adding a highlight so a change in visibility resulting
from a new highlight is handled correct.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createAppHighlightInSelectedRange):
2021-05-25 Simon Fraser <simon.fraser@apple.com>
Initialize WebCore and WebKit logging channels in the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=226210
Reviewed by Andy Estes.
Send the strings representing the enabled WebCore and WebKit logging channels to the
GPU Process, and use them to initialize log channels there, as we do for the WebContent
process.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::encode const):
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
2021-05-24 Zan Dobersek <zdobersek@igalia.com>
[CoordinatedGraphics] Handle null native surface handle for surfaceless rendering
https://bugs.webkit.org/show_bug.cgi?id=226165
Reviewed by Philippe Normand.
During ThreadedCompositor initialization, a null native surface handle
would represent a surfaceless rendering target. Assuming corresponding
driver support for this behavior, the GL context creation would still
succeed and composition could be performed.
To support this behavior, the GL context is now spawned first, and if
successful, the scene is set as active. But in case of a null native
surface (i.e. surfaceless rendering), the painting has to be mirrored
by default because of the OpenGL coordinate system being the immediate
coordinate system inside which we end up working.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::createGLContext):
2021-05-24 Chris Dumez <cdumez@apple.com>
[GLIB] Stop using UncheckedLock in IconDatabase
https://bugs.webkit.org/show_bug.cgi?id=226190
Reviewed by Sam Weinig.
Stop using UncheckedLock in IconDatabase to benefit from Clang thread-safety analysis.
* UIProcess/API/glib/IconDatabase.h:
2021-05-24 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Adjust meaningful click heuristic to detect focus changes and editable content
https://bugs.webkit.org/show_bug.cgi?id=226199
rdar://78368624
Reviewed by Tim Horton.
Fine tune the "meaningful click" heuristic by not dispatching a non-meaningful click message to the UI process
in the cases where the tap:
- Causes the focused element to change.
- Is over a form control or editable element.
Test: fast/events/ios/meaningful-click-when-focusing-body.html
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
2021-05-24 Devin Rousso <drousso@apple.com>
[iOS DnD] [WK2] don't cancel the long-press gesture until we know we have `UIDragItem`
https://bugs.webkit.org/show_bug.cgi?id=226188
<rdar://problem/77448503>
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dragInteraction:prepareForSession:completion:]):
(-[WKContentView dragInteraction:itemsForBeginningSession:]):
Instead of `_cancelLongPressGestureRecognizer` when first asked to get `UIDragItem`, only
call it once we actually have `UIDragItem`. This shouldn't change the behavior of r218812
as we're still `_cancelLongPressGestureRecognizer` before generating `UITargetedDragPreview`
or animating them (i.e. before the drag starts). This allows a synthetic click from a
long-press gesture to be dispatched in the case that drag gesture has no items.
2021-05-24 Chris Fleizach <cfleizach@apple.com>
AX: Fix build failure for WK API WTF::String usage
https://bugs.webkit.org/show_bug.cgi?id=226204
Reviewed by Tim Horton.
Build fix for WTF string usage.
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKAccessibilityTestingInjectPreference):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2021-05-24 Sam Weinig <weinig@apple.com>
Convert DestinationColorSpace from an enum to class wrapping a platform color space (CGColorSpaceRef for CG ports, etc.)
https://bugs.webkit.org/show_bug.cgi?id=226143
Reviewed by Darin Adler.
- Update ImageBuffer subclass signatures to use "const DestinationColorSpace&" to
conform to the base class.
- Replace ColorSpaceData with Optional<DestinationColorSpace>. No reason to have two
types that are the same.
- Give all ports a color space configuration for ShareableBitmap now that there is
a common class for representing color space.
- Update DisplayList decoding to account for BeginClipToDrawingCommands and GetPixelBuffer
no longer being inlineable due to now having non-trivial destructors due to
DestinationColorSpace member.
* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::create):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::Configuration::encode const):
(WebKit::ShareableBitmap::Configuration::decode):
* Shared/ShareableBitmap.h:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::colorSpace):
* Shared/mac/ColorSpaceData.h: Removed.
* Shared/mac/ColorSpaceData.mm: Removed.
* SourcesCocoa.txt:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::colorSpace):
* UIProcess/PageClient.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::recursivelyMapIOSurfaceBackingStore):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::colorSpace):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::colorSpace):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::configuration):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::create):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::createFrameImageAtIndex):
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime):
(WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createImageBuffer const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertDragImageToBitmap):
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setColorSpace):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::snapshotOptionsToBitmapConfiguration):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setColorSpace):
2021-05-24 Dana Estra <destra@apple.com>
Remove deprecated API usage in PageClientImplMac
https://bugs.webkit.org/show_bug.cgi?id=226184
Reviewed by Devin Rousso.
Covered by existing tests.
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::screenToRootView):
(WebKit::PageClientImpl::rootViewToScreen):
2021-05-24 Chris Fleizach <cfleizach@apple.com>
AX: Settings: Increase contrast isn't detected in browser until an additional setting is applied
https://bugs.webkit.org/show_bug.cgi?id=225909
Reviewed by Per Arne Vollan.
Tests: accessibility/mac/media-query-values-change.html
1) WebContent blocks access to distributed notification center, so we can't rely on that to re-post notifications
2) AppKit caches the values of these AX settings, so we need to invalidate that cache directly
* Platform/spi/mac/AppKitSPI.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKAccessibilityTestingInjectPreference):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::invertColorsPreferenceKey):
(WebKit::dispatchSimulatedNotificationsForPreferenceChange):
(WebKit::setPreferenceValue):
(WebKit::reduceMotionPreferenceKey): Deleted.
2021-05-24 Darin Adler <darin@apple.com>
Remove StringBuilder::appendLiteral
https://bugs.webkit.org/show_bug.cgi?id=226137
Reviewed by Chris Dumez.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList): Use append
instead of appendLiteral.
(WebKit::domainsToString): Ditto.
(WebKit::buildList): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics): Ditto.
(WebKit::appendBoolean): Ditto.
(WebKit::appendNextEntry): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Ditto.
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics): Ditto.
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Ditto.
(WebKit::domainsToString): Ditto.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::create): Moved this here from the header.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::toString const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::encode const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::decode): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::operator== const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::toString const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::encode const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::decode): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::operator< const): Ditto.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Moved member
functions of the nested structures into the implementation file and fixed
the indentation of the structures to indicate the nesting.
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::continueCheckingRequest): Do not use a local
variable for the reuslt of makeString.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::newTestingSession): Ditto.
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::dumpContentsToFile): Use append instead of appendLiteral
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::asJSON const): Ditto.
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::makeVersionedDirectoryPath): Do not use a local variable for
the result of makeString.
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::buildAcceptLanguages): Use append instead of appendLiteral.
* NetworkProcess/soup/WebSocketTaskSoup.cpp:
(WebKit::WebSocketTask::acceptedExtensions const): Ditto.
* NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
(WebKit::NetworkMDNSRegister::registerMDNSName): Use auto for the result of makeString.
* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::writeHeaders): Ditto.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::initializeSandboxParameters): Do not use a local variable for the result of
makeString. Also, take advantage of the support for concatenating an NSString instead
of converting it to a WTF::String.
* Shared/mac/WebMemorySampler.mac.mm:
(WebKit::WebMemorySampler::sampleWebKit const): Use ASCIILiteral and remove explicit
conversion to String.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewRunJavaScriptCallback): Use append instead of appendLiteral.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::fileCanBeAcceptedForUpload): Use auto for result of makeString.
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Use makeString instead of
StringBuilder.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::requestStorageSpace): Use auto for result of makeString.
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::loggingString): Use append instead of appendLiteral.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processDidFinishLaunching): Use auto for result of makeString.
(WebKit::WebProcessPool::startMemorySampler): Ditto.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::dumpHistoryItem): Use append instead of appendLiteral.
(WebKit::WebPage::getContentsAsString): Ditto.
2021-05-24 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277940.
https://bugs.webkit.org/show_bug.cgi?id=226182
Caused Safari crash under IPC::typeFromCFTypeRef
Reverted changeset:
"Convert DestinationColorSpace from an enum to class wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.)"
https://bugs.webkit.org/show_bug.cgi?id=226143
https://trac.webkit.org/changeset/277940
2021-05-24 Chris Dumez <cdumez@apple.com>
Drop CheckedLock / CheckedCondition aliases
https://bugs.webkit.org/show_bug.cgi?id=226176
Reviewed by Kate Cheney.
Drop CheckedLock / CheckedCondition aliases now that they are the default.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/WebStorage/StorageManagerSet.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
* NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h:
* NetworkProcess/glib/DNSCache.h:
* Platform/IPC/Connection.cpp:
* Platform/IPC/Connection.h:
* Platform/IPC/StreamConnectionWorkQueue.h:
* Platform/IPC/StreamServerConnection.h:
* Shared/BlockingResponseMap.h:
* Shared/Cocoa/XPCEndpointClient.h:
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
* Shared/mac/MediaFormatReader/MediaFormatReader.h:
* Shared/mac/MediaFormatReader/MediaSampleCursor.h:
* Shared/mac/MediaFormatReader/MediaTrackReader.h:
* UIProcess/API/glib/IconDatabase.h:
* UIProcess/WebURLSchemeTask.h:
* UIProcess/mac/DisplayLink.h:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView knowsPageRange:]):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
* WebProcess/Network/WebSocketStream.cpp:
* WebProcess/Plugins/PluginProcessConnectionManager.h:
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/ViewUpdateDispatcher.h:
2021-05-23 Chris Dumez <cdumez@apple.com>
Make CheckedLock the default Lock
https://bugs.webkit.org/show_bug.cgi?id=226157
Reviewed by Darin Adler.
Make CheckedLock the default Lock so that we get more benefits from Clang
Thread Safety Analysis. Note that CheckedLock 100% relies on the existing
Lock implementation and merely adds the clang anotations for thread
safety.
That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
UncheckedLock / UncheckedCondition if I got a build failure. Build
failures are usually caused by the following facts:
- Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
JSC code passes as argument
- Locker<CheckedLock> has no move constructor
- Locker<CheckedLock> cannot be constructed from a lock pointer, only
a reference
For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.
I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
* UIProcess/API/glib/IconDatabase.h:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView knowsPageRange:]):
2021-05-23 Sam Weinig <weinig@apple.com>
Convert DestinationColorSpace from an enum to class wrapping a platform color space (CGColorSpaceRef for CG ports, etc.)
https://bugs.webkit.org/show_bug.cgi?id=226143
Reviewed by Darin Adler.
- Update ImageBuffer subclass signatures to use "const DestinationColorSpace&" to
conform to the base class.
- Replace ColorSpaceData with Optional<DestinationColorSpace>. No reason to have two
types that are the same.
- Give all ports a color space configuration for ShareableBitmap now that there is
a common class for representing color space.
- Update DisplayList decoding to account for BeginClipToDrawingCommands and GetPixelBuffer
no longer being inlineable due to now having non-trivial destructors due to
DestinationColorSpace member.
* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::create):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::Configuration::encode const):
(WebKit::ShareableBitmap::Configuration::decode):
* Shared/ShareableBitmap.h:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::colorSpace):
* Shared/mac/ColorSpaceData.h: Removed.
* Shared/mac/ColorSpaceData.mm: Removed.
* SourcesCocoa.txt:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::colorSpace):
* UIProcess/PageClient.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::recursivelyMapIOSurfaceBackingStore):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::colorSpace):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::colorSpace):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::configuration):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::create):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::createFrameImageAtIndex):
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime):
(WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createImageBuffer const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertDragImageToBitmap):
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setColorSpace):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::snapshotOptionsToBitmapConfiguration):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setColorSpace):
2021-05-23 Chris Dumez <cdumez@apple.com>
Use CheckedLock in even more places
https://bugs.webkit.org/show_bug.cgi?id=226152
Reviewed by Darin Adler.
Use CheckedLock in even more places to benefit from Clang Thread Safety Analysis.
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
* NetworkProcess/glib/DNSCache.h:
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::locateIterator const):
(WebKit::MediaSampleCursor::locateMediaSample const):
(WebKit::MediaSampleCursor::locateTiming const):
(WebKit::MediaSampleCursor::stepInOrderedMap):
(WebKit::MediaSampleCursor::stepInPresentationTime):
(WebKit::MediaSampleCursor::getMediaSample const):
(WebKit::MediaSampleCursor::getTiming const):
(WebKit::MediaSampleCursor::getPlayableHorizon const):
* Shared/mac/MediaFormatReader/MediaSampleCursor.h:
2021-05-22 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Implement page client hook for requesting image extraction results
https://bugs.webkit.org/show_bug.cgi?id=226144
rdar://78355604
Reviewed by Tim Horton.
Add a method stub for `PageClientImpl::requestImageExtraction`, which currently just invokes the completion
handler with empty results. See bug for more details.
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestImageExtraction):
* UIProcess/ios/WKContentViewInteraction.h:
2021-05-22 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in more places
https://bugs.webkit.org/show_bug.cgi?id=226138
Reviewed by Darin Adler.
Adopt CheckedLock in more places to benefit from Clang Thread Safety Analysis.
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::enqueueMatchingMessages):
(IPC::Connection::SyncMessageState::processIncomingMessage):
(IPC::Connection::SyncMessageState::dispatchMessages):
(IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection):
2021-05-22 Chris Dumez <cdumez@apple.com>
Replace LockHolder with Locker in local variables
https://bugs.webkit.org/show_bug.cgi?id=226133
Reviewed by Darin Adler.
Replace LockHolder with Locker in local variables. It is shorter and it allows switching the lock
type more easily since the compiler with deduce the lock type T for Locker<T>.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::m_closeCallback):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::openDatabase):
(WebKit::WebIDBServer::deleteDatabase):
(WebKit::WebIDBServer::abortTransaction):
(WebKit::WebIDBServer::commitTransaction):
(WebKit::WebIDBServer::didFinishHandlingVersionChangeTransaction):
(WebKit::WebIDBServer::createObjectStore):
(WebKit::WebIDBServer::deleteObjectStore):
(WebKit::WebIDBServer::renameObjectStore):
(WebKit::WebIDBServer::clearObjectStore):
(WebKit::WebIDBServer::createIndex):
(WebKit::WebIDBServer::deleteIndex):
(WebKit::WebIDBServer::renameIndex):
(WebKit::WebIDBServer::putOrAdd):
(WebKit::WebIDBServer::getRecord):
(WebKit::WebIDBServer::getAllRecords):
(WebKit::WebIDBServer::getCount):
(WebKit::WebIDBServer::deleteRecord):
(WebKit::WebIDBServer::openCursor):
(WebKit::WebIDBServer::iterateCursor):
(WebKit::WebIDBServer::establishTransaction):
(WebKit::WebIDBServer::databaseConnectionPendingClose):
(WebKit::WebIDBServer::databaseConnectionClosed):
(WebKit::WebIDBServer::abortOpenAndUpgradeNeeded):
(WebKit::WebIDBServer::didFireVersionChangeEvent):
(WebKit::WebIDBServer::openDBRequestCancelled):
(WebKit::WebIDBServer::getAllDatabaseNamesAndVersions):
(WebKit::WebIDBServer::addConnection):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::close):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::writeSizeFile):
(WebKit::CacheStorage::Engine::readSizeFile):
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
(WebKit::CacheStorage::Engine::deleteNonEmptyDirectoryOnBackgroundThread):
* NetworkProcess/glib/DNSCache.cpp:
(WebKit::DNSCache::lookup):
(WebKit::DNSCache::update):
(WebKit::DNSCache::removeExpiredResponsesFired):
(WebKit::DNSCache::clear):
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::suspend):
(WebKit::CompositingRunLoop::resume):
(WebKit::CompositingRunLoop::scheduleUpdate):
(WebKit::CompositingRunLoop::stopUpdates):
(WebKit::CompositingRunLoop::updateTimerFired):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::setScaleFactor):
(WebKit::ThreadedCompositor::setScrollPosition):
(WebKit::ThreadedCompositor::setViewportSize):
(WebKit::ThreadedCompositor::renderLayerTree):
(WebKit::ThreadedCompositor::sceneUpdateFinished):
(WebKit::ThreadedCompositor::updateSceneState):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::clearLoadedIconsTimerFired):
(WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
(WebKit::IconDatabase::loadIconForPageURL):
(WebKit::IconDatabase::iconURLForPageURL):
(WebKit::IconDatabase::setIconForPageURL):
(WebKit::IconDatabase::clear):
2021-05-22 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277913.
https://bugs.webkit.org/show_bug.cgi?id=226140
Caused multiple layout-test crash on mac debug queues
Reverted changeset:
"Replace LockHolder with Locker in local variables"
https://bugs.webkit.org/show_bug.cgi?id=226133
https://trac.webkit.org/changeset/277913
2021-05-21 Chris Dumez <cdumez@apple.com>
Replace LockHolder with Locker in local variables
https://bugs.webkit.org/show_bug.cgi?id=226133
Reviewed by Darin Adler.
Replace LockHolder with Locker in local variables. It is shorter and it allows switching the lock
type more easily since the compiler with deduce the lock type T for Locker<T>.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::m_closeCallback):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::openDatabase):
(WebKit::WebIDBServer::deleteDatabase):
(WebKit::WebIDBServer::abortTransaction):
(WebKit::WebIDBServer::commitTransaction):
(WebKit::WebIDBServer::didFinishHandlingVersionChangeTransaction):
(WebKit::WebIDBServer::createObjectStore):
(WebKit::WebIDBServer::deleteObjectStore):
(WebKit::WebIDBServer::renameObjectStore):
(WebKit::WebIDBServer::clearObjectStore):
(WebKit::WebIDBServer::createIndex):
(WebKit::WebIDBServer::deleteIndex):
(WebKit::WebIDBServer::renameIndex):
(WebKit::WebIDBServer::putOrAdd):
(WebKit::WebIDBServer::getRecord):
(WebKit::WebIDBServer::getAllRecords):
(WebKit::WebIDBServer::getCount):
(WebKit::WebIDBServer::deleteRecord):
(WebKit::WebIDBServer::openCursor):
(WebKit::WebIDBServer::iterateCursor):
(WebKit::WebIDBServer::establishTransaction):
(WebKit::WebIDBServer::databaseConnectionPendingClose):
(WebKit::WebIDBServer::databaseConnectionClosed):
(WebKit::WebIDBServer::abortOpenAndUpgradeNeeded):
(WebKit::WebIDBServer::didFireVersionChangeEvent):
(WebKit::WebIDBServer::openDBRequestCancelled):
(WebKit::WebIDBServer::getAllDatabaseNamesAndVersions):
(WebKit::WebIDBServer::addConnection):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::close):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::writeSizeFile):
(WebKit::CacheStorage::Engine::readSizeFile):
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
(WebKit::CacheStorage::Engine::deleteNonEmptyDirectoryOnBackgroundThread):
* NetworkProcess/glib/DNSCache.cpp:
(WebKit::DNSCache::lookup):
(WebKit::DNSCache::update):
(WebKit::DNSCache::removeExpiredResponsesFired):
(WebKit::DNSCache::clear):
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::suspend):
(WebKit::CompositingRunLoop::resume):
(WebKit::CompositingRunLoop::scheduleUpdate):
(WebKit::CompositingRunLoop::stopUpdates):
(WebKit::CompositingRunLoop::updateTimerFired):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::setScaleFactor):
(WebKit::ThreadedCompositor::setScrollPosition):
(WebKit::ThreadedCompositor::setViewportSize):
(WebKit::ThreadedCompositor::renderLayerTree):
(WebKit::ThreadedCompositor::sceneUpdateFinished):
(WebKit::ThreadedCompositor::updateSceneState):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::clearLoadedIconsTimerFired):
(WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
(WebKit::IconDatabase::loadIconForPageURL):
(WebKit::IconDatabase::iconURLForPageURL):
(WebKit::IconDatabase::setIconForPageURL):
(WebKit::IconDatabase::clear):
2021-05-21 Chris Dumez <cdumez@apple.com>
Stop using holdLock() in WebKit/WebKitLegacy/Tools as it is not compatible with Clang thread safety analysis
https://bugs.webkit.org/show_bug.cgi?id=226127
Reviewed by Alex Christensen.
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::close):
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::releaseDecoder):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
(WebKit::LibWebRTCCodecsProxy::releaseEncoder):
(WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::enqueueMatchingMessages):
(IPC::Connection::SyncMessageState::processIncomingMessage):
(IPC::Connection::SyncMessageState::dispatchMessages):
(IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::copy):
(WebKit::MediaSampleCursor::getSampleMap const):
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
(prepareDataForPrintingOnSecondaryThread):
2021-05-21 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Expand sandbox with missing sysctl-read handles for core CPU and cache features
https://bugs.webkit.org/show_bug.cgi?id=226126
<rdar://problem/78218756>
Reviewed by Per Arne Vollan.
Update our sandbox profiles to permit read access to a set of CPU and cache features that have been requested by
our sandbox and system framework teams. These have been judged to be safe to expose to our processes, and will
allow frameworks to make optimal use of the system WebKit is running on.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-21 Sam Weinig <weinig@apple.com>
Make CGColorSpaceRef argument coding match other CF objects and use CGColorSpaceCreateWithPropertyList for fallback
https://bugs.webkit.org/show_bug.cgi?id=226112
Reviewed by Darin Adler.
This is a precursor to some color space type unification. This change:
- Modernizes CF arugment coders to use ArgumentCoder specialization. It also means
we now support encoding CF types both as plain types and RetainPtr<> types, with
decoding being kept only supporing RetainPtr<>s, as decoding into non-smart pointer
is not very useful.
- Move CGColorSpaceRef coding to ArgumentCodersCF and use CGColorSpaceCopyPropertyList
and CGColorSpaceCreateWithPropertyList as the fallback coding (if there is no name),
matching what other libraries on macOS and iOS do.
- Switch ColorSpaceData to be a struct wrapping an Optional<RetainPtr<CGColorSpaceRef>>
and use the new shared coding. This will be replaced entirely in subsequent changes
so I didn't want to change this too much now.
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* Shared/Cocoa/ArgumentCodersCocoa.mm:
(IPC::encodeDataInternal):
(IPC::decodeDataInternal):
(IPC::encodeDateInternal):
(IPC::decodeDateInternal):
(IPC::encodeNumberInternal):
(IPC::decodeNumberInternal):
(IPC::encodeSecureCodingInternal):
(IPC::decodeSecureCodingInternal):
(IPC::encodeStringInternal):
(IPC::decodeStringInternal):
(IPC::encodeURLInternal):
(IPC::decodeURLInternal):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<Ref<Font>>::encodePlatformData):
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData):
* Shared/FontInfo.cpp:
(WebKit::FontInfo::encode const):
(WebKit::FontInfo::decode):
* Shared/Plugins/PluginProcessCreationParameters.cpp:
(WebKit::PluginProcessCreationParameters::encode const):
(WebKit::PluginProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/cf/ArgumentCodersCF.cpp:
(IPC::typeFromCFTypeRef):
(IPC::ArgumentCoder<CFTypeRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFTypeRef>>::decode):
(IPC::ArgumentCoder<CFArrayRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFArrayRef>>::decode):
(IPC::ArgumentCoder<CFBooleanRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFBooleanRef>>::decode):
(IPC::ArgumentCoder<CFDataRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFDataRef>>::decode):
(IPC::ArgumentCoder<CFDateRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFDateRef>>::decode):
(IPC::ArgumentCoder<CFDictionaryRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFDictionaryRef>>::decode):
(IPC::ArgumentCoder<CFNumberRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFNumberRef>>::decode):
(IPC::ArgumentCoder<CFStringRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFStringRef>>::decode):
(IPC::ArgumentCoder<CFURLRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CFURLRef>>::decode):
(IPC::ArgumentCoder<CGColorSpaceRef>::encode):
(IPC::ArgumentCoder<RetainPtr<CGColorSpaceRef>>::decode):
(IPC::ArgumentCoder<SecCertificateRef>::encode):
(IPC::ArgumentCoder<RetainPtr<SecCertificateRef>>::decode):
(IPC::ArgumentCoder<SecKeychainItemRef>::encode):
(IPC::ArgumentCoder<RetainPtr<SecKeychainItemRef>>::decode):
(IPC::ArgumentCoder<SecAccessControlRef>::encode):
(IPC::ArgumentCoder<RetainPtr<SecAccessControlRef>>::decode):
(IPC::ArgumentCoder<SecTrustRef>::encode):
(IPC::ArgumentCoder<RetainPtr<SecTrustRef>>::decode):
(IPC::encode): Deleted.
(IPC::decode): Deleted.
* Shared/cf/ArgumentCodersCF.h:
(IPC::CFRetainPtrArgumentCoder::encode):
* Shared/mac/ColorSpaceData.mm:
(WebKit::ColorSpaceData::encode const):
(WebKit::ColorSpaceData::decode):
(): Deleted.
* Shared/mac/SecItemRequestData.cpp:
(WebKit::SecItemRequestData::encode const):
(WebKit::SecItemRequestData::decode):
* Shared/mac/SecItemResponseData.cpp:
(WebKit::SecItemResponseData::encode const):
(WebKit::SecItemResponseData::decode):
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::CertificateInfo>::encode):
(IPC::ArgumentCoder<WebCore::CertificateInfo>::decode):
(IPC::encodeNSError):
(IPC::decodeNSError):
(IPC::ArgumentCoder<WebCore::ContentFilterUnblockHandler>::encode):
(IPC::ArgumentCoder<WebCore::ContentFilterUnblockHandler>::decode):
2021-05-21 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Adopt QLItem in WKImageExtractionPreviewController
https://bugs.webkit.org/show_bug.cgi?id=226114
rdar://76657718
Reviewed by Tim Horton.
Adopt `QLItem` in `WKImageExtractionPreviewController`, and use it in place of `WKImageExtractionPreviewItem`.
This allows us to vend image previews based solely on image data, rather than a file on disk.
* UIProcess/mac/WKImageExtractionPreviewController.h:
* UIProcess/mac/WKImageExtractionPreviewController.mm:
(-[WKImageExtractionPreviewController initWithPage:imageData:title:imageURL:]):
(-[WKImageExtractionPreviewController provideDataForItem:]):
(-[WKImageExtractionPreviewController previewPanel:previewItemAtIndex:]):
(-[WKImageExtractionPreviewItem initWithFileURL:title:imageURL:pageURL:]): Deleted.
(-[WKImageExtractionPreviewItem dealloc]): Deleted.
(-[WKImageExtractionPreviewItem previewItemURL]): Deleted.
(-[WKImageExtractionPreviewItem previewItemTitle]): Deleted.
(-[WKImageExtractionPreviewItem previewOptions]): Deleted.
(-[WKImageExtractionPreviewController initWithPage:fileURL:title:imageURL:]): Deleted.
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController willDestroyView:]):
Adopt the new QuickLookUI softlinking header in PAL.
2021-05-21 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Expand IOKit method filters to cover items encountered during testing
https://bugs.webkit.org/show_bug.cgi?id=226106
<rdar://problem/78327511>
Reviewed by Per Arne Vollan.
Allow additional IOKit methods based on testing results and the method values we hit during normal operations.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-21 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in RemoteImageBufferProxy
https://bugs.webkit.org/show_bug.cgi?id=226098
Reviewed by Tim Horton.
Adopt CheckedLock in RemoteImageBufferProxy to benefit from Clang Thread Safety Analysis.
I had to use WTF_IGNORES_THREAD_SAFETY_ANALYSIS on one of the getter where we weren't
locking. My understanding is that the code is currently safe without the lock in this
case and I added a comment and assertions to clarify that.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::waitForDidFlushOnSecondaryThread):
2021-05-21 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in NetworkCache::Storage::TraverseOperation
https://bugs.webkit.org/show_bug.cgi?id=226101
Reviewed by Darin Adler.
Adopt CheckedLock in NetworkCache::Storage::TraverseOperation to benefit from Clang
Thread Safety Analysis.
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::TraverseOperation::WTF_GUARDED_BY_LOCK):
(WebKit::NetworkCache::Storage::traverse):
2021-05-21 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in MediaFormatReader and fix threading bug
https://bugs.webkit.org/show_bug.cgi?id=226100
Reviewed by Darin Adler.
Adopt CheckedLock in MediaFormatReader and fix threading bug found by Clang Thread Safety
Analysis. In particular, parseByteSource() was failing to grab the lock before updating
m_parseTracksStatus in one of its branches.
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::parseByteSource):
(WebKit::MediaFormatReader::didParseTracks):
(WebKit::MediaFormatReader::didProvideMediaData):
(WebKit::MediaFormatReader::finishParsing):
(WebKit::MediaFormatReader::copyProperty):
(WebKit::MediaFormatReader::copyTrackArray):
* Shared/mac/MediaFormatReader/MediaFormatReader.h:
2021-05-21 Chris Dumez <cdumez@apple.com>
[Cocoa] Unable to upload files that are stored in the cloud (without a local copy)
https://bugs.webkit.org/show_bug.cgi?id=226090
<rdar://77775887>
Reviewed by Darin Adler.
Allow the network process to load / read dataless files stored in the cloud by allowing
the process to materialize such files. I initially only allowed the AsyncFileStream
thread to materialize the dataless files and this was enough to make the file upload
use cases work. However, I noticed that drag and dropping such file in the Safari URL
bar would fail loading, which I think is bad user experience. As a result, I have
decided to allow the materializing at network process level.
I have verified manually that I can now upload such dataless files via either file
picker or drag and drop (used https://blueimp.github.io/jQuery-File-Upload/). I have
also verified that drag and dropping such a file in the Safari URL bar successfuly
loads that file.
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2021-05-21 Brent Fulgham <bfulgham@apple.com>
[Cocoa] GPU Process should recognize that pathForProcessContainer() might fail and handle it gracefully
https://bugs.webkit.org/show_bug.cgi?id=226086
<rdar://problem/78288016>
Reviewed by Tim Horton.
The GPU Process implementation of gpuProcessCachesDirectory does not recognize that WebKit often runs without
a container (e.g., as part of a daemon process). In such cases, the GPU process will attempt to create a
cache directory someplace outside of its sandbox and fail, preventing caching from happening.
We need to use the same logic we use in the WebContent process to address this use case.
To avoid making this mistake again, let's consolidate the logic in one method, and use it in the multiple places
that have this same code.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::cacheDirectoryInContainerOrHomeDirectory): Added.
(WebKit::WebProcessPool::cookieStorageDirectory): Use the new 'cacheDirectoryInContainerOrHomeDirectory' method.
(WebKit::WebProcessPool::networkingCachesDirectory): Ditto.
(WebKit::WebProcessPool::webContentCachesDirectory): Ditto.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::gpuProcessCachesDirectory): Ditto.
* UIProcess/WebProcessPool.h:
2021-05-21 Chris Dumez <cdumez@apple.com>
Replace more static Locks with CheckedLocks in WebKit / WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=226093
Reviewed by Darin Adler.
Replace more static Locks with CheckedLocks so that we can benefit from Clang Thread Safety Analysis.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
(WebKit::WebResourceLoadStatisticsStore::suspend):
(WebKit::WebResourceLoadStatisticsStore::resume):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* Platform/IPC/Connection.cpp:
(IPC::WTF_REQUIRES_LOCK):
(IPC::addAsyncReplyHandler):
(IPC::clearAsyncReplyHandlers):
(IPC::CompletionHandler<void):
* WebProcess/Network/WebSocketStream.cpp:
(WebKit::WebSocketStream::streamWithIdentifier):
(WebKit::WebSocketStream::networkProcessCrashed):
(WebKit::WebSocketStream::WebSocketStream):
(WebKit::WebSocketStream::~WebSocketStream):
2021-05-21 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in cases where we try-lock
https://bugs.webkit.org/show_bug.cgi?id=226056
Reviewed by Alex Christensen.
Use CheckedLock more in cases where we try-lock to benefit from Clang
Thread Safety Analysis.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::releaseDecoder):
(WebKit::LibWebRTCCodecs::registerDecodeFrameCallback):
(WebKit::LibWebRTCCodecs::completedDecoding):
(WebKit::LibWebRTCCodecs::releaseEncoder):
(WebKit::LibWebRTCCodecs::registerEncodeFrameCallback):
(WebKit::LibWebRTCCodecs::completedEncoding):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
(WebKit::LibWebRTCCodecs::Decoder::WTF_GUARDED_BY_LOCK):
(WebKit::LibWebRTCCodecs::Encoder::WTF_GUARDED_BY_LOCK):
2021-05-21 Per Arne <pvollan@apple.com>
Accessibility caption styles does not always reflect the selection
https://bugs.webkit.org/show_bug.cgi?id=226084
<rdar://75426845>
Reviewed by Chris Fleizach.
This is caused by a race between pushing the caption preference value to the WebContent process and receiving the notification in that process.
This patch addresses this by reposting the notification after having set the preference value in the WebContent process.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::captionProfilePreferenceKey):
(WebKit::dispatchSimulatedNotificationsForPreferenceChange):
2021-05-21 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] REGRESSION(Sandbox): Font smoothing within Safari doesn't seem to respect AppleFontSmoothing
https://bugs.webkit.org/show_bug.cgi?id=226066
<rdar://problem/72795817>
Reviewed by Per Arne Vollan.
We accidentally blocked access to the relevant defaults database.
It turns out this is untestable. I can't use the actual functionality without actually setting the preference
for the whole user (and all their apps). And, I can't use sandbox_check() to make sure the file is readable
because it's in the user's home directory, so the path to check will be different for every user.
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-21 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Plumb element bounds when presenting QLPreviewController for image extraction
https://bugs.webkit.org/show_bug.cgi?id=226085
rdar://76020349
Reviewed by Tim Horton.
Include the previewed element's bounding rect when presenting QuickLook for image extraction. See the bug for
more details.
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
2021-05-21 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, late-ish May 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=225990
Unreviewed non-unified build fixes.
* NetworkProcess/PreconnectTask.h: Add missing forward declaration for NetworkSession.
* NetworkProcess/WebStorage/LocalStorageDatabase.h: Add missing wtf/HashMap.h header,
remove unneeded wtf/RefCounted.h header.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode): Add missing WebCore:: namespace prefix to
usage of WebCore::MediaProducer::MutedStateFlags.
2021-05-21 Youenn Fablet <youenn@apple.com>
Implement a remote Internal Unit in GPUProcess for audio MediaStreamTrack rendering
https://bugs.webkit.org/show_bug.cgi?id=225603
Reviewed by Eric Carlson.
Implement an InternalUnit by creating a ring buffer that gets written on WebProcess and read on GPUProcess by an audio unit.
In the previous implementation, each audio track was sent to GPUProcess that was doing the mixing.
Sending was done by sending IPC message for each audio sample, which was also processing inefficient.
We are now creating an Audio Unit in GPUProcess and similarly to WebAudio asking WebProcess to render audio in a buffer that will be actually rendered by the audio unit.
The mixing happens in WebProcess so only one buffer is shared between GPUProcess and WebProcess, and no IPC message is sent for each chunk.
The potential downside is that the mixing is done with fixed chunk size instead of chunk size requested by the audio unit.
This might trigger some latency or some overhead if the fixed chunk size is too far from what the audio unit is asking.
In case of GPUProcess crash, we keep the same format description but we delay recreation of the unit if the unit is stopped.
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::audioMediaStreamTrackRendererInternalUnitManager):
(WebKit::GPUConnectionToWebProcess::dispatchMessage):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
(WebKit::RemoteAudioMediaStreamTrackRenderer::start):
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp: Added.
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::RemoteAudioMediaStreamTrackRendererInternalUnitManager):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::~RemoteAudioMediaStreamTrackRendererInternalUnitManager):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::createUnit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::deleteUnit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::startUnit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::stopUnit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::setAudioOutputDevice):
(WebKit::renderCallback):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::Unit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::~Unit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::start):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::stop):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::setAudioOutputDevice):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::render):
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.h: Added.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.messages.in: Added.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
(WebKit::AudioMediaStreamTrackRenderer::start):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h:
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererInternalUnitIdentifier.h: Added.
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererInternalUnitManager.cpp: Added.
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::add):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::remove):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::createRemoteInternalUnit):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::gpuProcessConnectionClosed):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::Proxy):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::~Proxy):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::createRemoteUnit):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::initialize):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::start):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::storageChanged):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::stop):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::setAudioOutputDevice):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::retrieveFormatDescription):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::stopThread):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::startThread):
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::restartIfNeeded):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererInternalUnitManager.h: Added.
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererInternalUnitManager.messages.in: Added.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::audioMediaStreamTrackRendererInternalUnitManager):
* WebProcess/WebProcess.h:
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::setupCaptureProcesses):
2021-05-20 Julian Gonzalez <julian_a_gonzalez@apple.com>
WKRemoteObjectRegistry _invokeMethod needs to check for nil completionHandlers
https://bugs.webkit.org/show_bug.cgi?id=225941
Reviewed by Ryosuke Niwa.
_invokeMethod's argument-checking loop needs to be run
even if replyInfo is nil, as otherwise we can perform an invocation
if a method signature specifies a completion handler even though
none is provided.
* Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
(-[_WKRemoteObjectRegistry _invokeMethod:]):
2021-05-20 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] <select> options are unnecessarily truncated
https://bugs.webkit.org/show_bug.cgi?id=226048
<rdar://problem/76008154>
Reviewed by Tim Horton.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker createMenu]):
UIMenu's currently limit action titles to two lines. Use SPI to remove
the limit and avoid unnecessary truncation.
2021-05-20 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r277606.
rdar://78283324
Need to wait for more projects to migrate to new API.
Reverted changeset:
"[Cocoa] Remove prototype loadSimulatedRequest methods"
https://bugs.webkit.org/show_bug.cgi?id=223658
https://commits.webkit.org/r277606
2021-05-20 Kate Cheney <katherine_cheney@apple.com>
Mark ServiceWorkerThreadProxy with a default app-bound value
https://bugs.webkit.org/show_bug.cgi?id=223201
<rdar://problem/77664416>
Reviewed by Youenn Fablet.
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::controlClient):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::updateAppBoundValue):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* Scripts/webkit/messages.py:
(headers_for_type):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::updateAppBoundValue):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2021-05-20 Eric Carlson <eric.carlson@apple.com>
Allow GPU process log channels to be configured
https://bugs.webkit.org/show_bug.cgi?id=226036
<rdar://problem/78271211>
Reviewed by Jer Noble.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::configureLoggingChannel): Configure WebCore and
WebKit logging channels because classes used in the GPU process use both.
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::configureLoggingChannel): Send configureLoggingChannel
message to the GPU process.
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::configureLoggingChannel): Send configureLoggingChannel to the
GPU process connection, if there is one.
2021-05-20 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Adopt "com.apple.QuartzCore.webkit-limited-types" entitlement
https://bugs.webkit.org/show_bug.cgi?id=226044
<rdar://problem/60549120>
Reviewed by Per Arne Vollan.
WebKit should adopt the "com.apple.QuartzCore.webkit-limited-types" entitlement as a further hardening measure to help
QuartzCore limit the features accessible from the WebContent and GPU Process. WebKit only needs a subset of the
features of QuartzCore, and this entitlement allows the framework to block certain code paths.
Tested by existing rendering test cases.
* Scripts/process-entitlements.sh:
2021-05-20 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Remove [ImplicitThis] and [CustomProxyToJSObject] extended attributes
https://bugs.webkit.org/show_bug.cgi?id=223758
Reviewed by Sam Weinig.
Use inherits<T> instead of toJSDOMWindow() if the value is never a JSProxy.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::reportException):
2021-05-20 Devin Rousso <drousso@apple.com>
REGRESSION(r277505): Crash under WTF::Detail::CallableWrapper<WebKit::WebPageProxy::setUnderPageBackgroundColorOverride(WebCore::Color&&)::$_10, void>::call
https://bugs.webkit.org/show_bug.cgi?id=225979
<rdar://problem/78130098>
Reviewed by Tim Horton.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setUnderPageBackgroundColorOverride):
Semi-speculative fix by checking the weakly-held `PageClient` before attempting to use it.
Dissasembly suggests this as the cause as the invalid access occurs early in the lambda.
2021-05-20 Dean Jackson <dino@apple.com>
Configure fullscreen view after it has transitioned
https://bugs.webkit.org/show_bug.cgi?id=226031
<rdar://problem/78277029>
Reviewed by Tim Horton.
Call an internal configuration method after the fullscreen transition.
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2021-05-20 Brent Fulgham <bfulgham@apple.com>
[macOS] Allow access to the 'DiskImageURL' IOKit property
https://bugs.webkit.org/show_bug.cgi?id=226033
<rdar://problem/78199855>
Reviewed by Per Arne Vollan.
Access to certain disk image types is affected by the ability to read the DiskImageURL IOKit property. Since file
URLs may reference such locations (and indeed, telemetry shows that this is happening) we should grant this property
access to avoid users encountering file access errors when attempting to load content backed by relevant disk images.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-20 Tim Horton <timothy_horton@apple.com>
Move off UIKit IPI in WKMouseGestureRecognizer
https://bugs.webkit.org/show_bug.cgi?id=226030
rdar://78266173
Reviewed by Devin Rousso and Wenson Hsieh.
Use UIGestureRecognizerDelegate instead of IPI.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
(-[WKContentView gestureRecognizer:shouldReceivePress:]):
* UIProcess/ios/WKMouseGestureRecognizer.mm:
(-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]): Deleted.
(-[WKMouseGestureRecognizer _shouldReceivePress:]): Deleted.
2021-05-20 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in IPC::Connection
https://bugs.webkit.org/show_bug.cgi?id=226021
Reviewed by Darin Adler.
Use CheckedLock more in IPC::Connection. This is heavily multithreaded code and
it would benefit significantly from Clang Thread Safety Analysis.
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::processIncomingMessage):
(IPC::Connection::enqueueMatchingMessagesToMessageReceiveQueue):
(IPC::Connection::addMessageReceiveQueue):
(IPC::Connection::addWorkQueueMessageReceiver):
(IPC::Connection::addThreadMessageReceiver):
(IPC::Connection::removeMessageReceiveQueue):
(IPC::Connection::sendMessage):
(IPC::Connection::waitForMessage):
(IPC::Connection::pushPendingSyncRequestID):
(IPC::Connection::popPendingSyncRequestID):
(IPC::Connection::waitForSyncReply):
(IPC::Connection::processIncomingSyncReply):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::installIncomingSyncMessageCallback):
(IPC::Connection::uninstallIncomingSyncMessageCallback):
(IPC::Connection::hasIncomingSyncMessage):
(IPC::Connection::connectionDidClose):
(IPC::Connection::sendOutgoingMessages):
(IPC::Connection::enqueueIncomingMessage):
(IPC::Connection::dispatchMessage):
(IPC::Connection::dispatchOneIncomingMessage):
(IPC::Connection::dispatchIncomingMessages):
* Platform/IPC/Connection.h:
(IPC::Connection::WTF_GUARDED_BY_LOCK):
2021-05-20 Geoffrey Garen <ggaren@apple.com>
GraphicsLayer::setName() causes heap fragmentation
https://bugs.webkit.org/show_bug.cgi?id=225838
Reviewed by Simon Fraser.
Profiling for heap fragmentation shows that GraphicsLayer::setName() is
a top contributor. Worth about 5MB maximum on GMail.
Use MAKE_STATIC_STRING_IMPL for our constant layer names so we end up
with only one copy and no heap allocation in the many cases that are
compile-time constants.
* WebProcess/Inspector/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::showPaintRect):
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::CompositingCoordinator):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::LayerTreeHost):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:
(WebKit::LayerTreeHost::LayerTreeHost):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
2021-05-20 Per Arne <pvollan@apple.com>
[iOS] Add missing method in sandbox IOKit filter
https://bugs.webkit.org/show_bug.cgi?id=225975
<rdar://78212330>
Reviewed by Brent Fulgham.
Add missing method in IOSurfaceRootUserClient filter on iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-05-20 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in WebKit2 code
https://bugs.webkit.org/show_bug.cgi?id=226001
Reviewed by Alex Christensen.
Use CheckedLock more in WebKit2 code to benefit from Clang Thread Safety Analysis.
* NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
(LegacyCustomProtocolManager::networkProcessCreated):
(WebKit::LegacyCustomProtocolManager::registerScheme):
(WebKit::LegacyCustomProtocolManager::unregisterScheme):
(WebKit::LegacyCustomProtocolManager::supportsScheme):
(WebKit::LegacyCustomProtocolManager::protocolForID):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
(WebKit::LegacyCustomProtocolManager::addCustomProtocol):
(WebKit::LegacyCustomProtocolManager::removeCustomProtocol):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::addSessionStorageQuotaManager):
(WebKit::NetworkProcess::removeSessionStorageQuotaManager):
(WebKit::NetworkProcess::setSessionStorageQuotaManagerIDBRootPath):
(WebKit::NetworkProcess::resetQuota):
(WebKit::NetworkProcess::storageQuotaManager):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::suspend):
(WebKit::StorageManagerSet::resume):
* NetworkProcess/WebStorage/StorageManagerSet.h:
* NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h:
* NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
(WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver):
(WebKit::LaunchServicesDatabaseObserver::startObserving):
(WebKit::LaunchServicesDatabaseObserver::handleEvent):
* Shared/BlockingResponseMap.h:
(BlockingResponseMap::waitForResponse):
(BlockingResponseMap::didReceiveResponse):
* Shared/Cocoa/XPCEndpointClient.h:
* Shared/Cocoa/XPCEndpointClient.mm:
(WebKit::XPCEndpointClient::setEndpoint):
(WebKit::XPCEndpointClient::connection):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::request const):
(WebKit::WebURLSchemeTask::willPerformRedirection):
(WebKit::WebURLSchemeTask::didPerformRedirection):
(WebKit::WebURLSchemeTask::pageDestroyed):
(WebKit::WebURLSchemeTask::stop):
(WebKit::WebURLSchemeTask::nsRequest const):
* UIProcess/WebURLSchemeTask.h:
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::addObserver):
(WebKit::DisplayLink::removeObserver):
(WebKit::DisplayLink::removeObservers):
(WebKit::DisplayLink::incrementFullSpeedRequestClientCount):
(WebKit::DisplayLink::decrementFullSpeedRequestClientCount):
(WebKit::DisplayLink::setPreferredFramesPerSecond):
(WebKit::DisplayLink::notifyObserversDisplayWasRefreshed):
* UIProcess/mac/DisplayLink.h:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThread):
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionAndDispatchToThread):
(WebKit::LibWebRTCCodecs::createDecoder):
(WebKit::LibWebRTCCodecs::decodeFrame):
(WebKit::LibWebRTCCodecs::createEncoder):
(WebKit::LibWebRTCCodecs::encodeFrame):
(WebKit::LibWebRTCCodecs::setEncodeRates):
(WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose):
(WebKit::LibWebRTCCodecs::setLoggingLevel):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
* WebProcess/Plugins/PluginProcessConnectionManager.cpp:
(WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
(WebKit::PluginProcessConnectionManager::removePluginProcessConnection):
(WebKit::PluginProcessConnectionManager::pluginProcessCrashed):
* WebProcess/Plugins/PluginProcessConnectionManager.h:
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::addScrollingTreeForPage):
(WebKit::EventDispatcher::removeScrollingTreeForPage):
(WebKit::EventDispatcher::wheelEvent):
(WebKit::EventDispatcher::takeQueuedTouchEventsForPage):
(WebKit::EventDispatcher::touchEvent):
(WebKit::EventDispatcher::dispatchTouchEvents):
(WebKit::EventDispatcher::notifyScrollingTreesDisplayWasRefreshed):
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
(WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
* WebProcess/WebPage/ViewUpdateDispatcher.h:
2021-05-20 Per Arne <pvollan@apple.com>
The test fast/images/eps-as-image.html is a constant crash
https://bugs.webkit.org/show_bug.cgi?id=225989
<rdar://77354349>
Reviewed by Maciej Stachowiak.
This is caused by an incorrect sandbox rule. A related service is referred to as an XPC service, but it should be a global name.
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-19 Tomoki Imai <Tomoki.Imai@sony.com>
Scrolling must be done after the layout when doing full page zoom
https://bugs.webkit.org/show_bug.cgi?id=225730
Reviewed by Simon Fraser.
Add check to disallow negative or zero zoom value.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageZoomFactor):
2021-05-19 Chris Dumez <cdumez@apple.com>
[GPUProcess] It is not safe to call GraphicsContext::paintFrameForMedia() off the main thread
https://bugs.webkit.org/show_bug.cgi?id=225996
Reviewed by Simon Fraser.
It is not safe to call GraphicsContext::paintFrameForMedia() off the main thread because it
relies on the MediaPlayer / MediaPlayerPrivate objects, which are main-thread object. Making
this function thread-safe would be a significant amount of work. As a result, I am simply
calling callOnMainThreadAndWait() in RemoteRenderingBackend::applyMediaItem(). Note that this
code path is only used when painting a video to a canvas.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::applyMediaItem):
Make sure we call paintFrameForMedia() on the main thread.
* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
(WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer):
(WebKit::RemoteMediaPlayerManagerProxy::mediaPlayer):
* GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
Drop lock that is no longer needed now that mediaPlayer() is always called on the main thread.
2021-05-19 Alex Christensen <achristensen@webkit.org>
Add support for Navigation Timing Level 2
https://bugs.webkit.org/show_bug.cgi?id=184363
Reviewed by Ryosuke Niwa.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
Mark reused TLS connections in complete metrics like I did in incomplete metrics in r277493.
2021-05-19 Sam Weinig <weinig@apple.com>
Remove ImageBuffer::toBGRA() and replace its uses with the more general ImageBuffer::getPixelBuffer()
https://bugs.webkit.org/show_bug.cgi?id=225976
Reviewed by Said Abou-Hallawa.
Remove ImageBuffer::toBGRA().
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::getBGRADataForImageBuffer): Deleted.
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::toBGRAData const): Deleted.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::toBGRAData const): Deleted.
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::getBGRADataForImageBuffer): Deleted.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableIOSurfaceBackend::toBGRAData const): Deleted.
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
2021-05-19 Chris Dumez <cdumez@apple.com>
Simplify and make InjectedBundle::initialize() more robust
https://bugs.webkit.org/show_bug.cgi?id=225980
Reviewed by Geoffrey Garen.
Simplify and make InjectedBundle::initialize() more robust as we are seeing some flaky
crashes in this area (rdar://33894266).
In particular, the following changes were made:
- Call dlopen_preflight() before dlopen() for extra robustness as we see some crashes under dlopen().
- Call [NSBundle preflightAndReturnError:] before [NSBundle loadAndReturnError:] for extra robustness
as we see some crashes under [NSBundle loadAndReturnError:].
- Call [NSBundle loadAndReturnError:] instead of [NSBundle load] so that we get a useful NSError for
logging.
- Call [NSBundle initWithPath:] instead of [NSBundle initWithURL:] since we have a path and since
[NSBundle initWithURL:] ends up calling [NSBundle initWithPath:] anyway. This avoids us having to
construct a NSURL from our path.
- Use NSBundle.executablePath instead of CFBundleCopyExecutableURL() since it is nicer and we have
a NSBundle.
- Use [NSString fileSystemRepresentation] to gets a file system representation of NSBundle.executablePath.
Previously, we were relying on CFURLGetFileSystemRepresentation().
* WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
(WebKit::InjectedBundle::initialize):
2021-05-19 Chris Dumez <cdumez@apple.com>
Drop "get" prefix from SQLiteStatement member functions as well as out-parameters
https://bugs.webkit.org/show_bug.cgi?id=225971
Reviewed by Darin Adler.
Update code base due to SQLiteStatement API changes.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries):
(WebKit::ResourceLoadStatisticsDatabaseStore::missingUniqueIndices):
(WebKit::ResourceLoadStatisticsDatabaseStore::columnsForTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
(WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::merge):
(WebKit::ResourceLoadStatisticsDatabaseStore::getThirdPartyDataForSpecificFirstPartyDomains const):
(WebKit::ResourceLoadStatisticsDatabaseStore::aggregatedThirdPartyData const):
(WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics):
(WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
(WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentlyUpdatedTimestamp const):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::allDomains const):
(WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlockAndDeleteCookiesFor const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlockButKeepCookiesFor const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithUserInteractionAsFirstParty const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domains const):
(WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
(WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectSubStatisticsCount):
(WebKit::ResourceLoadStatisticsDatabaseStore::getDomainStringFromDomainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const):
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainIDExistsInDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters):
(WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString):
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString):
(WebKit::ResourceLoadStatisticsDatabaseStore::earliestTimesToSend):
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::items const):
(WebKit::LocalStorageDatabase::item const):
(WebKit::LocalStorageDatabase::databaseIsEmpty const):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::IconDatabase):
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::iconIDForIconURL):
(WebKit::IconDatabase::iconData):
(WebKit::IconDatabase::loadIconForPageURL):
* UIProcess/API/glib/IconDatabase.h:
2021-05-18 Darin Adler <darin@apple.com>
Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF
https://bugs.webkit.org/show_bug.cgi?id=225839
Reviewed by Sam Weinig.
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters): Use makeString instead
of StringBuilder.
2021-05-19 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] <select multiple> picker should collapse sections when tapping anywhere on a group header
https://bugs.webkit.org/show_bug.cgi?id=225974
<rdar://problem/77930033>
Reviewed by Wenson Hsieh.
Currently, the <select multiple> picker only collapses a section when
tapping on the disclosure button on the side of the group header. Instead,
a tap anywhere on the group header should collapse/expand the corresponding
section.
The new behavior is achieved by introducing WKSelectPickerGroupHeaderView,
a view that encapsulates the header label and disclosure icon. A tap
gesture recognizer is added to animate the icon, and notify the its
owner (WKSelectPickerTableViewController) when the view is tapped.
This patch also corrects the icon animation in RTL layouts, and corrects
the spacing between the header label and icon.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPickerGroupHeaderView initWithGroupName:section:]):
(-[WKSelectPickerGroupHeaderView setCollapsed:animated:]):
(-[WKSelectPickerGroupHeaderView setDelegate:]):
(-[WKSelectPickerGroupHeaderView didTapHeader:]):
(+[WKSelectPickerGroupHeaderView preferredFont]):
(+[WKSelectPickerGroupHeaderView preferredMargin]):
(+[WKSelectPickerGroupHeaderView preferredHeight]):
(-[WKSelectPickerTableViewController tableView:heightForHeaderInSection:]):
(-[WKSelectPickerTableViewController tableView:viewForHeaderInSection:]):
(-[WKSelectPickerTableViewController didTapSelectPickerGroupHeaderView:]):
2021-05-19 Sam Weinig <weinig@apple.com>
Update Base64 encoding/decoding to match more modern WebKit conventions
https://bugs.webkit.org/show_bug.cgi?id=225920
Reviewed by Chris Dumez.
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didComplete):
* UIProcess/WebURLSchemeTask.h:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
Update to use uint8_t* data buffers more consistently for synchronous loads.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::sendReplyToSynchronousRequest):
Update to use uint8_t* data buffers more consistently for synchronous loads.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::fireConversionRequest):
Update to use new base64URLDecode / base64URLEncodeToString().
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::applyBasicAuthorizationHeader):
Use new serializationForBasicAuthorizationHeader() helper.
* Shared/API/APIData.h:
(API::Data::create):
(API::Data::fastFreeBytes): Deleted.
Add new create function that takes ownership of a Vector's buffer rather
than copying it. Replace use of static functions with inline lambdas for
free-functions.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::sandboxFilePath):
Use makeString and new base64URLEncoded().
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(produceClientDataJson):
Use new base64URLEncodeToString().
* UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
(WebKit::base64EncodedPNGData):
Use new base64EncodeToString().
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::webCryptoMasterKey):
Use new defaultWebCryptoMasterKey() and new adopting API::Data::create function.
* UIProcess/Inspector/glib/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::setBackendCommands):
Use new base64EncodeToString().
* UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp:
(WebKit::RemoteWebInspectorUIProxy::platformSave):
Use new base64Decode().
* UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp:
(WebKit::WebInspectorUIProxy::platformSave):
Use new base64Decode().
* UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm:
(WebKit::RemoteWebInspectorUIProxy::platformSave):
Use new base64Decode().
* UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
(WebKit::WebInspectorUIProxy::platformSave):
Use new base64Decode().
* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::setBackendCommands):
Use new base64EncodeToString().
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticatorInternal::produceHashSet):
(WebKit::LocalAuthenticator::makeCredential):
(WebKit::LocalAuthenticator::getAssertion):
Use new base64EncodeToString().
* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::feedReports):
Use new base64Decode().
* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
(WebKit::MockLocalConnection::filterResponses const):
Use new base64EncodeToString().
2021-05-19 Chris Dumez <cdumez@apple.com>
Improve logging in ProcessThrottler::invalidateAllActivities()
https://bugs.webkit.org/show_bug.cgi?id=225766
Reviewed by Geoffrey Garen.
Improve logging in ProcessThrottler::invalidateAllActivities(). We now log the number
of foreground and background activities. Normally each activity logs when getting
invalidated so we know this number. However, some activities are "quiet" and do not
log when invalidated (e.g. activities taken for IPC).
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::invalidateAllActivities):
2021-05-19 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] <select multiple> picker checkmarks should use large symbol scale
https://bugs.webkit.org/show_bug.cgi?id=225936
<rdar://problem/77942151>
Reviewed by Wenson Hsieh.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPickerTableViewController tableView:cellForRowAtIndexPath:]):
Set the cell's image view's preferredSymbolConfiguration to use a
UIImageSymbolScaleLarge scale, and a UIFontTextStyleBody text style
to support Dynamic Type sizes.
2021-05-19 Chris Dumez <cdumez@apple.com>
[Hardening] CARingBuffer should validate the storage size before adopting it
https://bugs.webkit.org/show_bug.cgi?id=225928
<rdar://73575595>
Reviewed by Jer Noble.
We use a lot of SharedMemory-backed CARingBuffers. The pattern is that a process creates the
SharedMemory then sends a SharedMemory::Handle to another process, who adopts it as storage
for its CARingBuffer. Because the process that sends us the SharedMemory::Handle may not be
trusted, we need to validate that the size of the storage is sufficient based on the
CARingBuffer's format & frameCount.
* GPUProcess/media/RemoteAudioDestinationManager.cpp:
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
(WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged):
* GPUProcess/webrtc/RemoteMediaRecorder.cpp:
(WebKit::RemoteMediaRecorder::audioSamplesStorageChanged):
* Shared/Cocoa/SharedRingBufferStorage.cpp:
(WebKit::ReadOnlySharedRingBufferStorage::size const):
(WebKit::ReadOnlySharedRingBufferStorage::allocate):
(WebKit::SharedRingBufferStorage::allocate):
* Shared/Cocoa/SharedRingBufferStorage.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp:
(WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage):
* WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp:
(WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage):
* WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage):
2021-05-18 Tim Horton <timothy_horton@apple.com>
allowsContentJavaScript API not applied from defaultWebpagePreferences
https://bugs.webkit.org/show_bug.cgi?id=225957
Reviewed by Wenson Hsieh.
New API test: WebKit.AllowsContentJavaScriptFromDefaultPreferences
* UIProcess/API/APIWebsitePolicies.cpp:
(API::WebsitePolicies::copy const):
allowsContentJavaScript works fine on the per-navigation-level WKWebpagePreferences,
but is ignored if applied on the WKWebViewConfiguration's defaultWebpagePreferences,
because it is not copied in copy(). Copy it!
2021-05-18 Tim Horton <timothy_horton@apple.com>
REGRESSION (r277683): WebContent process crashing in unit tests
https://bugs.webkit.org/show_bug.cgi?id=225955
rdar://78184041
Unreviewed partial revert.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
Revert the CRASH() part of r277683 because it is causing mysterious unit testing failures.
2021-05-18 Aditya Keerthi <akeerthi@apple.com>
[macOS] Titlebar separator doesn't show when WKWebView is scrolled
https://bugs.webkit.org/show_bug.cgi?id=220633
<rdar://problem/71094055>
Reviewed by Darin Adler.
Starting in Big Sur, NSWindows with a titlebar display a separator if
there is a scrolled NSScrollView adjacent to the titlebar. Since
WKWebViews are scrollable views, but not backed by NSScrollView, we
need to adopt SPI to support this functionality.
This patch updates WKWebView to conform to the NSScrollViewSeparatorTrackingAdapter
protocol, ensuring the titlebar separator is displayed when
necessary. Note that since WKWebViews are not actually NSScrollView's we
don't already have the scroll position of the view in the UIProcess. To
determine whether or not the view is scrolled, this patch adds plumbing
so that the WebProcess can tell the UIProcess the new scroll position
when a page is scrolled.
Tests: WKWebViewTitlebarSeparatorTests.BackForwardCache
WKWebViewTitlebarSeparatorTests.ChangeTitlebarAdjacency
WKWebViewTitlebarSeparatorTests.ChangeViewVisibility
WKWebViewTitlebarSeparatorTests.NavigationResetsTitlebarAppearance
WKWebViewTitlebarSeparatorTests.ParentWhileScrolled
WKWebViewTitlebarSeparatorTests.ScrollWithTitlebarAdjacency
WKWebViewTitlebarSeparatorTests.ScrollWithoutTitlebarAdjacency
* Platform/spi/mac/AppKitSPI.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView scrollViewFrame]):
(-[WKView hasScrolledContentsUnderTitlebar]):
* UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView scrollViewFrame]):
(-[WKWebView hasScrolledContentsUnderTitlebar]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::updateWindowAndViewFrames):
If the WKWebView's frame changes, update the titlebar adjacency
state and notify observers of the change.
(WebKit::WebViewImpl::viewWillMoveToWindowImpl):
Unregister the WKWebView as an NSScrollViewSeparatorTrackingAdapter if
it is removed from the window.
(WebKit::WebViewImpl::viewDidHide):
Hidden views are not adjacent to the titlebar.
(WebKit::WebViewImpl::viewDidUnhide):
An unhidden view may be adjacent to the titlebar.
(WebKit::WebViewImpl::pageDidScroll):
Use the scroll position of the page to determine whether or not the
WKWebView is scrolled.
(WebKit::WebViewImpl::scrollViewFrame):
Needed to conform to NSScrollViewSeparatorTrackingAdapter.
(WebKit::WebViewImpl::hasScrolledContentsUnderTitlebar):
Needed to conform to NSScrollViewSeparatorTrackingAdapter. Returns true
if the view is registered as an NSScrollViewSeparatorTrackingAdapter
and is scrolled.
(WebKit::WebViewImpl::updateTitlebarAdjacencyState):
The WKWebView needs to be registered as an NSScrollViewSeparatorTrackingAdapter
if it's adjacent to the titlebar and unregistered otherwise.
* UIProcess/PageClient.h:
(WebKit::PageClient::pageDidScroll):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::pageDidScroll):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
Reset the scroll position upon navigation, as pageDidScroll does not get
called when navigating.
(WebKit::PageClientImpl::pageDidScroll):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::pageDidScroll):
Pass the current scroll position when the page is scrolled, so that the
UIProcess knows whether or not the page has a non-zero scroll position.
2021-05-18 Tim Horton <timothy_horton@apple.com>
REGRESSION (r275013): Trying to navigate in a WKWebView from a command line tool crashes the Web Content process
https://bugs.webkit.org/show_bug.cgi?id=225938
<rdar://problem/78029118>
Reviewed by Alex Christensen.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
Some kinds of processes do not have a bundle identifier, so requiring one
is simply not going to work.
Also, make the other exit()s in this function use CRASH() instead, so
that they make traditional crash logs instead of just exiting with a
non-zero error code (which is much quieter).
2021-05-18 Alex Christensen <achristensen@webkit.org>
Allow SafariForWebKitDevelopment to launch successfully
https://bugs.webkit.org/show_bug.cgi?id=223551
Suggested by BJ Burg. Reviewed by Tim Horton.
* UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
2021-05-18 Ryosuke Niwa <rniwa@webkit.org>
Enabling IPC testing API should prevent WebContent process from getting terminated in more cases
https://bugs.webkit.org/show_bug.cgi?id=225906
<rdar://problem/78138794>
Rebaselined the tests.
* Scripts/webkit/tests/TestWithIfMessageMessageReceiver.cpp:
(WebKit::TestWithIfMessage::didReceiveMessage):
* Scripts/webkit/tests/TestWithImageDataMessageReceiver.cpp:
(WebKit::TestWithImageData::didReceiveMessage):
(WebKit::TestWithImageData::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp:
(WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage):
(WebKit::TestWithLegacyReceiver::didReceiveSyncTestWithLegacyReceiverMessage):
* Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp:
(WebKit::TestWithSemaphore::didReceiveMessage):
(WebKit::TestWithSemaphore::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithStreamBufferMessageReceiver.cpp:
(WebKit::TestWithStreamBuffer::didReceiveMessage):
* Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp:
(WebKit::TestWithStream::didReceiveStreamMessage):
* Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp:
(WebKit::TestWithSuperclass::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
(WebKit::TestWithoutAttributes::didReceiveSyncMessage):
2021-05-18 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r277614.
<rdar://78167889>
Broke Mail
Reverted changeset:
"Remove API::Object::Type::BundlePageGroup"
https://bugs.webkit.org/show_bug.cgi?id=225611
https://commits.webkit.org/r277614
2021-05-18 Said Abou-Hallawa <said@apple.com>
Allow logging minimal info about uploading media files
https://bugs.webkit.org/show_bug.cgi?id=225636
<rdar://problem/76639138>
Reviewed by Alex Christensen.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::addParametersShared):
Centralize logging uploading the images and media files.
2021-05-18 Keith Miller <keith_miller@apple.com>
Temporarily revert r276592 as it breaks some native apps
https://bugs.webkit.org/show_bug.cgi?id=225917
Unreviewed, revert.
* WebProcess/Plugins/Netscape/JSNPObject.h:
2021-05-18 Garrett Davidson <garrett_davidson@apple.com>
Add nil checks for LAContexts before inserting them in the dictionaries.
https://bugs.webkit.org/show_bug.cgi?id=225897
Reviewed by Tim Horton.
In 225218 we stopped dropping requests that didn't have LAContexts. However, that let us
proceed only until we tried to put the (nil) LAContext in an NSDictionary to make a Sec*
call, which throws an exception. This patch adds proper nil checking before inserting the
contexts into the dictionaries.
Manually tested registration and assertion on macOS with and without LAContexts.
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::createCredentialPrivateKey const):
2021-05-18 Chris Dumez <cdumez@apple.com>
ReadOnlySharedRingBufferStorage::updateFrameBounds() should validate boundsBufferSize
https://bugs.webkit.org/show_bug.cgi?id=225918
Reviewed by Youenn Fablet.
ReadOnlySharedRingBufferStorage::updateFrameBounds() should validate boundsBufferSize since the
process writing the buffer size on the other end may not be trusted.
* Shared/Cocoa/SharedRingBufferStorage.cpp:
(WebKit::ReadOnlySharedRingBufferStorage::updateFrameBounds):
2021-05-18 Youenn Fablet <youenn@apple.com>
Resurrect WKWebView media controls API removed in https://bugs.webkit.org/show_bug.cgi?id=221929
https://bugs.webkit.org/show_bug.cgi?id=225696
<rdar://77863194>
Reviewed by Alex Christensen.
Revert closeAllMediaPresentations, pauseAllMediaPlayback, resumeAllMediaPlayback, suspendAllMediaPlayback and requestMediaPlaybackState.
Mark them as deprecated in favor of the latest API versions and implement them based on the latest API versions.
No change of behavior.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView closeAllMediaPresentations:]):
(-[WKWebView pauseAllMediaPlayback:]):
(-[WKWebView resumeAllMediaPlayback:]):
(-[WKWebView suspendAllMediaPlayback:]):
(-[WKWebView requestMediaPlaybackState:]):
2021-05-17 Ryosuke Niwa <rniwa@webkit.org>
Enabling IPC testing API should prevent WebContent process from getting terminated in more cases
https://bugs.webkit.org/show_bug.cgi?id=225906
Reviewed by Wenson Hsieh.
Avoid hitting debug assertions in WebContent process when a dispatched message isn't processed
in a message receivers and don't kill WebContent process in GPU processs when RemoteRenderingBackend
receives a bad IPC message.
Also fixed a typo in encodeSharedMemory where we were exiting early when the protection was ReadWrite
instead of when it was not ReadWrite or ReadOnly.
These fixes are needed to land tests for recent GPU process fixes.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
* Scripts/webkit/messages.py:
(generate_message_handler):
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::encodeSharedMemory):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureGPUProcessConnection):
2021-05-17 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Object identifiers with the deleted value should cause MESSAGE_CHECKs
https://bugs.webkit.org/show_bug.cgi?id=225886
rdar://78114708
Reviewed by Chris Dumez.
See WebCore/ChangeLog for more details. Use `ObjectIdentifier::isValid()` instead of just checking for the empty
value, when determining whether an object identifier should trigger a message check to the web process.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
2021-05-17 Kate Cheney <katherine_cheney@apple.com>
WebFrameLoaderClient::dispatchWillSendRequest sometimes resets app-bound value
https://bugs.webkit.org/show_bug.cgi?id=225829
<rdar://problem/78034595>
Reviewed by Alex Christensen.
webPage->injectedBundleResourceLoadClient().willSendRequestForFrame
can sometimes return a completely new request. We should make sure the
app-bound value is kept when this happens.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
2021-05-17 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r277605.
Broke iOS tests
Reverted changeset:
"Remove _WKUserContentFilter and _WKUserContentExtensionStore"
https://bugs.webkit.org/show_bug.cgi?id=224391
https://commits.webkit.org/r277605
2021-05-17 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, fix the internal macOS build
Add a missing `WebCore::` namespace before `TranslationContextMenuInfo`.
This error was likely masked by a `using namespace WebCore;` present in an earlier unified source.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleContextMenuTranslation):
2021-05-17 Devin Rousso <drousso@apple.com>
[Modern Media Controls] promote submenus items if there is only one
https://bugs.webkit.org/show_bug.cgi?id=225883
Reviewed by Eric Carlson.
As an example, if a `<video>` only has subtitles and not any other languages, the "Subtitles"
submenu should really be top-level (i.e. have "Subtitles" be the title of the entire
contextmenu instead of being a submenu of a title-less contextmenu) in the contextmenu shown
when tapping the tracks button.
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showMediaControlsContextMenu:items:completionHandler:]):
2021-05-17 Alex Christensen <achristensen@webkit.org>
Remove API::Object::Type::BundlePageGroup
https://bugs.webkit.org/show_bug.cgi?id=225611
Reviewed by Brady Eidson.
Its last use was removed in rdar://77775952
* Shared/API/APIObject.h:
* Shared/API/APIPageGroupHandle.cpp: Removed.
* Shared/API/APIPageGroupHandle.h: Removed.
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* Shared/Cocoa/SharedRingBufferStorage.cpp:
(WebKit::SharedRingBufferStorage::setStorage):
(WebKit::SharedRingBufferStorage::allocate):
* Shared/UserData.cpp:
(WebKit::UserData::encode):
(WebKit::UserData::decode):
* Shared/mac/MediaFormatReader/MediaSampleCursor.h:
* Sources.txt:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::transformHandlesToObjects):
(WebKit::WebProcessProxy::transformObjectsToHandles):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.mm:
(-[WKWebProcessPlugInPageGroup identifier]): Deleted.
(-[WKWebProcessPlugInPageGroup dealloc]): Deleted.
(-[WKWebProcessPlugInPageGroup _apiObject]): Deleted.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h: Removed.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController pageGroup]): Deleted.
* WebProcess/WebPage/WebPageGroupProxy.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::transformHandlesToObjects):
(WebKit::WebProcess::transformObjectsToHandles):
2021-05-17 Alex Christensen <achristensen@webkit.org>
[Cocoa] Remove prototype loadSimulatedRequest methods
https://bugs.webkit.org/show_bug.cgi?id=223658
Reviewed by Geoffrey Garen.
Now that rdar://75892301 is fixed we can remove the original API.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]): Deleted.
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]): Deleted.
2021-05-17 Alex Christensen <achristensen@webkit.org>
Remove _WKUserContentFilter and _WKUserContentExtensionStore
https://bugs.webkit.org/show_bug.cgi?id=224391
Reviewed by Darin Adler.
I removed their use in rdar://75889414
They were replaced by WKContentRuleList and WKContentRuleListStore.
* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController _addUserContentFilter:]):
(-[WKUserContentController _removeAllUserContentFilters]):
* UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
(+[_WKUserContentExtensionStore defaultStore]):
(+[_WKUserContentExtensionStore storeWithURL:]):
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(toUserContentRuleListStoreError): Deleted.
(-[_WKUserContentExtensionStore _apiObject]): Deleted.
(-[_WKUserContentExtensionStore _removeAllContentExtensions]): Deleted.
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
(-[_WKUserContentExtensionStore _initWithWKContentRuleListStore:]): Deleted.
(-[_WKUserContentExtensionStore _contentRuleListStore]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h: Removed.
* UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h: Removed.
* UIProcess/API/Cocoa/_WKUserContentFilter.h:
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter _initWithWKContentRuleList:]):
(-[_WKUserContentFilter _apiObject]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterInternal.h: Removed.
* UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: Removed.
* UIProcess/WebProcessPool.h:
* WebKit.xcodeproj/project.pbxproj:
2021-05-17 Chris Dumez <cdumez@apple.com>
Avoid more String creations when preparing SQLite statements
https://bugs.webkit.org/show_bug.cgi?id=225855
Reviewed by Alex Christensen.
Avoid more String creations when preparing SQLite statements by using ASCIILiteral. Also rename the
SQLiteDatabase::prepareStatement() / SQLiteDatabase::executeCommand() overloads that take in a
String to make sure they are not called by mistake.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries):
(WebKit::insertDistinctValuesInTableStatement):
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::columnsForTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnInTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
(WebKit::joinSubStatisticsForSorting):
(WebKit::ResourceLoadStatisticsDatabaseStore::aggregatedThirdPartyData const):
(WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
(WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
(WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement const):
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::openDatabase):
(WebKit::LocalStorageDatabase::migrateItemTableIfNeeded):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::createTablesIfNeeded):
(WebKit::IconDatabase::populatePageURLToIconURLMap):
2021-05-14 Simon Fraser <simon.fraser@apple.com>
Allow wheel events to be coalesced during scroll deceleration
https://bugs.webkit.org/show_bug.cgi?id=225834
<rdar://70402512>
Reviewed by Tim Horton.
When scrolling slows down towards the tail end of a momentum scroll, we can reduce our
commit frequency to save power, but we only want to do this on displays whose refresh rate
is higher than the default "update rendering" frequency.
We do this by leveraging the existing WebWheelEventCoalescer, which coalesces events
in the UI process. It tracks time since previous event, and coalesces when the
instantaneous velocity is less than 320 points per second (matching other frameworks
on the system).
WebWheelEventCoalescer needs to know when to enable coalescing, which it computes
on creation, and when the window is moved to a different screen with potentially
a different refresh rate.
* Shared/WebWheelEventCoalescer.cpp:
(WebKit::WebWheelEventCoalescer::isInMomentumPhase):
(WebKit::WebWheelEventCoalescer::shouldDispatchEvent):
* Shared/WebWheelEventCoalescer.h:
(WebKit::WebWheelEventCoalescer::shouldCoalesceEventsDuringDeceleration const):
(WebKit::WebWheelEventCoalescer::setShouldCoalesceEventsDuringDeceleration):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wheelEventCoalescer):
(WebKit::WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration const):
(WebKit::WebPageProxy::windowScreenDidChange):
* UIProcess/WebPageProxy.h:
2021-05-17 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not pull audio session category from the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=225826
Reviewed by Darin Adler.
Remove `category` and `routeSharingPolicy` from `RemoteAudioSessionConfiguration`
because we should not pull these properties from the GPU process.
Remove IPC message `RemoteAudioSession::ConfigurationChanged` because it is not used.
* GPUProcess/mac/LocalAudioSessionRoutingArbitrator.h:
* GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::configuration):
* GPUProcess/media/RemoteAudioSessionProxy.h:
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::categoryCanMixWithOthers):
(WebKit::RemoteAudioSessionProxyManager::updateCategory):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::setCategory):
(WebKit::RemoteAudioSession::category const):
(WebKit::RemoteAudioSession::configurationChanged): Deleted.
* WebProcess/GPU/media/RemoteAudioSession.h:
* WebProcess/GPU/media/RemoteAudioSession.messages.in:
* WebProcess/GPU/media/RemoteAudioSessionConfiguration.h:
(WebKit::RemoteAudioSessionConfiguration::encode const):
(WebKit::RemoteAudioSessionConfiguration::decode):
* WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp:
2021-05-14 Jer Noble <jer.noble@apple.com>
MediaSessionCoordinator survives page reload/navigation
https://bugs.webkit.org/show_bug.cgi?id=225822
Reviewed by Eric Carlson.
Update the classes affected by virtual function changes in MediaSessionCoordinator. Update
the creation mechanism inside WebPage/Proxy.
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]):
* UIProcess/Media/MediaSessionCoordinatorProxyPrivate.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::trackIdentifierChanged):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatorStateChanged):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createMediaSessionCoordinator):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::trackIdentifierChanged):
(WebKit::RemoteMediaSessionCoordinator::coordinatorStateChanged):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createMediaSessionCoordinator):
(WebKit::WebPage::invalidateMediaSessionCoordinator):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-05-16 Chris Dumez <cdumez@apple.com>
Modernize / Optimize SQLiteStatement creation and preparation
https://bugs.webkit.org/show_bug.cgi?id=225791
Reviewed by Sam Weinig.
Update code base now that the SQLiteDatabase & SQLiteStatement API has changed.
Also use more ASCIILiterals.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::enableForeignKeys):
(WebKit::ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries):
(WebKit::ResourceLoadStatisticsDatabaseStore::missingUniqueIndices):
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::columnsForTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnInTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::scopedStatement const):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
(WebKit::ResourceLoadStatisticsDatabaseStore::aggregatedThirdPartyData const):
(WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearTopFrameUniqueRedirectsToSinceSameSiteStrictEnforcement):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlockAndDeleteCookiesFor const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlockButKeepCookiesFor const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithUserInteractionAsFirstParty const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domains const):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
(WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
(WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectSubStatisticsCount):
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters):
(WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::migrateItemTableIfNeeded):
(WebKit::LocalStorageDatabase::databaseIsEmpty const):
(WebKit::LocalStorageDatabase::scopedStatement const):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::IconDatabase):
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::pruneTimerFired):
(WebKit::IconDatabase::iconIDForIconURL):
(WebKit::IconDatabase::setIconIDForPageURL):
(WebKit::IconDatabase::iconData):
(WebKit::IconDatabase::addIcon):
(WebKit::IconDatabase::updateIconTimestamp):
(WebKit::IconDatabase::deleteIcon):
2021-05-15 Ryosuke Niwa <rniwa@webkit.org>
Delete WebSQL code from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=225739
Reviewed by Sihui Liu.
Deleted WebSQL code. We keep some code for website data store since it's possible
for user's device to still have WebSQL data, and we should be able to delete them.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes):
* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetWebSQLDisabled):
(WKPreferencesGetWebSQLDisabled):
* UIProcess/API/C/WKPreferencesRef.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
2021-05-15 Said Abou-Hallawa <said@apple.com>
[GPU Process] Ensure RemoteRenderingBackendProxy is restored to its original state when GPUP connection is closed
https://bugs.webkit.org/show_bug.cgi?id=225781
<rdar://76678163>
Reviewed by Darin Adler.
GPUProcess may exit in different scenarios: a crash, under memory pressure
or when it is not being used; see r276148. In all cases, the state of
RemoteRenderingBackendProxy has to be restored to its original state when
it was created. gpuProcessConnectionDidClose() is supposed to do that.
But some members are not cleared in this function.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose):
Make sure the resource cache and the getImageData memory and semaphore
are cleared.
(WebKit::RemoteRenderingBackendProxy::createRemoteImageBuffer):
Add this helper method to be called when a RemoteImageBufferProxy is first
created or when its backend is cleared.
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
Add this new function to restore RemoteResourceCacheProxy to its original
state.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
(WebKit::RemoteResourceCacheProxy::imageBuffers const): Deleted.
2021-05-15 Alex Christensen <achristensen@webkit.org>
Remove _WKWebsitePolicies
https://bugs.webkit.org/show_bug.cgi?id=224293
Reviewed by Darin Adler.
Its last use was removed in rdar://problem/58064847 and we've released a Safari version since then.
It was replaced by WKWebpagePreferences
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateWebsitePolicies:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebpagePreferences.mm:
* UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Removed.
* UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Removed.
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::draggingExited):
(WebKit::WebViewImpl::performDragOperation):
(WebKit::WebViewImpl::setPromisedDataForImage):
* WebKit.xcodeproj/project.pbxproj:
2021-05-15 Ian Gilbert <iang@apple.com>
Replace PlatformCAAnimationRemote::KeyframeValue with Variant
https://bugs.webkit.org/show_bug.cgi?id=225474
Reviewed by Ryosuke Niwa.
KeyframeValue was effectively a Variant. Replaced the existing class with a WTF::Variant.
No test as this does not change code behavior.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<RefPtr<WebCore::FilterOperation>>::encode):
(IPC::ArgumentCoder<RefPtr<WebCore::FilterOperation>>::decode):
* Shared/WebCoreArgumentCoders.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
(WebKit::animationValueFromKeyframeValue):
(WebKit::operator<<):
(WebKit::PlatformCAAnimationRemote::KeyframeValue::encode const): Deleted.
(WebKit::PlatformCAAnimationRemote::KeyframeValue::decode): Deleted.
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop FileSystem::fileMetadata() / fileMetadataFollowingSymlinks()
https://bugs.webkit.org/show_bug.cgi?id=225820
Reviewed by Darin Adler.
Update our code base because of the FileSystem API changes.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::getDirectorySize):
(WebKit::CacheStorage::Engine::getDirectories):
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::traverseDirectory):
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::ensureSandboxCacheDirectory):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::isInternalInstall):
2021-05-14 John Wilander <wilander@apple.com>
Javascript can't access a SameSite=Strict cookie after page is loaded after a redirect from a third party site
https://bugs.webkit.org/show_bug.cgi?id=208049
<rdar://problem/59701889>
Reviewed by Chris Dumez.
The HTTP WG has decided that SameSite=strict cookies should be returned in document.cookie
even in cases where they are not sent in the HTTP request for the page. Chromium and Gecko
now work according to those rules and the spec is being updated.
See:
- https://github.com/httpwg/http-extensions/issues/769
- https://github.com/httpwg/http-extensions/pull/1428/files.
Here's an excerpt from the spec change:
'If a user agent does return cookies for a given call to a "non-HTTP" API with
an associated Document, then the user agent MUST compute the cookie-string
following the algorithm defined in {{retrieval-algorithm}}, indicating that the
retrieval is from a "non-HTTP" API. The retrieval-uri is the associated
Document's cookie URL {{COOKIE-URL}}, and the retrieval is same-site if the
Document's "site for cookies" is same-site with the top-level origin as defined
in {{document-requests}}.'
Existing layout tests changed and rebased.
* WebProcess/WebPage/WebCookieJar.cpp:
(WebKit::WebCookieJar::cookies const):
Now sends WebCore::IsCookieAccessForDOM::Yes to WebCore::CookieJar::sameSiteInfo().
(WebKit::WebCookieJar::setCookies):
Now sends WebCore::IsCookieAccessForDOM::Yes to WebCore::CookieJar::sameSiteInfo().
2021-05-14 Tim Horton <timothy_horton@apple.com>
REGRESSION (r269824): Random tile corruption when scrolling/zooming in macCatalyst
https://bugs.webkit.org/show_bug.cgi?id=225837
<rdar://problem/75053997>
Reviewed by Simon Fraser.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
Mark the newly front buffer non-volatile before painting into it.
This was lost in r269824. Oddly, this caused less trouble than
one might expect, except on some particular hardware.
2021-05-14 Jonathan Bedard <jbedard@apple.com>
Fix iOS 14.5 embedded build
https://bugs.webkit.org/show_bug.cgi?id=225835
<rdar://problem/78039315>
Reviewed by Dewei Zhu.
No new tests, build fix.
* WebProcess/cocoa/WebProcessCocoa.mm: Import mach.h.
2021-05-14 Sam Weinig <weinig@apple.com>
Use PixelBufferFormat to specify ImageBuffer::getPixelBuffer destination format allowing for more control over data conversion
https://bugs.webkit.org/show_bug.cgi?id=225813
Reviewed by Darin Adler.
Update calls/implementations of getPixelBuffer/putPixelBuffer to adjust
to new signature.
* GPUProcess/graphics/RemoteImageBuffer.h:
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::getPixelBuffer const):
(WebKit::CGDisplayListImageBufferBackend::putPixelBuffer):
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::getPixelBuffer const):
(WebKit::ImageBufferShareableBitmapBackend::putPixelBuffer):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::putPixelBuffer):
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableIOSurfaceBackend::getPixelBuffer const):
(WebKit::ImageBufferShareableIOSurfaceBackend::putPixelBuffer):
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
2021-05-14 Patrick Angle <pangle@apple.com>
Web Inspector: `_WKInspector` leaks `WebInspectorUIProxy`
https://bugs.webkit.org/show_bug.cgi?id=225815
Reviewed by Tim Horton.
Add a missing call in `_WKInspector`'s destructor to destruct the `WebInspectorUIProxy` in API object storage.
* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector dealloc]):
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop "get" prefix from WTF::FileSystem's getFileModificationTime() / getFileCreationTime()
https://bugs.webkit.org/show_bug.cgi?id=225812
Reviewed by Darin Adler.
Update code base due to WTF API change.
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::fileTimes):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeMediaKeys):
* WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
(WebKit::removeAllMediaKeyStorageForOriginPath):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::getVolumeFreeSpace() to FileSystem::volumeFreeSpace()
https://bugs.webkit.org/show_bug.cgi?id=225811
Reviewed by Darin Adler.
Update code base due to API change.
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::computeCapacity):
2021-05-14 Wenson Hsieh <wenson_hsieh@apple.com>
Replace -[WKContentView _hasPendingImageExtraction] with a monotonically increasing ID
https://bugs.webkit.org/show_bug.cgi?id=225823
rdar://77519437
Reviewed by Tim Horton.
Refactor some image extraction code by turning this boolean flag into a monotonically increasing
`ObjectIdentifier` instead; see the bug for more details.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _doAfterPendingImageExtraction:]):
(-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction:]):
2021-05-14 Devin Rousso <drousso@apple.com>
Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
https://bugs.webkit.org/show_bug.cgi?id=225615
<rdar://problem/76568094>
Reviewed by Wenson Hsieh.
`underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
- the most recent non-null value provided
- the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
- the underlying platform view's background color
Modifications to this property will not have any effect until control is returned to the runloop.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView underPageBackgroundColor]): Added.
(-[WKWebView setUnderPageBackgroundColor:]): Added.
(+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.
* UIProcess/API/ios/WKWebViewIOS.mm:
(baseScrollViewBackgroundColor):
(scrollViewBackgroundColor):
Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
`UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::underPageBackgroundColor const): Added.
(WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
(WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
(WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
(WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
Store the client-overriden value for `underPageBackgroundColor` and manage state changes.
* UIProcess/PageClient.h:
(WebKit::PageClient::underPageBackgroundColorWillChange): Added.
(WebKit::PageClient::underPageBackgroundColorDidChange): Added.
* UIProcess/Cocoa/PageClientImplCocoa.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
(WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::contentViewBackgroundColor): Added.
Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
would use this value before falling back to the underlying platform view's background color.
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
can be used when drawing the overscroll layer.
* UIProcess/ViewSnapshotStore.cpp:
(WebKit::ViewSnapshotStore::recordSnapshot):
Go back to using the `pageExtendedBackgroundColor` (before r273083).
2021-05-14 Devin Rousso <drousso@apple.com>
[iOS] contextmenu hints can be clipped by the WKWebView
https://bugs.webkit.org/show_bug.cgi?id=224204
<rdar://problem/77089174>
Reviewed by Wenson Hsieh.
r275562 tried to fix this by moving the interaction previews to a separate `UIWindow`, but
this had the unfortunate consequence of placing those previews on top of everything in the
current `UIWindow` (e.g. above the share sheet). As such, WebKit can't use a `UIWindow` for
this as the `WKWebView` has no idea what the view hierarchy above it looks like.
Test: ContextMenu.HintPreviewContainer
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
Add new SPI `-[WKUIDelegate _contextMenuHintPreviewContainerViewForWebView:]` that's used as
the container for the `UIPreviewTarget` created for the contextmenu hint preview.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView cleanUpInteractionPreviewContainers]): Added.
(-[WKContentView _didCommitLoadForMainFrame]):
(-[WKContentView _createPreviewContainerWithLayerName:]):
(-[WKContentView containerForDropPreviews]):
(-[WKContentView _removeContainerForDropPreviews]): Added.
(-[WKContentView containerForDragPreviews]):
(-[WKContentView _removeContainerForDragPreviews]): Added.
(-[WKContentView containerForContextMenuHintPreviews]):
(-[WKContentView _removeContainerForContextMenuHintPreviews]): Added.
(-[WKContentView cleanUpDragSourceSessionState]):
(-[WKContentView _removeContextMenuViewIfPossible]):
(-[WKContentView dropInteraction:concludeDrop:]):
(-[WKContentView _hideTargetedPreviewContainerViews]): Deleted.
Clean up and centralize logic around creating and removing interaction preview containers.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didMoveToWindow]):
If the `WKWebView` is removed from it's parent, make sure to remove the contextmenu hint
preview as well as it could be outside the view hierarchy of the `WKWebView` from the SPI.
2021-05-14 Chris Dumez <cdumez@apple.com>
Introduce FileSystem::updateFileModificationTime()
https://bugs.webkit.org/show_bug.cgi?id=225810
Reviewed by Darin Adler.
Call the new FileSystem::updateFileModificationTime() API to modify the
file modification time instead of having low-level platform-specific
file system code at the WebKit2 layer.
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
2021-05-14 Alex Christensen <achristensen@webkit.org>
Resource Timing: secureConnectionStart == 0 when a connection is re-used
https://bugs.webkit.org/show_bug.cgi?id=225733
Reviewed by Chris Dumez.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::getFileSize() to FileSystem::fileSize()
https://bugs.webkit.org/show_bug.cgi?id=225798
Reviewed by Alex Christensen.
Update code path to due to the API change.
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::setItem):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::getDirectorySize):
(WebKit::CacheStorage::Engine::readSizeFile):
* NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
(WebKit::NetworkCache::BlobStorage::synchronize):
* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::mapFile):
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::read):
* Shared/PersistencyUtils.cpp:
(WebKit::createForFile):
* UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::pathGetFileName() to FileSystem::pathFileName()
https://bugs.webkit.org/show_bug.cgi?id=225806
Reviewed by Alex Christensen.
Rename FileSystem::pathGetFileName() to FileSystem::pathFileName(), as we avoid "get" prefixes in WebKit.
* NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::origins const):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
2021-05-14 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.1 release
* gtk/NEWS: Add release notes for 2.33.1.
2021-05-13 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Plumb data detector results through some platform objects
https://bugs.webkit.org/show_bug.cgi?id=225775
Work towards rdar://75504956
Reviewed by Tim Horton and Devin Rousso.
Add IPC encoding and decoding support for the new struct.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::encodePlatformData):
(IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::decodePlatformData):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::encode):
(IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::decode):
* Shared/WebCoreArgumentCoders.h:
2021-05-13 Dean Jackson <dino@apple.com>
[WebXR] Allow WebXR to be tested on PLATFORM(COCOA)
https://bugs.webkit.org/show_bug.cgi?id=225578
Reviewed by Sam Weinig.
Remove checking for a WebXR feature flag.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultWebXREnabled):
2021-05-13 Tim Horton <timothy_horton@apple.com>
Work around WebCore failing to build due to NDEBUG getting undefined in release
https://bugs.webkit.org/show_bug.cgi?id=225782
<rdar://problem/77982432>
Reviewed by Simon Fraser.
* Platform/spi/ios/UIKitSPI.h:
Apply a temporary workaround to preserve NDEBUG through these includes.
There are a few ways to get to CoreGraphicsPrivate.h, so we fix all of them.
2021-05-13 Megan Gardner <megan_gardner@apple.com>
Add textIndicator bounce for AppHighlights on scroll.
https://bugs.webkit.org/show_bug.cgi?id=225727
Reviewed by Tim Horton.
Use factored out textIndicator code to add a bounce to an appHighlight
when it is scrolled to.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKWindowVisibilityObserver _dictionaryLookupPopoverWillClose:]):
(WebKit::WebViewImpl::setTextIndicator):
(WebKit::WebViewImpl::clearTextIndicatorWithAnimation):
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsWithAnimationFromViewOnly):
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setTextIndicator):
(WebKit::WebPageProxy::clearTextIndicator):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::setTextIndicator):
(WebKit::PageClientImpl::clearTextIndicator):
(WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpTextIndicator:]):
(-[WKContentView clearTextIndicator:]):
(-[WKContentView setTextIndicatorAnimationProgress:]):
(-[WKContentView teardownTextIndicatorLayer]):
(-[WKContentView startFadeOut]):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::setTextIndicator):
(WebKit::PageClientImpl::clearTextIndicator):
(WebKit::PageClientImpl::didPerformDictionaryLookup):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _animationControllerForText]):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setTextIndicator const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindIndicator):
2021-05-13 Sam Weinig <weinig@apple.com>
Split pixel buffer format data out into a new PixelBufferFormat struct
https://bugs.webkit.org/show_bug.cgi?id=225707
Reviewed by Darin Adler.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
Adopt PixelBufferFormat.
2021-05-13 Chris Dumez <cdumez@apple.com>
Rename FileSystem::directoryName() to FileSystem::parentPath()
https://bugs.webkit.org/show_bug.cgi?id=225768
Reviewed by Darin Adler.
Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
consistency with std::filesystem::parent_path() which is used internally.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::writeFile):
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::getExecutablePath):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::IconDatabase):
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_get_disk_cache_directory):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
2021-05-13 Chris Dumez <cdumez@apple.com>
Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
https://bugs.webkit.org/show_bug.cgi?id=225772
Reviewed by Darin Adler.
Update code base due to API naming change.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::getDirectorySize):
(WebKit::CacheStorage::Engine::getDirectories):
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::traverseDirectory):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::isInternalInstall):
2021-05-13 Chris Dumez <cdumez@apple.com>
Process suspension may be delayed by up to 5 seconds after there is no longer any database activity
https://bugs.webkit.org/show_bug.cgi?id=225774
Reviewed by Geoffrey Garen.
Use a 1 second HysteresisActivity in WebSQLiteDatabaseTracker instead of a 5 seconds one.
I frequently see our processes' suspension getting delayed by 5 seconds when homing out of
MobileSafari due to database activity. This change should help with that.
* Shared/WebSQLiteDatabaseTracker.cpp:
(WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
2021-05-13 Chris Dumez <cdumez@apple.com>
Introduce FileSystem::hardLinkCount()
https://bugs.webkit.org/show_bug.cgi?id=225767
Reviewed by Darin Adler.
Leverage the FileSystem API instead of having platform-specific code.
* NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
(WebKit::NetworkCache::BlobStorage::synchronize):
(WebKit::NetworkCache::BlobStorage::shareCount):
2021-05-13 Sam Weinig <weinig@apple.com>
CGDisplayList debug configuration fails to build
https://bugs.webkit.org/show_bug.cgi?id=225729
Reviewed by Darin Adler.
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::nameForBackingStoreType):
Add missing case for RemoteLayerBackingStore::Type::CGDisplayList.
2021-05-13 Darin Adler <darin@apple.com>
Remove StringBuilder::appendNumber
https://bugs.webkit.org/show_bug.cgi?id=225732
Reviewed by Sam Weinig.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::buildList): Use append instead of appendNumber.
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Ditto.
* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::appendCurrentMemoryUsageToFile): Ditto.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewRunJavaScriptCallback): Ditto.
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::loggingString): Ditto.
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(PageResourceLoadClient::didReceiveResponseForResource): Use makeString instead
of StringBuilder.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::buildHTTPHeaders): Use append instead of appendNumber.
2021-05-13 Peng Liu <peng.liu6@apple.com>
Subtitles in Safari fail to appear after switching language
https://bugs.webkit.org/show_bug.cgi?id=225738
Reviewed by Jer Noble.
`TextTrackPrivateRemote::setMode()` calls `InbandTextTrackPrivate::setMode()`, but
it does not set the value of `TextTrackPrivateRemote::mode` properly. Therefore,
`TextTrackPrivateRemote::mode` will always be `Disabled`. When we switch text track
in the WebContent process side, we will only send the IPC message `TextTrackSetMode`
to `RemoteMediaPlayerProxy` in the GPU process to change the mode from `Disabled`
to `Showing`, but cannot change its value back to `Disabled`. When a user keeps
switching text track, all text tracks in the GPU process will become `Showing`,
and `MediaPlayerPrivateAVFoundation` cannot deal with that. As a result,
the WebContent process won't get the correct subtitles from the GPU process.
`cueFormat()` has the similar issue, it does not impact the functionality though.
Actually, `TextTrackPrivateRemote` can simply use the implementations of its
base class `InbandTextTrackPrivate` regarding mode and cue format.
In addition, `TextTrackPrivateRemote` does not need to get the "mode" value from
`RemoteTextTrackProxy` in the GPU process. So this patch removes the `mode` attribute
of `TextTrackPrivateRemoteConfiguration`.
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::configuration):
* GPUProcess/media/TextTrackPrivateRemoteConfiguration.h:
(WebKit::TextTrackPrivateRemoteConfiguration::encode const):
(WebKit::TextTrackPrivateRemoteConfiguration::decode):
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::setMode):
(WebKit::TextTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/TextTrackPrivateRemote.h:
2021-05-13 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r277262): test imported/w3c/web-platform-tests/css/selectors/focus-visible-002.html is crashing
https://bugs.webkit.org/show_bug.cgi?id=225659
Reviewed by Adrian Perez de Castro.
Do not try to grab focus on WebView widget for synthesized mouse press and release events if the widget has
already the focus or is not the current toplevel focus widget.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSynthesizeMouseEvent):
2021-05-13 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277258.
https://bugs.webkit.org/show_bug.cgi?id=225740
Caused layout test failures
Reverted changeset:
"[GTK] Use always async scrolling in accelerated compositing
mode"
https://bugs.webkit.org/show_bug.cgi?id=225512
https://trac.webkit.org/changeset/277258
2021-05-13 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Add ArgumentCoder for GTlsCertificate
https://bugs.webkit.org/show_bug.cgi?id=225509
Reviewed by Adrian Perez de Castro.
Move the GTlsCertificate serialization from CertificateInfo ArgumentCoder to its own.
* Shared/glib/ArgumentCodersGLib.cpp:
(IPC::ArgumentCoder<GRefPtr<GVariant>>::encode):
(IPC::ArgumentCoder<GRefPtr<GVariant>>::decode):
(IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::encode):
(IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::decode):
(IPC::encode): Deleted.
(IPC::decode): Deleted.
* Shared/glib/ArgumentCodersGLib.h:
* Shared/glib/UserMessage.cpp:
(WebKit::UserMessage::encode const):
(WebKit::UserMessage::decode):
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<CertificateInfo>::encode):
(IPC::ArgumentCoder<CertificateInfo>::decode):
2021-05-12 Chris Dumez <cdumez@apple.com>
Notification.requestPermission() should return a Promise
https://bugs.webkit.org/show_bug.cgi?id=225712
Reviewed by Darin Adler.
Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::~NotificationPermissionRequestManager):
(WebKit::NotificationPermissionRequestManager::startRequest):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::requestPermission):
* WebProcess/WebCoreSupport/WebNotificationClient.h:
2021-05-12 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Failed to open WebInspector UI since r277231
https://bugs.webkit.org/show_bug.cgi?id=225715
Reviewed by Don Olmstead.
Windows WebKit2 failed to open WebInspector UI after r277231
changed Filesystem::pathByAppendingComponent.
"inspector-resource:///Main.html" was wrongly mapped to
"C:\\Main.html".
requestURL.fileSystemPath() returns "\Main.html". The preceding
"\" should be removed before concatenating it with the bundle path
by using FileSystem::pathByAppendingComponent.
* UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.cpp:
(WebKit::InspectorResourceURLSchemeHandler::platformStartTask): Removed the preceding "\".
2021-05-12 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Permit sysctl-read operations needed by Metal and other system frameworks
https://bugs.webkit.org/show_bug.cgi?id=225720
<rdar://problem/77438105>
Reviewed by Per Arne Vollan.
Further testing of iOS and macOS have revealed a handful of sysctl-read operations we should allow to improve
performance and correctness of OpenGL/Metal and other high-performance math routines.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-12 Chris Dumez <cdumez@apple.com>
Simplify / Modernize Notification permission implementation
https://bugs.webkit.org/show_bug.cgi?id=225711
Reviewed by Alex Christensen.
Simplify / Modernize Notification permission implementation. The main change was
adopting sendWithAsyncReply() for the IPC instead of using 2 separate IPC messages
for the request and the decision. As a result, we don't have to deal with request
identifiers.
No new tests, no behavior change and covered by existing API tests.
* Sources.txt:
* UIProcess/API/APIUIClient.h:
(API::UIClient::decidePolicyForNotificationPermissionRequest):
* UIProcess/API/C/WKNotificationPermissionRequest.cpp:
(WKNotificationPermissionRequestAllow):
(WKNotificationPermissionRequestDeny):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/glib/WebKitNotificationPermissionRequest.cpp:
(webkitNotificationPermissionRequestAllow):
(webkitNotificationPermissionRequestDeny):
* UIProcess/API/glib/WebKitUIClient.cpp:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
* UIProcess/Notifications/NotificationPermissionRequest.h:
(WebKit::NotificationPermissionRequest::create):
(WebKit::NotificationPermissionRequest::~NotificationPermissionRequest):
(WebKit::NotificationPermissionRequest::didReceiveDecision):
(WebKit::NotificationPermissionRequest::NotificationPermissionRequest):
* UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp: Removed.
* UIProcess/Notifications/NotificationPermissionRequestManagerProxy.h: Removed.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::requestNotificationPermission):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::startRequest):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-05-12 Ada Chan <ada.chan@apple.com>
[WebXR] Implement XRDeviceProxy::submitFrame
https://bugs.webkit.org/show_bug.cgi?id=225718
Reviewed by Sam Weinig.
* Shared/Cocoa/XRDeviceProxy.h:
* Shared/Cocoa/XRDeviceProxy.mm:
(WebKit::XRDeviceProxy::submitFrame):
* UIProcess/Cocoa/PlatformXRCoordinator.h:
(WebKit::PlatformXRCoordinator::submitFrame):
* UIProcess/Cocoa/PlatformXRSystem.h:
* UIProcess/Cocoa/PlatformXRSystem.messages.in:
* UIProcess/Cocoa/PlatformXRSystem.mm:
(WebKit::PlatformXRSystem::submitFrame):
* WebProcess/cocoa/PlatformXRSystemProxy.h:
* WebProcess/cocoa/PlatformXRSystemProxy.mm:
(WebKit::PlatformXRSystemProxy::submitFrame):
2021-05-12 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Silence uninteresting sandbox reports
https://bugs.webkit.org/show_bug.cgi?id=225713
<rdar://problem/77483132>
Reviewed by Per Arne Vollan.
Telemetry from the recently released iOS and macOS updates show a set of uninteresting sandbox violations. Most of
these are harmless, but all of them involve some runtime cost and may prevent code from making the best use of
available hardware and should be permitted.
These changes also bring the various sandboxes into better alignment, as many of these items had previously been
added to one of the other sandboxes.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-12 Wenson Hsieh <wenson_hsieh@apple.com>
Plumb some more metadata to QuickLook when revealing images
https://bugs.webkit.org/show_bug.cgi?id=225709
rdar://77864866
Reviewed by Devin Rousso.
Add plumbing to supply QuickLook with some additional information about the image URL and current page URL when
revealing images.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuRevealImage):
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
* UIProcess/mac/WKImageExtractionPreviewController.h:
* UIProcess/mac/WKImageExtractionPreviewController.mm:
(-[WKImageExtractionPreviewItem initWithFileURL:title:imageURL:pageURL:]):
(-[WKImageExtractionPreviewItem dealloc]):
(-[WKImageExtractionPreviewItem previewItemURL]):
(-[WKImageExtractionPreviewItem previewOptions]):
(-[WKImageExtractionPreviewController initWithPage:fileURL:title:imageURL:]):
Rename the `URL` argument to `fileURL`, to avoid confusion with the new `imageURL` that's passed in. Note that
this is temporary, since we'll adopt new QuickLook SPI on macOS once the fix for rdar://74299451 is available.
(-[WKImageExtractionPreviewItem initWithURL:title:]): Deleted.
(-[WKImageExtractionPreviewController initWithPage:url:title:]): Deleted.
2021-05-12 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r275297): Unexpected autofocus when switching tabs
https://bugs.webkit.org/show_bug.cgi?id=225710
<rdar://problem/77542939>
Reviewed by Wenson Hsieh.
r275297 introduced logic to handle a focus environment change by
advancing to the next or previous focusable element, depending on the
focus context's heading direction. This logic enables a tab or a
shift+tab to change the focus from browser chrome directly to an
element on a web page.
However, the focus environment can change through mechanisms other than
tab / shift+tab. One example of this is when a user switches tabs. In
these cases, the UIFocusHeading supplied by the focus context is
UIFocusHeadingNone. Nevertheless, we unconditionally call
`-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]`
when the focus context changes. Consequently, an element on the web page
is always focused when the WKContentView gains focus.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateFocusInContext:withAnimationCoordinator:]):
To fix, ensure we only focus an element on the page if the focus heading
is UIFocusHeadingNext or UIFocusHeadingPrevious. UIFocusHeadingNext will
focus the first focusable element, while UIFocusHeadingPrevious will focus
the last focusable element.
Note that a call to `-[WKContentView becomeFirstResponder]` is not made
if the focus heading is UIFocusHeadingNone. From my testing, I observed
that the view already was the first responder in that case.
2021-05-12 Chris Dumez <cdumez@apple.com>
Unreviewed follow-up to r277376.
Fix bad early return in NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision().
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision):
2021-05-12 Chris Dumez <cdumez@apple.com>
Queue notification permission requests for the same origin on WebKit side
https://bugs.webkit.org/show_bug.cgi?id=225701
<rdar://76804977>
Reviewed by Geoffrey Garen.
If there are parallel notification permission requests for the same origin, we now queue them on WebKit
side and only ask the client once for the origin. Once we've received the permission from the client,
we respond to all JS requests at this point.
This patch also removes some dead code to facilitate refactoring the code to support this.
In a follow-up I am planning to use sendWithAsyncReply() and refactor this code further.
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::startRequest):
(WebKit::NotificationPermissionRequestManager::permissionLevel):
(WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::policyForOrigin const):
* WebProcess/Notifications/WebNotificationManager.h:
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::requestPermission):
(WebKit::WebNotificationClient::checkPermission):
* WebProcess/WebCoreSupport/WebNotificationClient.h:
2021-05-12 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in WebPageProxy::endColorPicker()
https://bugs.webkit.org/show_bug.cgi?id=225679
Reviewed by Ryosuke Niwa.
Make sure that endColorPicker() and didEndColorPicker()
do not both attempt to null-out m_colorPicker.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::endColorPicker):
(WebKit::WebPageProxy::didEndColorPicker):
2021-05-12 Peng Liu <peng.liu6@apple.com>
Implement TextTrackPrivateRemote::inBandMetadataTrackDispatchType()
https://bugs.webkit.org/show_bug.cgi?id=225674
Reviewed by Eric Carlson.
This patch ensures that `InbandTextTrack::inBandMetadataTrackDispatchType()`
behaviors the same no matter "Media in GPU Process" is enabled or not.
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::configuration):
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/TextTrackPrivateRemote.h:
2021-05-12 Youenn Fablet <youenn@apple.com>
Introduce an internal unit to render audio MediaStreamTrack(s)
https://bugs.webkit.org/show_bug.cgi?id=225601
Reviewed by Eric Carlson.
Update according new WebCore API.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
(WebKit::RemoteAudioMediaStreamTrackRenderer::start):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
(WebKit::AudioMediaStreamTrackRenderer::start):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h:
2021-05-12 Martin Robinson <mrobinson@igalia.com>
REGRESSION(r277083): Proximity scroll snap is broken on iOS
https://bugs.webkit.org/show_bug.cgi?id=225649
Reviewed by Simon Fraser.
No new tests. iOS does not have great support for the event sending test
infrastructure used to test scroll snap.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::encode): Include the snap type when encoding ScrollSnapOffsetsInfo.
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::decode): Include the snap type when decoding ScrollSnapOffsetsInfo.
* Shared/WebCoreArgumentCoders.h: Added EnumTraits for ScrollSnapStrictness.
2021-05-11 Chris Dumez <cdumez@apple.com>
Port WTF::FileSystem::listDirectory to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225633
Reviewed by Darin Adler.
Update FileSystem::listDirectory() call sites to deal with the fact that:
- The function now returns file names instead of full file paths
- The callers now have to do filtering by themselves if they need it
* NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::origins const):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::getDirectorySize):
(WebKit::CacheStorage::Engine::getDirectories):
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::traverseDirectory):
* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::synchronousRemoveAllContentRuleLists):
* UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::mediaKeyOrigins):
(WebKit::WebsiteDataStore::removeMediaKeys):
* WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
(WebKit::WebKitExtensionManager::scanModules):
* WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
(WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
(WebKit::removeAllMediaKeyStorageForOriginPath):
(WebKit::WebMediaKeyStorageManager::deleteMediaKeyEntriesModifiedBetweenDates):
(WebKit::WebMediaKeyStorageManager::deleteAllMediaKeyEntries):
2021-05-11 Chris Dumez <cdumez@apple.com>
Add SPI to suspend / resume a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=225333
<rdar://77462543>
Reviewed by Geoff Garen.
Add SPI to suspend / resume a WKWebView. This suspends the page as if it was in
the back/forward cache but the suspension happens in-place, no need to navigate.
The suspended page is also not part of the Back/Forward cache so its cap on the
number of suspended pages does not apply here.
Most of WKWebView's API / SPI will throw an exception when called on a suspended
view (The WKPageRefAPI will RELEASE_ASSERT()). Some of the basic API will stay
functional (URL, isLoading, title, ...). It is also safe to deallocate / close
a suspended WKWebView.
* UIProcess/API/C/WKPage.cpp:
(crashIfPageIsSuspended):
(WKPageLoadURL):
(WKPageLoadURLWithShouldOpenExternalURLsPolicy):
(WKPageLoadURLWithUserData):
(WKPageLoadURLRequest):
(WKPageLoadURLRequestWithUserData):
(WKPageLoadFile):
(WKPageLoadFileWithUserData):
(WKPageLoadData):
(WKPageLoadDataWithUserData):
(WKPageLoadHTMLString):
(WKPageLoadHTMLStringWithUserData):
(WKPageLoadAlternateHTMLString):
(WKPageLoadAlternateHTMLStringWithUserData):
(WKPageLoadPlainTextString):
(WKPageLoadPlainTextStringWithUserData):
(WKPageLoadWebArchiveData):
(WKPageLoadWebArchiveDataWithUserData):
(WKPageStopLoading):
(WKPageReload):
(WKPageReloadWithoutContentBlockers):
(WKPageReloadFromOrigin):
(WKPageReloadExpiredOnly):
(WKPageTryClose):
(WKPageClose):
(WKPageGoForward):
(WKPageGoBack):
(WKPageGoToBackForwardListItem):
(WKPageTryRestoreScrollPosition):
(WKPageUpdateWebsitePolicies):
(WKPageSetApplicationNameForUserAgent):
(WKPageSetCustomUserAgent):
(WKPageSetCustomTextEncodingName):
(WKPageTerminate):
(WKPageRestoreFromSessionState):
(WKPageRestoreFromSessionStateWithoutNavigation):
(WKPageSetCustomBackingScaleFactor):
(WKPageSetTextZoomFactor):
(WKPageSetPageZoomFactor):
(WKPageSetPageAndTextZoomFactors):
(WKPageSetScaleFactor):
(WKPageSetUseFixedLayout):
(WKPageSetFixedLayoutSize):
(WKPageListenForLayoutMilestones):
(WKPageSetSuppressScrollbarAnimations):
(WKPageSetRubberBandsAtLeft):
(WKPageSetRubberBandsAtRight):
(WKPageSetRubberBandsAtTop):
(WKPageSetRubberBandsAtBottom):
(WKPageSetEnableVerticalRubberBanding):
(WKPageSetEnableHorizontalRubberBanding):
(WKPageSetBackgroundExtendsBeyondPage):
(WKPageSetPaginationMode):
(WKPageSetPaginationBehavesLikeColumns):
(WKPageSetPageLength):
(WKPageSetGapBetweenPages):
(WKPageSetPaginationLineGridEnabled):
(WKPageSetMaintainsInactiveSelection):
(WKPageCenterSelectionInVisibleArea):
(WKPageFindStringMatches):
(WKPageGetImageForFindMatch):
(WKPageSelectFindMatch):
(WKPageFindString):
(WKPageHideFindUI):
(WKPageCountStringMatches):
(WKPageSetPageContextMenuClient):
(WKPageSetPageFindClient):
(WKPageSetPageFindMatchesClient):
(WKPageSetPageInjectedBundleClient):
(WKPageSetPageFormClient):
(WKPageSetPageLoaderClient):
(WKPageSetPagePolicyClient):
(WKPageSetPageUIClient):
(WKPageSetPageNavigationClient):
(WKPageSetPageStateClient):
(WKPageRunJavaScriptInMainFrame):
(WKPageRunJavaScriptInMainFrame_b):
(WKPageRenderTreeExternalRepresentation):
(WKPageGetSourceForFrame):
(WKPageGetContentsAsString):
(WKPageGetBytecodeProfile):
(WKPageGetSamplingProfilerOutput):
(WKPageGetSelectionAsWebArchiveData):
(WKPageGetContentsAsMHTMLData):
(WKPageForceRepaint):
(WKPageValidateCommand):
(WKPageExecuteCommand):
(WKPageComputePagesForPrinting):
(WKPageDrawPagesToPDF):
(WKPageBeginPrinting):
(WKPageEndPrinting):
(WKPageSetControlledByAutomation):
(WKPageSetAllowsRemoteInspection):
(WKPageSetMediaVolume):
(WKPageSetMuted):
(WKPageSetMediaCaptureEnabled):
(WKPageDidAllowPointerLock):
(WKPageClearUserMediaState):
(WKPageDidDenyPointerLock):
(WKPageSetMayStartMediaWhenInWindow):
(WKPageSelectContextMenuItem):
(WKPageSetScrollPinningBehavior):
(WKPageSetAddsVisitedLinks):
(WKPageClearWheelEventTestMonitor):
(WKPageCallAfterNextPresentationUpdate):
(WKPageSetIgnoresViewportScaleLimits):
(WKPageGetApplicationManifest_b):
(WKPageDumpPrivateClickMeasurement):
(WKPageClearPrivateClickMeasurement):
(WKPageSetPrivateClickMeasurementOverrideTimerForTesting):
(WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSimulateResourceLoadStatisticsSessionRestart):
(WKPageSetPrivateClickMeasurementTokenPublicKeyURLForTesting):
(WKPageSetPrivateClickMeasurementTokenSignatureURLForTesting):
(WKPageSetPrivateClickMeasurementAttributionReportURLsForTesting):
(WKPageMarkPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSetPCMFraudPreventionValuesForTesting):
(WKPageSetMockCameraOrientation):
(WKPageLoadedSubresourceDomains):
(WKPageClearLoadedSubresourceDomains):
(WKPageSetMediaCaptureReportingDelayForTesting):
(WKPageDispatchActivityStateUpdateForTesting):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadRequest:]):
(-[WKWebView loadFileURL:allowingReadAccessToURL:]):
(-[WKWebView loadHTMLString:baseURL:]):
(-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
(-[WKWebView startDownloadUsingRequest:completionHandler:]):
(-[WKWebView resumeDownloadFromResumeData:completionHandler:]):
(-[WKWebView goToBackForwardListItem:]):
(-[WKWebView goBack]):
(-[WKWebView goForward]):
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView stopLoading]):
(-[WKWebView evaluateJavaScript:completionHandler:]):
(-[WKWebView evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView closeAllMediaPresentationsWithCompletionHandler:]):
(-[WKWebView pauseAllMediaPlaybackWithCompletionHandler:]):
(-[WKWebView setAllMediaPlaybackSuspended:completionHandler:]):
(-[WKWebView requestMediaPlaybackStateWithCompletionHandler:]):
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView setAllowsBackForwardNavigationGestures:]):
(-[WKWebView setCustomUserAgent:]):
(-[WKWebView setAllowsLinkPreview:]):
(-[WKWebView setPageZoom:]):
(-[WKWebView findString:withConfiguration:completionHandler:]):
(-[WKWebView setMediaType:]):
(-[WKWebView setInteractionState:]):
(-[WKWebView setAllowsMagnification:]):
(-[WKWebView setMagnification:centeredAtPoint:]):
(-[WKWebView setMagnification:]):
(-[WKWebView printOperationWithPrintInfo:]):
(-[WKWebView createPDFWithConfiguration:completionHandler:]):
(-[WKWebView createWebArchiveDataWithCompletionHandler:]):
(-[WKWebView loadSimulatedRequest:response:responseData:]):
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
(-[WKWebView loadSimulatedRequest:responseHTMLString:]):
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
(-[WKWebView loadFileRequest:allowingReadAccessToURL:]):
(-[WKWebView _toggleStrikeThrough:]):
(-[WKWebView _increaseListLevel:]):
(-[WKWebView _decreaseListLevel:]):
(-[WKWebView _changeListType:]):
(-[WKWebView _setViewportSizeForCSSViewportUnits:]):
(-[WKWebView _didEnableBrowserExtensions:]):
(-[WKWebView _didDisableBrowserExtensions:]):
(-[WKWebView _setEditable:]):
(-[WKWebView _executeEditCommand:argument:completion:]):
(-[WKWebView _startTextManipulationsWithConfiguration:completion:]):
(-[WKWebView _completeTextManipulation:completion:]):
(-[WKWebView _completeTextManipulationForItems:completion:]):
(-[WKWebView _takeFindStringFromSelection:]):
(-[WKWebView _updateMediaPlaybackControlsManager]):
(-[WKWebView _togglePictureInPicture]):
(-[WKWebView _closeAllMediaPresentations]):
(-[WKWebView _stopMediaCapture]):
(-[WKWebView _stopAllMediaPlayback]):
(-[WKWebView _suspendAllMediaPlayback]):
(-[WKWebView _resumeAllMediaPlayback]):
(-[WKWebView _restoreAppHighlights:]):
(-[WKWebView _restoreAndScrollToAppHighlight:]):
(-[WKWebView _addAppHighlight]):
(-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
(-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLs:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:]):
(-[WKWebView _grantAccessToAssetServices]):
(-[WKWebView _revokeAccessToAssetServices]):
(-[WKWebView _switchFromStaticFontRegistryToUserFontRegistry]):
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]):
(-[WKWebView _suspendPage:]):
(-[WKWebView _resumePage:]):
(-[WKWebView _setApplicationNameForUserAgent:]):
(-[WKWebView _killWebContentProcess]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _reloadExpiredOnly]):
(-[WKWebView _killWebContentProcessAndResetState]):
(-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView _getPDFFirstPageSizeInFrame:completionHandler:]):
(-[WKWebView _restoreFromSessionStateData:]):
(-[WKWebView _restoreSessionState:andNavigate:]):
(-[WKWebView _close]):
(-[WKWebView _tryClose]):
(-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
(-[WKWebView _attachmentForIdentifier:]):
(-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
(-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]):
(-[WKWebView _isJITEnabled:]):
(-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
(-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _updateWebpagePreferences:]):
(-[WKWebView _notifyUserScripts]):
(-[WKWebView _deferrableUserScriptsNeedNotification]):
(-[WKWebView _setAllowsRemoteInspection:]):
(-[WKWebView _setRemoteInspectionNameOverride:]):
(-[WKWebView _setAddsVisitedLinks:]):
(-[WKWebView _getMainResourceDataWithCompletionHandler:]):
(-[WKWebView _getWebArchiveDataWithCompletionHandler:]):
(-[WKWebView _getContentsAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsOfAllFramesAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
(-[WKWebView _getApplicationManifestWithCompletionHandler:]):
(-[WKWebView _setPaginationMode:]):
(-[WKWebView _setPaginationBehavesLikeColumns:]):
(-[WKWebView _setPageLength:]):
(-[WKWebView _setGapBetweenPages:]):
(-[WKWebView _setPaginationLineGridEnabled:]):
(-[WKWebView _setTextZoomFactor:]):
(-[WKWebView _setPageZoomFactor:]):
(-[WKWebView _countStringMatches:options:maxCount:]):
(-[WKWebView _findString:options:maxCount:]):
(-[WKWebView _hideFindUI]):
(-[WKWebView _saveBackForwardSnapshotForItem:]):
(-[WKWebView _clearServiceWorkerEntitlementOverride:]):
(-[WKWebView _preconnectToServer:]):
(-[WKWebView _setCanUseCredentialStorage:]):
(-[WKWebView _setLayoutMode:]):
(-[WKWebView _setFixedLayoutSize:]):
(-[WKWebView _setBackgroundExtendsBeyondPage:]):
(-[WKWebView _setViewScale:]):
(-[WKWebView _setCORSDisablingPatterns:]):
(-[WKWebView _getProcessDisplayNameWithCompletionHandler:]):
(-[WKWebView _setMinimumEffectiveDeviceWidth:]):
(-[WKWebView _grantAccessToPreferenceService]):
(-[WKWebView _setScrollPerformanceDataCollectionEnabled:]):
(-[WKWebView _setAllowsMediaDocumentInlinePlayback:]):
(-[WKWebView _setMediaCaptureEnabled:]):
(-[WKWebView _setPageMuted:]):
(-[WKWebView _removeDataDetectedLinks:]):
(-[WKWebView _doAfterNextPresentationUpdate:]):
(-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent):
(WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspend):
(WebKit::WebPageProxy::resume):
(WebKit::WebPageProxy::requestMediaPlaybackState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspend):
(WebKit::WebPage::resume):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-05-11 Darin Adler <darin@apple.com>
Remove the String::toInt family of functions
https://bugs.webkit.org/show_bug.cgi?id=225599
Reviewed by Anders Carlsson.
* Shared/win/AuxiliaryProcessMainWin.cpp:
(WebKit::AuxiliaryProcessMainCommon::parseCommandLine): Use
parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toUInt64.
* UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
(WebKit::ScriptMessageClient::didPostMessage): Ditto.
* UIProcess/win/WebProcessPoolWin.cpp:
(WebKit::initializeRemoteInspectorServer): Use
parseIntegerAllowingTrailingJunk<uint16_t> instead of StringView::toUInt64.
This is a 16-bit port number, so not valuable to parse larger integers.
2021-05-11 Devin Rousso <drousso@apple.com>
[macCatalyst] should have CSS `hover: hover` and `pointer: fine`
https://bugs.webkit.org/show_bug.cgi?id=225672
Reviewed by Tim Horton.
Test: iOSMouseSupport.MouseAlwaysConnected
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isMousePrimaryPointingDevice): Added.
(WebKit::hasAccessoryMousePointingDevice): Added.
(WebKit::hasAccessoryStylusPointingDevice): Added.
(WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const):
(WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const):
(WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevice const):
(WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const):
(WebKit::hasMouseDevice): Deleted.
macCatalyst should consider the mouse as the primary pointing device, just like macOS:
- `hover` and `any-hover` should always be `hover`
- `pointer` and `any-pointer` should always be `fine` (instead of only if an accessory mouse/stylus is connected)
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Added.
(WebKit::WebProcessProxy::notifyHasStylusDeviceChanged):
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::platformInitialize):
(WebKit::WebProcessProxy::platformDestroy):
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Deleted.
* UIProcess/ios/WKMouseDeviceObserver.h:
* UIProcess/ios/WKMouseDeviceObserver.mm:
* Shared/WebProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* WebProcess/WebProcess.messages.in:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Clean up macro usage to avoid unnecessary work on macCatalyst.
Drive-by: Move non-platform code to non-platform files.
2021-05-11 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277341.
https://bugs.webkit.org/show_bug.cgi?id=225685
Caused WK2 layout tests to exit with an exception
Reverted changeset:
"Add SPI to suspend / resume a WKWebView"
https://bugs.webkit.org/show_bug.cgi?id=225333
https://trac.webkit.org/changeset/277341
2021-05-11 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Mail compose web view doesn't scroll to reveal the selection in certain configurations
https://bugs.webkit.org/show_bug.cgi?id=225675
rdar://77095886
Reviewed by Tim Horton.
Currently when computing input view bounds upon receiving `UIKeyboardDidChangeFrameNotification`, we attempt to
map the on-screen bounds of the keyboard to the window's coordinate space, and save the result in an ivar in
`WKWebView`, `_inputViewBounds`. The keyboard frame (which corresponds to `UIKeyboardFrameEndUserInfoKey` in the
notification's userInfo dictionary) is given to us in screen coordinates, and we currently pass this through
`-convertRect:fromWindow:`, with a nil `UIWindow`.
However, this results in mapping the rect from the coordinate space of the window's `UIWindowScene` rather than
the window screen. In shipping Mail on iOS, this doesn't matter because the window containing the compose web
view shares the same coordinate space as the screen. In some other configurations of MobileMail, however, the
compose web view appears inside its own `UIWindow`. This causes the above coordinate conversion logic to fail,
since we attempt to map a rect given to us in screen coordinates from the compose web view's window scene's
coordinate space, instead of the screen's coordinate space.
We fix this by using `-convertRect:fromCoordinateSpace:` instead, and explicitly pass in
`self.window.screen.coordinateSpace`.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _updateScrollViewForTransaction:]):
(-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
(-[WKWebView _contentRectForUserInteraction]):
(-[WKWebView _updateVisibleContentRects]):
(-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
Rename `_inputViewBounds` to `_inputViewBoundsInWindow` for clarity.
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _inputViewBoundsInWindow]):
(-[WKWebView _inputViewBounds]): Deleted.
2021-05-11 Simon Fraser <simon.fraser@apple.com>
Crash in DisplayLink::incrementFullSpeedRequestClientCount()
https://bugs.webkit.org/show_bug.cgi?id=225683
<rdar://77716330>
Reviewed by Tim Horton.
Crash data suggest that in WebPageProxy::updateWheelEventActivityAfterProcessSwap()
the connection might be null. Protect against that an an unset DisplayID, as we do
in wheelEventHysteresisUpdated().
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::incrementFullSpeedRequestClientCount): Remove an extra semicolon.
2021-05-11 Tim Horton <timothy_horton@apple.com>
Fix the CGDisplayListImageBufferBackend build
https://bugs.webkit.org/show_bug.cgi?id=225681
Unreviewed.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::getPixelBuffer const):
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h:
2021-05-11 Alex Christensen <achristensen@webkit.org>
Remove xpc_connection_kill
https://bugs.webkit.org/show_bug.cgi?id=225602
Reviewed by Alexey Proskuryakov.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::terminateWithReason):
2021-05-11 Chris Dumez <cdumez@apple.com>
Add SPI to suspend / resume a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=225333
<rdar://77462543>
Reviewed by Geoffrey Garen.
Add SPI to suspend / resume a WKWebView. This suspends the page as if it was in
the back/forward cache but the suspension happens in-place, no need to navigate.
The suspended page is also not part of the Back/Forward cache so its cap on the
number of suspended pages does not apply here.
Most of WKWebView's API / SPI will throw an exception when called on a suspended
view (The WKPageRefAPI will RELEASE_ASSERT()). Some of the basic API will stay
functional (URL, isLoading, title, ...). It is also safe to deallocate / close
a suspended WKWebView.
* UIProcess/API/C/WKPage.cpp:
(crashIfPageIsSuspended):
(WKPageLoadURL):
(WKPageLoadURLWithShouldOpenExternalURLsPolicy):
(WKPageLoadURLWithUserData):
(WKPageLoadURLRequest):
(WKPageLoadURLRequestWithUserData):
(WKPageLoadFile):
(WKPageLoadFileWithUserData):
(WKPageLoadData):
(WKPageLoadDataWithUserData):
(WKPageLoadHTMLString):
(WKPageLoadHTMLStringWithUserData):
(WKPageLoadAlternateHTMLString):
(WKPageLoadAlternateHTMLStringWithUserData):
(WKPageLoadPlainTextString):
(WKPageLoadPlainTextStringWithUserData):
(WKPageLoadWebArchiveData):
(WKPageLoadWebArchiveDataWithUserData):
(WKPageStopLoading):
(WKPageReload):
(WKPageReloadWithoutContentBlockers):
(WKPageReloadFromOrigin):
(WKPageReloadExpiredOnly):
(WKPageTryClose):
(WKPageClose):
(WKPageGoForward):
(WKPageGoBack):
(WKPageGoToBackForwardListItem):
(WKPageTryRestoreScrollPosition):
(WKPageUpdateWebsitePolicies):
(WKPageSetApplicationNameForUserAgent):
(WKPageSetCustomUserAgent):
(WKPageSetCustomTextEncodingName):
(WKPageTerminate):
(WKPageRestoreFromSessionState):
(WKPageRestoreFromSessionStateWithoutNavigation):
(WKPageSetCustomBackingScaleFactor):
(WKPageSetTextZoomFactor):
(WKPageSetPageZoomFactor):
(WKPageSetPageAndTextZoomFactors):
(WKPageSetScaleFactor):
(WKPageSetUseFixedLayout):
(WKPageSetFixedLayoutSize):
(WKPageListenForLayoutMilestones):
(WKPageSetSuppressScrollbarAnimations):
(WKPageSetRubberBandsAtLeft):
(WKPageSetRubberBandsAtRight):
(WKPageSetRubberBandsAtTop):
(WKPageSetRubberBandsAtBottom):
(WKPageSetEnableVerticalRubberBanding):
(WKPageSetEnableHorizontalRubberBanding):
(WKPageSetBackgroundExtendsBeyondPage):
(WKPageSetPaginationMode):
(WKPageSetPaginationBehavesLikeColumns):
(WKPageSetPageLength):
(WKPageSetGapBetweenPages):
(WKPageSetPaginationLineGridEnabled):
(WKPageSetMaintainsInactiveSelection):
(WKPageCenterSelectionInVisibleArea):
(WKPageFindStringMatches):
(WKPageGetImageForFindMatch):
(WKPageSelectFindMatch):
(WKPageFindString):
(WKPageHideFindUI):
(WKPageCountStringMatches):
(WKPageSetPageContextMenuClient):
(WKPageSetPageFindClient):
(WKPageSetPageFindMatchesClient):
(WKPageSetPageInjectedBundleClient):
(WKPageSetPageFormClient):
(WKPageSetPageLoaderClient):
(WKPageSetPagePolicyClient):
(WKPageSetPageUIClient):
(WKPageSetPageNavigationClient):
(WKPageSetPageStateClient):
(WKPageRunJavaScriptInMainFrame):
(WKPageRunJavaScriptInMainFrame_b):
(WKPageRenderTreeExternalRepresentation):
(WKPageGetSourceForFrame):
(WKPageGetContentsAsString):
(WKPageGetBytecodeProfile):
(WKPageGetSamplingProfilerOutput):
(WKPageGetSelectionAsWebArchiveData):
(WKPageGetContentsAsMHTMLData):
(WKPageForceRepaint):
(WKPageValidateCommand):
(WKPageExecuteCommand):
(WKPageComputePagesForPrinting):
(WKPageDrawPagesToPDF):
(WKPageBeginPrinting):
(WKPageEndPrinting):
(WKPageSetControlledByAutomation):
(WKPageSetAllowsRemoteInspection):
(WKPageSetMediaVolume):
(WKPageSetMuted):
(WKPageSetMediaCaptureEnabled):
(WKPageDidAllowPointerLock):
(WKPageClearUserMediaState):
(WKPageDidDenyPointerLock):
(WKPageSetMayStartMediaWhenInWindow):
(WKPageSelectContextMenuItem):
(WKPageSetScrollPinningBehavior):
(WKPageSetAddsVisitedLinks):
(WKPageClearWheelEventTestMonitor):
(WKPageCallAfterNextPresentationUpdate):
(WKPageSetIgnoresViewportScaleLimits):
(WKPageGetApplicationManifest_b):
(WKPageDumpPrivateClickMeasurement):
(WKPageClearPrivateClickMeasurement):
(WKPageSetPrivateClickMeasurementOverrideTimerForTesting):
(WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSimulateResourceLoadStatisticsSessionRestart):
(WKPageSetPrivateClickMeasurementTokenPublicKeyURLForTesting):
(WKPageSetPrivateClickMeasurementTokenSignatureURLForTesting):
(WKPageSetPrivateClickMeasurementAttributionReportURLsForTesting):
(WKPageMarkPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSetPCMFraudPreventionValuesForTesting):
(WKPageSetMockCameraOrientation):
(WKPageLoadedSubresourceDomains):
(WKPageClearLoadedSubresourceDomains):
(WKPageSetMediaCaptureReportingDelayForTesting):
(WKPageDispatchActivityStateUpdateForTesting):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadRequest:]):
(-[WKWebView loadFileURL:allowingReadAccessToURL:]):
(-[WKWebView loadHTMLString:baseURL:]):
(-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
(-[WKWebView startDownloadUsingRequest:completionHandler:]):
(-[WKWebView resumeDownloadFromResumeData:completionHandler:]):
(-[WKWebView goToBackForwardListItem:]):
(-[WKWebView goBack]):
(-[WKWebView goForward]):
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView stopLoading]):
(-[WKWebView evaluateJavaScript:completionHandler:]):
(-[WKWebView evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView closeAllMediaPresentationsWithCompletionHandler:]):
(-[WKWebView pauseAllMediaPlaybackWithCompletionHandler:]):
(-[WKWebView setAllMediaPlaybackSuspended:completionHandler:]):
(-[WKWebView requestMediaPlaybackStateWithCompletionHandler:]):
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView setAllowsBackForwardNavigationGestures:]):
(-[WKWebView setCustomUserAgent:]):
(-[WKWebView setAllowsLinkPreview:]):
(-[WKWebView setPageZoom:]):
(-[WKWebView findString:withConfiguration:completionHandler:]):
(-[WKWebView setMediaType:]):
(-[WKWebView setInteractionState:]):
(-[WKWebView setAllowsMagnification:]):
(-[WKWebView setMagnification:centeredAtPoint:]):
(-[WKWebView setMagnification:]):
(-[WKWebView printOperationWithPrintInfo:]):
(-[WKWebView createPDFWithConfiguration:completionHandler:]):
(-[WKWebView createWebArchiveDataWithCompletionHandler:]):
(-[WKWebView loadSimulatedRequest:response:responseData:]):
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
(-[WKWebView loadSimulatedRequest:responseHTMLString:]):
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
(-[WKWebView loadFileRequest:allowingReadAccessToURL:]):
(-[WKWebView _toggleStrikeThrough:]):
(-[WKWebView _increaseListLevel:]):
(-[WKWebView _decreaseListLevel:]):
(-[WKWebView _changeListType:]):
(-[WKWebView _setViewportSizeForCSSViewportUnits:]):
(-[WKWebView _didEnableBrowserExtensions:]):
(-[WKWebView _didDisableBrowserExtensions:]):
(-[WKWebView _setEditable:]):
(-[WKWebView _executeEditCommand:argument:completion:]):
(-[WKWebView _startTextManipulationsWithConfiguration:completion:]):
(-[WKWebView _completeTextManipulation:completion:]):
(-[WKWebView _completeTextManipulationForItems:completion:]):
(-[WKWebView _takeFindStringFromSelection:]):
(-[WKWebView _updateMediaPlaybackControlsManager]):
(-[WKWebView _togglePictureInPicture]):
(-[WKWebView _closeAllMediaPresentations]):
(-[WKWebView _stopMediaCapture]):
(-[WKWebView _stopAllMediaPlayback]):
(-[WKWebView _suspendAllMediaPlayback]):
(-[WKWebView _resumeAllMediaPlayback]):
(-[WKWebView _restoreAppHighlights:]):
(-[WKWebView _restoreAndScrollToAppHighlight:]):
(-[WKWebView _addAppHighlight]):
(-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
(-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLs:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:]):
(-[WKWebView _grantAccessToAssetServices]):
(-[WKWebView _revokeAccessToAssetServices]):
(-[WKWebView _switchFromStaticFontRegistryToUserFontRegistry]):
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]):
(-[WKWebView _suspendPage:]):
(-[WKWebView _resumePage:]):
(-[WKWebView _setApplicationNameForUserAgent:]):
(-[WKWebView _killWebContentProcess]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _reloadExpiredOnly]):
(-[WKWebView _killWebContentProcessAndResetState]):
(-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView _getPDFFirstPageSizeInFrame:completionHandler:]):
(-[WKWebView _restoreFromSessionStateData:]):
(-[WKWebView _restoreSessionState:andNavigate:]):
(-[WKWebView _close]):
(-[WKWebView _tryClose]):
(-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
(-[WKWebView _attachmentForIdentifier:]):
(-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
(-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]):
(-[WKWebView _isJITEnabled:]):
(-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
(-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _updateWebpagePreferences:]):
(-[WKWebView _notifyUserScripts]):
(-[WKWebView _deferrableUserScriptsNeedNotification]):
(-[WKWebView _setAllowsRemoteInspection:]):
(-[WKWebView _setRemoteInspectionNameOverride:]):
(-[WKWebView _setAddsVisitedLinks:]):
(-[WKWebView _getMainResourceDataWithCompletionHandler:]):
(-[WKWebView _getWebArchiveDataWithCompletionHandler:]):
(-[WKWebView _getContentsAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsOfAllFramesAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
(-[WKWebView _getApplicationManifestWithCompletionHandler:]):
(-[WKWebView _setPaginationMode:]):
(-[WKWebView _setPaginationBehavesLikeColumns:]):
(-[WKWebView _setPageLength:]):
(-[WKWebView _setGapBetweenPages:]):
(-[WKWebView _setPaginationLineGridEnabled:]):
(-[WKWebView _setTextZoomFactor:]):
(-[WKWebView _setPageZoomFactor:]):
(-[WKWebView _countStringMatches:options:maxCount:]):
(-[WKWebView _findString:options:maxCount:]):
(-[WKWebView _hideFindUI]):
(-[WKWebView _saveBackForwardSnapshotForItem:]):
(-[WKWebView _clearServiceWorkerEntitlementOverride:]):
(-[WKWebView _preconnectToServer:]):
(-[WKWebView _setCanUseCredentialStorage:]):
(-[WKWebView _setLayoutMode:]):
(-[WKWebView _setFixedLayoutSize:]):
(-[WKWebView _setBackgroundExtendsBeyondPage:]):
(-[WKWebView _setViewScale:]):
(-[WKWebView _setCORSDisablingPatterns:]):
(-[WKWebView _getProcessDisplayNameWithCompletionHandler:]):
(-[WKWebView _setMinimumEffectiveDeviceWidth:]):
(-[WKWebView _grantAccessToPreferenceService]):
(-[WKWebView _setScrollPerformanceDataCollectionEnabled:]):
(-[WKWebView _setAllowsMediaDocumentInlinePlayback:]):
(-[WKWebView _setMediaCaptureEnabled:]):
(-[WKWebView _setPageMuted:]):
(-[WKWebView _removeDataDetectedLinks:]):
(-[WKWebView _doAfterNextPresentationUpdate:]):
(-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent):
(WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspend):
(WebKit::WebPageProxy::resume):
(WebKit::WebPageProxy::requestMediaPlaybackState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspend):
(WebKit::WebPage::resume):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-05-11 Ben Nham <nham@apple.com>
Failing sandbox check for media permissions should not generate a violation report
https://bugs.webkit.org/show_bug.cgi?id=225662
Reviewed by Geoffrey Garen.
We sandbox_check the UIProcess for camera and video permissions. But if the process doesn't
have those permissions, sandbox_check fails and generates an expensive violation report that
task_suspends the process. We need to suppress the reporting with SANDBOX_CHECK_NO_REPORT.
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::checkSandboxRequirementForType):
2021-05-11 Alex Christensen <achristensen@webkit.org>
Add SPI to restrict networking to a set of hosts
https://bugs.webkit.org/show_bug.cgi?id=225426
<rdar://77571521>
Reviewed by Tim Horton.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::allowedNetworkHosts const):
(API::PageConfiguration::setAllowedNetworkHosts):
(API::PageConfiguration::loadsFromNetwork const): Deleted.
(API::PageConfiguration::setLoadsFromNetwork): Deleted.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setLoadsFromNetwork:]):
(-[WKWebViewConfiguration _loadsFromNetwork]):
(-[WKWebViewConfiguration _setAllowedNetworkHosts:]):
(-[WKWebViewConfiguration _allowedNetworkHosts]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
2021-05-11 Brent Fulgham <bfulgham@apple.com>
[macOS] Extend access to 'com.apple.print.normalizerd' when canvas drawing is done in the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=225623
<rdar://problem/77354349>
Reviewed by Per Arne Vollan.
We need to dynamically extend access to 'com.apple.print.normalizerd' when the GPU Process is not handling canvas drawing.
WebKit needs this access to properly draw EPS images.
Tested by fast/images/eps-as-image.html
* UIProcess/WebPageProxy.cpp:
(WebKit::gpuMachServices): Add 'com.apple.print.normalizerd' to set of required services.
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: Remove 'com.apple.print.normalizerd' since it is
not possible to use from the Web Authentication process.
* WebProcess/com.apple.WebProcess.sb.in: Expect the extension to be dynamically extended on all releases.
2021-05-11 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Add _STAttributionDisplayName to macOS and iOS GPUProcess Info.plist
https://bugs.webkit.org/show_bug.cgi?id=225626
rdar://77019240
Reviewed by Youenn Fablet.
* GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist:
* GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist:
2021-05-11 Ada Chan <ada.chan@apple.com>
[WebXR] Return a default layer handle in XRDeviceProxy::createLayerProjection
https://bugs.webkit.org/show_bug.cgi?id=225631
Reviewed by Dean Jackson.
* Shared/Cocoa/XRDeviceProxy.h:
* Shared/Cocoa/XRDeviceProxy.mm:
(WebKit::XRDeviceProxy::createLayerProjection):
* UIProcess/Cocoa/PlatformXRCoordinator.h:
(WebKit::PlatformXRCoordinator::defaultLayerHandle):
* WebProcess/cocoa/PlatformXRSystemProxy.h:
* WebProcess/cocoa/PlatformXRSystemProxy.mm:
(WebKit::PlatformXRSystemProxy::createLayerProjection):
2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Allow immediate action gestures to begin when force clicking text inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=225600
<rdar://problem/77792365>
Reviewed by Tim Horton.
Adopt the new hit-test option. See WebCore/ChangeLog for more details.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
(WebKit::WebPage::lookupTextAtLocation):
2021-05-10 Sam Weinig <weinig@apple.com>
Use PixelBuffer rather than ImageData in platform/ code to fix layering violation
https://bugs.webkit.org/show_bug.cgi?id=225584
Reviewed by Darin Adler.
Replace all uses of the DOM layer object WebCore::ImageData with the new platform
layer WebCore::PixelBuffer, which fixes a layering violation WebCore and avoids
unnecessary allocations / reference counting.
* Platform/IPC/ArgumentCoders.h:
(IPC::ArgumentCoder<Optional<T>>::encode):
(IPC::ArgumentCoder<Optional<T>>::decode):
Add templatized Encoder/Decoder to work with streaming encoder.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
(WebKit::RemoteGraphicsContextGL::paintImageDataToImageBuffer): Deleted.
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(paintRenderingResultsToPixelBuffer):
(paintRenderingResultsToImageData): Deleted.
* GPUProcess/graphics/RemoteImageBuffer.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetPixelBufferHelper):
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetPixelBuffer):
(WebKit::RemoteRenderingBackend::semaphoreForGetPixelBuffer):
(WebKit::RemoteRenderingBackend::updateSharedMemoryAndSemaphoreForGetPixelBuffer):
(WebKit::RemoteRenderingBackend::destroyGetPixelBufferSharedMemory):
(WebKit::RemoteRenderingBackend::populateGetPixelBufferSharedMemory):
(WebKit::RemoteRenderingBackend::decodeItem):
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetImageDataHelper): Deleted.
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetImageData): Deleted.
(WebKit::RemoteRenderingBackend::semaphoreForGetImageData): Deleted.
(WebKit::RemoteRenderingBackend::updateSharedMemoryAndSemaphoreForGetImageData): Deleted.
(WebKit::RemoteRenderingBackend::destroyGetImageDataSharedMemory): Deleted.
(WebKit::RemoteRenderingBackend::populateGetImageDataSharedMemory): Deleted.
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::getPixelBuffer const):
(WebKit::CGDisplayListImageBufferBackend::putPixelBuffer):
(WebKit::CGDisplayListImageBufferBackend::getImageData const): Deleted.
(WebKit::CGDisplayListImageBufferBackend::putImageData): Deleted.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Ref<WebCore::ImageData>>::encode): Deleted.
(IPC::ArgumentCoder<Ref<WebCore::ImageData>>::decode): Deleted.
(IPC::ArgumentCoder<RefPtr<WebCore::ImageData>>::encode): Deleted.
(IPC::ArgumentCoder<RefPtr<WebCore::ImageData>>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::getPixelBuffer const):
(WebKit::ImageBufferShareableBitmapBackend::putPixelBuffer):
(WebKit::ImageBufferShareableBitmapBackend::getImageData const): Deleted.
(WebKit::ImageBufferShareableBitmapBackend::putImageData): Deleted.
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToPixelBuffer):
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToImageData): Deleted.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::putPixelBuffer):
(WebKit::RemoteImageBufferProxy::putImageData): Deleted.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::sharedMemoryForGetPixelBuffer):
(WebKit::RemoteRenderingBackendProxy::waitForGetPixelBufferToComplete):
(WebKit::RemoteRenderingBackendProxy::destroyGetPixelBufferSharedMemory):
(WebKit::RemoteRenderingBackendProxy::sharedMemoryForGetImageData): Deleted.
(WebKit::RemoteRenderingBackendProxy::waitForGetImageDataToComplete): Deleted.
(WebKit::RemoteRenderingBackendProxy::destroyGetImageDataSharedMemory): Deleted.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableIOSurfaceBackend::getPixelBuffer const):
(WebKit::ImageBufferShareableIOSurfaceBackend::putPixelBuffer):
(WebKit::ImageBufferShareableIOSurfaceBackend::getImageData const): Deleted.
(WebKit::ImageBufferShareableIOSurfaceBackend::putImageData): Deleted.
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
2021-05-10 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Extend Network Process sandbox to access more Network Extension databases
https://bugs.webkit.org/show_bug.cgi?id=225614
<rdar://problem/77696566>
Reviewed by Per Arne Vollan.
We don't allow the Network Process to directly memory-map files used by the network extensions
feature. We can improve memory performance by allowing the process to mmap these files, rather
than forcing a series of XPC operations to build the same database in memory.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2021-05-10 Kate Cheney <katherine_cheney@apple.com>
Speculative revalidation requests not properly attributed as app-bound
https://bugs.webkit.org/show_bug.cgi?id=225613
<rdar://problem/77664358>
Reviewed by Brent Fulgham.
Speculative revalidation requests make network connections and should
be attributed as app-bound based on the initiating navigation.
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourceInfo::isAppBound const):
(WebKit::NetworkCache::SubresourceInfo::setIsAppBound):
(WebKit::NetworkCache::SubresourcesEntry::subresources):
(WebKit::NetworkCache::SubresourcesEntry::subresources const): Deleted.
Remove const qualifier for the SubresourcesEntry::subresources()
function now that we need to store the app-bound value.
2021-05-10 Kate Cheney <katherine_cheney@apple.com>
Preflight requests not properly attributed as app-bound
https://bugs.webkit.org/show_bug.cgi?id=225596
<rdar://problem/77664272>
Reviewed by Brent Fulgham.
Testing SPI to request load data to check if preflight requests
were properly marked.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didLoadAppBoundRequest:]):
(-[WKWebView _didLoadNonAppBoundRequest:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com>
Make WebCore::HitTestRequest::RequestType an enum class
https://bugs.webkit.org/show_bug.cgi?id=225597
Reviewed by Sam Weinig.
See WebCore/ChangeLog for more details.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(-[WKWebProcessPlugInFrame hitTest:options:]):
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
(WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::performDictionaryLookupAtLocation):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::hitTest const):
* WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::defaultHitTestRequestTypes):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleContextMenuEvent):
(WebKit::WebPage::characterIndexForPointAsync):
(WebKit::WebPage::updateWithImageExtractionResult):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::rectForElementAtInteractionLocation const):
(WebKit::rangeForPointInRootViewCoordinates):
(WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation):
(WebKit::isObscuredElement):
(WebKit::selectionPositionInformation):
(WebKit::textInteractionPositionInformation):
(WebKit::WebPage::positionInformation):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::shouldDelayWindowOrderingEvent):
(WebKit::WebPage::acceptsFirstMouse):
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
(WebKit::WebPage::lookupTextAtLocation):
2021-05-10 Chris Dumez <cdumez@apple.com>
[iOS] Pages with service workers do not suspend promptly
https://bugs.webkit.org/show_bug.cgi?id=225598
Reviewed by Youenn Fablet.
WebProcessProxy::updateServiceWorkerProcessAssertion() was starting a foreground/background activity
if there is a service worker in-process and if any of the client processes are foreground/background.
The issue is that a common case is that one of the client process is the service worker process
itself (since we run the service worker in-process whenever possible nowadays). As a result, it would
create a process assertion cycle. We'd start a foreground activity due to the service worker but we
would not release it when the view is no longer foreground, because the process would stay "foreground"
due to the service worker process assertion.
To address this, updateServiceWorkerProcessAssertion() now only takes process assertions if there
are client processes other than the current process. This avoids the cycle and this is really the only
case we need to make sure the service worker process doesn't suspend. In the case where the service
worker and the client are in the same process, then the normal process assertions are sufficient.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion):
2021-05-10 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, fix the build with recent SDKs.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectMultiplePicker configurePresentation]):
2021-05-10 Alex Christensen <achristensen@webkit.org>
Add ObjC API similar to WKBundlePageCopyGroupIdentifier
https://bugs.webkit.org/show_bug.cgi?id=225477
Reviewed by Chris Dumez.
Once adopted this will allow us to remove WKWebProcessPlugInPageGroup
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _groupIdentifier]):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2021-05-10 Antoine Quint <graouts@webkit.org>
Fix some unified build errors
https://bugs.webkit.org/show_bug.cgi?id=225594
Reviewed by Wenson Hsieh.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* UIProcess/ios/WKTextSelectionRect.mm:
* UIProcess/mac/WKTextInputWindowController.mm:
2021-05-10 Youenn Fablet <youenn@apple.com>
Have IPC::Semaphore::wait return a state boolean
https://bugs.webkit.org/show_bug.cgi?id=225587
Reviewed by Alex Christensen.
Semaphore::wait might return early, in particular if its sempahore is destroyed.
To handle this case, return false in that case to allow specific handling by caller.
Use return state in RemoteCaptureSampleManager::RemoteAudio::startThread as a way to stop the capture thread.
Covered by existing tests.
* Platform/IPC/IPCSemaphore.h:
* Platform/IPC/darwin/IPCSemaphoreDarwin.cpp:
(IPC::Semaphore::wait):
* Platform/IPC/unix/IPCSemaphoreUnix.cpp:
(IPC::Semaphore::wait):
* Platform/IPC/win/IPCSemaphoreWin.cpp:
(IPC::Semaphore::wait):
* WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::RemoteAudio::startThread):
2021-05-10 Aditya Keerthi <akeerthi@apple.com>
[iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element
https://bugs.webkit.org/show_bug.cgi?id=225541
<rdar://problem/77537795>
Reviewed by Wenson Hsieh.
With the introduction of desktop-class browing on iPad, form control
elements began to retain focus even after their input peripheral
(popover, menu, etc.) was dismissed. This behavior matches macOS - when
a <select> element is clicked, a menu is presented, and when a option
is selected, the menu is dismissed but the element retains focus.
Consequently, when a <select> menu is dismissed by choosing an option on
an iPad with a hardware keyboard, the element retains focus. Now, when
switching tabs and coming back to the tab with the focused <select>, an
activity state update is triggered. Upon recognizing that there is a
focused element, an ElementDidFocus message is sent to the UIProcess.
In [WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:],
the focus is given permission to present the input peripheral (menu)
when the hardware keyboard is attached. This is necessary when necessary
when focusing a text input, because the UCB needs to be displayed and
text selection needs to be set up. However, the behavior is undesirable
for elements that present a popover or a menu (select, color inputs, and
date inputs), since the user is unexpectedly shown an input peripheral.
Even worse, the user's scroll position will be changed to ensure the
focused element is visible.
To fix the undesirable behavior, and get closer to the macOS behavior,
custom input peripherals should not be displayed when switching back
to a tab with a focused element.
Test: fast/forms/ios/focus-select-and-switch-tabs.html
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
Only show the input peripheral if it is not a keyboard view.
2021-05-10 Alex Christensen <achristensen@webkit.org>
Remove WKBundlePageGroupRef
https://bugs.webkit.org/show_bug.cgi?id=225471
Reviewed by Darin Adler.
Its last use was removed in rdar://60987265
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/APIInjectedBundleBundleClient.h:
(API::InjectedBundle::Client::willDestroyPage):
(API::InjectedBundle::Client::didInitializePageGroup): Deleted.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.mm:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetAsynchronousSpellCheckingEnabledForTesting):
(WKBundleGetLiveDocumentURLsForTesting):
(WKBundleSetUserStyleSheetLocationForTesting):
(WKBundleAddUserScript): Deleted.
(WKBundleAddUserStyleSheet): Deleted.
(WKBundleRemoveUserScript): Deleted.
(WKBundleRemoveUserStyleSheet): Deleted.
(WKBundleRemoveUserScripts): Deleted.
(WKBundleRemoveUserStyleSheets): Deleted.
(WKBundleRemoveAllUserContent): Deleted.
(WKBundleSetAsynchronousSpellCheckingEnabled): Deleted.
(WKBundleGetLiveDocumentURLs): Deleted.
(WKBundleSetUserStyleSheetLocation): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageGetPageGroup): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp: Removed.
* WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h: Removed.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setAsynchronousSpellCheckingEnabled):
(WebKit::InjectedBundle::setUserStyleSheetLocation):
(WebKit::InjectedBundle::liveDocumentURLs):
(WebKit::InjectedBundle::didInitializePageGroup): Deleted.
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/InjectedBundle/InjectedBundleClient.cpp:
(WebKit::InjectedBundleClient::didInitializePageGroup): Deleted.
* WebProcess/InjectedBundle/InjectedBundleClient.h:
* WebProcess/WebPage/WebPageGroupProxy.cpp:
(WebKit::WebPageGroupProxy::create):
2021-05-10 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Add picker UI for <input type=date> and <input type=datetime-local>
https://bugs.webkit.org/show_bug.cgi?id=224924
Reviewed by Adrian Perez de Castro.
Use a GtkPopover with a GtkCalendar.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSetFocus): Only notify the web process about focus changes when shouldNotifyFocusEvents is true.
(webkitWebViewBaseSetShouldNotifyFocusEvents): Set whether the web view should notify about focus changes to the
web process.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/gtk/WebDateTimePickerGtk.cpp:
(WebKit::WebDateTimePickerGtk::~WebDateTimePickerGtk): Call invalidate instead of endPicker.
(WebKit::WebDateTimePickerGtk::invalidate): Destroy the popover and allow the web view to notify about focus
events again.
(WebKit::WebDateTimePickerGtk::endPicker): Invalidate and notify the parent.
(WebKit::timeToString): Helper to convert the time portions of a DateComponents to a string.
(WebKit::calendarDateToString): Helper to convert selected date to a string.
(WebKit::WebDateTimePickerGtk::didChooseDate): Notify the WebPageProxy about the selected date.
(WebKit::WebDateTimePickerGtk::showDateTimePicker): Create or update a GtkPopover with a calendar.
(WebKit::WebDateTimePickerGtk::update): Update the calendar and current date.
* UIProcess/gtk/WebDateTimePickerGtk.h:
2021-05-10 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Use always async scrolling in accelerated compositing mode
https://bugs.webkit.org/show_bug.cgi?id=225512
Reviewed by Fujii Hironori.
We currently use async scrolling only when the hardware acceleration policy is set for always, but not when
entering accelerating compositing mode in ondemand policy. Since the GTK port still supports the non accelerated
compositing mode we need to add and remove the scrolling tree when entering and leaving the accelerated
compositing mode.
* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_set_hardware_acceleration_policy): Always enable async scrolling when accelerated compositing
is enabled.
* UIProcess/gtk/WebPreferencesGtk.cpp:
(WebKit::WebPreferences::platformInitializeStore): Ditto.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics): Remove the scrolling tree if the
drawing area is destroyed in accelerated compositing mode.
(WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Add the scrolling tree.
(WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode): Remove the scrolling tree.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage): Do not add the scrolling tree from here for the GTK port.
(WebKit::WebPage::close): Do not remove the scrolling tree from here for the GTK port.
2021-05-10 Youenn Fablet <youenn@apple.com>
Use IPC::Semaphore instead of sending an IPC message for every captured audio sample
https://bugs.webkit.org/show_bug.cgi?id=225452
Reviewed by Eric Carlson.
Previously, we were sending an IPC message from UIProcess or GPUProcess to WebProcess for every microphone audio sample chunk.
We are now using IPC::Semaphore to signal that a new chunk is to be processed.
We no longer send the chunk timestamp. Instead, we reconstruct it from the number of previously processed samples.
At audio storage change, we send the start time and we assume that there is continuous timing based on sample counts after that.
That is why we recreate a new audio storage change anytime we need to reset or the configuration changes, which should not happen often in practice.
We process fixed-size chunks on WebProcess side and signal it on GPUProcess/UIProcess side.
This size is sent through IPC at audio storage change time and is the max of 128 samples (WebAudio quantum) and AudioSession preferred size.
In case WebAudio is used, it should be 128 samples. In case WebAudio is not used, it should be 20 ms of audio data.
Covered by existing tests and manually tested.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::start):
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::storageChanged):
* WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::audioStorageChanged):
(WebKit::RemoteCaptureSampleManager::RemoteAudio::RemoteAudio):
(WebKit::RemoteCaptureSampleManager::RemoteAudio::~RemoteAudio):
(WebKit::RemoteCaptureSampleManager::RemoteAudio::stopThread):
(WebKit::RemoteCaptureSampleManager::RemoteAudio::startThread):
(WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage):
* WebProcess/cocoa/RemoteCaptureSampleManager.h:
* WebProcess/cocoa/RemoteCaptureSampleManager.messages.in:
2021-05-09 Ryosuke Niwa <rniwa@webkit.org>
IPC testing API should have the ability to send and receive shared memory
https://bugs.webkit.org/show_bug.cgi?id=225576
Reviewed by Wenson Hsieh.
This patch adds the capability to send & receive shared memory for IPC testing purposes.
It adds IPC.createSharedMemory which creates a JavaScript object representing a newly
allocated IPC-sharable memory. It has readBytes and writeBytes methods. Both takes offset
and the number of bytes to read / write. readBytes will return a new ArrayBuffer and
writeBytes takes an ArrayBuffer or a typed array as the first argument.
IPC.sendMessage and IPC.sendSyncMessage now supprts encoding this SharedMemory JavaScript
object. It supports the type specific arguments of "protection" and "dataSize" in addition
to the regular "value" property for the SharedMemory object.
This patch also adds the support for sending Semaphore object over IPC created via
IPC.createSemaphore, which was supposed to be added in r277199.
Finally, this patch also exposes the VM page size via IPC.vmPageSize to facilitate
the allocation of a sharable memory of an interesting size for testing purposes.
Tests: TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory
TestWebKitAPI.IPCTestingAPI.CanCreateSharedMemory
TestWebKitAPI.IPCTestingAPI.CanSendSemaphpre
TestWebKitAPI.IPCTestingAPI.CanSendSharedMemory
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetImageData): Use uint32_t instead
of size_t since the latter depends on the specific architecture (e.g. 32-bit vs 64-bit).
(WebKit::RemoteRenderingBackend::updateSharedMemoryAndSemaphoreForGetImageData): Ditto.
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackend.messages.in: Ditto.
* Platform/IPC/JSIPCBinding.h: Added a specialization for SharedMemory::IPCHandle.
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPCSemaphore::encode const): Added.
(WebKit::IPCTestingAPI::JSSharedMemory): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::create): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::size): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::JSSharedMemory): Added.
(WebKit::IPCTestingAPI::convertToUint64): Moved up here.
(WebKit::IPCTestingAPI::JSIPCSemaphore::signal): Fixed a typo.
(WebKit::IPCTestingAPI::JSIPCSemaphore::waitFor): Ditto.
(WebKit::IPCTestingAPI::JSSharedMemory::createHandle): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::createJSWrapper): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::wrapperClass): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::unwrap): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::toWrapped): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::initialize): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::finalize): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::staticFunctions): Added.
(WebKit::IPCTestingAPI::JSSharedMemory::readBytes): Added.
(WebKit::IPCTestingAPI::arrayBufferDataFromValueRef): Extracted out of encodeTypedArray.
(WebKit::IPCTestingAPI::JSSharedMemory::writeBytes): Added.
(WebKit::IPCTestingAPI::JSIPC::staticFunctions): Added IPC.createSharedMemory.
(WebKit::IPCTestingAPI::JSIPC::staticValues): Added IPC.vmPageSize.
(WebKit::IPCTestingAPI::encodeTypedArray):
(WebKit::IPCTestingAPI::getObjectIdentifierFromProperty): Now uses convertToUint64.
(WebKit::IPCTestingAPI::encodeSharedMemory): Added.
(WebKit::IPCTestingAPI::encodeSemaphore): Added.
(WebKit::IPCTestingAPI::encodeArgument): Added the support for encoding SharedMemory and
Semaphore.
(WebKit::IPCTestingAPI::JSIPC::createSharedMemory): Added.
(WebKit::IPCTestingAPI::JSIPC::vmPageSize): Added.
(IPC::jsValueForDecodedArgumentValue): Added. Creates a newly added SharedMemory JavaScript
object for SharedMemory::IPCHandle. It also exposes dataSize and protection value.
This decoder detects whether the shared memory is writable or not by attempting to map it
as Protection::ReadWrite and falling back to Protection::ReadOnly if the former fails.
2021-05-09 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 6: Migrate ItemBufferWritingClient from ItemHandle to a const Variant&
https://bugs.webkit.org/show_bug.cgi?id=224270
Reviewed by Wenson Hsieh.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::encodeItemOutOfLineHelper):
2021-05-08 Peng Liu <peng.liu6@apple.com>
[GPUP] A small video element enters fullscreen with strange animations
https://bugs.webkit.org/show_bug.cgi?id=225548
Reviewed by Eric Carlson.
Use `FloatRect` instead of `IntRect` to exchange video element location/size
information between WebContent processes and the UI process to avoid information
mismatch due to floating-point rounding.
Deal with the video element resizing differently for two cases:
1) Video is playing in the inline mode.
2) Video is entering fullscreen/picture-in-picture.
For the latter case, `-[WKVideoLayerRemote layoutSublayers]` will scale the layer
with the same factor in both X and Y direction.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::setVideoInlineSizeIfPossible):
(WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced):
* UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
(WebKit::VideoFullscreenManagerProxy::exitFullscreen):
(WebKit::VideoFullscreenManagerProxy::setInlineRect):
(WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::setVideoInlineSizeFenced):
(WebKit::MediaPlayerPrivateRemote::inVideoFullscreenOrPictureInPicture const):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm:
(-[WKVideoLayerRemote layoutSublayers]):
(-[WKVideoLayerRemote resolveBounds]):
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::inlineVideoFrame):
(WebKit::VideoFullscreenManager::requestUpdateInlineRect):
2021-05-08 Darin Adler <darin@apple.com>
Remove uses of the WTF::String::toInt family of functions from WebKit framework sources
https://bugs.webkit.org/show_bug.cgi?id=225570
Reviewed by Sam Weinig.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::readSizeFile): Use parseInteger<uint64_t>
instead of charactersToUIntStrict. Also simplified the code a bit by
reducing the mixing of integer types in the function.
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::deleteOldVersions): Use parseInteger<unsigned>
instead of String::toUIntStrict. Also use StringView::substring so we don't
have to allocate a copy of a substring just to parse it.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Use
parseInteger<uint32_t> instead of charactersToUIntStrict. Also let the
StringView constructor take care of converting the const char*
so we don't have to write explicit calls to std::strlen here.
(WebKit::XPCServiceInitializerDelegate::getProcessIdentifier): Use
parseInteger<uint64_t> instead of String::toUInt64Strict. Also pass the
const char* as a StringView rather than converting it to a String so we
don't have to allocate a copy of the string just to parse it.
* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::PluginVersion::parse): Use parseIntegerAllowingTrailingJunk<unsigned>
instead of String::toUInt. Also use StringView::split instead of String::split
so we don't have to allocate memory for all the substrings and a range-based
for loop for simplicity.
* UIProcess/API/Cocoa/WKWebView.mm:
(coreTextManipulationItemIdentifierFromString): Use -[NSString longLongValue]
instead of String::toUInt64. There's no need to parse this unsigned because
the values will fit in 63 bits just fine, and it's nice to use NSString
directly rather than copying the string just to parse the integer in it.
(coreTextManipulationTokenIdentifierFromString): Ditto.
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::parsePostBuffer): Use parseIntegerAllowingTrailingJunk<unsigned>
instead of String::toInt. The length can't be negative; it was not helpful
to parse negative numbers before and this is a small bug fix, but in a code
path that is probably not used for much of anything any more.
2021-05-08 Sam Weinig <weinig@apple.com>
Factor out pixel buffer from DOM specific ImageData class
https://bugs.webkit.org/show_bug.cgi?id=225554
Reviewed by Darin Adler.
Update for ImageData::data() returning a reference.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::populateGetImageDataSharedMemory):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Ref<WebCore::ImageData>>::encode):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-05-08 Alex Christensen <achristensen@webkit.org>
REGRESSION (r276797?): [ macOS/iOS ] TestWebKitAPI.URLSchemeHandler.Exceptions is flakey crashing
https://bugs.webkit.org/show_bug.cgi?id=225373
Reviewed by Sam Weinig.
This patch fixes three problems related to the lifetime of WKURLSchemeTasks:
1. There was an unneeded abstraction API::URLSchemeTask which wrapped a WebURLSchemeTask, which could have a different lifetime than its owner.
This is especially bad since at least one was used on multiple threads.
2. We weren't explicitly keeping a strong reference to the task given to the API client in startURLSchemeTask: and stopURLSchemeTask: which could
cause all our internal maps to release their references to the task after the first call to didFailWithError and there was a test that did multiple
calls to didFailWithError and verifies it throws an NSException the second time.
3. We were keeping a HashSet of raw WebURLSchemeHandler pointers, then using each of them without keeping it alive.
This is covered by at least the URLSchemeHandler.Exceptions API test which would crash in many exciting places before this but doesn't crash after this.
* Sources.txt:
* UIProcess/API/APIURLSchemeTask.cpp: Removed.
* UIProcess/API/APIURLSchemeTask.h: Removed.
* UIProcess/API/C/WKTestingSupport.cpp:
(WKGetAPIURLSchemeTaskInstanceCount): Deleted.
* UIProcess/API/C/WKTestingSupport.h:
* UIProcess/API/Cocoa/WKURLSchemeTask.mm:
(-[WKURLSchemeTaskImpl init]):
(-[WKURLSchemeTaskImpl dealloc]):
(-[WKURLSchemeTaskImpl request]):
(-[WKURLSchemeTaskImpl _requestOnlyIfCached]):
(-[WKURLSchemeTaskImpl _willPerformRedirection:newRequest:completionHandler:]):
(-[WKURLSchemeTaskImpl didReceiveResponse:]):
(-[WKURLSchemeTaskImpl didReceiveData:]):
(-[WKURLSchemeTaskImpl didFinish]):
(-[WKURLSchemeTaskImpl didFailWithError:]):
(-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:]):
(-[WKURLSchemeTaskImpl _frame]):
* UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h:
* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h:
* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
(WebKit::WebURLSchemeHandlerCocoa::platformStartTask):
(WebKit::WebURLSchemeHandlerCocoa::platformStopTask):
(WebKit::WebURLSchemeHandlerCocoa::platformTaskCompleted): Deleted.
* UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.h:
* UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::stopAllURLSchemeTasks):
* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::taskCompleted):
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.h:
* WebKit.xcodeproj/project.pbxproj:
2021-05-08 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Use the new libsoup network metrics API
https://bugs.webkit.org/show_bug.cgi?id=225510
Reviewed by Michael Catanzaro.
Use the new API available in libsoup3. It provides more accurate information for time metrics and also size
metrics that were missing.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::createRequest):
(WebKit::NetworkDataTaskSoup::clearRequest):
(WebKit::NetworkDataTaskSoup::resume):
(WebKit::NetworkDataTaskSoup::didSendRequest):
(WebKit::NetworkDataTaskSoup::dispatchDidCompleteWithError):
(WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
(WebKit::NetworkDataTaskSoup::didGetHeaders):
(WebKit::NetworkDataTaskSoup::wroteHeadersCallback):
(WebKit::NetworkDataTaskSoup::wroteBodyCallback):
(WebKit::NetworkDataTaskSoup::gotBodyCallback):
(WebKit::NetworkDataTaskSoup::networkEvent):
(WebKit::NetworkDataTaskSoup::didStartRequest):
(WebKit::NetworkDataTaskSoup::didRestart):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
2021-05-07 Brent Fulgham <bfulgham@apple.com>
[iOS] [GPU] Silence warning about com.apple.audio.AudioComponentRegistrar in the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=225547
<rdar://problem/77334436>
Reviewed by Per Arne Vollan.
We block access to various media things (like 'com.apple.audio.AudioComponentRegistrar') when the GPU Process is being used.
Some AudioToolbox code continues to try to connect even though we are not activating relevant parts of the audio subsystem.
AudioToolbox doesn't care about this blocked connection when running in this mode, but they have not had a chance to modify
the framework to avoid attempting to connect.
To avoid spurious logging and telemetry, silence the sandbox violation when the GPU Process is active.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-05-07 Brent Fulgham <bfulgham@apple.com>
[macOS] [GPU] Process is missing access to IOMobileFramebufferUserClient on Apple Silicon
https://bugs.webkit.org/show_bug.cgi?id=225545
<rdar://problem/77591664>
Reviewed by Jer Noble.
Apple Silicon GPU Process needs access to IOMobileFramebufferUserClient for certain types of media playback. We allow this
on iOS, and in the WebContent process, but missed it in the GPU Process.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-05-07 James Savage <james.savage@apple.com>
Validate Swift async imports.
https://bugs.webkit.org/show_bug.cgi?id=225134
<rdar://73620237>
Reviewed by Sam Weinig.
Audit our imported Objective-C API for correct translations to Swift's
upcoming concurrency feature. This mostly entails removing redundant
words, tagging methods which Swift's heuristics missed, and in some
cases disabling methods that do not follow Swift's async conventions.
* Shared/API/Cocoa/WKFoundation.h: Because the Foundation macros used
for Swift async won't exist in all SDKs, provide our own wrapper around
them to avoid undefined macro errors.
* SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Passing these
flags to older tools will result in errors, so only so conditionally.
* SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added a
new source file reference for generated sources. These will be copied
from WebKitAdditions if available, or replaced with empty sources for
compatibility.
* UIProcess/API/Cocoa/NSAttributedString.h: Adopt new attributes to
define an explicit Swift async name.
* UIProcess/API/Cocoa/WKContentRuleListStore.h: Ditto.
* UIProcess/API/Cocoa/WKDownloadDelegate.h: In this case I also apply
NS_SWIFT_NAME as the "decisionHandler" argument would otherwise not
import as async. Despite using a different macro, I'm just using
NS_SWIFT_ASYNC_NAME to check for these changes as all these annotations
should exist or not-exist at once.
* UIProcess/API/Cocoa/WKHTTPCookieStore.h: Ditto.
* UIProcess/API/Cocoa/WKNavigationDelegate.h: Ditto.
* UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Ditto.
* UIProcess/API/Cocoa/WKUIDelegate.h: Ditto.
* UIProcess/API/Cocoa/WKWebView.h: _Nullable_result is a new annotation
which specifies that the result and error are not mutually exclusive,
but rather than we can expect a nil result in cases where there are not
an error. For the same reason as above, we only want to refer to this
keyword conditionally.
* UIProcess/API/Cocoa/WKWebsiteDataStore.h: Ditto.
2021-05-07 Tim Horton <timothy_horton@apple.com>
Add an experimental alternative display-list-based RemoteLayerBackingStore implementation
https://bugs.webkit.org/show_bug.cgi?id=225508
Reviewed by Sam Weinig.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp: Added.
(WebKit::CGDisplayListImageBufferBackend::calculateMemoryCost):
(WebKit::CGDisplayListImageBufferBackend::create):
(WebKit::CGDisplayListImageBufferBackend::CGDisplayListImageBufferBackend):
(WebKit::CGDisplayListImageBufferBackend::createImageBufferBackendHandle const):
(WebKit::CGDisplayListImageBufferBackend::context const):
(WebKit::CGDisplayListImageBufferBackend::backendSize const):
(WebKit::CGDisplayListImageBufferBackend::bytesPerRow const):
(WebKit::CGDisplayListImageBufferBackend::copyNativeImage const):
(WebKit::CGDisplayListImageBufferBackend::toBGRAData const):
(WebKit::CGDisplayListImageBufferBackend::getImageData const):
(WebKit::CGDisplayListImageBufferBackend::putImageData):
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h: Added.
Add an ImageBuffer backend backed by a CG display list.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
Add a new RemoteLayerBackingStore type that uses CGDisplayListImageBufferBackend.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode const):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::supportsPartialRepaint):
Disable partial repaint if using display-list-based backing store,
because we don't currently have any way to mutate display lists.
(WebKit::RemoteLayerBackingStore::display):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
When applying a display-list-based backing store to a layer, we just
pass the encodede data directly to the layer, and tell it to use the
display list to render.
* SourcesCocoa.txt:
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(WebKit::RemoteLayerTreeNode::createWithPlainLayer):
(-[WKPlainRemoteLayer description]): Deleted.
Move WKPlainRemoteLayer to RemoteLayerTreeLayers, and rename it to WKCompositingLayer.
It will now back all WKCompositingViews.
* UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h: Added.
* UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm: Added.
(-[WKCompositingLayer description]):
(-[WKCompositingLayer _setWKContentsDisplayList:]):
(-[WKCompositingLayer _wkContentsDisplayList]):
(-[WKCompositingLayer drawInContext:]):
Make WKCompositingLayer replay the given display list in drawRect
(just because we're currently missing API to actually directly pass
the encoded display list data to CA).
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(+[WKCompositingView layerClass]):
Use WKCompositingLayer as the layer class for all WKCompositingViews.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::updateBackingStore):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
(WebKit::RemoteLayerTreeContext::useCGDisplayListsForDOMRendering const):
(WebKit::RemoteLayerTreeContext::setUseCGDisplayListsForDOMRendering):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
Plumb the internal feature flag from WebPreferences to RemoteLayerTreeContext
to PlatformCALayerRemote to RemoteLayerBackingStore; if the preference is
on and the feature is available, we'll always prefer display-list backed
surfaces over either of the bitmap types.
2021-05-07 Brent Fulgham <bfulgham@apple.com>
[iOS] Make AccessibilityReduceMotion test case work on iOS
https://bugs.webkit.org/show_bug.cgi?id=225244
<rdar://problem/77589455>
Reviewed by Per Arne Vollan.
New tests for Accessibility-related features were added in Bug 215664, but only for macOS.
We support these same features on iOS, and should have test coverage.
Tested by AccessibilityReduceMotion.mm.
* Platform/spi/Cocoa/AccessibilitySupportSPI.h:
2021-05-07 Brent Fulgham <bfulgham@apple.com>
[iOS] [GPU] Silence warning about com.apple.fontservicesd
https://bugs.webkit.org/show_bug.cgi?id=225520
<rdar://problem/77536616>
Reviewed by Per Arne Vollan.
We silenced the warnings about blocked connections to 'com.apple.fontservicesd' in the WebContent process in Bug 220320. We should
have done the same to the GPU Process to avoid spurious reports and telemetry.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-05-07 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277201.
https://bugs.webkit.org/show_bug.cgi?id=225542
Includes project file change.
Reverted changeset:
"[iOS] Make AccessibilityReduceMotion test case work on iOS"
https://bugs.webkit.org/show_bug.cgi?id=225244
https://trac.webkit.org/changeset/277201
2021-05-07 Brent Fulgham <bfulgham@apple.com>
[iOS] Make AccessibilityReduceMotion test case work on iOS
https://bugs.webkit.org/show_bug.cgi?id=225244
<rdar://problem/77589455>
New tests for Accessibility-related features were added in Bug 215664, but only for macOS.
We support these same features on iOS, and should have test coverage.
Reviewed by Per Arne Vollan.
Tested by AccessibilityReduceMotion.mm.
* Platform/spi/Cocoa/AccessibilitySupportSPI.h:
2021-05-07 Ryosuke Niwa <rniwa@webkit.org>
IPC testing API should have the ability to create and receive IPC::Semaphore
https://bugs.webkit.org/show_bug.cgi?id=225537
Reviewed by Wenson Hsieh.
This patch adds the capability to create IPC::Semaphore for IPC testing purposes.
It adds IPC.createSemaphore which creates a JavaScript object representing a semaphore
with signal and waitFor methods like IPC::Semaphore but waitFor taking milliseconds
to be consistent with other JavaScript APIs.
This patch also adds the support for encoding RemoteRenderingBackendCreationParameters
to facilitate creating a remote rendering backend during IPC testing.
Tests: TestWebKitAPI.IPCTestingAPI.CanReceiveIPCSemaphore
TestWebKitAPI.IPCTestingAPI.CanCreateIPCSemaphore
* Platform/IPC/JSIPCBinding.cpp:
(IPC::jsValueForDecodedArgumentValue): Takes r-value reference since IPC::Semaphore
doesn't have a copy constructor.
* Platform/IPC/JSIPCBinding.h:
(IPC::jsValueForDecodedArgumentValue): Ditto. Added a specialization for IPC::Semaphore.
(IPC::putJSValueForDecodeArgumentInArray):
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPCSemaphore): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::create): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::exchange): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::JSIPCSemaphore): Added.
(WebKit::IPCTestingAPI::createTypeError): Moved up.
(WebKit::IPCTestingAPI::JSIPCSemaphore::createJSWrapper): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::wrapperClass): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::unwrap): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::toWrapped): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::initialize): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::finalize): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::staticFunctions): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::signal): Added.
(WebKit::IPCTestingAPI::JSIPCSemaphore::waitFor): Added.
(WebKit::IPCTestingAPI::JSIPC::wrapperClass):
(WebKit::IPCTestingAPI::JSIPC::staticFunctions): Added IPC.createSemaphore.
(WebKit::IPCTestingAPI::getObjectIdentifierFromProperty): Added.
(WebKit::IPCTestingAPI::encodeRemoteRenderingBackendCreationParameters): Added.
(WebKit::IPCTestingAPI::encodeArgument): Added the support for encoding
RemoteRenderingBackendCreationParameters as an IPC argument.
(WebKit::IPCTestingAPI::JSIPC::createSemaphore): Added.
(IPC::jsValueForDecodedArgumentValue): Defined the aforementioned specialization for
IPC::Semaphore with IPCTestingAPI .
2021-05-07 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Set the -isSourceEditable property when presenting webpage translation popup
https://bugs.webkit.org/show_bug.cgi?id=225515
<rdar://problem/77658040>
Reviewed by Tim Horton.
See WebCore/ChangeLog for more details.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuTranslation):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleContextMenuTranslation):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::handleContextMenuTranslation):
* WebProcess/WebCoreSupport/WebContextMenuClient.h:
* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::handleTranslation):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::handleContextMenuTranslation):
* WebProcess/WebPage/WebPage.h:
2021-05-07 Carlos Garnacho <carlosg@gnome.org>
[GTK4] Rewrite GTK gesture support to work for both 3.x and 4.x.
https://bugs.webkit.org/show_bug.cgi?id=212324
Reviewed by Carlos Garcia Campos.
Rewrite the touch gesture handling to avoid GdkEvent as an exchange
token, and not rely on the web view being able to hold and re-route
these at whim. This makes touch and touchpad gestures work on GTK3
and GTK4 in similar ways, and so that both work.
For this, touch event propagation got some substantial changes, it
used to work by first delivering the touch events to the web page,
and manually feeding the returned+unhandled ones to gesture controllers.
Now event delivery is delegated on GTK, and happens right away on
gesture controllers, it is the WebkitWebViewBase which chooses to make
them effective after the web page (maybe) handled the events. Gestures
are reset whenever the web page is considered to be handling touch
events.
Also fix some buglets accumulated along the way, web view zoom conflicted
with in-page zoom handling, and ViewGestureController page switching
conflicted with press-drag-release emulation on the web page. These now
work better and closer to GtkScrolledWindow behavior.
No new tests, the GTK touch tests that should catch this were disabled
in the past and need fixing. This patch will require manual testing.
* PlatformGTK.cmake: Drop GTK4 conditionals around ViewGestureController
* SourcesGTK.txt: Drop GestureController.cpp. Build ViewGestureController
code files unconditionally.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithTouchEvent): Delegate handling on
WebKitWebViewBase.
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Use platform
independent struct to forward scroll to ViewGestureController.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSnapshot): Involve ViewGestureController in rendering.
(webkitWebViewBaseButtonPressEvent):
(webkitWebViewBaseButtonReleaseEvent):
(webkitWebViewBaseButtonPressed):
(webkitWebViewBaseButtonReleased):
(webkitWebViewBaseMotionNotifyEvent): Ignore pointer-emulated events from
touchscreens.
(webkitWebViewBaseHandleWheelEvent):
(webkitWebViewBaseScroll): Use platform independent struct
to forward scroll to ViewGestureController.
(appendTouchEvent):
(touchPointStateForEvents):
(webkitWebViewBaseGetTouchPointsForEvent):
(webkitWebViewBaseTouchEvent):
Generalized to work on both GTK3 and GTK4.
(webkitWebViewBaseZoomBegin):
(webkitWebViewBaseZoomChanged):
(webkitWebViewBaseTouchLongPress):
(webkitWebViewBaseTouchPress):
(webkitWebViewBaseTouchRelease):
(webkitWebViewBaseTouchDragBegin):
(webkitWebViewBaseTouchDragUpdate):
(webkitWebViewBaseTouchDragEnd):
(webkitWebViewBaseTouchDragCancel):
(webkitWebViewBaseTouchSwipe): Newly added touch gesture implementation
callbacks. Not delegated anymore on GestureController.
(webkitWebViewBaseConstructed): Create touch gestures in the base view
widget, let them handle events automatically instead of relying on
manual event feeding via gtk_event_controller_handle_event(). Also add
a GtkEventControllerLegacy to handle forwarding of raw touch events to
the web page in GTK4.
(webkitWebViewBaseSetEnableBackForwardNavigationGesture):
(webkitWebViewBaseViewGestureController):
(webkitWebViewBaseBeginBackSwipeForTesting):
(webkitWebViewBaseCompleteBackSwipeForTesting):
(webkitWebViewBaseWillSwapWebProcess):
(webkitWebViewBaseDidExitWebProcess):
(webkitWebViewBaseDidRelaunchWebProcess):
(webkitWebViewBaseDidStartProvisionalLoadForMainFrame):
(webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):
(webkitWebViewBaseDidFinishNavigation):
(webkitWebViewBaseDidFailNavigation):
(webkitWebViewBaseDidSameDocumentNavigationForMainFrame):
(webkitWebViewBaseDidRestoreScrollPosition): Remove conditionals around
ViewGestureController for GTK4.
(webkitWebViewBasePageGrabbedTouch): New method to tag touch events
altogether as handled by the web page, thus resetting any ongoing view-level
gesture handling. This inversion is necessary as gesture controllers are now
always fed input events parallel to web page touch event handling.
(webkitWebViewBaseGestureController): Deleted.
(webkit_web_view_base_class_init):
(webkitWebViewBaseEvent): Removed widget_class->event vfunc. Touchpad gesture
event forwarding to event controllers is delegated on GTK.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/ViewGestureController.h:
* UIProcess/gtk/GestureController.cpp: Removed. Gestures are implemented in
the base view.
* UIProcess/gtk/GestureController.h: Removed.
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::isEventStop):
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
(WebKit::isTouchEvent):
(WebKit::createScrollEvent):
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
(WebKit::ViewGestureController::handleScrollWheelEvent):
(WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
(WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting): Declare
PlatformGtkScrollData, and use it as "platform scroll event" for both GTK3 and GTK4.
(WebKit::ViewGestureController::snapshot): New GTK4 specific method to render
the page switching gesture action.
2021-05-07 Youenn Fablet <youenn@apple.com>
Add WebRTC logging control in GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=225346
Reviewed by Eric Carlson.
Implement setting of WebRTC log level using LibWebRTCCodecs and LibWebRTCCodecsProxy.
This will help debugging issues with GPU-running webrtc codecs.
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::toWebRTCVideoRotation):
(WebKit::LibWebRTCCodecsProxy::setRTCLoggingLevel):
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThread):
(WebKit::LibWebRTCCodecs::setLoggingLevel):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::setLoggingLevel):
* WebProcess/Network/webrtc/LibWebRTCProvider.h:
2021-05-07 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Safari sometimes hangs underneath `WebKit::UIDelegate::UIClient::createNewPage`
https://bugs.webkit.org/show_bug.cgi?id=225481
rdar://77565282
Reviewed by Chris Dumez.
Consider the scenario where a webpage programmatically opens a window in a new tab on iOS while the keyboard is
visible. In certain configurations, Safari indirectly tells the `WKWebView` containing the original webpage to
`-resignFirstResponder` and then `-becomeFirstResponder` again, while creating a new web view and shuffling
around the view hierarchy under `-webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:`.
Since the keyboard is up, this causes UIKit to ask for an autocorrection context via `-[WKContentView
requestAutocorrectionContextWithCompletionHandler:]`, which blocks the main thread on a response from the web
process. Of course, since we're handling synchronous IPC, the web process isn't capable of sending a response
back to the UI process, so we deadlock until we exceed the IPC timeout, and then exit the call stack.
Instead, it's possible in this case to recognize that we're already handling a synchronous IPC message, and any
attempts to wait for a response will time out anyways. Instead of waiting for the entire timeout duration, we
can fail eagerly to avoid hanging the process that is waiting.
* Platform/IPC/Connection.cpp:
(IPC::Connection::Connection):
(IPC::Connection::sendMessage):
(IPC::Connection::waitForMessage):
(IPC::Connection::dispatchSyncMessage):
* Platform/IPC/Connection.h:
Add a new counter variable, `m_inDispatchSyncMessageCount`, that is incremented and decremented while we're
in the process of dispatching an incoming sync IPC message. If `m_inDispatchSyncMessageCount` is nonzero and
we have a non-infinite IPC timeout duration, then we should fail sooner inside `Connection::waitForMessage`,
instead of waiting to time out.
Drive-by refactoring: while we're here, let's also move initialization for some of the members on `Connection`
into the class declaration, instead of the constructor.
(IPC::Connection::WTF_GUARDED_BY_LOCK):
* Platform/IPC/Timeout.h:
(IPC::Timeout::isInfinity const):
* WebKit.xcodeproj/project.pbxproj:
2021-05-06 Brent Fulgham <bfulgham@apple.com>
[iOS] Allow file-read* and file-write-data for /dev/null and /dev/zero
https://bugs.webkit.org/show_bug.cgi?id=225482
<rdar://problem/77503594>
Reviewed by Per Arne Vollan.
Revise sandbox to allow read and write-data access to /dev/null and /dev/zero.
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2021-05-06 Chris Dumez <cdumez@apple.com>
Retry asynchronously in WebProcessPool::getGPUProcessConnection() in case of failure
https://bugs.webkit.org/show_bug.cgi?id=225486
Reviewed by Alex Christensen.
Retry asynchronously in WebProcessPool::getGPUProcessConnection(), similarly to what
we do in WebsiteDataStore::getNetworkProcessConnection(). As a result, we no longer
need to ref the WebProcessPool in the lambda and we avoid retrying unnecessarily
when the WebProcessPool is getting destroyed.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::getGPUProcessConnection):
2021-05-06 Eric Carlson <eric.carlson@apple.com>
[GPUP] Reduce MediaPlayer polling frequency when possible
https://bugs.webkit.org/show_bug.cgi?id=225396
<rdar://problem/77562643>
Reviewed by Jer Noble.
When the MediaPlayerPrivate supports the new "current time changed" callback, use it
know when currentTime changes instead of polling at a fixed frequency. Current time
changes much more frequently than the other state that needs to be pushed to the
web process periodically so split current time out of the "cached state" struct
and push it separately when it changes, which also allow us to reduce the polling
frequency significantly.
Some of the state we were updating every time the cached state timer fired only
changes at known times, so reduce the number of things updated every time state
is pushed.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::getConfiguration): Set the timeChanged callback.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkStateChanged): Update cached
readyState and networkState since they aren't updated by updateCachedState.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged): Ditto.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerDurationChanged): Update cached duration.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerCharacteristicChanged): Update hasAudio
and hasVideo.
(WebKit::RemoteMediaPlayerProxy::startUpdateCachedStateMessageTimer): Decrease the
time frequency to 200ms when the player supports the time change callback. Decrease
it to 250ms even when it doesn't because we interpolate time in the WP anyway.
(WebKit::RemoteMediaPlayerProxy::currentTimeChanged): Send the time change.
(WebKit::RemoteMediaPlayerProxy::updateCachedState): Send CurrentTimeChanged if
the player doesn't support the new callback. Don't update properties that change
at predictable times.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::pause): Use m_cachedMediaTime and m_cachedMediaTimeQueryTime
instead of m_cachedState.currentTime and m_cachedState.timestamp.
(WebKit::MediaPlayerPrivateRemote::currentMediaTime const): Ditto.
(WebKit::MediaPlayerPrivateRemote::playbackStateChanged): Ditto.
(WebKit::MediaPlayerPrivateRemote::currentTimeChanged): Update time instance variables.
(WebKit::MediaPlayerPrivateRemote::updateCachedState):
(WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime): Use m_cachedMediaTime
and m_cachedMediaTimeQueryTime instead of m_cachedState.currentTime and m_cachedState.timestamp.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
* WebProcess/GPU/media/RemoteMediaPlayerState.h:
(WebKit::RemoteMediaPlayerState::encode const): Remove currentTime and timestamp.
(WebKit::RemoteMediaPlayerState::decode): Ditto.
2021-05-06 Alex Christensen <achristensen@webkit.org>
Fix crash when WebsiteDataStore is destroyed with outstanding getNetworkProcessConnection request
https://bugs.webkit.org/show_bug.cgi?id=225478
<rdar://77576148>
Reviewed by Chris Dumez.
In WebsiteDataStore::getNetworkProcessConnection if we don't get a connection the first time, we terminate the network process
and try again. This greatly increases our success rate. However, if we are cancelling the reply because of the destruction
of the WebsiteDataStore, we will end up doing bad things with partially destroyed objects, which ends up crashing.
In order to prevent this, use RunLoop::main.dispatch to retry on the next runloop iteration so that we will never be inside the
stack of WebsiteDataStore::~WebsiteDataStore when retrying. In that case, we will find that weakThis is null and send an empty
reply.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
2021-05-06 Sihui Liu <sihui_liu@apple.com>
Drop some unnecessary code in LocalStorageDatabase
https://bugs.webkit.org/show_bug.cgi?id=225435
Reviewed by Chris Dumez.
No behavior change.
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase): Remove two paremeters that are no longer needed after
dropping code.
(WebKit::LocalStorageDatabase::openDatabase):
(WebKit::LocalStorageDatabase::migrateItemTableIfNeeded): SQLiteTransaction() by default sets readOnly to false,
and it will be rolled back for failure in ~SQLiteTransaction.
(WebKit::LocalStorageDatabase::close):
(WebKit::LocalStorageDatabase::tryToOpenDatabase): Deleted. Merged to openDatabase.
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::ensureDatabase const):
2021-05-06 Per Arne Vollan <pvollan@apple.com>
Add sandbox extension flag to specify that path contains no symlinks
https://bugs.webkit.org/show_bug.cgi?id=219428
<rdar://problem/66551986>
Reviewed by Brent Fulgham.
In general, when SandboxExtension::createHandleWithoutResolvingPath is called, it is assumed that there are no symlinks
in the provided path. Add a 'canonical' flag, which can be used by platform APIs to verify that this is the case. This
patch also stops resolving symlinks with [NSString stringByResolvingSymlinksInPath] in favor of realpath, since realpath
correcly replaces /var with /private/var, which [NSString stringByResolvingSymlinksInPath] does not.
* Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::SandboxExtensionImpl::sandboxExtensionForType):
(WebKit::stringByResolvingSymlinksInPath):
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
* Shared/SandboxExtension.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
2021-05-06 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] UI process hangs when showing a modal JavaScript dialog while focusing an input field
https://bugs.webkit.org/show_bug.cgi?id=225409
rdar://76792407
Reviewed by Darin Adler, Chris Dumez and Tim Horton.
Consider the scenario where an input field has a focus event handler that shows a modal JavaScript dialog (e.g.
confirm, alert, prompt). We get the following sequence of events in this scenario:
(WEB) The text field is focused, and sends WebPageProxy::ElementDidFocus. A modal dialog is then triggered by
script inside the focus event handler, sending a message like WebPageProxy::RunJavaScriptAlert.
(UI) The UI process receives WebPageProxy::ElementDidFocus, and calls `-reloadInputViews` while showing the
keyboard. UIKit may then call back into `-requestAutocorrectionContextWithCompletionHandler:`, which
triggers sync IPC back to the web process. While waiting to receive a response message, we receive and
dispatch WebPageProxy::RunJavaScriptAlert.
At this point, the UI process is still waiting for a HandleAutocorrectionContext response IPC message, but the
web process is blocked on a response to the modal JavaScript dialog; since both processes are blocked on each
other, we're now in deadlock.
To mitigate this, we can preemptively send autocorrection context data right before we're about to synchronously
block in the web process on a modal dialog. In the UI process, we use this autocorrection context object to
immediately stop syncwaiting for a HandleAutocorrectionContext response. See below for more details.
Test: fast/events/ios/show-modal-alert-during-focus.html
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::dispatchMessages):
(IPC::Connection::waitForMessage):
Make a slight adjustment here so that `waitForMessage` bails if one of the messages we're dispatching underneath
`SyncMessageState::dispatchMessages` is the message we happen to be waiting for anyways. In this case, it's
necessary in order for the preemptive `WebPageProxy::HandleAutocorrectionContext` message sent by the web
process to unblock the UI process, which is waiting for a `WebPageProxy::HandleAutocorrectionContext` response.
* UIProcess/PageClient.h:
(WebKit::PageClient::runModalJavaScriptDialog):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runModalJavaScriptDialog):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::runJavaScriptConfirm):
(WebKit::WebPageProxy::runJavaScriptPrompt):
Wrap calls to `runJavaScript(Alert|Confirm|Prompt)` underneath a new page client method that takes a block,
`runModalJavaScriptDialog`. See `-[WKContentView runModalJavaScriptDialog:]` below for more details.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::runModalJavaScriptDialog):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
Avoid blocking on the web process if it's waiting on a modal JavaScript dialog anyways; just use the last
autocorrection context we received from the web process (which we know must've been sent right before showing
the modal dialog anyways).
(-[WKContentView runModalJavaScriptDialog:]):
In the case where we're in the process of presenting the keyboard (or UCB) on iOS after focusing an input field,
avoid immediately allowing the client to show any modal UI until we're done managing keyboard logic in WebKit.
Without this adjustment, we'll end up trying to present the modal JavaScript dialog in the middle of UIKit's
call to `-requestAutocorrectionContextWithCompletionHandler:`, which then causes UIKit to throw an exception
underneath keyboard code.
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::prepareToRunModalJavaScriptDialog):
Add logic to preemptively compute and send `WebAutocorrectionContext` data to the UI process on iOS, in the case
where we're about to show a modal JavaScript dialog and there is an editable focused element. While the modal
dialog is shown, we'll use this information to immediately respond to UIKit's autocorrection context requests,
instead of trying to block on responses from the web process.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestAutocorrectionContext):
(WebKit::WebPage::prepareToRunModalJavaScriptDialog):
2021-05-06 Darin Adler <darin@apple.com>
Streamline codec parsing, replacing uses of HashMap with SortedArrayMap
https://bugs.webkit.org/show_bug.cgi?id=225368
Reviewed by Sam Weinig.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
Removed unneeded include.
* Shared/WebsiteData/WebsiteData.h: Ditto.
2021-05-06 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Compute proximity information while snapping
https://bugs.webkit.org/show_bug.cgi?id=224326
Reviewed by Simon Fraser.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<SnapOffset<float>>::encode): Add the snap area index to the encoded arguments.
(ArgumentCoder<SnapOffset<float>>::decode): Add the snap area index to the decoded arguments.
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::encode): No longer encode ranges, but encode snap areas.
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::decode): Ditto for decode.
* Shared/WebCoreArgumentCoders.cpp: Remove code dealing with scroll offset ranges.
* Shared/WebCoreArgumentCoders.h: Ditto.
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const): Pass
in viewport size to closestSnapOffset which is necessary for calculating proximity.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Ditto.
2021-05-05 Kate Cheney <katherine_cheney@apple.com>
Remove network website data when a user clears an individual domain
https://bugs.webkit.org/show_bug.cgi?id=225350
<rdar://problem/76029480>
Reviewed by Brent Fulgham.
Convert parameters to Optional values now that we use the function
for individual domains.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
We should check all possible website data entries and delete
network domain data if any of them contain a domain.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::removeNetworkWebsiteData):
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::removeNetworkWebsiteData):
2021-05-05 Per Arne Vollan <pvollan@apple.com>
Reduce sandbox telemetry
https://bugs.webkit.org/show_bug.cgi?id=225417
<rdar://77489628>
Reviewed by Darin Adler.
Remove sandbox telemetry which is no longer needed.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-05 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: tie into existing TCADA/RLTT systems so that the value is kept in sync with painting
https://bugs.webkit.org/show_bug.cgi?id=225405
Reviewed by Tim Horton.
Instead of sending an IPC to the UIProcess whenever the logic to determine the sampled page
top color finishes, wait to dispatch the IPC until we're about to render (just like theme
color and page extended background color). On macOS, this means the IPC is dispatched inside
`TiledCoreAnimationDrawingArea::updateRendering`. On iOS, the `Color` is included as part of
the `RemoteLayerTreeTransaction`.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::sampledPageTopColorChanged const): Renamed from `didSamplePageTopColor`.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::sampledPageTopColorChanged): Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::willCommitLayerTree):
(WebKit::WebPage::flushPendingSampledPageTopColorChange): Added.
(WebKit::WebPage::didSamplePageTopColor): Deleted.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updateRendering):
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::sampledPageTopColor const): Added.
(WebKit::RemoteLayerTreeTransaction::setSampledPageTopColor): Added.
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode const):
(WebKit::RemoteLayerTreeTransaction::decode):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::sampledPageTopColorChanged): Renamed from `didSamplePageTopColor`.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didCommitLayerTree):
2021-05-05 Alex Christensen <achristensen@webkit.org>
Add WebKitAdditions stubs for new NetworkLoadMetrics
https://bugs.webkit.org/show_bug.cgi?id=225406
<rdar://77563372>
Reviewed by Jer Noble.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2021-05-05 Dean Jackson <dino@apple.com>
Separated layers need to be configured
https://bugs.webkit.org/show_bug.cgi?id=225378
Reviewed by Tim Horton.
Configure a layer as it becomes separated. The actual code will
come from WebKitAdditions.
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(configureSeparatedLayer):
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
2021-05-05 Tim Horton <timothy_horton@apple.com>
Add and adopt RemoteLayerBackingStore::Type (instead of "accelerates drawing" bit)
https://bugs.webkit.org/show_bug.cgi?id=225384
Reviewed by Anders Carlsson.
No new tests, no behavior change, just refactoring.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
(WebKit::RemoteLayerBackingStore::type const):
(WebKit::RemoteLayerBackingStore::acceleratesDrawing const): Deleted.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::ensureBackingStore):
(WebKit::RemoteLayerBackingStore::encode const):
(WebKit::RemoteLayerBackingStore::decode):
(WebKit::RemoteLayerBackingStore::pixelFormat const):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
(WebKit::RemoteLayerBackingStore::setBufferVolatility):
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::nameForBackingStoreType):
(WebKit::operator<<):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::updateBackingStore):
In preparation for adding another backing store type, refactor RemoteLayerBackingStore
to have a type enum instead of an "accelerates drawing" bit.
2021-05-05 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Remove access to the unused 'nvram' system command
https://bugs.webkit.org/show_bug.cgi?id=225370
<rdar://problem/66583129>
Reviewed by Per Arne Vollan.
Add a 'deny' rule for nvram, since we don't use it and have no reason to access it.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-05-05 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
https://bugs.webkit.org/show_bug.cgi?id=225323
Reviewed by Beth Dakin.
Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
color needs to extend in order for us to not bail. If the value > 0, we take an additional
snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
the color across the top of the page is only a small strip, these extra snapshot comparisons
will prevent a resulting color from being derived.
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
(-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setupPageConfiguration:]):
Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.
2021-05-05 Youenn Fablet <youenn@apple.com>
REGRESSION (r276633): ASSERTION FAILED: !forbidMallocUseScopeCount || disableMallocRestrictionScopeCount
https://bugs.webkit.org/show_bug.cgi?id=225374
<rdar://problem/77533237>
Reviewed by Chris Dumez.
Disable memory allocation checks in speech recognition code path.
No change of behavior.
* WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp:
(WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::storageChanged):
2021-05-05 Jean-Yves Avenard <jya@apple.com>
imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers.html is a flakey
https://bugs.webkit.org/show_bug.cgi?id=225386
rdar://74704447
Reviewed by Eric Carlson.
When enabling/disabling a track, the web content process would send a message to the GPU process which in turn
would send a message back to the content process, notifying that the track configuration had changed, that would
then enable/disable again the track.
If the content process in between those IPC messages had modified the track (such as via JS call), it was
possible for the track status to get lost once the GPU message above got actioned.
Having the GPU process notify that a track configuration got changed when it was originally triggered by the
content process is unnecessary. We modify the RemoteAudioTrack and RemoteVideoTrack so that if the change came
from the web process, the GPU process doesn't send a message back with information that could already be obsolete.
No new tests. Fix an assertion failure in tests.
* GPUProcess/media/RemoteAudioTrackProxy.cpp:
(WebKit::RemoteAudioTrackProxy::enabledChanged):
* GPUProcess/media/RemoteAudioTrackProxy.h:
* GPUProcess/media/RemoteVideoTrackProxy.cpp:
(WebKit::RemoteVideoTrackProxy::selectedChanged):
* GPUProcess/media/RemoteVideoTrackProxy.h:
2021-05-05 Youenn Fablet <youenn@apple.com>
Dynamically pass capture sandbox extensions to GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=225319
Reviewed by Eric Carlson.
Make sure to send the sandbox extensions for all WKWebView applications.
We do so once we are ready to start capture since TCC access should have been granted at that point.
Manually tested.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
(WebKit::GPUProcess::updateSandboxAccess):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::encode const):
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
(WebKit::GPUProcessProxy::updateSandboxAccess):
(WebKit::GPUProcessProxy::updateCaptureAccess):
(WebKit::isSafari): Deleted.
(WebKit::shouldCreateCameraSandboxExtension): Deleted.
(WebKit::shouldCreateMicrophoneSandboxExtension): Deleted.
* UIProcess/GPU/GPUProcessProxy.h:
2021-05-04 Peng Liu <peng.liu6@apple.com>
[GPUP] Implement SourceBufferPrivateRemote::bufferFull()
https://bugs.webkit.org/show_bug.cgi?id=224139
Reviewed by Jer Noble.
Modify two IPC messages to implement `SourceBufferPrivateRemote::bufferFull()`.
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::evictCodedFrames):
(WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::evictCodedFrames):
(WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded):
2021-05-04 Jiewen Tan <jiewen_tan@apple.com>
PCM: Find a way to validate source_secret_token and source_secret_token_signature
https://bugs.webkit.org/show_bug.cgi?id=224321
<rdar://problem/76695542>
Reviewed by John Wilander.
Covered by exisiting tests.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
Reverts r236878.
2021-05-04 Jer Noble <jer.noble@apple.com>
[Media in GPU Process] Move AudioSessionRoutingArbitratorProxy to the GPU process
https://bugs.webkit.org/show_bug.cgi?id=217535
<rdar://problem/70152548>
Reviewed by Eric Carlson.
Add a new, local-only object which can aggregate changes to the audio routing.
The UIProcess version of this object spans a process boundary, but this new
object can operate locally without an XPC communication channel. As part of this
change, the "SharedArbitrator" in AudioSessionRoutingArbitratorProxyCocoa has been
moved into WebCore to be used both there and in this new object.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
(WebKit::GPUConnectionToWebProcess::didClose):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/mac/LocalAudioSessionRoutingArbitrator.cpp: Added.
(WebKit::LocalAudioSessionRoutingArbitrator::create):
(WebKit::LocalAudioSessionRoutingArbitrator::LocalAudioSessionRoutingArbitrator):
(WebKit::LocalAudioSessionRoutingArbitrator::~LocalAudioSessionRoutingArbitrator):
(WebKit::LocalAudioSessionRoutingArbitrator::processDidTerminate):
(WebKit::LocalAudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory):
(WebKit::LocalAudioSessionRoutingArbitrator::leaveRoutingAbritration):
* GPUProcess/mac/LocalAudioSessionRoutingArbitrator.h:
* SourcesCocoa.txt:
* UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy):
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
(WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
(WebKit::AudioSessionRoutingArbitratorProxy::endRoutingArbitration):
(): Deleted.
(WebKit::SharedArbitrator::sharedInstance): Deleted.
(WebKit::SharedArbitrator::isInRoutingArbitrationForArbitrator): Deleted.
(WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): Deleted.
(WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator): Deleted.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::setCategory):
2021-05-04 Kate Cheney <katherine_cheney@apple.com>
Remove internal NetworkSessionCocoa additions
https://bugs.webkit.org/show_bug.cgi?id=225365
<rdar://problem/75693914>
Reviewed by Per Arne Vollan.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
2021-05-04 Chris Dumez <cdumez@apple.com>
Blob contentType with charset renders html as plain text
https://bugs.webkit.org/show_bug.cgi?id=225226
Reviewed by Alex Christensen.
Our code would use the Blob's Content-Type (media type) as a MIME type internally. As a result, if the Blob's
media type would contain anything besides the MIME type (e.g. a charget), then it would lead to failures.
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
2021-05-04 Alex Christensen <achristensen@webkit.org>
localStorage changes aren't reflected between WKWebViews using WKWebViewConfiguration._groupIdentifier
https://bugs.webkit.org/show_bug.cgi?id=225344
<rdar://77496721>
Reviewed by Brady Eidson.
When we switched from using _pageGroup to _groupIdentifier, we also broke localStorage by making a new pageGroupID for each WKWebView.
This is the low-risk solution to this problem that remembers what pageGroupID we used for this same identifier, creating the effect of
using the same StorageNamespaceIdentifier for each _groupIdentifier like we did when we used _pageGroup.
See the comment in StorageAreaMap::dispatchLocalStorageEvent.
The higher-risk solution that needs to be done but probably shouldn't be merged to a branch at this point is to remove StorageNamespaceIdentifier.
I plan to do that in a follow-up patch.
* UIProcess/WebPageGroup.cpp:
(WebKit::pageGroupData):
2021-05-04 Jer Noble <jer.noble@apple.com>
[Cocoa] Allow HTMLMediaElement preload > "metadata" on iPad by default
https://bugs.webkit.org/show_bug.cgi?id=223802
Reviewed by Eric Carlson.
Align default iPad WebKit behavior for media element preload with Mac WebKit behavior.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
2021-05-04 Alex Christensen <achristensen@webkit.org>
Don't iterate NetworkProcessProxy::m_websiteDataStores
https://bugs.webkit.org/show_bug.cgi?id=225337
<rdar://77233103>
Reviewed by Geoffrey Garen.
There is evidence that this collection is mutated while iterating, and there are a lot of ways that might happen.
Instead, keep a Vector<Ref<WebsiteDataStore>>.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessDidTerminate):
* UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const):
2021-05-04 Eric Carlson <eric.carlson@apple.com>
[GPUP] Use MonotonicTime for elapsed time
https://bugs.webkit.org/show_bug.cgi?id=225329
<rdar://problem/77472811>
Reviewed by Simon Fraser.
No new tests, no change of behavior.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerPlaybackStateChanged):
(WebKit::RemoteMediaPlayerProxy::updateCachedState):
(WebKit::RemoteMediaPlayerProxy::performTaskAtMediaTime):
(WebKit::RemoteMediaPlayerProxy::setVideoPlaybackMetricsUpdateInterval):
(WebKit::RemoteMediaPlayerProxy::maybeUpdateCachedVideoMetrics):
(WebKit::RemoteMediaPlayerProxy::updateCachedVideoMetrics):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::pause):
(WebKit::MediaPlayerPrivateRemote::currentMediaTime const):
(WebKit::MediaPlayerPrivateRemote::playbackStateChanged):
(WebKit::MediaPlayerPrivateRemote::updateCachedState):
(WebKit::MediaPlayerPrivateRemote::videoPlaybackQualityMetrics):
(WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
* WebProcess/GPU/media/RemoteMediaPlayerState.h:
(WebKit::RemoteMediaPlayerState::encode const):
(WebKit::RemoteMediaPlayerState::decode):
2021-05-04 Jiewen Tan <jiewen_tan@apple.com>
REGRESSION: [ iOS ] 11 http/wpt/webauthn/ tests are crashing
https://bugs.webkit.org/show_bug.cgi?id=225225
rdar://77074618
Reviewed by Brent Fulgham.
Covered by exisiting tests.
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::runPresenter):
(WebKit::AuthenticatorManager::runPresenterInternal):
* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
Disables the modern UI in the mock testing environment.
2021-05-04 Chris Dumez <cdumez@apple.com>
[iOS] Use async API to take RunningBoard assertions
https://bugs.webkit.org/show_bug.cgi?id=225324
<rdar://76972252>
Reviewed by Geoffrey Garen.
Use async [RBSAssertion acquireWithInvalidationHandler:] API to take process assertions
instead of the synchronous [RBSAssertion acquireWithError:] API. This avoids risking
hanging the main thread for too long.
Note that [RBSAssertion isValid] returns false until the assertion is taken so I am
using our own "isValid" boolean to indicate if the RBSAssertion was invalidated or
or not. We use this flag to decide if we need to take the assertion again. We wouldn't
want to re-take the assertion simply because it is still in the process of being
acquired.
* UIProcess/ProcessAssertion.cpp:
(WebKit::ProcessAssertion::isValid const): Deleted.
* UIProcess/ProcessAssertion.h:
(WebKit::ProcessAssertion::isValid const):
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager init]):
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
(-[WKProcessAssertionBackgroundTaskManager assertion:didInvalidateWithError:]):
(-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::~ProcessAssertion):
(WebKit::ProcessAssertion::processAssertionWasInvalidated):
(-[WKProcessAssertionBackgroundTaskManager _hasBackgroundTask]): Deleted.
(-[WKRBSAssertionDelegate dealloc]): Deleted.
(-[WKRBSAssertionDelegate assertionWillInvalidate:]): Deleted.
(-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]): Deleted.
(WebKit::ProcessAssertion::isValid const): Deleted.
2021-05-04 Jim Mason <jmason@ibinx.com>
[GTK] segmentation fault in WebKit::IconDatabase::loadIconForPageURL
https://bugs.webkit.org/show_bug.cgi?id=225279
Reviewed by Carlos Garcia Campos.
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::loadIconForPageURL):
(WebKit::IconDatabase::setIconForPageURL):
2021-05-04 Youenn Fablet <youenn@apple.com>
Use OptionSet for MediaProducer::MediaStateFlags
https://bugs.webkit.org/show_bug.cgi?id=225227
Reviewed by Eric Carlson.
Update code according safer MediaProducer::MediaStateFlags type.
* UIProcess/API/C/WKPage.cpp:
(WKPageGetMediaState):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView cameraCaptureState]):
(-[WKWebView microphoneCaptureState]):
* UIProcess/Cocoa/MediaUtilities.mm:
(WebKit::toWKMediaCaptureStateDeprecated):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityState):
(WebKit::WebPageProxy::setMuted):
(WebKit::WebPageProxy::updatePlayingMediaDidChange):
(WebKit::WebPageProxy::updateReportedMediaCaptureState):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/Plugins/PluginView.h:
(WebKit::PluginView::mediaState const):
2021-05-03 Megan Gardner <megan_gardner@apple.com>
Allow AppHighlight visibility to be toggled
https://bugs.webkit.org/show_bug.cgi?id=225276
Reviewed by Wenson Hsieh.
Add supporting infrastructure to allow highlights to be turned on and off.
* Scripts/webkit/messages.py:
(headers_for_type):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::restoreAppHighlightsAndScrollToIndex):
(WebKit::WebPageProxy::setAppHighlightsActive):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformAction:withSender:]):
(-[WKContentView targetForAction:withSender:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setAppHighlightsActive):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-05-03 Tim Horton <timothy_horton@apple.com>
Use ImageBuffer scaling in RemoteLayerBackingStore, rather than handling scale in the class
https://bugs.webkit.org/show_bug.cgi?id=225081
Reviewed by Said Abou-Hallawa.
No new tests, no behavior change.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::display):
(WebKit::RemoteLayerBackingStore::backingStoreSize const): Deleted.
Make use of ImageBuffer's scaling support instead of scaling ourselves.
This will be helpful for future patches where the backing store's ImageBuffer
needs to know the presentation size, not just the backing store size.
We also do the back->front copy in scaled space now, which simplifies the code a bit.
We have to explicitly specify the source and destination rect for the copy, because
GraphicsContext::drawImageBuffer's implicit source rect is computed using
ImageBuffer::logicalSize(), which is a *truncated* IntSize.
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::ImageBufferShareableBitmapBackend):
Apply the device scale factor to the GraphicsContext that ImageBufferShareableBitmapBackend
adopts from ShareableBitmap. We don't need to flip because ShareableBitmap does that,
but it doesn't know anything about scales at all.
2021-05-03 Patrick Angle <pangle@apple.com>
Web Inspector: [Cocoa] Grid overlay area names aren't centered within areas.
https://bugs.webkit.org/show_bug.cgi?id=225176
Reviewed by Devin Rousso.
Grid area names were changed to be centered in their area in r275519. On iOS, the label was changed to treat the
provided point as the center, but the label was still being anchored in the top-left corner. This patch corrects
that by using the center of the area as the anchor point for the label.
* UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(-[WKInspectorHighlightView _createGridOverlayLayer:scale:]):
2021-05-03 Zhenchao Li <zhenchao_li@apple.com>
Add macOS Safari sandbox exception for com.apple.CFNetwork preferences
https://bugs.webkit.org/show_bug.cgi?id=225184
<rdar://69305108>
Reviewed by Per Arne Vollan
rdar://69305108 Add macOS Safari sandbox exception for com.apple.CFNetwork preferences
* Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2021-05-03 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Grouped <select> options should appear inline in the menu
https://bugs.webkit.org/show_bug.cgi?id=225314
<rdar://problem/76785797>
Reviewed by Wenson Hsieh.
Currently, <select> options within an <optgroup> element are presented
within an expandable/collapsible submenu. However, to better match the
visual style across the rest of the system, the grouped options should
appear inline in the root menu, and groups should be separated by a
visual separator.
Covered by existing tests. A testing-only method was updated to reflect
the changes.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker createMenu]):
Used UIMenuOptionsDisplayInline to present submenus inline in the root
menu. This option separates submenus using a visual separator.
Since inline submenus do not support a title, and <optgroup> elements
can be labeled, the group title is displayed as a disabled action at
the top of the submenu.
Removed logic to promote the grouped submenu to the root menu in the
case where only one submenu contains all options, since the submenu
now appears inline, and an additional tap is no longer necessary to
view the options.
(-[WKSelectPicker actionForOptionIndex:]):
Updated this testing-only method to account for the potential existence
of an additional action representing a group title.
2021-05-03 Devin Rousso <drousso@apple.com>
[macCatalyst] "Enter Full Screen" button in media controls disappears
https://bugs.webkit.org/show_bug.cgi?id=225210
<rdar://problem/77010150>
Reviewed by Eric Carlson.
In order for the "Enter Full Screen" media controls button to stay visible the `<video>`
must return `true` for `HTMLMediaElement::webkitSupportsFullscreen`, which calls into
`MediaPlayerPrivate::supportsFullscreen`. On macOS and iOS, this will always return `true`
because of `ENABLE(FULLSCREEN_API)`, but on macCatalyst that's not enabled, so we instead
use `DeprecatedGlobalSettings::avKitEnabled`, but this is only set in the WebProcess (and
WK1). With the GPUProcess enabled, this value is not set, so the `RemoteMediaPlayerProxy`
will instead get `false`.
This patch removes `DeprecatedGlobalSettings::avKitEnabled` since it's enabled on WK1 and
non-GPUProcess WK2, and the related iOS-only SPI appears to not be used anywhere internally,
instead having callsites just check `HAVE(AVKIT)`.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
2021-05-03 Aditya Keerthi <akeerthi@apple.com>
[iOS] Crash when tapping fields on cycle.travel
https://bugs.webkit.org/show_bug.cgi?id=225259
<rdar://problem/77386417>
Reviewed by Wenson Hsieh.
The From/To fields on cycle.travel have a click handler that presents
a popover. The popover is presented by changing its display property
from "none" to "block", and contains an input element with the "autofocus"
attribute. After changing the popover element's display property, the
page focuses another element by calling focus().
In WebKit, focusing an element sends an IPC message from the WebProcess
to the UIProcess, so that UIProcess knows of the focused element and
can present the necessary UI. All relevant information about the element
is encoded in a FocusedElementInformation struct, which is populated by
WebPage::getFocusedElementInformation.
Prior to populating the FocusedElementInformation,
getFocusedElementInformation performs a layout if needed,
so that the information sent to the UIProcess is up-to-date. In this
instance, a layout is needed after the popover element's display
property is changed. Then, since the page immediately focuses another
element after the display change, WebKit calls
getFocusedElementInformation prior to the layout being performed.
getFocusedElementInformation then sees that a layout is needed, and
triggers the pending layout.
Now, since since the popover contains an element with "autofocus",
another element is focused as a post-layout task. This means that the
layout triggered by getFocusedElementInformation changes the focused
element. r256401 added an early return in this case, to prevent a null
pointer deref.
An early return in getFocusedElementInformation leaves the passed-in
FocusedElementInformation in an inconsistent state. In particular,
the FocusedElementInformation's elementContext is left with invalid
identifiers. Currently, all callers of getFocusedElementInformation do
not check whether the information is in a valid state. Consequently,
the caller (in this case, WebPage::elementDidFocus) proceeds to send
an IPC message with the FocusedElementInformation as one of the
arguments. Then, a release assert is hit as sending IPC messages with
invalid arguments is unsafe.
To fix, make getFocusedElementInformation return an optional
FocusedElementInformation, rather than populating a parameter that
could be left in an invalid state. Then, any early returns can return
WTF::nullopt, to signify that we were unable to generate a valid
FocusedElementInformation. Finally, whenever the method returns
nullopt, we do not send the IPC message (or in another case, send a
message with nullopt).
Test: fast/forms/focus-change-after-layout-update-during-focus-crash.html
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView updateCurrentFocusedElementInformation:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::requestFocusedElementInformation):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::elementDidFocus):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestFocusedElementInformation):
(WebKit::WebPage::focusedElementInformation):
2021-05-03 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Properly reset WebKitWebView's responsiveness flag
https://bugs.webkit.org/show_bug.cgi?id=225291
Reviewed by Alicia Boya Garcia.
Reset the web process responsiveness flag whenever the web process is terminated.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewWebProcessTerminated):
(webkit_web_view_terminate_web_process):
2021-05-03 Youenn Fablet <youenn@apple.com>
Use OptionSet for MediaProducer::MutedStateFlags
https://bugs.webkit.org/show_bug.cgi?id=224550
<rdar://problem/76960294>
Reviewed by Eric Carlson.
Update to use new OptionSet MediaProducer::MutedStateFlags.
Fix a potential bug in case the page is video capture muted, covered by updated API test.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetMuted):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _setPageMuted:]):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_set_is_muted):
* UIProcess/Cocoa/MediaUtilities.mm:
(WebKit::toWKMediaMutedState):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityState):
* UIProcess/WebPageProxy.h:
2021-05-03 Kimmo Kinnunen <kkinnunen@apple.com>
IPC::Semaphore operations ASSERT when the semaphore has been destroyed
https://bugs.webkit.org/show_bug.cgi?id=225142
<rdar://problem/76178000>
Reviewed by Chris Dumez.
Add KERN_TERMINATED to the expected return values of semaphore_{signal,wait,timedwait} calls.
* Platform/IPC/darwin/IPCSemaphoreDarwin.cpp:
(IPC::Semaphore::signal):
(IPC::Semaphore::wait):
(IPC::Semaphore::waitFor):
2021-04-30 Darin Adler <darin@apple.com>
Use SortedArrayMap in a few more places
https://bugs.webkit.org/show_bug.cgi?id=225251
Reviewed by Sam Weinig.
* NetworkProcess/NetworkLoad.cpp: Removed unneeded includes.
* NetworkProcess/NetworkResourceLoadMap.h: Ditto.
* Shared/SharedStringHashStore.h: Ditto.
* UIProcess/API/APIPageConfiguration.h: Ditto.
* UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: Ditto.
* UIProcess/API/Cocoa/_WKInspector.mm: Ditto.
* UIProcess/Automation/SimulatedInputDispatcher.h: Ditto.
* UIProcess/Inspector/WebInspectorUIProxy.cpp: Ditto.
* UIProcess/Plugins/mac/PluginInfoStoreMac.mm: Ditto.
* UIProcess/WebPageGroup.h: Ditto.
* UIProcess/WebPasteboardProxy.h: Ditto.
* UIProcess/WebPreferences.h: Ditto.
* WebProcess/Geolocation/WebGeolocationManager.h: Ditto.
* WebProcess/WebPage/WebBackForwardListProxy.h: Ditto.
2021-04-30 Wenson Hsieh <wenson_hsieh@apple.com>
App highlight UI should be disabled when selecting text in image overlays
https://bugs.webkit.org/show_bug.cgi?id=225260
rdar://77359313
Reviewed by Tim Horton.
Add a bit to `EditorState` to indicate when a ranged selection is inside an image overlay.
* Shared/EditorState.cpp:
(WebKit::EditorState::encode const):
(WebKit::EditorState::decode):
* Shared/EditorState.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView shouldAllowAppHighlightCreation]):
(-[WKContentView canPerformAction:withSender:]):
(-[WKContentView targetForAction:withSender:]):
Make `-targetForAction:withSender:` return `self` only if we have a ranged selection that is not inside an image
overlay. Interestingly, UIKit doesn't seem to consult `-canPerformAction:withSender:` for actions that are added
through `-[UIMenuController setMenuItems:]`, so we add the check here instead of inside `-canPerformAction:`
above.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
Set the new bit here. Note that this (importantly) doesn't trigger layout, because `VisibleSelection::range`
just returns a (potentially uncanonicalized) `SimpleRange`. For the purposes of checking whether the selection
is inside an image overlay, this is sufficient.
2021-04-30 Eric Carlson <eric.carlson@apple.com>
[GPUP] Poll videoPlaybackQualityMetrics at the frequency is it accessed by script
https://bugs.webkit.org/show_bug.cgi?id=225245
rdar://77159589
Reviewed by Jer Noble.
Updating videoPlaybackQualityMetrics is computationally expensive, so instead of
getting it every time cached properties are updated (every 100 ms) keep track of
how often the page fetches the property and update it at that frequency.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::play):
(WebKit::RemoteMediaPlayerProxy::pause):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerRateChanged):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerPlaybackStateChanged):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerCharacteristicChanged):
(WebKit::RemoteMediaPlayerProxy::updateCachedState):
(WebKit::RemoteMediaPlayerProxy::setVideoPlaybackMetricsUpdateInterval):
(WebKit::RemoteMediaPlayerProxy::maybeUpdateCachedVideoMetrics):
(WebKit::RemoteMediaPlayerProxy::updateCachedVideoMetrics):
(WebKit::RemoteMediaPlayerProxy::logChannel const):
(WebKit::RemoteMediaPlayerProxy::setShouldUpdatePlaybackMetrics): Deleted.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* Scripts/webkit/messages.py:
(headers_for_type):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::pause):
(WebKit::MediaPlayerPrivateRemote::updateCachedState):
(WebKit::MediaPlayerPrivateRemote::updateVideoPlaybackMetricsUpdateInterval):
(WebKit::MediaPlayerPrivateRemote::videoPlaybackQualityMetrics):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2021-04-30 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Always extend access to local process HTTP/3 cache directory
https://bugs.webkit.org/show_bug.cgi?id=225171
<rdar://problem/76287224>
Reviewed by Alex Christensen.
Always pass the cache directory for HTTP/3 use, regardless of the current setting of
the flag. We still pass the flag so that users can turn the feature on and off, so there
is no change in expected behavior. However, certain OS settings can override the user
setting in the browser, so it's helpful to have the path permission for cases where a user
toggles state outside of the browser.
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
2021-04-30 Peng Liu <peng.liu6@apple.com>
ASSERTION FAILED: Unhandled message RemoteRemoteCommandListenerProxy_UpdateSupportedCommands
https://bugs.webkit.org/show_bug.cgi?id=225234
Reviewed by Darin Adler.
We need to keep dispatching (and ignoring) messages for `RemoteRemoteCommandListenerProxy`
after the object is destroyed. That could happen because other web processes may still have
active `RemoteRemoteCommandListener` after `GPUConnectionToWebProcess::m_remoteRemoteCommandListener`
is destroyed.
No new tests. Fix an assertion failure in tests.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::dispatchMessage):
2021-04-30 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Add a heuristic to determine whether a synthetic click triggered any meaningful changes
https://bugs.webkit.org/show_bug.cgi?id=225240
rdar://77221196
Reviewed by Tim Horton.
Add a simple heuristic to inform WKWebView iOS clients when a tap either failed to result in a synthetic click,
or resulted in a synthetic click that (probably) didn't have any "meaningful side effects". While this notion of
"meaningfulness" isn't well defined, the idea behind the heuristic is that it should distinguish between taps on
clickable elements like buttons or links that trigger some noticable change on the page, vs. taps on both
clickable or non-clickable elements that do not trigger any changes on the page.
For instance on a news-article-like page, this delegate method should be invoked when tapping on paragraph text
in the article, even if there is a click handler over the entire article or even body element. However, tapping
a link or a button on the same page should not cause this delegate method to be invoked. Additionally, if the
page explicitly prevents default behavior during a synthetic mouse event, this method should also *not* be
invoked.
This behavior is roughly similar to the existing delegate method `-_webView:didNotHandleTapAsClickAtPoint:`,
except that this variant allows for more wiggle room around what constitutes a "meaningful" interaction with the
page.
* UIProcess/API/APIUIClient.h:
(API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]):
See Tools/ChangeLog for more details about this testing hook.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didHandleOrPreventMouseDownOrMouseUpEvent):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isProbablyMeaningfulClick):
Implement the core of the heuristic here. For now, it just examines the size of the click target. This isn't
going to satisfy the case where a page installs a click event handler on the body element (or a similar
element that encapsulates most of the page) and then performs hit-testing in their script, but it's somewhere to
start.
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::attemptSyntheticClick):
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::commitPotentialTapFailed):
2021-04-30 Per Arne Vollan <pvollan@apple.com>
prefers-reduced-motion is not reactive on iOS
https://bugs.webkit.org/show_bug.cgi?id=222381
<rdar://75933915>
Reviewed by Brent Fulgham.
With CFPrefs direct mode, there is a race between the notification that an accessibility preference has been changed
by the user, and the the in-memory Accessibility preference cache in the WebContent process. We resolve this by using
new SPI to clear the cached Accessibility settings when we are notified of an accessibility change so they always
reflect the user's most recent setting.
* Platform/spi/Cocoa/AccessibilitySupportSPI.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::setPreferenceValue):
2021-04-30 Jiewen Tan <jiewen_tan@apple.com>
_WKWebAuthenticationPanelDelegate registration and assertion SPI doesn't work without an LAContext
https://bugs.webkit.org/show_bug.cgi?id=225218
<rdar://76969220>
Reviewed by Brent Fulgham.
Covered by manual tests.
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
Adds a case for nil LAContext.
2021-04-30 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r276838.
Caused
TestWebKitAPI.WebKit.AlternativeServicesDefaultDirectoryCreation
to fail
Reverted changeset:
"[Cocoa] Always extend access to local process HTTP/3 cache
directory"
https://bugs.webkit.org/show_bug.cgi?id=225171
https://commits.webkit.org/r276838
2021-04-30 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Properly recover from unresponsive web processes
https://bugs.webkit.org/show_bug.cgi?id=224533
Reviewed by Carlos Garcia Campos.
Add a new method to the GLib API to terminate the web process associated to a
WebKitWebView.
* UIProcess/API/glib/WebKitNavigationClient.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_terminate_web_process):
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebView.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2021-04-30 Per Arne <pvollan@apple.com>
Enforce IOKit filtering
https://bugs.webkit.org/show_bug.cgi?id=223937
<rdar://problem/76271551>
Reviewed by Brent Fulgham.
Enforce IOKit method filtering based on telemetry. This patch also adds IOKit method telemetry for some Apple Silicion
IOKit classes, which were overlooked in the first telemetry phase.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-30 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Always extend access to local process HTTP/3 cache directory
https://bugs.webkit.org/show_bug.cgi?id=225171
<rdar://problem/76287224>
Reviewed by Alex Christensen.
Always pass the cache directory for HTTP/3 use, regardless of the current setting of
the flag. We still pass the flag so that users can turn the feature on and off, so there
is no change in expected behavior. However, certain OS settings can override the user
setting in the browser, so it's helpful to have the path permission for cases where a user
toggles state outside of the browser.
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
2021-04-29 Megan Gardner <megan_gardner@apple.com>
Remove some unneeded code.
https://bugs.webkit.org/show_bug.cgi?id=225216
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpAppHighlightMenusIfNeeded]): Deleted.
2021-04-29 Peng Liu <peng.liu6@apple.com>
AVAudioSession throws an exception when WebKit tries to set its routeSharingPolicy to "independent"
https://bugs.webkit.org/show_bug.cgi?id=225213
Reviewed by Jer Noble.
AVAudioSession does not expect WebKit to set its routeSharingPolicy
to AVAudioSessionRouteSharingPolicyIndependent(RouteSharingPolicy::Independent).
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::updateCategory):
2021-04-29 Brent Fulgham <bfulgham@apple.com>
[iOS] Remove unused logd-diagnostic-client rules
https://bugs.webkit.org/show_bug.cgi?id=225214
<rdar://problem/66587621>
Reviewed by Per Arne Vollan.
WebKit does not have either of the two entitlements required to use the 'log-diagnostic-client' rules.
We should remove these rules from the sandbox to reduce attack surface, since they provide no benefit.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-04-29 Peng Liu <peng.liu6@apple.com>
[GPUP] Two message loops between WebContent process and GPU process to enable/select audio/video tracks
https://bugs.webkit.org/show_bug.cgi?id=225193
Reviewed by Eric Carlson.
The current implementation has two message loops between Web process
and GPU process related to enable/select audio/video tracks.
For audio, the message loop is:
Web Process -> GPU process: RemoteMediaPlayerProxy::audioTrackSetEnabled
GPU Process -> Web Process: MediaPlayerPrivateRemote::remoteAudioTrackConfigurationChanged
The message loop will lead to the following function call loop:
AudioTrackPrivateRemote::updateConfiguration()
AudioTrackPrivateRemote::setEnabled()
RemoteMediaPlayerProxy::audioTrackSetEnabled()
RemoteAudioTrackProxy::setEnabled()
AudioTrackPrivateAVFObjC::setEnabled()
AudioTrackPrivate::setEnabled()
RemoteAudioTrackProxy::enabledChanged()
RemoteAudioTrackProxy::configurationChanged()
MediaPlayerPrivateRemote::remoteAudioTrackConfigurationChanged()
again, AudioTrackPrivateRemote::updateConfiguration(), and repeat ...
The loop for video tracks is similar.
The loop is bad but normally does not impact a media player's functionality.
However, if a page disables and enables an audio track of a media element with HLS stream
in one run loop, the loop will disable and enable the track repeatedly, as a result,
CoreMedia's HLS player will disable/enable audio segments and send/cancel download
requests repeatedly. Eventually the player won't play audio.
This patch fixes these two message loops.
Test: media/media-video-audio-track.html
* WebProcess/GPU/media/AudioTrackPrivateRemote.cpp:
(WebKit::AudioTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/VideoTrackPrivateRemote.cpp:
(WebKit::VideoTrackPrivateRemote::updateConfiguration):
2021-04-29 Alex Christensen <achristensen@webkit.org>
Make URLSchemeTask destruction more straightforward
https://bugs.webkit.org/show_bug.cgi?id=225195
<rdar://77310818>
Reviewed by Chris Dumez.
There's a seemingly-new crash in the lambda of WebURLSchemeHandlerCocoa::platformTaskCompleted
That labmda doesn't need to exist. We should do our object destruction like the rest of our objects.
* UIProcess/API/Cocoa/WKURLSchemeTask.mm:
(-[WKURLSchemeTaskImpl dealloc]):
* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
(WebKit::WebURLSchemeHandlerCocoa::platformTaskCompleted):
2021-04-29 Ben Nham <nham@apple.com>
Reduce memory footprint for background tabs
https://bugs.webkit.org/show_bug.cgi?id=225007
Reviewed by Chris Dumez.
When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
we should attempt to reduce our memory footprint after some time interval to help relieve
system-wide memory pressure. This is enabled only on Mac because iOS already does something
similar just before WebContent suspends.
One exception to this is that we don't do this proactive slimming for processes that are in
the back/forward cache or in the WebProcess cache. This is because dropping the memory cache
in those types of processes leads to perf regressions in benchmarks that do certain types of
cross-origin navigations. We'll use a separate mechanism for controlling the memory usage of
those processes; our current logic keeps those processes around until we are at the warning
or critical memory pressure level.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::pageDidEnterWindow):
(WebKit::WebProcess::pageWillLeaveWindow):
(WebKit::WebProcess::nonVisibleProcessGraphicsCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessMemoryCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): Deleted.
* WebProcess/WebProcess.h:
2021-04-29 Brent Fulgham <bfulgham@apple.com>
[iOS] Reduce logging for uninteresting sandbox violations
https://bugs.webkit.org/show_bug.cgi?id=225197
<rdar://problem/77321299>
Reviewed by Per Arne Vollan.
CFPreferences needs to read from .GlobalPreferences.plist and .GlobalPreferences_m.plist on iOS, just like it
does on macOS. We should unblock these so we stop getting useless telemetry about the violations, and avoid
preference problems on iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-04-29 Darin Adler <darin@apple.com>
Extend SortedArrayMap further to work on case-folded strings, use in MIMETypeRegistry
https://bugs.webkit.org/show_bug.cgi?id=224968
Reviewed by Sam Weinig.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _isDisplayingPDF]): Updated since MIMETypeRegistry::pdfMIMETypes
returns a different type.
* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry initWithConfiguration:]): Updated since
MIMETypeRegistry::systemPreviewMIMETypes returns a different type.
2021-04-29 Ben Nham <nham@apple.com>
Unreviewed, reverting r276619.
Causes multiple regressions on perf bots, as multiple tests test hot page loads in
WebContent processes that are in the process cache. Dropping the memory cache in those
processes caused multiple benchmarks to regress.
Reverted changeset:
"Reduce memory footprint for background tabs"
https://bugs.webkit.org/show_bug.cgi?id=225007
https://commits.webkit.org/r276619
2021-04-29 Chris Dumez <cdumez@apple.com>
Improve local storage size estimation for quota limitation
https://bugs.webkit.org/show_bug.cgi?id=225123
<rdar://problem/77248111>
Reviewed by Alex Christensen.
Improve local storage size estimation for quota limitation:
- Rely on String::sizeInBytes() to compute the String size, instead of using
String::length() * sizeof(UChar)
- Make estimation consistent between StorageMap & LocalStorageDatabase
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::removeItem):
(WebKit::LocalStorageDatabase::setItem):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
2021-04-29 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276689, r276736, and r276737.
https://bugs.webkit.org/show_bug.cgi?id=225188
Broke platform/ios/ios/storage/domstorage/5mb-quota.html
Reverted changesets:
"Improve local storage size estimation for quota limitation"
https://bugs.webkit.org/show_bug.cgi?id=225123
https://trac.webkit.org/changeset/276689
"REGRESSION(r276689): [ iOS wk2 ]
platform/ios/ios/storage/domstorage/5mb-quota.html is a
constant text failure"
https://bugs.webkit.org/show_bug.cgi?id=225160
https://trac.webkit.org/changeset/276736
"Make sure we invalidate the iterator in StorageMap::clear()"
https://bugs.webkit.org/show_bug.cgi?id=225164
https://trac.webkit.org/changeset/276737
2021-04-29 Said Abou-Hallawa <said@apple.com>
Fix build break after r276753
Unreviewed, build fix.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-04-29 Said Abou-Hallawa <said@apple.com>
[GPU Process] REGRESSION(r272888): Don't assert the validity of the dataURL mimeType inside GPU Process
https://bugs.webkit.org/show_bug.cgi?id=225175
<rdar://76286963>
Reviewed by Simon Fraser.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
Assert the validity of the mimeType before sending it to GPU Process.
2021-04-28 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Coalesce adjacent selection geometries when rendering individual selection quads
https://bugs.webkit.org/show_bug.cgi?id=225054
Reviewed by Tim Horton.
Make some further minor adjustments to selection behavior in image overlays on iOS. In particular, when using
selection handles to modify the selected range, shift the start and end of the selected range so that they're at
the beginning and end of text runs, respectively.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::insideImageOverlay):
(WebKit::expandForImageOverlay):
(WebKit::rangeForPointInRootViewCoordinates):
2021-04-28 Devin Rousso <drousso@apple.com>
experiment with averaging sampling colors across the top of the page as the scroll area background
https://bugs.webkit.org/show_bug.cgi?id=224987
<rdar://problem/76251889>
Reviewed by Darin Adler.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didSamplePageTopColor const): Added.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didSamplePageTopColor): Added.
Pass along the `sampledPageTopColor` to the UIProcess.
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::sampledPageTopColor): Added.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::scrollAreaBackgroundColor const):
(WebKit::WebPageProxy::didSamplePageTopColor): Added.
Use the `sampledPageTopColor` if the `UseSampledPageTopColorForScrollAreaBackgroundColor`
internal preference is enabled instead of the CSS `background-color` of the `<html>`/`<body>`.
* UIProcess/PageClient.h:
(WebKit::PageClient::sampledPageTopColorWillChange): Added.
(WebKit::PageClient::sampledPageTopColorDidChange): Added.
* UIProcess/Cocoa/PageClientImplCocoa.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::sampledPageTopColorWillChange): Added.
(WebKit::PageClientImplCocoa::sampledPageTopColorDidChange): Added.
Add ObjC KVO support for `-[WKWebView _sampledPageTopColor]`.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setupPageConfiguration:]):
(-[WKWebView _sampledPageTopColor]): Added.
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _setSampledPageTopColorMaxDifference:]): Added.
(-[WKWebViewConfiguration _sampledPageTopColorMaxDifference]): Added.
Provide SPI to configure the `SampledPageTopColorMaxDifference` preference when
creating the `WKWebView`. Expose the result as `_sampledPageTopColor` SPI.
2021-04-28 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd
https://bugs.webkit.org/show_bug.cgi?id=225072
rdar://77159489
Reviewed by Darin Adler.
The fix for this crash that I landed in r276688 was based on a misunderstanding that accessing `treeScope()`
would trigger a null pointer deref if `isInTreeScope()` is `false`. This is not the case, since the `treeScope`
of a `Node` is a separate notion from whether that `Node` is connected to said tree scope.
Since this crash is really due to dereferencing a null container node in the case where `selectionStart` or
`selectionEnd` are null, a better fix is to just check the nullity of the container node.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::rangeForPointInRootViewCoordinates):
2021-04-28 Basuke Suzuki <basuke.suzuki@sony.com>
Suppress warnings for %{private}s format specifier
https://bugs.webkit.org/show_bug.cgi?id=225137
Reviewed by Alex Christensen.
Add PRIVATE_LOG_STRING macro which is defined depending on if
os_log() is used or rather old printf().
See also: https://bugs.webkit.org/show_bug.cgi?id=207478
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::enableForeignKeys):
(WebKit::ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries):
(WebKit::ResourceLoadStatisticsDatabaseStore::columnsForTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnInTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
(WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
(WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
(WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
(WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearTopFrameUniqueRedirectsToSinceSameSiteStrictEnforcement):
(WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
(WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
(WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
(WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
(WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForAllButCookieDataRemoval):
(WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentlyUpdatedTimestamp const):
(WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents):
(WebKit::ResourceLoadStatisticsDatabaseStore::removeDataForDomain):
(WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
(WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateDataRecordsRemoved):
(WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectSubStatisticsCount):
(WebKit::ResourceLoadStatisticsDatabaseStore::getDomainStringFromDomainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const):
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const):
(WebKit::ResourceLoadStatisticsDatabaseStore::domainIDExistsInDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters):
(WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
(WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed):
(WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
2021-04-28 Ryosuke Niwa <rniwa@webkit.org>
When IPC testing API is enabled, GPU process shouldn't kill Web Process
https://bugs.webkit.org/show_bug.cgi?id=225143
<rdar://70692277>
Reviewed by Chris Dumez.
Set Connection::g_ignoreInvalidMessageForTesting on createGPUConnectionToWebProcess
when the IPC testing API is enabled.
Tests: IPCTestingAPI.CanSendSyncMessageToGPUProcess
IPCTestingAPI.CanSendAsyncMessageToGPUProcess
IPCTestingAPI.CanSendInvalidAsyncMessageToGPUProcessWithoutTermination
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::didReceiveInvalidMessage): Exit early without
killing the Web process if IPC testing API is enabled.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::createGPUConnectionToWebProcess): Set the aforementioned flag
on the IPC connection.
* Shared/GPUProcessConnectionParameters.h:
(WebKit::GPUProcessConnectionParameters): Added ignoreInvalidMessageForTesting.
(WebKit::GPUProcessConnectionParameters::encode const):
(WebKit::GPUProcessConnectionParameters::decode):
* UIProcess/WebPageProxy.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains): Cleanup. Use a helper function.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::getGPUProcessConnection): Set the value of
GPUProcessConnectionParameters::ignoreInvalidMessageForTesting based on the value
of WebProcessProxy::m_ignoreInvalidMessageForTesting.
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::ignoreInvalidMessageForTesting const): Added.
2021-04-28 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276658.
https://bugs.webkit.org/show_bug.cgi?id=225161
Introduced perf regression
Reverted changeset:
"Enforce IOKit filtering"
https://bugs.webkit.org/show_bug.cgi?id=223937
https://trac.webkit.org/changeset/276658
2021-04-28 Alex Christensen <achristensen@webkit.org>
REGRESSION(r275267) Network process crashes in Data::adoptMap
https://bugs.webkit.org/show_bug.cgi?id=225159
<rdar://77066555>
Reviewed by Geoffrey Garen.
There was a missing check to see if mapping was successful.
* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::Data::mapToFile const):
2021-04-28 Alex Christensen <achristensen@webkit.org>
Add SPI to query whether a URL would be upgraded to HTTPS
https://bugs.webkit.org/show_bug.cgi?id=225154
<rdar://77269904>
Reviewed by Geoff Garen.
* UIProcess/API/Cocoa/WKWebView.mm:
(+[WKWebView _shouldUpgradeToHTTPS:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
2021-04-28 Brent Fulgham <bfulgham@apple.com>
[iOS] [GPU] The UI process should issue mach sandbox extensions to 'iconservices'
https://bugs.webkit.org/show_bug.cgi?id=225111
<rdar://problem/68366888>
Reviewed by Per Arne Vollan.
In Bug 205443 we did work to extend access to non-web-browsing services to the WebContent process only when
needed. This was lost in the transition to the GPU Process, and should be added back.
This change does the following:
1. Adds sandbox extension handles for the iconservices (and related) services to the GPU process creation parameters.
2. Updates the GPUProcessProxy to extend iconservices when waranted, and add them to the creation parameter structure.
3. Updates the GPUProcess to consume the extensions (when granted).
4. Makes a GPU process-specific version of the 'nonBrowserServices' static function for use by GPUProcessProxy. This is needed
because fewer services are needed in the GPU process than in the WebContent process.
5. Removes unused telemetry from the WebContent process sandbox.
6. Switches the GPU process sandbox to deny iconservices (and related) by default, and to consume the extensions instead.
Tested by exisiting TestWebKitAPI tests.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::encode const):
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
2021-04-28 Chris Dumez <cdumez@apple.com>
Crash under GPUProcessProxy::getGPUProcessConnection()
https://bugs.webkit.org/show_bug.cgi?id=224017
<rdar://75146104>
Reviewed by Darin Adler.
The crash would happen when replyToPendingMessages() get called in the AuxiliaryProcessProxy
destructor and there would be a pending getGPUProcessConnection() IPC. The lambda in
WebProcessPool::getGPUProcessConnection() would check if a WeakPtr to the WebProcessPool is
valid before calling `ensureGPUProcess().getGPUProcessConnection()`. However, at this point,
the WebProcessPool destructor is still running so the WeakPtr is still valid but
`ensureGPUProcess().getGPUProcessConnection()` will crash because the GPUProcessProxy
destructor has already run.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::~WebProcessPool):
Drop code that was causing the GPUProcessProxy to reply to all its pending IPC messages whenenever
a WebProcessPool gets destroyed. This is incorrect since a GPUProcessProxy may be shared by several
WebProcessPool objects. Note that the AuxiliaryProcessProxy destructor already takes care of
calling replyToPendingMessages().
(WebKit::WebProcessPool::getGPUProcessConnection):
Protect the WebProcessPool is the lambda to prevent the case where this lambda gets called and the
WebProcessPool & GPUProcessProxy are in the middle of destruction.
2021-04-28 Kimmo Kinnunen <kkinnunen@apple.com>
Asserting that function or variable is accessed in a certain thread should be simpler and more robust
https://bugs.webkit.org/show_bug.cgi?id=224971
Reviewed by Darin Adler.
Use ThreadAssertions in RemoteGraphicsContextGL implementations
as an example.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::initialize):
(WebKit::RemoteGraphicsContextGL::stopListeningForIPC):
(WebKit::RemoteGraphicsContextGL::displayWasReconfigured):
(WebKit::RemoteGraphicsContextGL::workQueueInitialize):
(WebKit::RemoteGraphicsContextGL::workQueueUninitialize):
(WebKit::RemoteGraphicsContextGL::didComposite):
(WebKit::RemoteGraphicsContextGL::forceContextLost):
(WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification):
(WebKit::RemoteGraphicsContextGL::reshape):
(WebKit::RemoteGraphicsContextGL::prepareForDisplay):
(WebKit::RemoteGraphicsContextGL::synthesizeGLError):
(WebKit::RemoteGraphicsContextGL::getError):
(WebKit::RemoteGraphicsContextGL::ensureExtensionEnabled):
(WebKit::RemoteGraphicsContextGL::notifyMarkContextChanged):
(WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintImageDataToImageBuffer):
(WebKit::RemoteGraphicsContextGL::copyTextureFromMedia):
(WebKit::RemoteGraphicsContextGL::simulateEventForTesting):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
(WebKit::RemoteGraphicsContextGLCocoa::platformWorkQueueInitialize):
(WebKit::RemoteGraphicsContextGLCocoa::prepareForDisplay):
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
2021-04-27 Basuke Suzuki <basuke.suzuki@sony.com>
[PlayStation] Suppress warnings for %llu format specifier for uint64_t.
https://bugs.webkit.org/show_bug.cgi?id=225138
Reviewed by Darin Adler.
PRIu64 from <cstdint> should be use to format uint64_t value in printf.
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::createFetchTask):
(WebKit::WebSWServerConnection::startFetch):
2021-04-27 Kimmo Kinnunen <kkinnunen@apple.com>
Add a Condition type that supports thread safety analysis
https://bugs.webkit.org/show_bug.cgi?id=224970
Reviewed by Darin Adler.
Use CheckedCondition and CheckedLock as an example of the
added implementations.
* Platform/IPC/Connection.cpp:
(IPC::Connection::waitForMessage):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::connectionDidClose):
* Platform/IPC/Connection.h:
(IPC::Connection::WTF_GUARDED_BY_LOCK):
Use CheckedCondition (as an example).
Mark up variables protected by
IPC::Connection::m_waitForMessageMutex
to use thread safety analysis.
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
(WebKit::MediaTrackReader::greatestPresentationTime const):
Fix unlocked access.
(WebKit::MediaTrackReader::addSample):
(WebKit::MediaTrackReader::waitForSample const):
(WebKit::MediaTrackReader::finishParsing):
(WebKit::MediaTrackReader::copyProperty):
(WebKit::MediaTrackReader::finalize):
* Shared/mac/MediaFormatReader/MediaTrackReader.h:
Use CheckedCondition (as an example).
Mark up variables protected by
MediaTrackReader::m_sampleStorageLock
to use thread safety analysis.
2021-04-27 Chris Dumez <cdumez@apple.com>
Improve local storage size estimation for quota limitation
https://bugs.webkit.org/show_bug.cgi?id=225123
Reviewed by Alex Christensen.
Improve local storage size estimation for quota limitation:
- Rely on String::sizeInBytes() to compute the String size, instead of using
String::length() * sizeof(UChar)
- Make estimation consistent between StorageMap & LocalStorageDatabase
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::removeItem):
(WebKit::LocalStorageDatabase::setItem):
(WebKit::estimateEntrySize): Deleted.
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
2021-04-27 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd
https://bugs.webkit.org/show_bug.cgi?id=225072
rdar://77159489
Reviewed by Darin Adler.
Make `rangeForPointInRootViewCoordinates` robust in the case where the original selection may have become
orphaned or null, by checking that the `targetNode` and existing `selectionStart` or `selectionEnd` are in a
tree scope before accessing `treeScope()`.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::rangeForPointInRootViewCoordinates):
2021-04-27 Chris Dumez <cdumez@apple.com>
IPC::decoder::decode() should mark decoder as invalid when failing
https://bugs.webkit.org/show_bug.cgi?id=225117
Reviewed by Darin Adler.
IPC::decoder::decode() should mark decoder as invalid when failing, instead of relying
on individual type decoders to do so. This makes type decoders a bit simpler and less
error-prone.
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<CString>::decode):
(IPC::decodeStringText):
* Platform/IPC/ArgumentCoders.h:
* Platform/IPC/Connection.cpp:
(IPC::Connection::dispatchMessageReceiverMessage):
(IPC::Connection::dispatchSyncMessage):
* Platform/IPC/Decoder.cpp:
(IPC::m_destinationID):
* Platform/IPC/Decoder.h:
(IPC::Decoder::decode):
(IPC::Decoder::operator>>):
* Platform/IPC/HandleMessage.h:
(IPC::handleMessage):
(IPC::handleMessageSynchronous):
(IPC::handleMessageSynchronousWantsConnection):
(IPC::handleMessageAsync):
(IPC::handleMessageAsyncWantsConnection):
* WebProcess/Plugins/Plugin.cpp:
(WebKit::Plugin::Parameters::decode):
2021-04-27 Alex Christensen <achristensen@webkit.org>
charset in contentType used in Blob.prototype.slice(start, end, contentType) is lost
https://bugs.webkit.org/show_bug.cgi?id=225057
Reviewed by Chris Dumez.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURLForSlice):
* WebProcess/FileAPI/BlobRegistryProxy.h:
2021-04-27 Fujii Hironori <Hironori.Fujii@sony.com>
HashTableConstIterator's consistency assertion fails while closing m_webIDBServers in NetworkProcess::didClose since r275846
https://bugs.webkit.org/show_bug.cgi?id=225089
Reviewed by Chris Dumez.
The items of m_webIDBServers were removed while iterating
m_webIDBServers.
Move m_webIDBServers to a temporary HashMap before iterating.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didClose):
2021-04-27 Chris Dumez <cdumez@apple.com>
Copy-on-write semantics should be an internal implementation detail of StorageMap
https://bugs.webkit.org/show_bug.cgi?id=225108
Reviewed by Alex Christensen.
Update StorageArea due to StorageMap API changes.
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::StorageArea):
(WebKit::StorageArea::setItem):
(WebKit::StorageArea::removeItem):
(WebKit::StorageArea::clear):
(WebKit::StorageArea::items const):
(WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
* NetworkProcess/WebStorage/StorageArea.h:
2021-04-27 Per Arne <pvollan@apple.com>
Enforce IOKit filtering
https://bugs.webkit.org/show_bug.cgi?id=223937
<rdar://problem/76271551>
Reviewed by Brent Fulgham.
Enforce IOKit method filtering based on telemetry. This patch also adds IOKit method telemetry for some Apple Silicion
IOKit classes, which were overlooked in the first telemetry phase.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-27 Chris Dumez <cdumez@apple.com>
Don't keep local storage data in memory in the NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=225065
Reviewed by Alex Christensen.
When a WebPage would start to use the local storage API, the WebProcess
would send a sync IPC to the NetworkProcess to retrieve all the local
storage entries for the origin. The NetworkProcess would read those
entries from a SQLite database and send them back to the WebProcess.
Both the NetworkProcess would keep the entries in memory, in a
StorageMap object (which is basically a HashMap). On some sites, the
strings in the local storage may be very large. It is useful for the
WebProcess to keep them in memory for performance reasons, especially
considering that the Web API is synchronous. However, there is no real
need to keep them in memory in the Network Process side, especially
given that the WebProcess already has its own copy. On the network
process side, we can get rid of the StorageMap entirely in the local
storage case and 100% rely on the SQLite database. This is what this
patch implements.
A/B testing shows this is a 2-3% progression on Membuster. There does
not appear to be a meaningful progression on PLUM sadly. This is also
neutral on PLT.
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::estimateEntrySize):
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase):
(WebKit::LocalStorageDatabase::openDatabase):
(WebKit::LocalStorageDatabase::tryToOpenDatabase):
(WebKit::LocalStorageDatabase::items const):
(WebKit::LocalStorageDatabase::removeItem):
(WebKit::LocalStorageDatabase::item const):
(WebKit::LocalStorageDatabase::setItem):
(WebKit::LocalStorageDatabase::clear):
(WebKit::LocalStorageDatabase::close):
(WebKit::LocalStorageDatabase::databaseIsEmpty const):
(WebKit::LocalStorageDatabase::openIfExisting):
(WebKit::LocalStorageDatabase::scopedStatement const):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
- Update LocalStorageDatabase API to match more closely the API of
StorageMap. This way StorageArea can rely on the LocalStorageDatabase
entirely instead of the StorageMap with minimal changes.
- Add quota support similarly to what is done in StorageArea so that
LocalStorageDatabase::setItem() fails when the quota is reached.
- Cache the SQLiteStatements for performance reasons
* NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
(WebKit::LocalStorageNamespace::flushAndClose):
We no longer need to call syncToDatabase() before closing since
LocalStorageDatabase no longer has a queue on pending operations.
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::StorageArea):
(WebKit::StorageArea::addListener):
(WebKit::StorageArea::removeListener):
(WebKit::StorageArea::setItem):
(WebKit::StorageArea::removeItem):
(WebKit::StorageArea::clear):
(WebKit::StorageArea::items const):
(WebKit::StorageArea::ensureDatabase const):
* NetworkProcess/WebStorage/StorageArea.h:
If the StorageArea is used for local storage, we now don't even initialize
a StorageMap and rely entirely on LocalStorageDatabase. If the StorageArea
is used for session storage, we keep using a StorageMap since there is no
backing database. This is fairly straightforward because I updated the
LocalStorageDatabase API to match fairly closely the StorageMap one.
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::waitUntilSyncingLocalStorageFinished):
2021-04-27 Chris Dumez <cdumez@apple.com>
[IPC Hardening] Make sure IPC::Decoder constructors consistently call markInvalid() when decoding fails
https://bugs.webkit.org/show_bug.cgi?id=225110
<rdar://76547775>
Reviewed by Darin Adler.
One of the IPC::Decoder constructors was failing to call markInvalid() after failing to
decoder the message name.
* Platform/IPC/Decoder.cpp:
(IPC::m_destinationID):
2021-04-27 Chris Dumez <cdumez@apple.com>
Ask LocalStorage database to free as much memory as possible on memory pressure
https://bugs.webkit.org/show_bug.cgi?id=225109
Reviewed by Geoffrey Garen.
Ask LocalStorage database to free as much memory as possible on memory pressure.
Some of the strings in the database can be large and we don't want SQLite to be
holding on to those for performance reason when we are under memory pressure.
This seems to be a ~1.75% improvement on PLUM/nytimes-home and a ~1% improvement
on PLUM/wikipedia, sadly not enough to show an impact on the overal PLUM score.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::lowMemoryHandler):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::handleLowMemoryWarning):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::handleLowMemoryWarning):
* NetworkProcess/WebStorage/StorageArea.h:
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::handleLowMemoryWarning):
* NetworkProcess/WebStorage/StorageManagerSet.h:
2021-04-27 Don Olmstead <don.olmstead@sony.com>
[CMake] Don't use FORWARDING_HEADERS_DIR for GTK WebKit headers
https://bugs.webkit.org/show_bug.cgi?id=225006
Reviewed by Michael Catanzaro.
Use WebKit2Gtk_FRAMEWORK_HEADERS_DIR and WebKit2Gtk_DERIVED_SOURCES_DIR for WebKit2 GTK
headers instead of FORWARDING_HEADERS_DIR and DERIVED_SOURCES_DIR.
* PlatformGTK.cmake:
2021-04-27 Brent Fulgham <bfulgham@apple.com>
[iOS] [GPU] The UI process should issue the mach sandbox extension to 'com.apple.AGXCompilerService'
https://bugs.webkit.org/show_bug.cgi?id=225004
<rdar://problem/68362930>
Reviewed by Darin Adler.
In Bug 203915 and Bug 210616 we did work to only extend access to AGX-related graphics facilities on relevant hardware. This was
lost in the transition to the GPU Process and should be added back.
This change does the following:
1. Adds sandbox extension handles for the AGX-related compiler services and IOKit classes to the GPUProcess creation parameters.
2. Updates the GPUProcessProxy to extend AGX features when warranted and add them to the creation parameter structure.
3. Updates the GPUProcess to consume the extensions (when granted).
4. Updates the WebProcessPool to use the WebCore version of the 'agxCompilerClasses' and 'agxCompilerServices' functions.
5. Moves the 'agxCompilerClasses' and 'agxCompilerServices' functions to WebCore, alongside the other AGX functions.
It also corrects the sandbox rule for the AGXCompilerService in the GPU Process sandbox, which incorrectly called it a 'global-name',
when it is an xpc-service.
Tested by existing graphics tests.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::encode const):
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: Correct AGX compiler service type.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::nonBrowserServices):
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::agxCompilerClasses): Deleted.
(WebKit::agxCompilerServices): Deleted.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
2021-04-27 Chris Fleizach <cfleizach@apple.com>
AX: Smart invert>Safari>images & other colors improperly invert
https://bugs.webkit.org/show_bug.cgi?id=225077
<rdar://problem/77176061>
Reviewed by Alan Bujtas.
The invert colors property is gathered during the screen data collection phase.
So properly update the value in WebCore, we need to resend these properties when
accessibility settings change.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::accessibilitySettingsDidChange):
2021-04-27 Philippe Normand <pnormand@igalia.com>
[Flatpak SDK] Direct AVIF loading does not work.
https://bugs.webkit.org/show_bug.cgi?id=222867
Reviewed by Michael Catanzaro.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::didGetFileInfo): Use mime-type reported for local files by gio
only as a last resort. Our MIMETypeRegistry is more reliable in these cases.
2021-04-27 Youenn Fablet <youenn@apple.com>
Add memory allocation checks in more realtime audio capture/rendering places
https://bugs.webkit.org/show_bug.cgi?id=224750
Reviewed by Eric Carlson.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
(WebKit::AudioMediaStreamTrackRenderer::pushSamples):
(WebKit::AudioMediaStreamTrackRenderer::storageChanged):
2021-04-26 Tim Nguyen <ntim@apple.com>
Add more eager OOB checks when creating DisplayListReaderHandle & DisplayListWriterHandle.
https://bugs.webkit.org/show_bug.cgi?id=225055
<rdar://71896663>
Reviewed by Wenson Hsieh.
There were already some OOB checks for both classes, this revision adds checks at creation-time.
Also add a comment on top of SharedDisplayListHandle.h to mention that only subclasses use it.
* GPUProcess/graphics/DisplayListReaderHandle.h:
(WebKit::DisplayListReaderHandle::create):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle):
* Shared/SharedDisplayListHandle.h:
(WebKit::SharedDisplayListHandle::SharedDisplayListHandle):
* WebProcess/GPU/graphics/DisplayListWriterHandle.h:
(WebKit::DisplayListWriterHandle::create):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createItemBuffer):
2021-04-26 Alex Christensen <achristensen@webkit.org>
Consistently include headers with <Framework/Header.h>
https://bugs.webkit.org/show_bug.cgi?id=225067
Reviewed by Alexey Proskuryakov.
* Shared/API/Cocoa/_WKRenderingProgressEventsInternal.h:
* Shared/API/Cocoa/_WKSameDocumentNavigationTypeInternal.h:
* UIProcess/API/Cocoa/NSAttributedString.mm:
* UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
* UIProcess/API/Cocoa/WKConnectionInternal.h:
* UIProcess/API/Cocoa/WKNavigationDataInternal.h:
* UIProcess/API/Cocoa/WKScriptMessage.mm:
* UIProcess/API/Cocoa/WKSecurityOriginInternal.h:
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
* UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/Cocoa/WKWebpagePreferences.mm:
* UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
* UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
* UIProcess/API/Cocoa/_WKAttachment.mm:
* UIProcess/API/Cocoa/_WKAttachmentInternal.h:
* UIProcess/API/Cocoa/_WKAuthenticatorResponseInternal.h:
* UIProcess/API/Cocoa/_WKInspectorConfiguration.mm:
* UIProcess/API/Cocoa/_WKThumbnailView.mm:
* UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
* UIProcess/API/mac/WKWebViewMac.h:
* UIProcess/API/mac/WKWebViewMac.mm:
* UIProcess/Cocoa/MediaUtilities.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
* UIProcess/Cocoa/UIDelegate.mm:
* UIProcess/Cocoa/WKContactPicker.mm:
* UIProcess/Cocoa/WKShareSheet.mm:
* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
* UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm:
* UIProcess/Inspector/mac/WKInspectorViewController.mm:
* UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/mac/HighPerformanceGPUManager.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h:
* WebProcess/InjectedBundle/API/mac/WKDOMInternals.h:
* WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
2021-04-26 Kate Cheney <katherine_cheney@apple.com>
ResourceLoadStatisticsDatabaseStore::aggregatedThirdPartyData() hangs for a long time
https://bugs.webkit.org/show_bug.cgi?id=225063
<rdar://problem/76248557>
Reviewed by Brent Fulgham.
Unique index values speed up sqlite database queries, and prevent
repeated entries in tables without primary keys. Its possible to
get into a state where some tables in the ITP database do not have index
values. We should check on open if the database has index values, and
create them if not. This may require migrating existing data and
removing repeated entries.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
Remove semi-colons in CREATE UNIQUE INDEX queries. They aren't needed
and if we remove them we can use these constexpr values to check for
the correct stored index later on.
(WebKit::stripIndexQueryToMatchStoredValue):
We use CREATE UNIQUE INDEX IF NOT EXISTS to avoid an error if the
unique index already exists, but the value is stored in the database
without the "IF NOT EXISTS" portion. In order to check for correct
values we need to strip this out.
(WebKit::expectedTableAndIndexQueries):
(WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries):
Return the schema and index for a given table. If the index is empty
that means SQLite created an automatic index and we should return
WTF::nullopt.
(WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::missingUniqueIndices):
(WebKit::ResourceLoadStatisticsDatabaseStore::missingReferenceToObservedDomains):
(WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedSchema):
(WebKit::insertDistinctValuesInTableQuery):
Since unique indices prevent repeat entries, tables without them might
have repeated entries. We need to select only one of each entry to
migrate to the new tables. This picks the one with the most recent
lastUpdated time.
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
This fix revealed an index that is never created. I added it here.
(WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectSubStatisticsCount):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _isRelationshipOnlyInDatabaseOnce:thirdParty:completionHandler:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
Convert SPI previously only used for layout tests to be used for an
API test where we can load a database with repeated values to ensure
the migration is correct after my change.
2021-04-26 Ben Nham <nham@apple.com>
Reduce memory footprint for background tabs
https://bugs.webkit.org/show_bug.cgi?id=225007
Reviewed by Chris Dumez.
When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
we should attempt to reduce our memory footprint after some time interval to help relieve
system-wide memory pressure. This is enabled only on Mac because iOS already does something
similar just before WebContent suspends.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::pageDidEnterWindow):
(WebKit::WebProcess::pageWillLeaveWindow):
(WebKit::WebProcess::nonVisibleProcessGraphicsCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessMemoryCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): Deleted.
* WebProcess/WebProcess.h:
2021-04-26 Ben Nham <nham@apple.com>
Handle warning-level memory notifications more aggressively
https://bugs.webkit.org/show_bug.cgi?id=225008
Reviewed by Chris Dumez.
We've found that in some workloads, the critical-level memory pressure handler releases
significantly more memory than the warning-level memory pressure handler. On Macs, it is
likely that the memory pressure coincides with swapping. So when we get even a warning-level
notification from the OS, we should err on the side of releasing more memory to help relieve
the swapping state. To do this, treat warning level notifications the same as critical level
notifications on Mac if the WebProcess is in the background.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
2021-04-26 Alex Christensen <achristensen@webkit.org>
Update Mac-specific CMake files
https://bugs.webkit.org/show_bug.cgi?id=225064
Rubber-stamped by Tim Horton.
* PlatformMac.cmake:
2021-04-26 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r271861): [iOS] Accessory bar navigation to elements outside the viewport fails
https://bugs.webkit.org/show_bug.cgi?id=224980
<rdar://problem/77042311>
Reviewed by Wenson Hsieh.
r271861 introduced logic to prevent obscured elements from being
focusable using the accessory bar, using hit testing. However, it also
prevented elements outside the viewport from participating in accessory
bar navigation.
To fix, include HitTestRequest::IgnoreClipping in the hit test request
options. This ensures that hit test requests are not clipped to the
viewport.
Note that this behavior is covered by an existing test, but the test
only failed on smaller devices.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isObscuredElement):
2021-04-26 Don Olmstead <don.olmstead@sony.com>
Fix includes for some GTK/GLib headers
https://bugs.webkit.org/show_bug.cgi?id=225020
Reviewed by Adrian Perez de Castro.
An include was assuming Source/WebKit as its root.
* UIProcess/API/glib/WebKitInitialize.cpp:
2021-04-26 Alexey Shvayka <shvaikalesh@gmail.com>
[JSC] OrdinarySet should invoke custom [[Set]] methods
https://bugs.webkit.org/show_bug.cgi?id=217916
Reviewed by Yusuke Suzuki.
* WebProcess/Plugins/Netscape/JSNPObject.h:
2021-04-26 Per Arne Vollan <pvollan@apple.com>
[iOS] Update sandbox message filter syntax
https://bugs.webkit.org/show_bug.cgi?id=223384
Reviewed by Brent Fulgham.
Update sandbox message filter syntax on iOS. The previous syntax should also still be supported.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-04-25 Devin Rousso <drousso@apple.com>
Add `ALWAYS_LOG_WITH_STREAM` macro for easier development/debugging
https://bugs.webkit.org/show_bug.cgi?id=224959
Reviewed by Darin Adler.
It's often very helpful to use existing `operator<<` defined on objects, but annoying to
have to copypaste the boilerplate code that creates a `WTF::TextStream` and uses it in a
`WTFLogAlways` or wait for a debug build to enable existing `LOG_WITH_STREAM`.
* Platform/Logging.h:
Move contents of `pal/LogMacros.h` to `wtf/Assertions.h`.
2021-04-25 Jer Noble <jer.noble@apple.com>
[GPUP] REGRESSION: Selecting play/pause on Spotify.com causes page to reload
https://bugs.webkit.org/show_bug.cgi?id=225023
<rdar://76985997>
Reviewed by Darin Adler.
A zero ObjectIdentifier is apparently invalid, which causes a debug ASSERT on the sending
side and a SIGKILL on the receiving side. Replace the zero ObjectIdentifier message when
clearing a LegacyCDMSession with an Optional<ObjectIdentifier>, and send an explicit
WTF::nullopt when clearing.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerCachedKeyForKeyId const):
(WebKit::RemoteMediaPlayerProxy::setLegacyCDMSession):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::setCDMSession):
2021-04-25 Jer Noble <jer.noble@apple.com>
[GPUP][iOS] Silent video playback can interrupt system audio
https://bugs.webkit.org/show_bug.cgi?id=225031
<rdar://76652073>
Reviewed by Eric Carlson.
When the WebContent process asks the GPU Process to set the AVAudioSession audio session
category, the GPU Process as an optimization returns early if the session category being
requested is the same as has already been set. However, the default value of the category
is "None" (which translates to AVAudioSessionCategoryAmbient), and setting the category
to "None" becomes a no-op due to this default. As such, the GPUP never sets the underlying
AVAudioSession's category away from the default, which is AVAudioSessionCategorySoloAmbient,
and thus will interrupt other audio during playback.
Additionally, there's a subtle logic error where the audio session category is not changed
when a given WebContent process (and it's RemoteAudioSession & Proxy) goes away.
The fix for both of these issues is to re-calculate the correct audio session category
when a RemoteAudioSessionProxy is added or removed from RemoteAudioSessionProxyManager.
Since "None" is the default value for a RemoteAudioSessionProxy, the mere act of adding
a new RemoteAudioSessionProxy (which is created when a WebContent process is created)
will cause the audio session category to be set to AVAudioSessionCategoryAmbient.
* GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::setCategory):
* GPUProcess/media/RemoteAudioSessionProxy.h:
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::addProxy):
(WebKit::RemoteAudioSessionProxyManager::removeProxy):
(WebKit::RemoteAudioSessionProxyManager::updateCategory):
(WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess): Deleted.
* GPUProcess/media/RemoteAudioSessionProxyManager.h:
2021-04-25 Dean Jackson <dino@apple.com>
[WebXR] Should be enabled when WEBXR_INTERNALS is true
https://bugs.webkit.org/show_bug.cgi?id=225026
<rdar://problem/77111380>
Reviewed by Sam Weinig.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultWebXREnabled): Return true when HAVE(WEBXR_INTERNALS).
2021-04-24 Tim Horton <timothy_horton@apple.com>
Changing the source of a model element with clipping applied does not update the model
https://bugs.webkit.org/show_bug.cgi?id=224917
Reviewed by Simon Fraser.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm:
(WebKit::PlatformCALayerRemoteModelHosting::dumpAdditionalProperties):
Add a bit to platformLayerTreeAsText() that makes PlatformCALayerRemoteModelHosting
dump the size of the model that it is hosting, which is used in the test for this bug.
2021-04-23 Kate Cheney <katherine_cheney@apple.com>
PCM: debug mode should send the second report on a 10 second delay after the first
https://bugs.webkit.org/show_bug.cgi?id=225010
<rdar://problem/77092303>
Reviewed by John Wilander.
Fix a bug in PCM debug mode where we don't set the timer for 10_s
after sending the first report for an attribution.
No new tests, this is debug mode only. Non-debug mode behavior is
covered by existing tests, and I tested debug mode manually.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
If the attribution has been sent to only one endpoint, indicated by
a non-null laterTimeToSend value, we should set the timer to be 10
seconds if debug mode is enabled.
Also, change the interval time from 1 minute to 10 seconds, because
there was no good reason that it was 1 minute and we should be
consistent. Also 1 minute is a long time to wait during a test.
2021-04-23 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275562.
https://bugs.webkit.org/show_bug.cgi?id=225002
Causes issues in iOS contextmenu animations and interactions
with other popovers
Reverted changeset:
"[iOS] contextmenu hints can be clipped by the WKWebView"
https://bugs.webkit.org/show_bug.cgi?id=224204
https://trac.webkit.org/changeset/275562
2021-04-23 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r273154): fast/forms/ios/repeatedly-focus-offscreen-select.html is consistently failing
https://bugs.webkit.org/show_bug.cgi?id=224985
<rdar://problem/77042177>
Reviewed by Wenson Hsieh.
The test is failing after r273154, which made <select> elements present
a UIMenu rather than a popover. The old logic ensured popovers were not
presented when the <select> element was offscreen (see r265117 for more
information on why that behavior was necessary), but the new
presentation omitted that logic.
To achieve the correct behavior, and fix the failing test, <select>
menus should not be presented when the element is offscreen.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker controlBeginEditing]):
2021-04-23 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276451.
https://bugs.webkit.org/show_bug.cgi?id=224999
Broke perf testing
Reverted changeset:
"[iOS] Update sandbox message filter syntax"
https://bugs.webkit.org/show_bug.cgi?id=223384
https://trac.webkit.org/changeset/276451
2021-04-23 Brent Fulgham <bfulgham@apple.com>
[iOS] GPU Process sandbox lacks IOMobileFramebufferUserClient method filter
https://bugs.webkit.org/show_bug.cgi?id=224956
<rdar://problem/68227590>
Reviewed by Per Arne Vollan.
This patch updates the GPU process sandbox to match the method filter used in the WebContent process
so that we will retain consistent protections when activating the GPU Process. These are the same rules
governing access to this resource when the GPU process is disabled, so should not create a change in behavior.
We also remove unneeded telemetry to reduce messaging burden and avoid performance issues.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-04-23 BJ Burg <bburg@apple.com>
Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler needs to serialize cleanup actions
https://bugs.webkit.org/show_bug.cgi?id=224986
<rdar://76768454>
Reviewed by Devin Rousso.
* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
(-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
Do cleanup on the main queue so that it can be serialized with reads.
(-[WKInspectorResourceURLSchemeHandler webView:stopURLSchemeTask:]):
Ensure that all removals from the map are processed before doing a lookup.
2021-04-23 Darin Adler <darin@apple.com>
Remove decoder memory allocations based on untrusted data (sizes) in the stream; related changes
https://bugs.webkit.org/show_bug.cgi?id=224984
Reviewed by Sam Weinig.
* Platform/IPC/ArgumentCoders.h: Remove the calls to
HashMap::reserveInitialCapacity and HashSet::reserveInitialCapacity, based
on number read in from the decoder. This means there will be more wasted
memory in these HashMap and HashSet objects, so we have to test to make
sure this does not create a performance problem. But without this check,
we are trying to allocate memory based on an unstrusted size.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<RefPtr<ApplePayError>>::encode): Removed the coder
for a Vector of these RefPtr, replaced it with a coder for an individual one,
allowing the Vector ArgumentCoder template to handle vector size and construction.
One benefit is that this adds in a shrinkToFit and prevents us from making any
separate mistake about pre-sizing the Vector here since we use shared code.
(IPC::ArgumentCoder<RefPtr<ApplePayError>>::decode): Ditto.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<RefPtr<SecurityOrigin>>::encode): Ditto.
(IPC::ArgumentCoder<RefPtr<SecurityOrigin>>::decode): Ditto.
(IPC::ArgumentCoder<WebCore::CDMInstanceSession::KeyStatusVector>::encode):
(IPC::ArgumentCoder<WebCore::CDMInstanceSession::KeyStatusVector>::decode):
Removed unnecessary specialization for the KeyStatusVector. There is already
an ArgumentCoder for Vector, for std::pair, for Ref<SharedBuffer>, and for
enumerations like CDMKeyStatus, so there's no need to have a specialized
coder for this. This function that we are removing had a call to
reserveInitialCapacity, but the Vector ArgumentCoder template does not.
* Shared/WebCoreArgumentCoders.h: Replaced the
ArgumentCoder<Vector<RefPtr<WebCore::ApplePayError>>> specialization with
ArgumentCoder<RefPtr<WebCore::ApplePayError>>. Removed the
ArgumentCoder<WebCore::CDMInstanceSession::KeyStatusVector> specialization.
2021-04-23 Kate Cheney <katherine_cheney@apple.com>
Set proper network logging level for full web browsers
https://bugs.webkit.org/show_bug.cgi?id=224982
<rdar://problem/76903650>
Reviewed by Brent Fulgham.
Full web browsers have different low-level network logging requirements
for ephemeral sessions.
No new tests. There's no automated way to test if network level logs
show up. I tested that logging is correct for web browser and non web
browser apps manually.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2021-04-23 Chris Dumez <cdumez@apple.com>
Disable GPUProcess on shipping iOS
https://bugs.webkit.org/show_bug.cgi?id=224897
Reviewed by Eric Carlson.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
(WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
(WebKit::defaultUseGPUProcessForMediaEnabled):
(WebKit::defaultUseGPUProcessForWebGLEnabled):
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
(WebKit::defaultCaptureVideoInGPUProcessEnabled):
(WebKit::defaultWebRTCCodecsInGPUProcess):
2021-04-23 Youenn Fablet <youenn@apple.com>
Fix KVO for camera/microphone capture state WKWebView API
https://bugs.webkit.org/show_bug.cgi?id=224922
<rdar://problem/77008199>
Reviewed by Eric Carlson.
Add missing willChange observer call and migrate keys to API keys.
Covered by API test.
* UIProcess/Cocoa/PageClientImplCocoa.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::microphoneCaptureWillChange):
(WebKit::PageClientImplCocoa::cameraCaptureWillChange):
(WebKit::PageClientImplCocoa::microphoneCaptureChanged):
(WebKit::PageClientImplCocoa::cameraCaptureChanged):
* UIProcess/PageClient.h:
(WebKit::PageClient::microphoneCaptureWillChange):
(WebKit::PageClient::cameraCaptureWillChange):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateReportedMediaCaptureState):
2021-04-23 Chris Dumez <cdumez@apple.com>
Improve our constructDeletedValue() template specializations
https://bugs.webkit.org/show_bug.cgi?id=224889
Reviewed by Darin Adler.
Improve our constructDeletedValue() template specializations and make them more consistent:
- Use placement-new instead of object assignment since we don't want/need to destroy the
existing object (since it is uninitialized).
- Do as little initialization as possible for performance reasons.
* NetworkProcess/cache/NetworkCache.h:
(WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::constructDeletedValue):
(WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::isDeletedValue):
* Platform/IPC/StringReference.h:
(WTF::HashTraits<IPC::StringReference>::constructDeletedValue):
* Shared/CallbackID.h:
(WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue):
(WTF::HashTraits<WebKit::CallbackID>::isDeletedValue):
2021-04-23 Youenn Fablet <youenn@apple.com>
Handle rotation correctly in WebRTC GPUProcess rendering pipeline
https://bugs.webkit.org/show_bug.cgi?id=224927
<rdar://76915991>
Reviewed by Eric Carlson.
Instead of updating the inner layer, update the root layer.
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
(WebKit::RemoteSampleBufferDisplayLayer::updateAffineTransform):
2021-04-23 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Implement PageClient::makeViewBlank()
https://bugs.webkit.org/show_bug.cgi?id=224236
Reviewed by Chris Dumez.
Make most of the changes in r275485 cross platform and implement PageClient::makeViewBlank() for the GTK port.
* UIProcess/API/glib/WebKitUIClient.cpp:
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::makeViewBlank):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSnapshot):
(webkitWebViewBaseDraw):
(webkitWebViewBaseMakeBlank):
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
(WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): Deleted.
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::flushPendingLayerChanges):
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
(WebKit::DrawingAreaCoordinatedGraphics::display):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didUpdateRendering):
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::didUpdateRendering): Deleted.
2021-04-22 Jer Noble <jer.noble@apple.com>
[Mac] CMBaseClass object pointers can become unaligned on x86
https://bugs.webkit.org/show_bug.cgi?id=224950
<rdar://77020922>
Reviewed by Eric Carlson.
CMBaseClass has a 4-byte version member before its 8-byte pointers on x86. Deal with this
the same way we do with other pointer-bearing, static, CM-type objects: enforce a 4-byte
packing, and prepend the struct with another 4-byte object in order to force the pointers
into 8-byte alignment.
* Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
(WebKit::CoreMediaWrapped<Wrapped>::vTable):
2021-04-22 Wenson Hsieh <wenson_hsieh@apple.com>
Followup to r276397
https://bugs.webkit.org/show_bug.cgi?id=224883
Reviewed by Darin Adler.
Use a range-based for loop when mapping FloatQuads in `sendTapHighlightForNodeIfNecessary`.
No change in behavior.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
2021-04-22 Brent Fulgham <bfulgham@apple.com>
[iOS] Remove useless 'network-outbound' rule from non-networking file rule
https://bugs.webkit.org/show_bug.cgi?id=224940
<rdar://problem/66583476>
Reviewed by Per Arne Vollan.
No new tests. No effect on behavior.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
2021-04-22 BJ Burg <bburg@apple.com>
[Cocoa] re-enable test case WKInspectorDelegate.InspectorConfiguration
https://bugs.webkit.org/show_bug.cgi?id=224577
<rdar://70505272>
Reviewed by Devin Rousso.
For the purposes of testing, we want to be able to issue a fetch() that will
hit a custom URL scheme handler registered with _WKInspectorConfiguration.
This is not allowed by the existing <meta> tag CSP directive list because 'connect-src *'
does not allow connecting to arbitrary schemes, just arbitrary domains.
To fix this, relax the 'connect-src' directive in Main.html and apply
a dynamically-computed CSP directive using the 'Content-Security-Policy' HTTP
response header. This is only sent for main resources (Main.html and Test.html)
using the newly added inspector-resource: URL scheme handler.
The dynamically computed directive explicitly allows 'self' and any other registered
custom URL scheme handlers. WebKit ports which have not migrated away from file:///
will only apply the weaker 'connect-src' directive from the <meta> tag after this change.
Progresses an existing API test: WKInspectorDelegate.InspectorConfiguration.
* UIProcess/API/Cocoa/_WKInspectorDelegate.h:
* UIProcess/API/APIInspectorClient.h:
(API::InspectorClient::frontendLoaded):
* UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h:
* UIProcess/API/Cocoa/_WKInspector.mm:
* UIProcess/API/Cocoa/_WKInspectorTesting.mm:
(JavaScriptSnippetToFetchURL):
(-[_WKInspector _fetchURLForTesting:]):
* UIProcess/Inspector/WebInspectorUIProxy.cpp:
(WebKit::WebInspectorUIProxy::frontendLoaded): Notify the _WKInspectorDelegate
adapter that the frontend has finished loading.
* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.h:
* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
(-[WKInspectorResourceURLSchemeHandler allowedURLSchemesForCSP]):
(-[WKInspectorResourceURLSchemeHandler setAllowedURLSchemesForCSP:]):
(-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
Added. Keep track of allowed custom schemes and allowed main resources.
Apply the CSP directive for main resource requests only.
* UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController webViewConfiguration]):
Set the allowed URL schemes property so the URL scheme handler can include
the schemes in the dynamically computed 'connect-src' directive.
2021-04-22 Simon Fraser <simon.fraser@apple.com>
Add trace points for WKWebView snapshotting
https://bugs.webkit.org/show_bug.cgi?id=224943
Reviewed by Tim Horton.
Add new trace points to make snapshotting-related issues easier to diagnose. In the UI
process we start/end a trace scope when requested to snapshot, and before calling the
client's completion handler.
Trace CARenderServer snapshots which happen in the UI process, and in the web process, trace
the start and end of the snapshot painting.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView requestSnapshot]):
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::paintSnapshotAtSize):
2021-04-22 Lauro Moura <lmoura@igalia.com>
Unreviewed. Guard doesPageNeedTCCD in platform COCOA after r274213
https://bugs.webkit.org/show_bug.cgi?id=224951
Silence -Wunused-function in non-cocoa platforms.
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2021-04-22 Patrick Griffis <pgriffis@igalia.com>
[SOUP] Show more connection information in the inspector
https://bugs.webkit.org/show_bug.cgi?id=224873
Show the h2 protocol as well as the connection identifier
in the inspector.
Reviewed by Adrian Perez de Castro.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::gotHeadersCallback):
(WebKit::soupHTTPVersionToString):
(WebKit::NetworkDataTaskSoup::didGetHeaders):
2021-04-22 Chris Dumez <cdumez@apple.com>
NowPlayingInfoForGPUManager::clearNowPlayingInfoPrivate() sometimes launches the GPUProcess on page close
https://bugs.webkit.org/show_bug.cgi?id=224939
Reviewed by Simon Fraser.
Make sure NowPlayingInfoForGPUManager::clearNowPlayingInfoPrivate() never launches the GPUProcess. The GPU
process already takes care of clearing now playing info on exit.
* WebProcess/GPU/media/WebMediaStrategy.cpp:
(WebKit::WebMediaStrategy::createNowPlayingManager const):
2021-04-22 Chris Dumez <cdumez@apple.com>
Call RemoteMediaEngineConfigurationFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia()
https://bugs.webkit.org/show_bug.cgi?id=224937
Reviewed by Eric Carlson.
Call RemoteMediaEngineConfigurationFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia(),
like we used to do, instead of doing it in the GPUProcessConnection constructor. It is safer to
register the factory before we have a GPUProcessConnection and we wouldn't want things to behave
differently depending on whether or not the GPUProcess is already launched. I made sure that this does
not eagerly launch the GPUProcess.
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::GPUProcessConnection):
(WebKit::GPUProcessConnection::mediaEngineConfigurationFactory): Deleted.
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setUseGPUProcessForMedia):
(WebKit::WebProcess::mediaEngineConfigurationFactory):
* WebProcess/WebProcess.h:
2021-04-22 Alex Christensen <achristensen@webkit.org>
Fix ENABLE macro around NetworkProcessConnection::connectToRTCDataChannelRemoteSource declaration
https://bugs.webkit.org/show_bug.cgi?id=224938
Reviewed by Chris Dumez.
This matches the macro around the definition.
* WebProcess/Network/NetworkProcessConnection.h:
2021-04-22 BJ Burg <bburg@apple.com>
v2: REGRESSION(r266890): [Cocoa] Fix API::InspectorClient leak
https://bugs.webkit.org/show_bug.cgi?id=223899
<rdar://problem/75249282>
Reviewed by Devin Rousso.
Address post-review feedback.
* UIProcess/API/Cocoa/_WKInspectorTesting.mm:
(-[_WKInspector _openURLExternallyForTesting:useFrontendAPI:]):
2021-04-22 Alex Christensen <achristensen@webkit.org>
Add some new messages.in files to the Mac CMake build
* PlatformMac.cmake:
2021-04-22 Per Arne <pvollan@apple.com>
[iOS] Update sandbox message filter syntax
https://bugs.webkit.org/show_bug.cgi?id=223384
<rdar://problem/75531614>
Reviewed by Brent Fulgham.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-04-22 Martin Robinson <mrobinson@webkit.org>
[GTK] Turn on editable <input type=date> and <input type=time> fields
https://bugs.webkit.org/show_bug.cgi?id=224921
Reviewed by Carlos Garcia Campos.
Turn on editable date and time inputs for GTK.
* SourcesGTK.txt: Add source file.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDateTimePicker): Added.
* UIProcess/API/gtk/PageClientImpl.h: Added method declaration.
* UIProcess/gtk/WebDateTimePickerGtk.cpp: Added. Stub for date/time picker which
doesn't have any user interface. This will allow clients to use the editable shadow
DOM date/time input editable fields.
(WebKit::WebDateTimePickerGtk::create):
(WebKit::WebDateTimePickerGtk::~WebDateTimePickerGtk):
(WebKit::WebDateTimePickerGtk::WebDateTimePickerGtk):
(WebKit::WebDateTimePickerGtk::endPicker):
(WebKit::WebDateTimePickerGtk::showDateTimePicker):
* UIProcess/gtk/WebDateTimePickerGtk.h: Added.
2021-04-22 Aditya Keerthi <akeerthi@apple.com>
Fix the tvOS build after r276325
https://bugs.webkit.org/show_bug.cgi?id=224929
<rdar://problem/77003408>
Reviewed by Wenson Hsieh.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
[UIColor systemBackgroundColor] is SPI on tvOS.
(-[WKDateTimePickerViewController viewDidLoad]):
UIBlurEffectStyleSystemMaterial is not available on tvOS. Instead, use
a UIView with a system background color as the background view.
2021-04-20 BJ Burg <bburg@apple.com>
v2: Web Inspector: exempt API::SharedJSContext from remote inspection and automatic inspection
https://bugs.webkit.org/show_bug.cgi?id=224841
<rdar://69386559>
Reviewed by Devin Rousso.
Use the RemoteInspector C SPI to temporarily turn off "allow remote inspection by default".
* UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
(API::SharedJSContext::ensureContext):
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] The Look Up text service popover should avoid covering selected text
https://bugs.webkit.org/show_bug.cgi?id=224915
rdar://75891746
Reviewed by Megan Gardner.
Adjust the presentation rect when showing the Look Up text service popup using the callout bar on iOS so that
we use the entire bounds of the selection. Currently, we only use the first selection rect (top to bottom) as
the presentation rect, which may cause the popup to obscure selected text.
This seems to have been derived from iOS legacy web view behavior that dating back to rdar://7475904; while the
exact reasoning for this is effectively lost to time, it's likely due to how there used to only be a single
block selection rect in non-editable content in iOS 5 anyways, so taking only the first selection rect would not
be incorrect. However, we now use character granularity selection everywhere in WebKit2, so this logic is no
longer sensible.
Test: TextServicesTests.LookUpPresentationRect
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _lookupForWebView:]):
(-[WKContentView _translateForWebView:]):
Make a similar adjustment here, since this presentation rect is intended to match that of the Look Up popover.
2021-04-22 Brent Fulgham <bfulgham@apple.com>
[macOS] Re-block access to SYS_setattrlist
https://bugs.webkit.org/show_bug.cgi?id=224892
<rdar://problem/74828532>
Reviewed by Per Arne Vollan.
No new tests. No change in behavior.
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-22 Chris Dumez <cdumez@apple.com>
Call RemoteCDMFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia()
https://bugs.webkit.org/show_bug.cgi?id=224907
Reviewed by Eric Carlson.
Call RemoteCDMFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia() like we
did before r275887, instead of doing it in the GPUProcessConnection constructor. This is
safer as it makes sure the CDMFactory gets registered even if the GPUProcess has not launched
yet. This is also more consistent with what we do for LegacyCDM since Bug 224905.
The MediaKeys API still seems functional after r275887 (unlike the LegacyCDM one) so it does
not seem it caused obvious breakage. That said, it is still safer to restore pre-r275887
behavior. There is also no drawback to restoring the previous behavior since I made sure the
GPUProcess does not get launched eagerly.
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::GPUProcessConnection):
(WebKit::GPUProcessConnection::dispatchMessage):
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setUseGPUProcessForMedia):
(WebKit::WebProcess::cdmFactory):
* WebProcess/WebProcess.h:
2021-04-22 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Add support for preconnect
https://bugs.webkit.org/show_bug.cgi?id=177934
Reviewed by Sergio Villar Senin.
Use new libsoup API to implement preconnect support.
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::createRequest):
(WebKit::NetworkDataTaskSoup::resume):
(WebKit::NetworkDataTaskSoup::preconnectCallback):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
2021-04-22 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Build error: Couldn't find include 'Soup-2.4.gir'
https://bugs.webkit.org/show_bug.cgi?id=224926
Reviewed by Philippe Normand.
Use the right soup API version when generating the introspection.
* PlatformGTK.cmake:
2021-04-22 Myles C. Maxfield <mmaxfield@apple.com>
[iOS] Web processes recreated after crashing are not created with the right contentSizeCategory
https://bugs.webkit.org/show_bug.cgi?id=224916
Reviewed by Tim Horton.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-04-21 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] GetDoubleClickTime() returns 0 in the non-interactive window station on Windows 10 version 2004
https://bugs.webkit.org/show_bug.cgi?id=224793
Reviewed by Don Olmstead.
* Shared/win/WebEventFactory.cpp:
(WebKit::clickCount): Use WebCore::getDoubleClickTime instead of
GetDoubleClickTime API.
2021-04-21 Peng Liu <peng.liu6@apple.com>
[GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes
https://bugs.webkit.org/show_bug.cgi?id=224891
Reviewed by Eric Carlson.
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::enqueuedSamplesForTrackID):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::bufferedSamplesForTrackId):
(WebKit::SourceBufferPrivateRemote::enqueuedSamplesForTrackID):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
2021-04-21 John Wilander <wilander@apple.com>
PCM: Remove PrivateClickMeasurement::PcmDataCarried::NonPersonallyIdentifiable overrides in testing
https://bugs.webkit.org/show_bug.cgi?id=224885
<rdar://problem/76973184>
Reviewed by Brent Fulgham.
We had a temporary override to PrivateClickMeasurement::PcmDataCarried::NonPersonallyIdentifiable
in WebKit::PrivateClickMeasurementManager::getTokenPublicKey() and
WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken().
This patch removes those overrides since the network load hang has been resolved.
No new tests. Existing tests cover this code.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
2021-04-21 Chris Dumez <cdumez@apple.com>
Regression(r275887) open.spotify.com says Safari is not supported
https://bugs.webkit.org/show_bug.cgi?id=224905
<rdar://76982108>
Reviewed by Eric Carlson.
Move legacyCDMFactory() getter from GPUProcessConnection to WebProcess so that
we can query it without having to launch the GPUProcess. This means we can
call legacyCDMFactory().registerFactory() inside of WebProcess::setUseGPUProcessForMedia()
(like before r275887) instead of doing it in the GPUProcessConnection constructor.
As a result, calls to WebKitMediaKeys.isTypeSupported() return accurate results
even if the GPUProcess is not launched yet. Calling WebKitMediaKeys.isTypeSupported() ends
up launching the GPU Process, as is expected.
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::GPUProcessConnection):
(WebKit::GPUProcessConnection::legacyCDMFactory): Deleted.
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::setCDM):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setUseGPUProcessForMedia):
(WebKit::WebProcess::legacyCDMFactory):
* WebProcess/WebProcess.h:
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
Introduce helper methods to map FloatQuads to and from content and root view coordinates
https://bugs.webkit.org/show_bug.cgi?id=224883
Reviewed by Tim Horton.
Use the new helper methods.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::convertContentToRootView):
(WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
Note that we previously rounded absolute quads to the nearest integer when mapping through root view
coordinates. From <https://bugs.webkit.org/show_bug.cgi?id=128277#c2>, this seemed unintentional to begin with,
and we should be able to use the `FloatPoint` conversion methods instead.
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
[iOS] Fix internal builds after r276325
https://bugs.webkit.org/show_bug.cgi?id=224896
Reviewed by Tim Horton.
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePickerViewController datePickerInsets]):
(-[WKDateTimePicker _contextMenuInteraction:styleForMenuWithConfiguration:]):
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Update font for group headers in the <select multiple> picker
https://bugs.webkit.org/show_bug.cgi?id=224823
<rdar://problem/76785841>
Reviewed by Wenson Hsieh.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPickerTableViewController tableView:heightForHeaderInSection:]):
The new font's size can varying depending on the user's Dynamic Type
setting. Consequently, the height of the header must now be computed
dynamically.
(-[WKSelectPickerTableViewController tableView:viewForHeaderInSection:]):
(-[WKSelectPickerTableViewController groupHeaderFont]):
Use a font with text style UIFontTextStyleTitle3 and a semibold weight,
matching other system grouped headers. The font is not saved as an
instance variable so that an up-to-date lineHeight can be obtained in
"tableView:heightForHeightInSection:".
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Text selection in image overlays should not be limited to rectilinear quads
https://bugs.webkit.org/show_bug.cgi?id=224837
<rdar://76829981>
Reviewed by Tim Horton.
See WebCore ChangeLog for more details.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<SelectionGeometry>::encode):
(IPC::ArgumentCoder<SelectionGeometry>::decode):
Encode the `SelectionGeometry` by serializing a `FloatQuad` instead of an enclosing rect.
* UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::operator==):
(-[WKContentView selectedTextRange]):
(-[WKContentView markedTextRange]):
* UIProcess/ios/WKTextSelectionRect.h:
* UIProcess/ios/WKTextSelectionRect.mm:
(-[WKTextSelectionRectCustomHandleInfo initWithFloatQuad:]):
(-[WKTextSelectionRectCustomHandleInfo bottomLeft]):
(-[WKTextSelectionRectCustomHandleInfo topLeft]):
(-[WKTextSelectionRectCustomHandleInfo bottomRight]):
(-[WKTextSelectionRectCustomHandleInfo topRight]):
(-[WKTextSelectionRect initWithCGRect:]):
(-[WKTextSelectionRect initWithSelectionGeometry:scaleFactor:]):
(-[WKTextSelectionRect _path]):
(-[WKTextSelectionRect _customHandleInfo]):
Implement SPI methods on `UITextSelectionRect` to render text selection UI using quads instead of rects.
(-[WKTextSelectionRect initWithSelectionGeometry:]): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::convertContentToRootView):
2021-04-21 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, mid April 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=222652
<rdar://problem/75262285>
Unreviewed non-unified build fixes.
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: Add missing
NetworkProcessConnection.h include.
(WebKit::RTCDataChannelRemoteManager::connectToRemoteSource): Sprinkle missing WebCore::
namespace prefixes.
(WebKit::RTCDataChannelRemoteManager::postTaskToHandler): Ditto.
(WebKit::RTCDataChannelRemoteManager::sourceFromIdentifier): Ditto.
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp: Add missing WebProcess.h include.
2021-04-21 Kimmo Kinnunen <kkinnunen@apple.com>
Fix build break after r276363
https://bugs.webkit.org/show_bug.cgi?id=224881
Unreviewed, build fix.
Fix build break after r276363
WebGL GPUP crashes when preparing for display due to off-thread WeakPtr access (IOSURFACE_SET_OWNERSHIP_IDENTITY)
* GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
2021-04-21 Kate Cheney <katherine_cheney@apple.com>
Followup change to bug 224779 based on post-land review comment.
https://bugs.webkit.org/show_bug.cgi?id=224779
<rdar://problem/76738879>
Reviewed by Chris Dumez.
Remove unnecessary document check.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::preconnectTo):
2021-04-21 Don Olmstead <don.olmstead@sony.com>
[CMake] Add OpenGLES2 targets
https://bugs.webkit.org/show_bug.cgi?id=224786
Reviewed by Adrian Perez de Castro.
Use the OpenGL::GLES target.
* CMakeLists.txt:
2021-04-21 Peng Liu <peng.liu6@apple.com>
[GPUP] Refactor the implementation of MediaSource::buffered()
https://bugs.webkit.org/show_bug.cgi?id=224848
Reviewed by Eric Carlson.
Add an IPC message `BufferedChanged` to forward the buffered ranges of
`MediaSource` from a WebContent process to the GPU process.
* GPUProcess/media/RemoteMediaSourceProxy.cpp:
(WebKit::RemoteMediaSourceProxy::buffered const):
(WebKit::RemoteMediaSourceProxy::bufferedChanged):
* GPUProcess/media/RemoteMediaSourceProxy.h:
* GPUProcess/media/RemoteMediaSourceProxy.messages.in:
* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::bufferedChanged):
* WebProcess/GPU/media/MediaSourcePrivateRemote.h:
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
Fix the watchOS build after r276325
https://bugs.webkit.org/show_bug.cgi?id=224868
<rdar://problem/76938541>
Reviewed by Wenson Hsieh.
r276325 broke the watchOS build by using UIBlurEffectStyleSystemMaterial
in WKDateTimeInputControl.mm.
However, while we have been compiling WKDateTimeInputControl for
watchOS, the class is unused. This is due to the fact that watchOS has
a separate date/time picker implementation. Rather than conditionally
compiling the UIBlurEffectStyleSystemMaterial logic (which would
involve writing additional logic to make sure WKDateTimeInputControl
still compiles on watchOS), we can simply stop building
WKDateTimeInputControl on watchOS.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dateTimeInputControl:]):
(-[WKContentView timePickerValueHour:]):
(-[WKContentView timePickerValueMinute:]):
* UIProcess/ios/forms/WKDateTimeInputControl.h:
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
2021-04-21 Kimmo Kinnunen <kkinnunen@apple.com>
WebGL GPUP crashes when preparing for display due to off-thread WeakPtr access (IOSURFACE_SET_OWNERSHIP_IDENTITY)
https://bugs.webkit.org/show_bug.cgi?id=224864
Reviewed by Chris Dumez.
Do not navigate WeakPtr in RemoteGraphicsContextGL thread.
Instead, cache the ownership identity tag during constructor
in main thread.
No new tests, caught with existing tests when the define
is enabled.
* GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
(WebKit::RemoteGraphicsContextGLCocoa::RemoteGraphicsContextGLCocoa):
(WebKit::RemoteGraphicsContextGLCocoa::prepareForDisplay):
2021-04-21 Simon Fraser <simon.fraser@apple.com>
Enhance scrolling-related trace points
https://bugs.webkit.org/show_bug.cgi?id=224852
Reviewed by Tim Horton.
Add a new trace point in EventDispatcher::displayWasRefreshed() so we can tell when the
WebProcess receives displayDidRefresh IPC (this can sometimes be delayed by other work that
might share the same dispatch thread).
We repurpose the existing DisplayRefreshDispatchingToMainThread which is the WK1 equivalent.
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::displayWasRefreshed):
2021-04-21 Philippe Normand <pnormand@igalia.com>
Unreviewed, WPE Cog build fix after r276316
* wpe/wpe-webkit-uninstalled.pc.in: Adjust paths once again.
2021-04-21 Tim Horton <timothy_horton@apple.com>
Long-pressing a data detectors link causes the link to be followed
https://bugs.webkit.org/show_bug.cgi?id=224847
<rdar://problem/72889738>
Reviewed by Wenson Hsieh.
On iOS, it is possible for a gesture to be externally cancelled (in this case,
when a data detectors context menu is presented by long pressing a link).
This is reported to WKMouseGestureRecognizer as "touches cancelled".
Currently, WKMouseGestureRecognizer just runs with that as a normal
"mouse button release" event, which then causes the link that you're long
pressing to also be followed.
* Shared/NativeWebMouseEvent.h:
* Shared/WebMouseEvent.cpp:
(WebKit::WebMouseEvent::WebMouseEvent):
(WebKit::WebMouseEvent::encode const):
(WebKit::WebMouseEvent::decode):
* Shared/WebMouseEvent.h:
(WebKit::WebMouseEvent::gestureCancelled const):
* Shared/ios/NativeWebMouseEventIOS.mm:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
* UIProcess/ios/WKMouseGestureRecognizer.mm:
(-[WKMouseGestureRecognizer createMouseEventWithType:wasCancelled:]):
(-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
(-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
(-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
(-[WKMouseGestureRecognizer touchesCancelled:withEvent:]):
(-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
(-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
(-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
(-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleMouseEvent):
Add a bit to WebKit::WebMouseEvent indicating that the gesture it is a part of
was cancelled. This will only be set on the mouse release event dispatched from
touchesCancelled from WKMouseGestureRecognizer, and will cause WebCore to
avoid dispatching the click event, as you would on macOS if you e.g.
moved the mouse too far from its origin during the press.
Plumb the bit all the way from WKMouseGestureRecognizer, through the
NativeWebMouseEvent constructor, to WebMouseEvent, and then check it
and call invalidateClick() immediately before handing WebCore the
mouse release event, to avoid the click event.
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Avoid triggering image extraction for animated images
https://bugs.webkit.org/show_bug.cgi?id=224851
Reviewed by Megan Gardner.
Avoid making image extraction requests for animated images by adding an optional `AllowsAnimatedImages`
argument to `createShareableBitmap`, and passing in `AllowsAnimatedImages::No` in the case where we're creating
a shareable bitmap for image extraction.
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestImageExtraction):
2021-04-21 Megan Gardner <megan_gardner@apple.com>
Support scrolling to a selected AppHighlight
https://bugs.webkit.org/show_bug.cgi?id=224773
Reviewed by Tim Horton.
* UIProcess/API/Cocoa/WKWebView.mm:
(restoreHighlight):
(-[WKWebView _restoreAppHighlights:]):
(-[WKWebView _restoreAndScrollToAppHighlight:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::restoreAppHighlightsAndScrollToIndex):
(WebKit::WebPageProxy::restoreAppHighlights): Deleted.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreAppHighlightsAndScrollToIndex):
(WebKit::WebPage::restoreAppHighlights): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-04-20 Kimmo Kinnunen <kkinnunen@apple.com>
Connection::m_mainThread is unused
https://bugs.webkit.org/show_bug.cgi?id=224806
Reviewed by Darin Adler.
Remove unused Connection::m_mainThread.
* Platform/IPC/Connection.cpp:
(IPC::Connection::Connection):
* Platform/IPC/Connection.h:
2021-04-20 Ian Gilbert <iang@apple.com>
Crash due to VectorBuffer pre-allocation failure
https://bugs.webkit.org/show_bug.cgi?id=224840
Reviewed by Sam Weinig.
Vector decoder could attempt to allocate a large buffer and on failure would crash.
Changed decode to avoid allocating a Vector based on the decoded size.
Test: ipc/large-vector-allocate-failure-crash.html
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<Vector<RefPtr<ApplePayError>>>::decode):
2021-04-20 Chris Dumez <cdumez@apple.com>
If an idle GPUProcess doesn't exit under memory pressure because it just launched, check again later
https://bugs.webkit.org/show_bug.cgi?id=224829
Reviewed by Darin Adler.
In r276305, I made it so that the GPUProcess does not exit under memory pressure when idle
if it launched less than 5 seconds ago. This gives the WebProcess time to schedule work with
the GPUProcess after launching it and makes sure we don't repeatedly / frequently exit &
relaunch the GPUProcess.
In this patch, I am tweaking the policy so that if we could have exited but didn't because
the GPUProcess was too young (less than 5 seconds old), then I schedule a timer for this
5 second deadline to check again if the GPUProcess could exit (meaning that it is unused).
When the timer fires, the process doesn't have to be under memory pressure still in order
to exit, it just needs to be idle. I figured the fact that we were under memory pressure
less than 5 seconds ago should be enough incentive to exit if idle.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::GPUProcess):
(WebKit::GPUProcess::canExitUnderMemoryPressure const):
* GPUProcess/GPUProcess.h:
2021-04-20 Devin Rousso <drousso@apple.com>
Parse `theme_color` in web application manifests and pass it along to `-[WKWebView themeColor]`
https://bugs.webkit.org/show_bug.cgi?id=224796
Reviewed by Darin Adler.
* UIProcess/API/Cocoa/_WKApplicationManifest.h:
* UIProcess/API/Cocoa/_WKApplicationManifest.mm:
(-[_WKApplicationManifest initWithCoder:]):
(-[_WKApplicationManifest encodeWithCoder:]):
(-[_WKApplicationManifest themeColor]): Added.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::themeColorChanged const):
(WebKit::WebChromeClient::pageExtendedBackgroundColorDidChange const):
Drive-by: Remove the `Color` parameter since it's not actually used in the WebProcess.
2021-04-20 Michael Catanzaro <mcatanzaro@gnome.org>
Lots of spurious -Wnonnull warnings with GCC 11
https://bugs.webkit.org/show_bug.cgi?id=224452
Reviewed by Darin Adler.
* WebProcess/Plugins/PluginView.cpp:
2021-04-20 Wenson Hsieh <wenson_hsieh@apple.com>
Rename WebCore::SelectionRect to WebCore::SelectionGeometry
https://bugs.webkit.org/show_bug.cgi?id=224820
Reviewed by Megan Gardner.
See WebCore/ChangeLog for more details.
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/EditorState.cpp:
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
(WebKit::operator<<):
* Shared/EditorState.h:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<SelectionGeometry>::encode):
(IPC::ArgumentCoder<SelectionGeometry>::decode):
(IPC::ArgumentCoder<SelectionRect>::encode): Deleted.
(IPC::ArgumentCoder<SelectionRect>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationRequest.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):
(WebKit::operator==):
(WebKit::operator<<):
(-[WKContentView _pointIsInsideSelectionRect:outBoundingRect:]):
(-[WKContentView _shouldToggleSelectionCommandsAfterTapAt:]):
(-[WKContentView webSelectionRectsForSelectionGeometries:]):
(-[WKContentView webSelectionRects]):
(-[WKContentView _lookupForWebView:]):
(-[WKContentView _shareForWebView:]):
(-[WKContentView _translateForWebView:]):
(-[WKContentView _addShortcutForWebView:]):
(-[WKContentView _showDictionary:]):
(-[WKContentView _accessibilityRetrieveRectsEnclosingSelectionOffset:withGranularity:]):
(-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
(-[WKContentView selectedTextRange]):
(-[WKContentView webSelectionRectsForSelectionRects:]): Deleted.
* UIProcess/ios/WKTextSelectionRect.h:
* UIProcess/ios/WKTextSelectionRect.mm:
(-[WKTextSelectionRect initWithCGRect:]):
(-[WKTextSelectionRect initWithSelectionGeometry:]):
(-[WKTextSelectionRect rect]):
(-[WKTextSelectionRect writingDirection]):
(-[WKTextSelectionRect containsStart]):
(-[WKTextSelectionRect containsEnd]):
(-[WKTextSelectionRect isVertical]):
(-[WKTextSelectionRect initWithSelectionRect:]): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
(WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
(WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::convertContentToRootView):
(WebKit::WebPage::getPlatformEditorState const):
(WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
(WebKit::WebPage::getRectsAtSelectionOffsetWithText):
(WebKit::WebPage::requestAutocorrectionData):
(WebKit::convertContentToRootViewSelectionRects): Deleted.
2021-04-20 Kate Cheney <katherine_cheney@apple.com>
Preconnect tasks and preflight checks do not correctly mark app-bound context string
https://bugs.webkit.org/show_bug.cgi?id=224779
<rdar://problem/76738879>
Reviewed by Brent Fulgham.
We are using request.firstPartyForCookies() to set the app-bound request
context as of https://bugs.webkit.org/show_bug.cgi?id=224311. Some
cases like preconnect tasks and CORS preflight requests don't set this
value because it is not needed for cookie purposes. Since we are now
using it for app-bound requests, and the context is needed for all
network connections, even those that don't send bytes, we should set
the firstPartyForCookies for these cases.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
This is the code path for preconnecting to the main resource load, so
we can use the given URL as the first party.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::preconnectTo):
This is the code path for sub resources. We should use the document
firstPartyForCookies value.
2021-04-20 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Update date/time picker appearance
https://bugs.webkit.org/show_bug.cgi?id=224794
<rdar://problem/76785859>
Reviewed by Wenson Hsieh.
Date/time pickers should have a system material background and should
avoid obscuring the associated element when possible.
* Platform/spi/ios/UIKitSPI.h:
Add new SPI declarations to support date/time picker modifications.
* UIProcess/ios/WKContentViewInteraction.mm:
(createTargetedPreview):
(createFallbackTargetedPreview):
(-[WKContentView _createTargetedContextMenuHintPreviewForFocusedElement]):
Set the UITargetedPreview background color to clearColor when
presenting a date/time picker, so that the presented picker has a
visible material effect. Without this change, the picker would have a
solid white or black background.
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePickerViewController initWithDelegate:]):
(-[WKDateTimePickerViewController viewDidLoad]):
Add a system material background to the date picker using
UIVisualEffectView.
(-[WKDateTimePickerViewController datePickerChanged:]):
(-[WKDateTimePickerViewController resetButtonPressed:]):
(-[WKDateTimePickerViewController doneButtonPressed:]):
(-[WKDateTimePickerViewController datePickerInsets]):
(-[WKDateTimePickerViewController preferredDatePickerSize]):
(-[WKDateTimePickerViewController preferredContentSize]):
(-[WKDateTimePickerViewController date]):
(-[WKDateTimePickerViewController setDate:]):
(-[WKDateTimePickerViewController setDatePickerMode:]):
(-[WKDateTimePickerViewController timeZone]):
(-[WKDateTimePickerViewController setTimeZone:]):
(-[WKDateTimePickerViewController calendar]):
(-[WKDateTimePicker initWithView:datePickerMode:]):
(-[WKDateTimePicker _preferredEdgeInsetsForDateTimePicker]):
Attempt to present the date picker in a way that does not obscure the
element.
(-[WKDateTimePicker _contextMenuInteraction:styleForMenuWithConfiguration:]):
(-[WKDateTimePicker contextMenuInteraction:configurationForMenuAtLocation:]):
(-[WKDateTimePicker dateTimePickerViewControllerDidChangeDate:]):
(-[WKDateTimePicker dateTimePickerViewControllerDidPressResetButton:]):
(-[WKDateTimePicker dateTimePickerViewControllerDidPressDoneButton:]):
(-[WKDateTimePicker shouldForceGregorianCalendar]):
(-[WKDateTimePicker dealloc]):
(-[WKDateTimePicker _timeZoneOffsetFromGMT:]):
(-[WKDateTimePicker _sanitizeInputValueForFormatter:]):
(-[WKDateTimePicker dateFormatterForPicker]):
(-[WKDateTimePicker _dateChangedSetAsNumber]):
(-[WKDateTimePicker _dateChangedSetAsString]):
(-[WKDateTimePicker setDateTimePickerToInitialValue]):
(-[WKDateTimePicker controlView]):
Updated this method to return nil, matching other form controls that
do not present a keyboard input view (example: <select>).
(-[WKDateTimePicker controlBeginEditing]):
(-[WKDateTimePicker controlEndEditing]):
(-[WKDateTimePicker calendarType]):
(-[WKDateTimePicker hour]):
(-[WKDateTimePicker minute]):
(-[WKDateTimePicker setHour:minute:]):
2021-04-20 Keith Miller <keith_miller@apple.com>
FullGCActivityCallback should use the percentage of pages uncompressed in RAM to determine deferral.
https://bugs.webkit.org/show_bug.cgi?id=224817
Reviewed by Filip Pizlo.
Add mincore to the acceptable syscall list.
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-20 Jiewen Tan <jiewen_tan@apple.com>
Platform Key registration does not prompt for user password when in biometric lockout
https://bugs.webkit.org/show_bug.cgi?id=224828
<rdar://76907840>
Reviewed by Brent Fulgham.
Covered by manul tests.
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
2021-04-20 Don Olmstead <don.olmstead@sony.com>
[CMake] Don't use FORWARDING_HEADERS_DIR for JSC GLib headers
https://bugs.webkit.org/show_bug.cgi?id=224821
Reviewed by Michael Catanzaro.
Use JavaScriptCoreGLib_FRAMEWORK_HEADERS_DIR and JavaScriptCoreGLib_DERIVED_SOURCES_DIR
for GLib JSC headers instead of FORWARDING_HEADERS_DIR and DERIVED_SOURCES_DIR.
* PlatformGTK.cmake:
2021-04-20 Brent Fulgham <bfulgham@apple.com>
[macOS] Add additional logging to help identify SSO dialog dismissals
https://bugs.webkit.org/show_bug.cgi?id=224703
<rdar://problem/76783787>
Reviewed by Maciej Stachowiak.
Add logging around the SSO sheet life cycle to help identify edge cases..."
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::presentViewController):
(WebKit::SOAuthorizationSession::dismissViewController):
2021-04-20 Wenson Hsieh <wenson_hsieh@apple.com>
[Mac Catalyst] Adopt UIView API to avoid showing focus rings around WKContentView
https://bugs.webkit.org/show_bug.cgi?id=224819
Reviewed by Tim Horton.
Replace our usage of the deprecated `-[UIView _setFocusRingType:]` method with API on `UIView` that achieves
the same effect.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
2021-04-20 Alex Christensen <achristensen@webkit.org>
Fix use-after-move introduced in r275407
https://bugs.webkit.org/show_bug.cgi?id=224045
Reviewed by Darin Adler.
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
2021-04-20 Marco Felsch <m.felsch@pengutronix.de>
[WPE] QML WPEView dynamic loading fails
https://bugs.webkit.org/show_bug.cgi?id=224814
Reviewed by Philippe Normand.
The scene graph can be initialized when we receive window handle change
notification and so we will not receive a scenegraph initialization
notification. In such case we need to initzialize it ourself.
No new tests. Testing can be done if the WPEView is moved to a
QML component which gets loaded later on demand.
* UIProcess/API/wpe/qt/WPEQtView.cpp:
(WPEQtView::configureWindow):
2021-04-20 Marco Felsch <m.felsch@pengutronix.de>
[WPE][Qt] Fix build failure after r270690
https://bugs.webkit.org/show_bug.cgi?id=223070
Reviewed by Philippe Normand.
WPE fails to build with `-DENABLE_WPE_QT_API=ON` after adapting the
visibility for linked frameworks done by r270690.
The reason for that is that the visibility is now more strict and we
have to add the WTF dependecy or drop the WTF fast-allocate mechanism.
Adding the WTF dependency is a bit odd since this would staticly link
the WTF lib into a small wrapper lib. Also this lib has nothing to do
with Webkit at all. It is just a QT adaption library.
No new tests, it can be build again.
* UIProcess/API/wpe/qt/WPEQtView.cpp:
(WPEQtView::notifyLoadChangedCallback):
(WPEQtView::notifyLoadFailedCallback):
(WPEQtView::runJavaScript):
* UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:
(WPEQtViewBackend::create):
* UIProcess/API/wpe/qt/WPEQtViewBackend.h:
* UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h:
Drop WTF usage and use system allocator since the lib has nothing to do
with Webkit at all.
2021-04-20 Basuke Suzuki <basuke.suzuki@sony.com>
Remove UNUSED warnings based on the configuration.
https://bugs.webkit.org/show_bug.cgi?id=224787
Reviewed by Darin Adler.
Added UNUSED_VARIABLE or its variant to suppress warnings based on the configuration.
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::prepareToSuspend):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestStorageSpace):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::pageIDFromWebFrame):
(WebKit::frameIDFromWebFrame):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::prepareToSuspend):
2021-04-20 Chris Dumez <cdumez@apple.com>
Make sure we don't exit the GPUProcess too frequently while under memory pressure
https://bugs.webkit.org/show_bug.cgi?id=224798
Reviewed by Darin Adler.
We've recently started to exit the GPUProcess if idle and under memory pressure, in order
to save memory. This is great but we wouldn't want to repeatedly exit and relaunch the
GPUProcess while under memory pressure either. To address this, I am adding a condition to
GPUProcess::canExitUnderMemoryPressure() to make sure we don't exit the GPUProcess if it's
been running for less than 5 seconds.
To avoid generating flakiness in our benchmarks and API tests, I am disabling this condition
if the memory pressure is simulated (via `notifyutil -p org.WebKit.lowMemory`).
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::canExitUnderMemoryPressure const):
* GPUProcess/GPUProcess.h:
2021-04-20 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r276271.
It did not fix the Canvas-Arcs subtest on the bots
Reverted changeset:
"MotionMark's Canvas-Arcs subtest is broken if the GPUProcess
is not yet running"
https://bugs.webkit.org/show_bug.cgi?id=224778
https://commits.webkit.org/r276271
2021-04-19 Darin Adler <darin@apple.com>
Refactor sorted array mapping machinery in LocaleToScriptMapping.cpp for reuse elsewhere
https://bugs.webkit.org/show_bug.cgi?id=224733
Reviewed by Yusuke Suzuki.
* NetworkProcess/PrivateClickMeasurementManager.h: Removed unused include of HashMap.h.
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: Ditto.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::createSelectorExceptionMap): Deleted.
(WebKit::commandNameForSelectorName): Use SortedArrayMap instead of HashMap.
2021-04-20 Kimmo Kinnunen <kkinnunen@apple.com>
WebGL GPU Process implementation should use thread safety annotations
https://bugs.webkit.org/show_bug.cgi?id=224752
Reviewed by Kenneth Russell.
Make WebGL GPU process implementation use thread safety analysis.
Mark up the guarded variables in IPC Stream implementation using
clang thread safety analysis annotations.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintImageDataToImageBuffer):
* Platform/IPC/StreamConnectionWorkQueue.cpp:
(IPC::StreamConnectionWorkQueue::dispatch):
(IPC::StreamConnectionWorkQueue::addStreamConnection):
(IPC::StreamConnectionWorkQueue::removeStreamConnection):
(IPC::StreamConnectionWorkQueue::processStreams):
* Platform/IPC/StreamConnectionWorkQueue.h:
* Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnectionBase::enqueueMessage):
* Platform/IPC/StreamServerConnection.h:
(IPC::StreamServerConnection<Receiver>::startReceivingMessages):
(IPC::StreamServerConnection<Receiver>::stopReceivingMessages):
(IPC::StreamServerConnection<Receiver>::dispatchStreamMessages):
(IPC::StreamServerConnection<Receiver>::dispatchOutOfStreamMessage):
2021-04-20 Kimmo Kinnunen <kkinnunen@apple.com>
REGRESSION(r224516): Remote WebGL Context is not create due to RemoteRenderingBackend not being created
https://bugs.webkit.org/show_bug.cgi?id=224751
Reviewed by Chris Dumez.
Fix WebGL GPU process after r275922.
RemoteRenderingBackend must be created so that RemoteGraphicsContextGL
can take a reference of it.
Fixes layout test failures when run with --gpu-process.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureBackendCreated):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createGraphicsContextGL const):
2021-04-19 Chris Dumez <cdumez@apple.com>
REGRESSION (r276189): GPUProcess.WebProcessTerminationAfterTooManyGPUProcessCrashes is crashing
https://bugs.webkit.org/show_bug.cgi?id=224790
<rdar://problem/76869318>
Reviewed by Darin Adler.
GPUProcess.WebProcessTerminationAfterTooManyGPUProcessCrashes is intentionally repeatedly
killing the GPUProcess. As a result, the GPUProcess may get killed very shortly after
a relaunch and the RemoteAudioDestinationManager::StartAudioDestination synchronous IPC
may fail if it is ongoing at the time of the crash. This would cause m_destinationID to
not get initialized and then get sent as IPC parameter, thus crashing.
pre-r276189, we were not crashing because m_destinationID was not reset on crash and we
would thus send IPC for a destination that does not exist but at least the destinationID
would not be 0. This patch makes sure we don't try and send IPC at all when m_destinationID
is 0.
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::connection):
(WebKit::RemoteAudioDestinationProxy::startRendering):
(WebKit::RemoteAudioDestinationProxy::stopRendering):
(WebKit::RemoteAudioDestinationProxy::storageChanged):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
2021-04-19 Jer Noble <jer.noble@apple.com>
[iOS] Media playback continues after backgrounding hosting application
https://bugs.webkit.org/show_bug.cgi?id=224776
<rdar://75707807>
Reviewed by Eric Carlson.
Tested by existing API test: WKWebViewPausePlayingAudioTests.OutOfWindow
When the MediaSessionHelperIOS was moved into the GPU process, no object remains listening for the
UIApplication{Will,Did}Enter{Foreground,Background}Notification rebroadcasted by WebPageIOS.
Rather than just rebroadcast the UIKit notification to all listeners within the WebContent process,
which may or may not be listening, just tell the current PlatformMediaSessionManager directly.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::applicationWillResignActive):
(WebKit::WebPage::applicationDidEnterBackground):
(WebKit::WebPage::applicationWillEnterForeground):
(WebKit::WebPage::applicationDidBecomeActive):
2021-04-19 Chris Dumez <cdumez@apple.com>
MotionMark's Canvas-Arcs subtest is broken if the GPUProcess is not yet running
https://bugs.webkit.org/show_bug.cgi?id=224778
Reviewed by Simon Fraser.
I recently made changes so that the GPUProcess is only launched when it is needed. This means
that until MotionMark's Canvas-Arcs subtest, the GPUProcess is usually not yet running. As a
result, RemoteRenderingBackendProxy::createImageBuffer() ends up launching the GPUProcess
and sending the GPUConnectionToWebProcess::CreateRenderingBackend and
RemoteRenderingBackend::CreateImageBuffer IPC right away. We seem to have a synchronization
issue because when this happens, the rendering for the Canvas-Arcs subtest is visibly broken
and its score is very low (< 6, instead of > 600).
Making the GPUConnectionToWebProcess::CreateRenderingBackend synchronous again (I made it
async recently) seems to address the synchronization issue and restores correct behavior on
MotionMark. I am therefore making this IPC synchronous again in this patch to get benchmark
coverage again while I investigate the root cause offline.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createRenderingBackend):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
2021-04-19 Chris Dumez <cdumez@apple.com>
Fix races in LibWebRTCCodecs introduced in r276214
https://bugs.webkit.org/show_bug.cgi?id=224758
Reviewed by Youenn Fablet.
After r276214, LibWebRTCCodecs's createDecoder() / createEncoder() may hop to the main
thread to initialize the connection to the GPUProcess. If releaseDecoder() / releaseEncoder()
were to get called very shortly after, they may win the race and have no decoder / encoder
to release, since they are dispatched directly to the background thread. To address the issue,
we now call ensureGPUProcessConnectionAndDispatchToThread() in releaseDecoder(), releaseEncoder()
and initializeEncoder().
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::releaseDecoder):
(WebKit::LibWebRTCCodecs::releaseEncoder):
(WebKit::LibWebRTCCodecs::initializeEncoder):
2021-04-19 Chris Dumez <cdumez@apple.com>
Add more GPUProcess release logging to facilitate debugging
https://bugs.webkit.org/show_bug.cgi?id=224761
Reviewed by Darin Adler.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::GPUProcess):
(WebKit::GPUProcess::createGPUConnectionToWebProcess):
(WebKit::GPUProcess::removeGPUConnectionToWebProcess):
(WebKit::GPUProcess::initializeGPUProcess):
2021-04-19 Kimmo Kinnunen <kkinnunen@apple.com>
Enable -Wthread-safety, add attributes to custom lock classes, and provide macros to declare guards
https://bugs.webkit.org/show_bug.cgi?id=221614
<rdar://problem/74396781>
Reviewed by David Kilzer.
Add -Wthread-safety to compile flags.
* Configurations/Base.xcconfig:
2021-04-18 Chris Dumez <cdumez@apple.com>
Update LibWebRTCCodecsProxy to use a Lock
https://bugs.webkit.org/show_bug.cgi?id=224728
Reviewed by Darin Adler.
Update LibWebRTCCodecsProxy to use a Lock, instead of a std::atomic<bool> that
has to be kept up to date. I think this simplifies the code a bit. Adding / Removing
encoder / decoder is not very hot code as far as I know and there will very rarely
be contention since allowsExitUnderMemoryPressure() is only called on memory pressure.
m_encoder / m_decoder are still always modified from the background thread. However, we
now check from the main thread if they are empty by locking.
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::close):
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::releaseDecoder):
(WebKit::LibWebRTCCodecsProxy::decodeFrame):
(WebKit::LibWebRTCCodecsProxy::setFrameSize):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
(WebKit::LibWebRTCCodecsProxy::releaseEncoder):
(WebKit::LibWebRTCCodecsProxy::initializeEncoder):
(WebKit::LibWebRTCCodecsProxy::encodeFrame):
(WebKit::LibWebRTCCodecsProxy::setEncodeRates):
(WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
(WebKit::LibWebRTCCodecsProxy::updateHasEncodersOrDecoders): Deleted.
2021-04-17 Chris Dumez <cdumez@apple.com>
GPUConnectionToWebProcess::allowsExitUnderMemoryPressure() should check if libWebRTCCodecsProxy is used
https://bugs.webkit.org/show_bug.cgi?id=224709
Reviewed by Darin Adler.
If the libWebRTCCodecsProxy has either encoders or decoders then the GPUProcess should not
exit under memory pressure, since it is not idle.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::allowsExitUnderMemoryPressure const):
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::releaseDecoder):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
(WebKit::LibWebRTCCodecsProxy::releaseEncoder):
(WebKit::LibWebRTCCodecsProxy::updateHasEncodersOrDecoders):
(WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
Use a std::atomic<bool> to determine if the LibWebRTCCodecsProxy has encoders/decoders since
allowsExitUnderMemoryPressure() gets called on the main thread but m_encoders / m_decoders
get updated on a background thread.
2021-04-17 Kimmo Kinnunen <kkinnunen@apple.com>
Unhandled IPC messages should use correct format with the decoder.destinationID() ASSERT message
https://bugs.webkit.org/show_bug.cgi?id=224335
Reviewed by Antti Koivisto.
Use PRIu64 instead of llu in the ASSERT messages for printing unhandled message destination.
uint64_t is printf'ed with PRIu64.
* Scripts/webkit/messages.py:
(generate_message_handler):
* Scripts/webkit/tests/TestWithIfMessageMessageReceiver.cpp:
(WebKit::TestWithIfMessage::didReceiveMessage):
* Scripts/webkit/tests/TestWithImageDataMessageReceiver.cpp:
(WebKit::TestWithImageData::didReceiveMessage):
(WebKit::TestWithImageData::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp:
(WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage):
(WebKit::TestWithLegacyReceiver::didReceiveSyncTestWithLegacyReceiverMessage):
* Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp:
(WebKit::TestWithSemaphore::didReceiveMessage):
(WebKit::TestWithSemaphore::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithStreamBufferMessageReceiver.cpp:
(WebKit::TestWithStreamBuffer::didReceiveMessage):
* Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp:
(WebKit::TestWithStream::didReceiveStreamMessage):
* Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp:
(WebKit::TestWithSuperclass::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
(WebKit::TestWithoutAttributes::didReceiveSyncMessage):
2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Add some support for webpage translation in WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=224683
<rdar://problem/75641882>
Reviewed by Darin Adler.
Remove some more compile-time guards, now that the WebCore enum is not conditional on `ENABLE(APP_HIGHLIGHT)`.
See WebCore/ChangeLog for more information.
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::menuItemIdentifier):
2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com>
Remove PromisedAttachmentInfo::blobURL and adjacent code
https://bugs.webkit.org/show_bug.cgi?id=224720
Reviewed by Ryosuke Niwa.
The `blobURL` member of `PromisedAttachmentInfo` was originally introduced to facilitate drag and drop support
for attachment elements in WebKit2, by writing blob URL data to temporary file paths on behalf of
`NSFilePromiseProvider` when starting a drag on attachment elements backed by blobs. However, this was
superceded by use of `NSFileWrapper` and the `_WKAttachment` SPI instead, such that we only support dragging
attachment elements if they correspond to API `Attachment` objects in the UI process. This means we can remove
this `blobURL`, along with the file name and content type members of the struct (which were only added to
support the ability to drag blob-backed attachments).
Code that utilized this member was originally introduced in <https://trac.webkit.org/r235202>, and was
subsequently removed in <https://trac.webkit.org/r240687>.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PromisedAttachmentInfo>::encode):
(IPC::ArgumentCoder<PromisedAttachmentInfo>::decode):
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKPromisedAttachmentContext initWithIdentifier:fileName:]):
(WebKit::WebViewImpl::writeToURLForFilePromiseProvider):
(WebKit::WebViewImpl::startDrag):
(-[WKPromisedAttachmentContext initWithIdentifier:blobURL:fileName:]): Deleted.
(-[WKPromisedAttachmentContext blobURL]): Deleted.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _prepareToDragPromisedAttachment:]):
2021-04-17 Chris Dumez <cdumez@apple.com>
Use WebProcess::existingGPUProcessConnection() whenever possible
https://bugs.webkit.org/show_bug.cgi?id=224725
Reviewed by Darin Adler.
Use WebProcess::existingGPUProcessConnection() whenever possible, instead of WebProcess::ensureGPUProcessConnection().
This avoids relaunching the GPUProcess if it has already exited.
* WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:
(WebKit::RemoteAudioHardwareListener::~RemoteAudioHardwareListener):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
(WebKit::AudioMediaStreamTrackRenderer::~AudioMediaStreamTrackRenderer):
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
(WebKit::RemoteRealtimeAudioSource::~RemoteRealtimeAudioSource):
* WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::~RemoteRealtimeVideoSource):
2021-04-17 Chris Dumez <cdumez@apple.com>
LibWebRTCCodecs eagerly launches the GPUProcess and always relaunches it on exit
https://bugs.webkit.org/show_bug.cgi?id=224704
Reviewed by Darin Adler.
LibWebRTCCodecs eagerly launches the GPUProcess and always relaunches it on exit. The GPUProcess
should only be (re-)launched when needed. In the case of the LibWebRTCCodecs, it seems it only
needs a GPUProcess connection if it has m_decoders / m_encoders are non-empty.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThread):
Renamed startListeningForIPC() to ensureGPUProcessConnectionOnMainThread(). Only do the
connection initialization if m_connection is not null.
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionAndDispatchToThread):
Version of dispatchToThread() which makes sure that the GPUProcessConnection is initialized
before dispatching. It is used when constructing a decoder / encoder. It sets the
m_needsGPUProcessConnection flag to true to indicate someone needed the connection
(and that we should re-initiate it in case it is severed). If the connection is already
initialized, then it does a simple dispatchToThread(). If the connection is not initialized
yet, then we have to hop to the main thread (if not already on it) to initialize the
GPUProcessConnection.
(WebKit::LibWebRTCCodecs::gpuProcessConnectionMayNoLongerBeNeeded):
Function that gets called on the background thread every time a encoder / decoder is
removed. Its purpose is to set m_needsGPUProcessConnection back to false once we no
longer have any encoder / decoder, so that gpuProcessConnectionDidClose() does not
attempt to relaunch the GPUProcess if it goes away.
LibWebRTCCodecs::setCallbacks():
Check if VP9Support is enabled via PlatformMediaSessionManager instead of from the
GPUProcessConnection. This avoids eagerly launching the GPUProcess. The
GPUProcessConnection constructor gets its VPx support information from
PlatformMediaSessionManager anyway. The WebPage constructor is where the VPx support
information comes from and it updates the VPx flags on the PlatformMediaSessionManager.
The WebPage constructor only updates the VPx flags on the GPUProcessConnection if this
connection already exists to avoid eagerly launching the GPUProcess.
(WebKit::LibWebRTCCodecs::createDecoder):
- Call ensureGPUProcessConnectionAndDispatchToThread() instead of dispatchToThread()
to make sure we have a GPUProcessConnection before creating the decoder.
- Add a missing locker for m_connectionLock on the background thread since it is using
m_connection (pre-existing bug).
(WebKit::LibWebRTCCodecs::releaseDecoder):
Call gpuProcessConnectionMayNoLongerBeNeeded() to reset the m_needsGPUProcessConnection
flag to false if necessary.
(WebKit::LibWebRTCCodecs::createEncoder):
- Call ensureGPUProcessConnectionAndDispatchToThread() instead of dispatchToThread()
to make sure we have a GPUProcessConnection before creating the encoder.
(WebKit::LibWebRTCCodecs::releaseEncoder):
Call gpuProcessConnectionMayNoLongerBeNeeded() to reset the m_needsGPUProcessConnection
flag to false if necessary.
(WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose):
- Clear m_connection when the GPUProcess connection is severed (note that this does not
necessarily indicate a crash since the GPUProcess exits when idle and under memory
pressure).
- Only re-initiate the GPUProcess connection if m_needsGPUProcessConnection is true,
meaning that we have encoders/decoders. I use this flag instead of checking m_encoders
& m_decoders since those containers are modified on the background thread and this
function is called on the main thread.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
(WebKit::LibWebRTCCodecs::create):
- Stop calling startListeningForIPC() on construction as we don't want to launch the GPUProcess
until an encoder / decoder is created.
- Fix a pre-existing issue where the class subclasses ThreadSafeRefCounted (via
ThreadMessageReceiverRefCounted) and yet was using std::unique_ptr<> instead of
RefPtr<>.
* WebProcess/WebProcess.h:
2021-04-17 Chris Dumez <cdumez@apple.com>
RemoteImageDecoderAVFManager should never re-launch the GPUProcess on destruction
https://bugs.webkit.org/show_bug.cgi?id=224723
Reviewed by Darin Adler.
RemoteImageDecoderAVFManager was calling ensureGPUProcessConnection() it is destructor,
just to remove itself as an IPC message receiver. This means it could unnecessarily
relaunch the GPUProcess. This patch addresses that.
This patch also makes it so that RemoteImageDecoderAVFManager registers itself as a
client of the GPUProcessConnection, so that it gets notified when the connection gets
severed. Right now, I only do very basic crash handling but this paves the way to do
better in the future. I did fix a bug where the RemoteImageDecoderAVFManager would
not re-register itself as a message receiver after a GPUProcess re-launch.
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::RemoteImageDecoderAVF):
* WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp:
(WebKit::RemoteImageDecoderAVFManager::createImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::deleteRemoteImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::~RemoteImageDecoderAVFManager):
(WebKit::RemoteImageDecoderAVFManager::gpuProcessConnectionDidClose):
(WebKit::RemoteImageDecoderAVFManager::ensureGPUProcessConnection):
(WebKit::RemoteImageDecoderAVFManager::gpuProcessConnection const): Deleted.
* WebProcess/GPU/media/RemoteImageDecoderAVFManager.h:
2021-04-17 Tyler Wilcock <twilco.o@protonmail.com>
Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules().
https://bugs.webkit.org/show_bug.cgi?id=197725
Reviewed by Darin Adler.
CSSStyleSheet.rules has been changed to alias CSSStyleSheet.cssRulesForBindings. Now,
to access just the CSSRuleList, CSSStyleSheet.cssRules must be called.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
(webkit_dom_css_style_sheet_get_rules):
Use CSSStyleSheet.cssRules instead of CSSStyleSheet.rules (deleted
with this patch) to get access to the CSSRuleList of this
stylesheet.
2021-04-17 Sam Weinig <weinig@apple.com>
Move RuntimeEnabledFeatures to Settings (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=224440
Reviewed by Alex Christensen.
Move a few RuntimeEnabledFeatures to Settings to consolidate settings
in one object and removes the need for additional boilerplate. This
is now possible as Settings are now accessible in workers.
Moves PeerConnectionEnabled, WebGLUsingMetal, WebGL2Enabled, WebGPUEnabled
and MaskWebGLStringsEnabled.
* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI):
* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::enableFrontendFeatures):
(WebKit::WebInspectorUI::WebInspectorUI):
* WebProcess/Inspector/WebInspectorUI.h:
2021-04-16 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in Editor
https://bugs.webkit.org/show_bug.cgi?id=224708
Reviewed by Wenson Hsieh.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestAutocorrectionData):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::fontAtSelection):
2021-04-16 Chris Dumez <cdumez@apple.com>
RemoteAudioDestinationProxy should not launch / relaunch the GPUProcess unless it is actually rendering
https://bugs.webkit.org/show_bug.cgi?id=224691
Reviewed by Geoffrey Garen.
RemoteAudioDestinationProxy was initiating a connection to the GPUProcess in its constructor and
re-initiating the connection right away upon GPUProcess crash. This goes against our recent efforts
to run the GPUProcess only when it is actually needed. The RemoteAudioDestinationProxy really only
needs the GPUProcess when it is actually rendering / playing.
* GPUProcess/media/RemoteAudioDestinationManager.cpp:
(WebKit::RemoteAudioDestinationManager::allowsExitUnderMemoryPressure const):
Allow the GPUProcess to exit when under memory pressure even if it has AudioDestinations, as long
as they are not playing.
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy):
(WebKit::RemoteAudioDestinationProxy::ensureGPUProcessConnection):
(WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy):
(WebKit::RemoteAudioDestinationProxy::startRendering):
(WebKit::RemoteAudioDestinationProxy::stopRendering):
(WebKit::RemoteAudioDestinationProxy::storageChanged):
(WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
2021-04-16 Chris Dumez <cdumez@apple.com>
[GPUProcess] Crash under RemoteAudioDestination::render()
https://bugs.webkit.org/show_bug.cgi?id=224688
<rdar://76643365>
Reviewed by Eric Carlson.
When the connection between the GPUProcess and the WebProcess was severed,
GPUConnectionToWebProcess::didClose() would get called and end up destroying
the RemoteAudioDestination object on the main thread. The issue is that the
RemoteAudioDestination may be playing at the time and we would end up
destroying the RemoteAudioDestination object without stopping rendering
first. As a result, we would crash on the background thread in the
RemoteAudioDestination::render() function, trying to use the m_ringBuffer
data member that got destroyed on the main thread.
To address this, I updated the RemoteAudioDestination destructor so that it
stops rendering if necessary. AudioOutputUnitStop() is synchronous so this
ensures render() is done running on the background thread (and won't be
called again) before proceeding with the destruction of the data members.
Test: webaudio/AudioContext/audiocontext-destruction-crash.html
* GPUProcess/media/RemoteAudioDestinationManager.cpp:
Updated the class to stop subclassing ThreadSafeRefCounted. This class does
not need RefCounting at all. I updated the call site to use UniqueRef<>.
(WebKit::RemoteAudioDestination::create): Deleted.
Drop this factory function and made the constructor public now that we no longer
subclass ThreadSafeRefCounted and use makeUniqueRef<>() at the call site.
(WebKit::RemoteAudioDestination::scheduleGracefulShutdownIfNeeded): Deleted.
Stop this function now that the destructor takes care of shutting down gracefully.
(WebKit::RemoteAudioDestination::RemoteAudioDestination):
Made the constructor public.
(WebKit::RemoteAudioDestination::render):
- Stop checking m_protectThisDuringGracefulShutdown on the background thread. This data
member is not needed since stop() is synchronous. It was also not thread-safe since
m_protectThisDuringGracefulShutdown was set on the main thread and we are on the
audio thread here.
- Similarly, drop the check for m_isPlaying. m_isPlaying is not atomic so the check
was not thread safe. Even if m_isPlaying was atomic, m_isPlaying get set to true
*after* calling m_audioOutputUnitAdaptor.start() so render() may early return
even though we were playing. Also, this check is not needed since we set
m_isPlaying to false after calling m_audioOutputUnitAdaptor.stop() and the stop()
call is synchronous and should not return until the audio thread stopped rendering.
* GPUProcess/media/RemoteAudioDestinationManager.h:
2021-04-16 Chris Dumez <cdumez@apple.com>
The RemoteRemoteCommandListener destructor should never (re-)launch the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=224701
Reviewed by Eric Carlson.
The RemoteRemoteCommandListener destructor should never (re-)launch the GPUProcess,
just to unregister itself. If the GPUProcess is not running, then the
RemoteRemoteCommandListener is not registered.
* WebProcess/GPU/media/RemoteRemoteCommandListener.cpp:
(WebKit::RemoteRemoteCommandListener::~RemoteRemoteCommandListener):
(WebKit::RemoteRemoteCommandListener::gpuProcessConnectionDidClose):
2021-04-16 Jiewen Tan <jiewen_tan@apple.com>
Pass credential name to the WebAuthn UI during registration
https://bugs.webkit.org/show_bug.cgi?id=224697
<rdar://75803352>
Reviewed by Brent Fulgham.
Covered by new test contents within existing test files.
* Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
Paperwork for the new SPI.
* UIProcess/API/APIWebAuthenticationPanel.cpp:
(API::WebAuthenticationPanel::create):
(API::WebAuthenticationPanel::WebAuthenticationPanel):
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel userName]):
Adds a new userName property.
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::getUserName):
(WebKit::AuthenticatorManager::runPanel):
(WebKit::AuthenticatorManager::runPresenter):
Passes the userName to the UI.
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm:
Paperwork for the new SPI.
* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm:
(WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator):
Passes the userName to the new SPI.
2021-04-16 Cameron McCormack <heycam@apple.com>
Place vertical scrollbars at (inline/block)-end edge in all writing modes.
https://bugs.webkit.org/show_bug.cgi?id=224224
Reviewed by Simon Fraser.
* UIProcess/win/WebPopupMenuProxyWin.h:
* WebProcess/Plugins/PDF/PDFPlugin.h:
2021-04-16 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Refactor some webpage translation code
https://bugs.webkit.org/show_bug.cgi?id=224680
Work towards <rdar://75641882>
Reviewed by Tim Horton.
See WebCore ChangeLog for more details.
* Shared/ContextMenuContextData.cpp:
(WebKit::ContextMenuContextData::ContextMenuContextData):
(WebKit::ContextMenuContextData::encode const):
(WebKit::ContextMenuContextData::decode):
* Shared/ContextMenuContextData.h:
Remove `selectionBounds`. We don't need this anymore, because we'll instead compute the selection bounds only
when the Translate menu item is selected, instead of relying on `m_activeContextMenuContextData` being up to
date.
(WebKit::ContextMenuContextData::selectedText const):
(WebKit::ContextMenuContextData::selectionBounds const): Deleted.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuTranslation):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebContextMenuClient.h:
* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::handleTranslation):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::handleContextMenuTranslation):
* WebProcess/WebPage/WebPage.h:
2021-04-16 Jiewen Tan <jiewen_tan@apple.com>
Allow using the platform authenticator on non-Touch ID Macs according to Internal requirements
https://bugs.webkit.org/show_bug.cgi?id=224639
<rdar://74698346>
Reviewed by Daniel Bates.
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
(WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
(WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
Don't set the UserVerification bit if UserVerification is not done.
* UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
Only check UserPresence on non-Touch ID Macs.
* UIProcess/WebAuthentication/Cocoa/LocalService.mm:
(WebKit::LocalService::isAvailable):
Make the platform authenticator available according to Internal requirements.
* UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
(WebKit::MockLocalConnection::verifyUser):
Mock testing support.
* UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:
(WebKit::getUserVerificationRequirement):
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
Add a helper for extracting the UserVerification input.
2021-04-16 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=224469
Reviewed by Eric Carlson.
* Scripts/webkit/messages.py: Fix clean build failures on the WinCairo port.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
(WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::encode):
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::mediaRelatedIOKitClasses):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
(WebKit::WebPageProxy::setPlaybackTarget):
(WebKit::temporaryMachServices): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setMockMediaPlaybackTargetPickerState):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::playbackTargetSelected const):
2021-04-16 Alex Christensen <achristensen@webkit.org>
Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629
Reviewed by Brady Eidson.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultOfflineWebApplicationCacheEnabled):
* Shared/WebPreferencesDefaultValues.h:
2021-04-16 Ada Chan <ada.chan@apple.com>
Add WKUIDelegate SPI for starting XR session
https://bugs.webkit.org/show_bug.cgi?id=224634
Reviewed by Tim Horton.
* UIProcess/API/APIUIClient.h:
(API::UIClient::startXRSession):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::startXRSession):
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r275839.
The new release assertion is hitting to easily in client apps
Reverted changeset:
"Make sure AuxiliaryProcessProxy::sendMessage() is called on
the main thread"
https://bugs.webkit.org/show_bug.cgi?id=224448
https://commits.webkit.org/r275839
2021-04-16 Chris Dumez <cdumez@apple.com>
Exit the GPUProcess when under memory pressure if it is not being used
https://bugs.webkit.org/show_bug.cgi?id=224556
Reviewed by Darin Adler.
Exit the GPUProcess when under memory pressure if it is not being used. This will
help us save memory, especially until we are able to enable "DOM Rendering in
GPUProcess".
Note that when the GPUProcess is ready to exit, it sends an IPC to the UIProcess
in order to get terminated, instead of terminating itself. The reason I do this is
so that the UIProcess can distinguish a GPUProcess crash from a normal idle exit.
A/B testing shows:
- 5-8% PLUM3 progression on iPhone
- 2.5-4% PLUM3 progression on iPad
- No PLT5 regression on either iPhone or iPad.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
(WebKit::GPUConnectionToWebProcess::allowsExitUnderMemoryPressure const):
(WebKit::GPUConnectionToWebProcess::releaseRenderingBackend):
(WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGL):
* GPUProcess/GPUConnectionToWebProcess.h:
(WebKit::GPUConnectionToWebProcess::remoteMediaPlayerManagerProxy):
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::removeGPUConnectionToWebProcess):
(WebKit::GPUProcess::canExitUnderMemoryPressure const):
(WebKit::GPUProcess::tryExitIfUnusedAndUnderMemoryPressure):
(WebKit::GPUProcess::tryExitIfUnused):
(WebKit::GPUProcess::lowMemoryHandler):
* GPUProcess/GPUProcess.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::allowsExitUnderMemoryPressure const):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/media/RemoteAudioDestinationManager.cpp:
(WebKit::RemoteAudioDestinationManager::deleteAudioDestination):
(WebKit::RemoteAudioDestinationManager::allowsExitUnderMemoryPressure const):
* GPUProcess/media/RemoteAudioDestinationManager.h:
* GPUProcess/media/RemoteCDMFactoryProxy.cpp:
(WebKit::RemoteCDMFactoryProxy::removeInstance):
(WebKit::RemoteCDMFactoryProxy::allowsExitUnderMemoryPressure const):
* GPUProcess/media/RemoteCDMFactoryProxy.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::deleteDecoder):
(WebKit::RemoteImageDecoderAVFProxy::allowsExitUnderMemoryPressure const):
* GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp:
(WebKit::RemoteLegacyCDMFactoryProxy::removeSession):
(WebKit::RemoteLegacyCDMFactoryProxy::allowsExitUnderMemoryPressure const):
* GPUProcess/media/RemoteLegacyCDMFactoryProxy.h:
* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer):
(WebKit::RemoteMediaPlayerManagerProxy::allowsExitUnderMemoryPressure const):
* GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp:
(WebKit::RemoteAudioMediaStreamTrackRendererManager::allowsExitUnderMemoryPressure const):
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h:
* GPUProcess/webrtc/RemoteMediaRecorderManager.cpp:
(WebKit::RemoteMediaRecorderManager::releaseRecorder):
(WebKit::RemoteMediaRecorderManager::allowsExitUnderMemoryPressure const):
* GPUProcess/webrtc/RemoteMediaRecorderManager.h:
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
(WebKit::RemoteSampleBufferDisplayLayerManager::allowsExitUnderMemoryPressure const):
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
* Shared/ProcessTerminationReason.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::hasSourceProxies const):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::gpuProcessExited):
(WebKit::GPUProcessProxy::processIsReadyToExit):
(WebKit::GPUProcessProxy::didClose):
(WebKit::GPUProcessProxy::didFinishLaunching):
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/GPU/GPUProcessProxy.messages.in:
* UIProcess/PageClient.h:
(WebKit::PageClient::gpuProcessDidExit):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::gpuProcessExited):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::gpuProcessExited):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::gpuProcessExited):
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::gpuProcessDidExit):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _gpuProcessDidExit]):
2021-04-16 Chris Dumez <cdumez@apple.com>
Early IPC messages to a WorkQueueMessageReceiver may get processed out of order
https://bugs.webkit.org/show_bug.cgi?id=224623
Reviewed by Geoffrey Garen.
Bug 224566 exposed an issue where early IPC being sent to WorkQueueMessageReceiver might get received
out of order. The reason behind it is that the WorkQueueMessageReceiver registers itself on the main
thread while we receive the IPC on the IPC thread. When we receive the IPC on the IPC thread, we check
if there is a WorkQueueMessageReceiver for it and if there is, we dispatch the message straight to its
WorkQueue. However, if the WorkQueueMessageReceiver has not registered itself yet on the main thread,
we hop to the main thread first, before dispatching the IPC back to the receiver's WorkQueue. The
extra hop to the main thread means that 2 IPC messages to the WorkQueueMessageReceiver sent one after
the other may get dispatched on the WorkQueue in an inconsistent order, if the WorkQueueMessageReceiver
registers itself as a receiver in between the 2 IPC messages.
We actually were trying to deal with this issue in Connection::addWorkQueueMessageReceiver(). When
the WorkQueueMessageReceiver would register itself on the main thread, we would grab the incomingMessages
lock and check m_incomingMessages for messages that should be dispatched to the WorkQueue. Those are
async messages that should have been dispatched straight to the WorkQueue on the IPC thread but didn't
because the WorkQueueMessageReceiver has not registered itself yet.
However, this logic in Connection::addWorkQueueMessageReceiver() was insufficient because it only checked
m_incomingMessages. m_incomingMessages only contains async messages. Sync messages (and special async
messages with the IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply flag) are stored in
Connection::SyncMessageState::m_messagesToDispatchWhileWaitingForSyncReply. This is what was causing
Bug 224566 since RemoteRenderingBackendProxy's CreateImageBuffer IPC was async with the
DispatchMessageEvenWhenWaitingForSyncReply flag and its GetDataURLForImageBuffer was synchronous. The
ordering of these 2 IPC messages could get reversed and it would cause correctness issues and flaky
crashes.
To address the issue, I updated Connection::addWorkQueueMessageReceiver() to ask the
Connection::SyncMessageState to enqueue its matching messages to the WorkQueue. There was one issue
though because Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection()
was taking messages out of m_messagesToDispatchWhileWaitingForSyncReply and storing them in a local
container and then iterating over this container to dispatch the messages. The dispatching of one
of these messages could cause a WorkQueueMessageReceiver to register itself (call addWorkQueueMessageReceiver()).
When this would happen, addWorkQueueMessageReceiver() would try and enqueue matching messages in
m_messagesToDispatchWhileWaitingForSyncReply and would miss the messages in the local container
that dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection() is currently iterating on.
To address this issue, I introduced a new m_messagesBeingDispatched data member and used that to
store the messages being dispatched instead of the local container. As a result,
addWorkQueueMessageReceiver() can now enqueue the messages in m_messagesBeingDispatched first and
then enqueue the ones in m_messagesToDispatchWhileWaitingForSyncReply.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createRenderingBackend):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
Revert r276007 that was committed as a temporary workaround for this bug.
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::enqueueMatchingMessages):
Add utility function to SyncMessageState to enqueue its matching messages in m_messagesBeingDispatched
and m_messagesToDispatchWhileWaitingForSyncReply to the provided MessageReceiveQueue. This is called
by Connection::addMessageReceiveQueue(). The logic is similar to the one in the
enqueueMatchingMessagesToMessageReceiveQueue() function but works on a Deque<ConnectionAndIncomingMessage>
instead of a Deque<std::unique_ptr<Decoder>>.
(IPC::Connection::SyncMessageState::dispatchMessages):
(IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection):
Use m_messagesBeingDispatched instead of a local container to store the messages we are about to
dispatch. This allows enqueueMatchingMessages() to check those messages to see if they should be
dispatched to a MessageReceiveQueue. We also need to make sure we don't iterate over
m_messagesBeingDispatched to call dispatch() on the messages. This is important because any message
dispatch may cause a WorkQueueMessageReceiver to register itself, which would call
enqueueMatchingMessages() and potentially extract matching messages from m_messagesBeingDispatched.
For this reason, we take messages from m_messagesBeingDispatched one by one, until the container
becomes empty.
(IPC::Connection::addMessageReceiveQueue):
(IPC::Connection::addWorkQueueMessageReceiver):
(IPC::Connection::addThreadMessageReceiver):
- This used to only check m_incomingMessages for matching messages that should be enqueued on the
MessageReceiveQueue in order to preserve IPC ordering. This was insufficient because it would fail
to consider sync IPC messages (or async IPC messages with the
IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply flag). Since those are stored in separate
containers in Connection::SyncMessageState, we now also call
Connection::SyncMessageState::enqueueMatchingMessages() to enqueue those messages and preserve their
ordering too. This fixes IPC ordering bug identified via Bug 224566.
- Avoid some code duplication by moving more logic to a shared enqueueMatchingMessagesToMessageReceiveQueue()
function. The function is no longer templated because I don't think it is worth increasing binary
size just to avoid the virtual enqueueMessage() function call on the MessageReceiverQueue. We do not
register message receivers very often and then only have a few early messages at most to enqueue.
2021-04-16 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Show resource priority and remote IP in the inspector
https://bugs.webkit.org/show_bug.cgi?id=224660
Reviewed by Adrian Perez de Castro.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::toNetworkLoadPriority):
(WebKit::NetworkDataTaskSoup::didGetHeaders):
(WebKit::NetworkDataTaskSoup::networkEvent):
2021-04-16 Youenn Fablet <youenn@apple.com>
Promote WKWebView device orientation permission delegate to API
https://bugs.webkit.org/show_bug.cgi?id=223919
Reviewed by Alex Christensen.
Move corresponding SPI to API.
Introduce WK_API_UNAVAILABLE to make that API not available in certain OSes.
Covered by existing tests.
* Scripts/postprocess-header-rule:
* Shared/API/Cocoa/WKFoundation.h:
* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2021-04-15 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276107.
https://bugs.webkit.org/show_bug.cgi?id=224653
It broke non-Cocoa clean builds
Reverted changeset:
"[GPUP] WebContent process should not create AVOutputContext
instances when media in GPU Process is enabled"
https://bugs.webkit.org/show_bug.cgi?id=224469
https://trac.webkit.org/changeset/276107
2021-04-15 Kate Cheney <katherine_cheney@apple.com>
CrashTracer: com.apple.WebKit.WebContent at com.apple.WebKit: WTF::HashTableConstIterator<WTF::String, WTF::KeyValuePair<...
https://bugs.webkit.org/show_bug.cgi?id=224637
<rdar://problem/76540809>
Reviewed by Alex Christensen.
If the protocol and host of the SecurityOrigin object are empty,
toRawString() could return null. We should add a valid key check here
before doing a hash table lookup.
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::policyForOrigin const):
2021-04-15 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=224469
Reviewed by Eric Carlson.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
(WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::encode):
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::mediaRelatedIOKitClasses):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
(WebKit::WebPageProxy::setPlaybackTarget):
(WebKit::temporaryMachServices): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setMockMediaPlaybackTargetPickerState):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::playbackTargetSelected const):
2021-04-15 Wenson Hsieh <wenson_hsieh@apple.com>
Move the implementation of -[WKWebView themeColor] into the main WKWebView category
https://bugs.webkit.org/show_bug.cgi?id=224628
Reviewed by Tim Horton.
Move the implementation of `-themeColor` out of the private category, and into the main category instead to
silence the warning.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView themeColor]):
2021-04-15 Tim Horton <timothy_horton@apple.com>
Add a mechanism to dump the PlatformCALayer subtree of a GraphicsLayer, for testing
https://bugs.webkit.org/show_bug.cgi?id=224595
Reviewed by Simon Fraser.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
Add a getter for the PlatformCALayer sublayers of PlatformCALayerRemote; see the note on PlatformCALayerCocoa.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::layerTreeAsText const):
Adopt the RenderLayerCompositor version of layerTreeAsText.
2021-04-15 Wenson Hsieh <wenson_hsieh@apple.com>
WKContentView should become focused without requiring -[WKWebView canBecomeFocused] to return YES
https://bugs.webkit.org/show_bug.cgi?id=224613
<rdar://problem/76710314>
Reviewed by Tim Horton.
Make a couple of minor tweaks to `WKContentView`'s implementation of the `UIFocus` protocol methods.
Test: UIFocusTests.ContentViewCanBecomeFocused
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView canBecomeFocused]): Deleted.
Remove the ability for clients to influence `-[WKContentView canBecomeFocused]` by overriding `-[WKWebView
canBecomeFocused]`. Apparently, making `WKWebView` focusable by UIKit in addition to the content view causes the
web view to occasionally take first responder instead of the content view, which then breaks key event handling.
Instead, make it so that `-[WKContentView canBecomeFocused]` still returns `NO` by default, return `YES` for
internal clients that override the private UI delegate method `-_webView:takeFocus:`, and additionally introduce
a new delegate method, `-_webViewCanBecomeFocused:`, so that clients can make `-[WKContentView canBecomeFocused]`
return `NO` even if the delegate responds to `-_webView:takeFocus:`. This is because it doesn't make sense for a
WebKit client to allow UIKit's focus engine to (effectively) descend into web content without a way for the
embedder to handle the case where focus later ascends out of web content (and asks the UI delegate to take
focus).
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView canBecomeFocused]):
(-[WKContentView didUpdateFocusInContext:withAnimationCoordinator:]):
Also, make a minor adjustment here to avoid moving focus to the next or previous focusable element in the case
where focus is being moved _away from_ the content view, by consulting `-[UIFocusUpdateContext nextFocusedView]`.
(-[WKContentView canBecomeFocusedForWebView]): Deleted.
2021-04-15 Brady Eidson <beidson@apple.com>
Move WKURLSchemeTask redirect API to SPI
https://bugs.webkit.org/show_bug.cgi?id=224581
Reviewed by Alex Christensen.
Need to work out some design kinks.
* UIProcess/API/Cocoa/WKURLSchemeTask.h:
* UIProcess/API/Cocoa/WKURLSchemeTask.mm:
(-[WKURLSchemeTaskImpl _willPerformRedirection:newRequest:completionHandler:]):
(-[WKURLSchemeTaskImpl willPerformRedirection:newRequest:completionHandler:]): Deleted.
* UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setURLSchemeHandlerForScheme):
2021-04-15 Simon Fraser <simon.fraser@apple.com>
UI process can assert in DisplayLink::decrementFullSpeedRequestClientCount()
https://bugs.webkit.org/show_bug.cgi?id=224388
Reviewed by Tim Horton.
The start/stop of m_wheelEventActivityHysteresis in WebPageProxy could cross
a process swap boundary, resulting in a decrement getting sent to the new DisplayLink/connection
pair for the new process, which asserted.
Fix by telling the DisplayLink about new processes when we're in an active wheel
event state.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::startNotificationMechanism):
(WebKit::DisplayRefreshMonitorMac::stopNotificationMechanism):
2021-04-15 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Bring back the call to ResourceResponse::setDeprecatedNetworkLoadMetrics after r276008
https://bugs.webkit.org/show_bug.cgi?id=224608
Reviewed by Adrian Perez de Castro.
It turns out it's actually still used by the inspector. I don't want to revert r276008 because it included other
fixes, so it's just fixed in this patch.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::didSendRequest):
(WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
2021-04-15 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Add support for "nextHopProtocol" for Resource Timing
https://bugs.webkit.org/show_bug.cgi?id=168543
Reviewed by Adrian Perez de Castro.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::didGetHeaders): Set NetworkLoadMetrics::protocol.
2021-04-15 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Stop using ResourceResponse::setDeprecatedNetworkLoadMetrics
https://bugs.webkit.org/show_bug.cgi?id=224541
Reviewed by Adrian Perez de Castro.
We are already providing the metrics via didCompleteWithError(). Also make sure we set fetchStart and use it
instead of a member.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::didSendRequest):
(WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
(WebKit::NetworkDataTaskSoup::dispatchDidCompleteWithError):
(WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
(WebKit::NetworkDataTaskSoup::networkEvent):
(WebKit::NetworkDataTaskSoup::didStartRequest):
(WebKit::NetworkDataTaskSoup::didRestart):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
2021-04-15 Chris Dumez <cdumez@apple.com>
REGRESSION(r275921-r275922): [ wk2 ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html is flakey crashing
https://bugs.webkit.org/show_bug.cgi?id=224566
<rdar://problem/76657007>
Reviewed by Tim Horton.
r275921-r275922 changed the timing of when the WebProcess/RemoteRenderingBackendProxy sends the GPUConnectionToWebProcess::CreateRenderingBackend
IPC to the GPUProcess. This IPC used to get sent as soon as the RemoteRenderingBackendProxy was constructed. However, I delayed sending it until
the RemoteRenderingBackendProxy actually needs to create an ImageBuffer to avoid launching the GPUProcess prematurely.
Unfortunately, this exposed a pre-existing synchronization issue with regards to the RemoteRenderingBackend IPC. In particular, the
GPUConnectionToWebProcess::CreateRenderingBackend was getting sent asynchronously and processed by the GPUProcess on the main thread. This would
cause the creation of the RemoteRenderingBackend object on the GPUProcess side, which would then register itself as a WorkQueueMessageReceiver.
The issue is that the WebProcess was sending the RemoteRenderingBackend IPC so quickly after the CreateRenderingBackend IPC that when the IPC is
received (on the IPC thread), the RemoteRenderingBackend has not had a change to register itself as a WorkQueueMessageReceiver yet. As a result,
some of the early IPC was getting dispatched to the main thread and later IPC would get sent to the RemoteRenderingBackend WorkQueue. This was
causing RemoteRenderingBackend to get processed out of order.
To address the synchronization issue for now, I made the GPUConnectionToWebProcess::CreateRenderingBackend synchronous. This may not be the
best design long term but it is an easy and safe way to resolve this for now. It makes sure the WebProcess cannot send RemoteRenderingBackend
IPC until after the GPUProcess has created the RemoteRenderingBackend and the RemoteRenderingBackend object has registered itself as a
WorkQueueMessageReceiver. We probably want to follow-up when we come up with a better design. For now though, I have verified locally that this
fixes the out of order IPC messaging AND the flaky crashes on these canvas tests.
No new tests, unskipped existing tests that are no longer flaky.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createRenderingBackend):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
2021-04-14 Basuke Suzuki <basuke.suzuki@sony.com>
Fix WK_EXPORT macro for declspec compilers
https://bugs.webkit.org/show_bug.cgi?id=224583
Reviewed by Don Olmstead.
It displays warnings when macro is not defined. Actually it is defined only when
it builds WebKit. It should be defined(BUILDING_WebKit).
* Shared/API/c/WKDeclarationSpecifiers.h:
2021-04-14 Jiewen Tan <jiewen_tan@apple.com>
6 http/wpt/webauthn layout-tests are constantly timing out
https://bugs.webkit.org/show_bug.cgi?id=224531
<rdar://76432480>
Reviewed by Brent Fulgham.
Covered by existing tests.
* UIProcess/WebAuthentication/Mock/MockLocalService.mm:
(WebKit::MockLocalService::MockLocalService):
Needs to deal with the mock testing infrastructure according to internal requirements.
2021-04-14 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Make image extraction interactions work for elements inside links
https://bugs.webkit.org/show_bug.cgi?id=224576
<rdar://problem/76664721>
Reviewed by Devin Rousso.
See WebCore ChangeLog for more details.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::elementPositionInformation):
2021-04-14 Devin Rousso <drousso@apple.com>
Promote `-[WKWebView _themeColor]` SPI to API
https://bugs.webkit.org/show_bug.cgi?id=224571
<rdar://problem/75231602>
Reviewed by Geoffrey Garen.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView themeColor]): Added.
(-[WKWebView _themeColor]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::themeColorWillChange):
(WebKit::PageClientImplCocoa::themeColorDidChange):
2021-04-14 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Make image extraction interactions work for elements inside links
https://bugs.webkit.org/show_bug.cgi?id=224517
<rdar://problem/76616431>
Reviewed by Devin Rousso.
See comments below for more details.
Tests: fast/images/image-extraction/click-link-with-image-overlay.html
fast/images/image-extraction/ios/select-word-in-image-overlay-inside-link.html
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
Add `imageElementContext`, an optional element context that exists alongside `elementContext`. This is necessary
in the case where the user is interacting with an image element inside a link element because we need to know
about the inner hit-tested image element for the purposes of image extraction, but the clickable element we use
for the `elementContext` is the link element instead.
* Shared/ios/InteractionInformationRequest.cpp:
(WebKit::InteractionInformationRequest::isValidForRequest const):
Make a slight adjustment here - since `includeImageData` may require image bitmap data in cases where only the
`includeSnapshot` flag is set, it's incorrect to assume that setting `includeSnapshot` fulfills all the needs of
`includeImageData`.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView hasSelectablePositionAtPoint:]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
Consult `imageElementContext` instead of `elementContext`.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::imagePositionInformation):
Set the position information's `imageElementContext`.
(WebKit::elementPositionInformation):
(WebKit::WebPage::positionInformation):
Make a couple of adjustments here: (1) avoid requesting link position information if the hit-tested node is text
inside of an image overlay. (2) If the `includeImageData` request flag is set and the hit-tested node is an
image element but `isImage` is not set, then additionally supply the image data using the
`imagePositionInformation` helper function. This ensures that in the case where we're requesting image data and
the user is interacting with an image element inside a link, we'll send decoded image data back to the UI
process.
2021-04-14 Youenn Fablet <youenn@apple.com>
Update WKPageSet implementation according new MediaProducer::MutedState values
https://bugs.webkit.org/show_bug.cgi?id=224548
Reviewed by Eric Carlson.
Covered by API test.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetMuted):
Translate WKMediaMutedState to WebCore::MediaProducer::MutedStateFlags properly.
2021-04-14 Alex Christensen <achristensen@webkit.org>
Don't block proxy authentication challenges
https://bugs.webkit.org/show_bug.cgi?id=224564
<rdar://76542907>
Reviewed by Brady Eidson.
You have to use SPI to get WebKit to tell CFNetwork to not handle proxy authentication by default,
but if you do it only works for first-party requests. Our challenge blocking to prevent cross-site fetches from
asking for basic auth credentials should not block challenges for proxy authentication. The radar has an application
that wants to handle them.
Covered by an API test.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didReceiveChallenge):
2021-04-14 Don Olmstead <don.olmstead@sony.com>
[GPUP] RemoteGraphicsContextsGL shouldn't be referenced when ENABLE_WEBGL is off
https://bugs.webkit.org/show_bug.cgi?id=224560
Reviewed by Alex Christensen.
Add an ENABLE(WEBGL) guard.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::didClose):
2021-04-14 Jiewen Tan <jiewen_tan@apple.com>
Unreviewed, a comment fix after r275847
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
Explains why instead of what.
2021-04-14 Alex Christensen <achristensen@webkit.org>
Temporarily fix more terminate_with_reason-related crashes
https://bugs.webkit.org/show_bug.cgi?id=224559
<rdar://76639741>
Reviewed by Geoff Garen.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::terminateWithReason):
2021-04-14 Devin Rousso <drousso@apple.com>
[iOS] limit how often `WebAVPlayerController` notifies the `PlaybackSessionModel` about changes to playback speed
https://bugs.webkit.org/show_bug.cgi?id=224515
<rdar://problem/75901463>
Reviewed by Eric Carlson.
This change will cause `HTMLMediaElement::setPlaybackRate` to not send IPC back and forth
between the WebProcess and UIProcess, as a modification to the `WebAVPlayerController` in
the UIProcess would notify its `PlaybackSessionModel` "delegate", which would in turn make
it's way back to the related `HTMLMediaElement::setPlaybackRate` in the WebProcess.
* UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionModelContext::setPlaybackRate): Added.
(WebKit::PlaybackSessionManagerProxy::setPlaybackRate): Added.
* WebProcess/cocoa/PlaybackSessionManager.messages.in:
* WebProcess/cocoa/PlaybackSessionManager.h:
* WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionManager::setPlaybackRate): Added.
Add support for handling when the `rate` of the `AVPlayerController` changes too.
2021-04-14 Kate Cheney <katherine_cheney@apple.com>
Service worker soft-update loads not being marked app-bound
https://bugs.webkit.org/show_bug.cgi?id=223200
<rdar://problem/75438555>
Reviewed by Youenn Fablet.
We should pass the app-bound request value when doing a soft update.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::isAppBound):
* NetworkProcess/NetworkResourceLoader.h:
Make a helper function to get the request's app-bound value.
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::loadFromNetwork):
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::createFetchTask):
* Shared/NavigatingToAppBoundDomain.h:
(WebKit::AppBoundNavigationTestingData::setDidPerformSoftUpdate):
(WebKit::AppBoundNavigationTestingData::clearAppBoundNavigationDataTesting):
(WebKit::AppBoundNavigationTestingData::encode const):
(WebKit::AppBoundNavigationTestingData::decode):
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _appBoundNavigationData:]):
Update testing struct to make sure a soft-update occurred before
checking app-bound data. This accounts for the delay between the
page load and the soft update.
2021-04-14 Alex Christensen <achristensen@webkit.org>
Reduce maximum HashTable entry size to 128 bytes
https://bugs.webkit.org/show_bug.cgi?id=224381
Reviewed by Yusuke Suzuki.
* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
(WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
* WebProcess/WebPage/ViewUpdateDispatcher.h:
(WebKit::ViewUpdateDispatcher::UpdateData::UpdateData):
2021-04-14 Chris Dumez <cdumez@apple.com>
[iOS] WKMouseDeviceObserver is calling WebProcessProxy::send() on a non-main thread
https://bugs.webkit.org/show_bug.cgi?id=224529
<rdar://76598710>
Reviewed by Tim Horton.
Make sure WKMouseDeviceObserver calls WebProcessProxy::notifyHasMouseDeviceChanged() on the main thread
since:
1. It iterates over WebProcessProxy::allProcesses() which is only safe on the main thread
2. It calls WebProcessProxy::send() wich is only safe on the main thread
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/WKMouseDeviceObserver.mm:
(-[WKMouseDeviceObserver mousePointerDevicesDidChange:]):
(-[WKMouseDeviceObserver _setHasMouseDeviceForTesting:]):
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged):
2021-04-14 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Add a property to the WebKitWebView indicating whether the web process is responsive
https://bugs.webkit.org/show_bug.cgi?id=224359
Reviewed by Adrian Perez de Castro.
Add a property to WebKitWebView indicating whether the web processes used are responsive.
* UIProcess/API/glib/WebKitNavigationClient.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed):
(webkitWebViewGetProperty):
(webkit_web_view_class_init):
(webkitWebViewSetIsWebProcessResponsive):
(webkit_web_view_get_is_web_process_responsive):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebView.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2021-04-13 Jer Noble <jer.noble@apple.com>
[GPUP] MediaSource.addSourceBuffer() will throw if given the same parameter as a previous call to HTMLMediaElement.canPlayType()
https://bugs.webkit.org/show_bug.cgi?id=224273
<rdar://74805071>
Reviewed by Eric Carlson.
Test: media/media-source/media-source-addsourcebuffer-after-canplaytype.html
RemoteMediaPlayerMIMETypeCache will receive requests to verify whether it can handle a MIME/codec combination,
as well as whether this indicates a MediaStream, MSE source, or neither. If a cache for the MSE back-end receives
a query for a MIME type, but the query parameters indicate this is not a MSE source, it will say no and cache the
response. However the cache is keyed solely on the MIME/codec, so when a subsequent call to create a SourceBuffer
hits the cache entry, it thinks it will be unable to handle the MIME and rejects.
Make the mime-type cache triple keyed: use both the raw ContentType (MIME & codecs) as well as the flags stating
whether the source is a MediaStream, MSE, or neither.
* WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp:
(WebKit::RemoteMediaPlayerMIMETypeCache::supportsTypeAndCodecs):
* WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.h:
2021-04-13 Ada Chan <ada.chan@apple.com>
Implement PlatformXRSystem::xrCoordinator() for USE(APPLE_INTERNAL_SDK)
https://bugs.webkit.org/show_bug.cgi?id=224510
Reviewed by Dean Jackson.
* UIProcess/Cocoa/PlatformXRSystem.mm:
2021-04-13 Chris Dumez <cdumez@apple.com>
Unreviewed fix after r275921 to address crashes on the iOS bots.
The crash would occur when the WebPage constructor would end up calling WebProcess::ensureGPUProcessConnection().
Since we're in the middle of constructing the page, the pageID has been added to m_pageMap but not the page yet.
ensureGPUProcessConnection() was iterating over m_pageMap and expecting pages in the map to be non-null.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::createWebPage):
(WebKit::WebProcess::ensureGPUProcessConnection):
2021-04-13 Chris Dumez <cdumez@apple.com>
RemoteRenderingBackendProxy should only relaunch the GPUProcess if it actually needs it
https://bugs.webkit.org/show_bug.cgi?id=224516
Reviewed by Geoff Garen.
Previously, RemoteRenderingBackendProxy would launch the GPUProcess as soon as it was
constructed. This went against the goals of r275887 to delay the GPUProcess launch
until it is actually needed. Also, in case a a GPUProcess crash/termination,
RemoteRenderingBackendProxy would relaunch the GPUProcess right away, even if it
did not need it (No live ImageBuffers). This patch addresses both issues.
This patch is a pre-requirement for terminating the GPUProcess on memory pressure when
it is not used by any tabs.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy):
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
(WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose):
(WebKit::RemoteRenderingBackendProxy::messageSenderConnection const):
(WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
(WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
2021-04-13 Chris Dumez <cdumez@apple.com>
Stop requiring a RemoteRenderingBackend for visibility propagation views
https://bugs.webkit.org/show_bug.cgi?id=224513
Reviewed by Geoff Garen.
Stop requiring a RemoteRenderingBackend for visibility propagation views. This is
inconvenient because doing media playback in the GPUProcess does not require a
RemoteRenderingBackend. This was also making things difficult to exit the
GPUProcess on memory pressure when unused.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createVisibilityPropagationContextForPage):
(WebKit::GPUConnectionToWebProcess::destroyVisibilityPropagationContextForPage):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackendCreationParameters.h:
(WebKit::RemoteRenderingBackendCreationParameters::encode const):
(WebKit::RemoteRenderingBackendCreationParameters::decode):
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::createVisibilityPropagationContextForPage):
(WebKit::GPUProcessConnection::destroyVisibilityPropagationContextForPage):
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
(WebKit::WebPage::gpuProcessConnectionDidBecomeAvailable):
(WebKit::WebPage::~WebPage):
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureGPUProcessConnection):
2021-04-13 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r275898; remove unnecessary files from the project.
* WebKit.xcodeproj/project.pbxproj:
2021-04-13 Alex Christensen <achristensen@webkit.org>
WebProcessPool should store Vector<Ref<WebProcessProxy>> instead of Vector<RefPtr>
https://bugs.webkit.org/show_bug.cgi?id=224412
Reviewed by Chris Dumez.
No change in behavior, except I also changed a raw pointer to a WeakPtr, so we should be a little safer.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::remoteWebInspectorEnabledCallback):
(WebKit::WebProcessPool::registerNotificationObservers):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::cacheMediaMIMETypes):
* UIProcess/VisitedLinkStore.cpp:
(WebKit::VisitedLinkStore::removeAll):
(WebKit::VisitedLinkStore::sendStoreHandleToProcess):
(WebKit::VisitedLinkStore::didUpdateSharedStringHashes):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::gpuProcessCrashed):
(WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
(WebKit::WebProcessPool::tryTakePrewarmedProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::enableProcessTermination):
(WebKit::WebProcessPool::shouldTerminate):
(WebKit::WebProcessPool::processDidFinishLaunching):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::processForRegistrableDomain):
(WebKit::WebProcessPool::createWebPage):
(WebKit::WebProcessPool::terminateAllWebContentProcesses):
(WebKit::webProcessProxyFromConnection):
* UIProcess/WebProcessPool.h:
(WebKit::WebProcessPool::sendToAllProcesses):
(WebKit::WebProcessPool::sendToAllProcessesForSession):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didFinishLaunching):
2021-04-13 Lauro Moura <lmoura@igalia.com>
REGRESSION(r275262) [WebDriver] Make automation JS code aware of injected script headers
https://bugs.webkit.org/show_bug.cgi?id=224422
Reviewed by BJ Burg.
r275262 introduced "//# sourceURL..." prefixes to injected scripts and
this broke Automation JS evaluation, as the code evaluated is wrapped
with "(async " + CODE + ")". This results in "Unexpected keyword 'function'.
Expected ')' to end a compound expression." errors.
Covered by existing tests.
* WebProcess/Automation/WebAutomationSessionProxy.js:
(let.AutomationSessionProxy.prototype._execute): Move initial lines
with leading comments before the async expression.
2021-04-13 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Color picker sheet should use default height
https://bugs.webkit.org/show_bug.cgi?id=224371
<rdar://problem/76416775>
Reviewed by Wenson Hsieh.
System color pickers have a default height that is between a half-sheet
and a full sheet. WebKit should match the default so that users do not
need to swipe up and down to access all of the controls in the color
picker.
* UIProcess/ios/forms/WKFormColorControl.mm:
(-[WKColorPicker configurePresentation]):
Always use UIModalPresentationPopover when presenting the
UIColorPickerViewController. In compact environments, this style
behaves the same as UIModalPresentationFormSheet, and the presented
height of the color picker matches the system default.
This method of presentation matches the logic in UIColorWell.
2021-04-13 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Refactor logic for presenting the shared QLPreviewPanel when revealing an image
https://bugs.webkit.org/show_bug.cgi?id=224445
<rdar://problem/76552762>
Reviewed by Andy Estes and Devin Rousso.
`QLPreviewPanel.h` states that `QLPreviewPanel`'s state should never be modified by something that is not
currently controlling it (where "control" is determined through the `QLPreviewPanelController` category
methods declared in the same header file). Currently, WebKit code for revealing an image using the shared
QuickLook panel does not respect this requirement, and instead attempts to set the `dataSource` and `delegate`
properties of `QLPreviewPanel` out of band.
While this is not an issue if nothing in the responder chain accepts preview panel control (i.e. implements the
method `-acceptsPreviewPanelControl:` and returns `YES`), it leads to compatibility issues in apps like Mail
that override these methods and replace the `dataSource` and `delegate` properties on `QLPreviewPanel`. The end
result is that `WebPageProxy` ends up in an unexpected state where `WKImageExtractionPreviewController` has been
created, but will never be destroyed (until the web view itself is destroyed) because we're no longer the
delegate for the shared `QLPreviewPanel`, and therefore won't receive the teardown message when the preview
window is dismissed.
To address this, we refactor this logic so that `WKWebView` (or `WKView`, if applicable) is capable of accepting
preview panel control. See below for more details.
* SourcesCocoa.txt:
* UIProcess/API/mac/WKView.mm:
(-[WKView acceptsPreviewPanelControl:]):
(-[WKView beginPreviewPanelControl:]):
(-[WKView endPreviewPanelControl:]):
Implement `QLPreviewPanelController` hooks on `WKView`, and plumb directly into `WebViewImpl`.
* UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView acceptsPreviewPanelControl:]):
(-[WKWebView beginPreviewPanelControl:]):
(-[WKWebView endPreviewPanelControl:]):
Implement `QLPreviewPanelController` hooks on `WKWebView`, and plumb directly into `WebViewImpl`.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::acceptsPreviewPanelControl):
Only accept control of the preview panel if we have an active image extraction preview controller.
(WebKit::WebViewImpl::beginPreviewPanelControl):
(WebKit::WebViewImpl::endPreviewPanelControl):
When beginning to take control (and relinquishing control) of the preview panel, respectively set and unset the
`dataSource` and `delegate` properties to the active image extraction preview controller.
* UIProcess/mac/WKImageExtractionPreviewController.h: Added.
* UIProcess/mac/WKImageExtractionPreviewController.mm: Added.
(-[WKImageExtractionPreviewItem initWithURL:title:]):
(-[WKImageExtractionPreviewItem dealloc]):
(-[WKImageExtractionPreviewItem previewItemURL]):
(-[WKImageExtractionPreviewItem previewItemTitle]):
(-[WKImageExtractionPreviewController initWithPage:url:title:]):
(-[WKImageExtractionPreviewController numberOfPreviewItemsInPreviewPanel:]):
(-[WKImageExtractionPreviewController previewPanel:previewItemAtIndex:]):
Partially upstream `_WKImageExtractionPreviewController` to OpenSource, as `WKImageExtractionPreviewController`
(the underscore is unnecessary because this object is not SPI- or API-exposed). Additionally, move it out into
its own header and source, so that it can be imported elsewhere.
* WebKit.xcodeproj/project.pbxproj:
2021-04-13 Alex Christensen <achristensen@webkit.org>
Remove support for NPAPI plugins in WKWebView
https://bugs.webkit.org/show_bug.cgi?id=224451
Reviewed by Chris Dumez.
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences encodeWithCoder:]):
(-[WKPreferences initWithCoder:]):
(-[WKPreferences plugInsEnabled]):
(-[WKPreferences setPlugInsEnabled:]):
2021-04-13 Said Abou-Hallawa <said@apple.com>
[GPU Process] Make ImageBuffer calculate its memoryCost() from its size
https://bugs.webkit.org/show_bug.cgi?id=224306
Reviewed by Simon Fraser.
* Shared/ShareableBitmap.h:
Make ShareableBitmap::calculateBytesPerRow() public.
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::configuration):
(WebKit::ImageBufferShareableBitmapBackend::calculateSafeBackendSize):
(WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow):
(WebKit::ImageBufferShareableBitmapBackend::calculateMemoryCost):
(WebKit::ImageBufferShareableBitmapBackend::create):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
ShareableBitmap::calculateBytesPerRow() is used to get the bytesPerRow()
by giving it the scaled backend size.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::create):
Use the new name of the function calculateSafeBackendSize().
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableIOSurfaceBackend::calculateSafeBackendSize):
(WebKit::ImageBufferShareableIOSurfaceBackend::calculateMemoryCost):
(WebKit::ImageBufferShareableIOSurfaceBackend::calculateExternalMemoryCost):
(WebKit::ImageBufferShareableIOSurfaceBackend::bytesPerRow const):
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
Implement these static functions and make them call the corresponding
functions from ImageBufferIOSurfaceBackend because this class is derived
from ImageBufferBackend.
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
Use the new name of the function calculateSafeBackendSize().
2021-04-13 Alex Christensen <achristensen@webkit.org>
Revert r275172
https://bugs.webkit.org/show_bug.cgi?id=224499
<rdar://76396241>
Reviewed by Tim Horton.
It turns out that terminate_with_reason uses a different syscall than xpc_connection_kill in its implementation,
and the former is not allowed by Messages's sandbox yet. Revert for Messages until they add it.
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
(IPC::Connection::kill):
* Platform/spi/Cocoa/ReasonSPI.h:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::platformInvalidate):
(WebKit::terminateWithReason):
2021-04-13 Jer Noble <jer.noble@apple.com>
[Cocoa] remove link-time dependency on WebKitSwift
https://bugs.webkit.org/show_bug.cgi?id=224493
Reviewed by Eric Carlson.
* Configurations/WebKit.xcconfig:
* WebKit.xcodeproj/project.pbxproj:
2021-04-13 Devin Rousso <drousso@apple.com>
[iOS] Only use the theme color if it's valid when `UseThemeColorForScrollAreaBackgroundColor` is enabled
https://bugs.webkit.org/show_bug.cgi?id=224455
Reviewed by Wenson Hsieh.
Without a check for `isValid()`, the `m_themeColor` would always be used, even if not set.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::scrollAreaBackgroundColor const):
2021-04-13 Chris Dumez <cdumez@apple.com>
Fix typo in GPUProcessConnection::enableVP9Decoders()
https://bugs.webkit.org/show_bug.cgi?id=224491
Reviewed by Darin Adler.
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::enableVP9Decoders):
2021-04-13 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275889.
https://bugs.webkit.org/show_bug.cgi?id=224488
Unintentional commit
Reverted changeset:
https://trac.webkit.org/changeset/275889
2021-04-13 Sihui Liu <sihui_liu@apple.com>
Make WebIDBServer not block main thread during initialization
https://bugs.webkit.org/show_bug.cgi?id=224299
Reviewed by Geoffrey Garen.
Move Lock from WebCore::IDBServer to WebIDBServer so we can block background thread in suspend() when m_server
is uninitialized.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::m_closeCallback):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::suspend):
(WebKit::WebIDBServer::resume):
(WebKit::WebIDBServer::openDatabase):
(WebKit::WebIDBServer::deleteDatabase):
(WebKit::WebIDBServer::abortTransaction):
(WebKit::WebIDBServer::commitTransaction):
(WebKit::WebIDBServer::didFinishHandlingVersionChangeTransaction):
(WebKit::WebIDBServer::createObjectStore):
(WebKit::WebIDBServer::deleteObjectStore):
(WebKit::WebIDBServer::renameObjectStore):
(WebKit::WebIDBServer::clearObjectStore):
(WebKit::WebIDBServer::createIndex):
(WebKit::WebIDBServer::deleteIndex):
(WebKit::WebIDBServer::renameIndex):
(WebKit::WebIDBServer::putOrAdd):
(WebKit::WebIDBServer::getRecord):
(WebKit::WebIDBServer::getAllRecords):
(WebKit::WebIDBServer::getCount):
(WebKit::WebIDBServer::deleteRecord):
(WebKit::WebIDBServer::openCursor):
(WebKit::WebIDBServer::iterateCursor):
(WebKit::WebIDBServer::establishTransaction):
(WebKit::WebIDBServer::databaseConnectionPendingClose):
(WebKit::WebIDBServer::databaseConnectionClosed):
(WebKit::WebIDBServer::abortOpenAndUpgradeNeeded):
(WebKit::WebIDBServer::didFireVersionChangeEvent):
(WebKit::WebIDBServer::openDBRequestCancelled):
(WebKit::WebIDBServer::getAllDatabaseNamesAndVersions):
(WebKit::WebIDBServer::addConnection):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::close):
* NetworkProcess/IndexedDB/WebIDBServer.h:
2021-04-13 Chris Dumez <cdumez@apple.com>
The GPUProcess should only launch when it is needed
https://bugs.webkit.org/show_bug.cgi?id=224461
Reviewed by Eric Carlson.
The GPUProcess should only launch when it is needed. This avoids wasting memory
on simple pages, especially until we enable "DOM rendering in GPU Process".
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::GPUProcessConnection):
As soon as we create a GPUProcessConnection, if "Media in GPUProcess" is enabled
we do some media-related initialization that we used to do in
WebProcess::setUseGPUProcessForMedia(). setUseGPUProcessForMedia() gets called
when constructing a WebPage and this initialization requires a GPUProcess. We
thus want to delay the initialization until we actually need a GPUProcess.
(WebKit::GPUProcessConnection::enableVP9Decoders):
Rename function to make it clear it is only used for VP9.
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::create):
(WebKit::RemoteAudioSession::RemoteAudioSession):
(WebKit::RemoteAudioSession::~RemoteAudioSession):
(WebKit::RemoteAudioSession::gpuProcessConnectionDidClose):
(WebKit::RemoteAudioSession::ensureConnection):
(WebKit::RemoteAudioSession::configuration const):
(WebKit::RemoteAudioSession::configuration):
(WebKit::RemoteAudioSession::setCategory):
(WebKit::RemoteAudioSession::setPreferredBufferSize):
(WebKit::RemoteAudioSession::tryToSetActiveInternal):
(WebKit::RemoteAudioSession::category const):
(WebKit::RemoteAudioSession::configurationChanged):
* WebProcess/GPU/media/RemoteAudioSession.h:
Update RemoteAudioSession to lazily initiate the GPUProcess connection instead
of doing it on construction. The RemoteAudioSession gets created as soon as we
create a WebPage, at which point we may not need a GPUProcess yet.
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::RemoteMediaSessionHelper):
(WebKit::RemoteMediaSessionHelper::ensureConnection):
(WebKit::RemoteMediaSessionHelper::gpuProcessConnectionDidClose):
(WebKit::RemoteMediaSessionHelper::startMonitoringWirelessRoutesInternal):
(WebKit::RemoteMediaSessionHelper::stopMonitoringWirelessRoutesInternal):
(WebKit::RemoteMediaSessionHelper::providePresentingApplicationPID):
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
Update RemoteMediaSessionHelper to lazily initiate the GPUProcess connection instead
of doing it on construction. The RemoteAudioSession gets created as soon as we
create a WebPage, at which point we may not need a GPUProcess yet.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
- Update GPUProcessConnection::updateParameters() call to enableVP9Decoders() due to rename.
This makes it clear it is only useful for VP9. We also only call it if there is already
a GPUProcess connection. If there is no connection right now, the GPUProcessConnection
constructor will take care of getting the latest values from the PlatformMediaSessionManager
and send them to the GPUProcess.
- Call ensureRemoteRenderingBackendProxy() only if we already have a GPUProcessConnection, to
avoid eagerly launching the GPUProcess. If no GPUProcessConnection exists,
WebProcess::ensureGPUProcessConnection() will take care of calling ensureRemoteRenderingBackendProxy()
on its pages.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureGPUProcessConnection):
This logic used to happen in WebPage::updatePreferences(). However, I had to make it conditional on
have a GPUProcessConnection to avoid eagerly launching the GPUProcess. As a result, I now need some
logic when we initiate the GPUProcessConnection to call ensureRemoteRenderingBackendProxy() on the
WebPages. Note that this is a temporary workaround until we enable DOM Rendering in the GPUProcess.
(WebKit::WebProcess::setUseGPUProcessForMedia):
setUseGPUProcessForMedia() gets called when constructing a WebPage, at which point a GPUProcess is
not useful yet. As a result, we should make sure setUseGPUProcessForMedia() does not call
ensureGPUProcessConnection() to avoid eagerly launching the GPUProcess and potentially wasting memory.
To fix this, I moved some of the logic to the GPUProcessConnection constructor so that we do the
media-related GPUProcess initialization ONLY once we actually have a GPUProcess.
2021-04-13 Sihui Liu <sihui_liu@apple.com>
StorageArea in LocalStorageNamespace can be abandoned
https://bugs.webkit.org/show_bug.cgi?id=224459
Reviewed by Geoffrey Garen.
Remove StorageArea from LocalStorageNamespace if it has no connection (no web page is using it).
* NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
(WebKit::LocalStorageNamespace::removeStorageArea):
* NetworkProcess/WebStorage/LocalStorageNamespace.h:
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::removeListener):
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::removeConnection):
(WebKit::StorageManagerSet::disconnectFromStorageArea):
2021-04-13 Peng Liu <peng.liu6@apple.com>
[macOS] Netflix videos opened in background tab never become playable after foregrounding
https://bugs.webkit.org/show_bug.cgi?id=224384
Reviewed by Eric Carlson.
When a page calls `navigator.requestMediaKeySystemAccess()` in a background tab, the request
will be added to a pending request hash map. However, the current implementation of
`MediaKeySystemPermissionRequestManager` does not send the request when the tab switches
to foreground. This patch fixes this issue by adding the `MediaKeySystemPermissionRequestManager`
object as a `MediaCanStartListener` of `Document`, so that it will send its pending requests
when the tab switches to foreground (`mediaCanStart()`).
* WebKit.xcodeproj/project.pbxproj: Add two cpp files to the xcode project.
* WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.cpp:
Add the object as a `MediaCanStartListener` so that it can send the `MediaKeySystemRequest`
to the UI process when the tab switches to foreground.
(WebKit::MediaKeySystemPermissionRequestManager::startMediaKeySystemRequest):
(WebKit::MediaKeySystemPermissionRequestManager::cancelMediaKeySystemRequest):
(WebKit::MediaKeySystemPermissionRequestManager::mediaCanStart):
* WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.h:
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GStreamer] CaptureDevice monitor used from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=222888
Reviewed by Youenn Fablet.
GStreamer ports aim to reduce usage of the GStreamer library in the UIProcess and thus
should not relay capture devicechange monitoring to the UIProcess. For the long term we plan
to migrate media processing to the GPUProcess but for now we have to maintain the media
pipelines in the WebProcess. Initializing GStreamer in multiple processes (including the
UIProcess) has a significant performance impact on embedded platforms, that's why we try to
avoid it as much as possible.
The device monitoring code from the UserMediaProcessManager was partly moved to the
RealtimeMediaSourceCenter so that it can be easily reused by GStreamer ports from the
UserMediaPermissionRequestManager.
* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::UserMediaProcessManager):
(WebKit::UserMediaProcessManager::updateCaptureDevices):
(WebKit::UserMediaProcessManager::devicesChanged):
(WebKit::UserMediaProcessManager::beginMonitoringCaptureDevices):
* UIProcess/UserMediaProcessManager.h:
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::UserMediaPermissionRequestManager):
(WebKit::UserMediaPermissionRequestManager::updateCaptureDevices):
(WebKit::UserMediaPermissionRequestManager::DeviceObserver::devicesChanged):
(WebKit::UserMediaPermissionRequestManager::addDeviceChangeObserver):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
(WebKit::UserMediaPermissionRequestManager::DeviceObserver::DeviceObserver):
2021-04-12 Julian Gonzalez <julian_a_gonzalez@apple.com>
[CoreIPC] Crash in logDiagnosticMessage code
https://bugs.webkit.org/show_bug.cgi?id=224390
Reviewed by Chris Dumez.
Create new WebPageProxy::logDiagnosticMessage APIs designed to be called on messages that
need sanity checking, and hook that up to IPC handlers (while leaving existing APIs
for all other callers).
Test: ipc/analytics-logger-crash.html
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::logDiagnosticMessageWithValue):
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::logDiagnosticMessageFromWebProcess):
(WebKit::ProvisionalPageProxy::logDiagnosticMessageWithEnhancedPrivacyFromWebProcess):
(WebKit::ProvisionalPageProxy::logDiagnosticMessageWithValueDictionaryFromWebProcess):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::logDiagnosticMessageFromWebProcess):
(WebKit::WebPageProxy::logDiagnosticMessageWithResultFromWebProcess):
(WebKit::WebPageProxy::logDiagnosticMessageWithValueFromWebProcess):
(WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacyFromWebProcess):
(WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionaryFromWebProcess):
(WebKit::WebPageProxy::logDiagnosticMessageWithDomainFromWebProcess):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage):
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult):
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue):
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy):
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithDomain):
2021-04-12 Jiewen Tan <jiewen_tan@apple.com>
Force the WebAuthn compatible mode to always show UI
https://bugs.webkit.org/show_bug.cgi?id=224402
<rdar://75757362>
Reviewed by Brent Fulgham.
Covered by manual tests.
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
2021-04-12 Sihui Liu <sihui_liu@apple.com>
Create WebIDBServer only when it is needed
https://bugs.webkit.org/show_bug.cgi?id=224305
rdar://71962196
Reviewed by Alex Christensen.
Currently each WebIDBServer has a separate thread, so we don't want to create or keep WebIDBServer if it's not
in use. There are two cases where network process needs a WebIDBServer:
1. handle requests from UI process to collect or remove data
2. handle requests from Web process to perform IDB operations
Previously, we created a WebIDBServer when network process connects to a web process, but that does not mean web
process will perform IDB operations and we may create a thread that's not used. To avoid this, add a new message
AddIDBConnection for web process to ensure network process has WebIDBServer when it's about to perform operation.
Also, previously network process removes a WebIDBServer when session is removed and WebIDBServer is not binded
with any web process connection. Now we remove WebIDBServer when it's done handling requests, that is count of
pending requests from UI process is 0 and WebIDBServer is not binded with web process connection. We also remove
WebIDBServer at when network process is about to be destroyed (NetworkProcess::didClose) so we can break the
reference cycle of NetworkProcess-WebIDBServer-IDBServer, and make sure thread exits.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::create):
(WebKit::WebIDBServer::WebIDBServer):
(WebKit::m_closeCallback):
(WebKit::WebIDBServer::~WebIDBServer):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::close):
(WebKit::WebIDBServer::tryClose):
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::addIDBConnection):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didClose):
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::createWebIDBServer):
(WebKit::NetworkProcess::connectionToWebProcessClosed):
(WebKit::NetworkProcess::removeWebIDBServerIfPossible): Deleted. Move the removal code to WebIDBServer.
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
2021-04-12 Chris Dumez <cdumez@apple.com>
Make sure AuxiliaryProcessProxy::sendMessage() is called on the main thread
https://bugs.webkit.org/show_bug.cgi?id=224448
Reviewed by Geoffrey Garen.
Make sure AuxiliaryProcessProxy::sendMessage() is called on the main thread. This is a follow-up to
Bug 224377 but for trunk.
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::sendMessage):
(WebKit::AuxiliaryProcessProxy::didFinishLaunching):
(WebKit::AuxiliaryProcessProxy::replyToPendingMessages):
2021-04-12 Ada Chan <ada.chan@apple.com>
Initial implementation of WebChromeClient::enumerateImmersiveXRDevices() and XRDeviceProxy
https://bugs.webkit.org/show_bug.cgi?id=224353
Reviewed by Dean Jackson
- Add XRDeviceProxy which implements PlatformXR::Device.
- Implement WebChromeClient::enumerateImmersiveXRDevices(), which calls PlatformXRSystemProxy
to get the list of XRDeviceProxy.
- XRDeviceProxy goes through PlatformXRSystemProxy to handle its operations.
PlatformXRSystemProxy sends messages over IPC to PlatformXRSystem on the UI process side,
which handles XR device discovery and manages sessions via the PlatformXRCoordinator interface.
PlatformXRSystem::xrCoordinator() returns null for now and will be handled in a later patch.
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Platform/Logging.h:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/Cocoa/XRDeviceProxy.h: Added.
* Shared/Cocoa/XRDeviceProxy.mm: Added.
(WebKit::XRDeviceProxy::create):
(WebKit::XRDeviceProxy::XRDeviceProxy):
Initialize its data members based on the XRDeviceInfo passed in.
Keep a weak pointer to PlatformXRSystemProxy (as PlatformXRSystemProxy has
strong references to its list of XRDeviceProxy).
(WebKit::XRDeviceProxy::sessionDidEnd):
Notify the TrackingAndRenderingClient that the session has ended.
(WebKit::XRDeviceProxy::initializeTrackingAndRendering):
(WebKit::XRDeviceProxy::shutDownTrackingAndRendering):
(WebKit::XRDeviceProxy::views const):
Return left and right views if the device supports stereo rendering.
Otherwise return just one view.
(WebKit::XRDeviceProxy::requestFrame):
* Shared/WebCoreArgumentCoders.h:
* SourcesCocoa.txt:
* UIProcess/Cocoa/PlatformXRCoordinator.h: Copied from Source/WebCore/platform/xr/cocoa/PlatformXRCocoa.h.
Initial interface for communicating with the platform regarding XR devices and sessions.
For now, the interface covers session creation and termination, and scheduling frame updates.
* UIProcess/Cocoa/PlatformXRSystem.h: Copied from Source/WebCore/platform/xr/cocoa/PlatformXRCocoa.h.
* UIProcess/Cocoa/PlatformXRSystem.messages.in: Copied from Source/WebCore/platform/xr/cocoa/PlatformXRCocoa.h.
* UIProcess/Cocoa/PlatformXRSystem.mm: Added.
(WebKit::PlatformXRSystem::PlatformXRSystem):
(WebKit::PlatformXRSystem::~PlatformXRSystem):
(WebKit::PlatformXRSystem::invalidate):
End any existing session on invalidation.
(WebKit::PlatformXRSystem::enumerateImmersiveXRDevices):
(WebKit::PlatformXRSystem::initializeTrackingAndRendering):
(WebKit::PlatformXRSystem::shutDownTrackingAndRendering):
(WebKit::PlatformXRSystem::requestFrame):
(WebKit::PlatformXRSystem::xrCoordinator):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
Set up the PlatformXRSystem held by the WebPageProxy.
(WebKit::WebPageProxy::resetState):
Invalidate m_xrSystem so existing session is ended properly.
* UIProcess/WebPageProxy.h:
* UIProcess/mac/HighPerformanceGPUManager.h:
Include WeakHashSet.h due to recent type change of m_processesRequiringHighPerformance
from HashSet to WeakHashSet.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::enumerateImmersiveXRDevices):
Get the list of XRDeviceInfo that represents the immersive devices returned
from PlatformXRSystem. Reuse any existing XRDeviceProxy instances that have the same
XRDeviceIdentifier. Otherwise, create new ones.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::xrSystemProxy):
* WebProcess/WebPage/WebPage.h:
* WebProcess/cocoa/PlatformXRSystemProxy.h: Copied from Source/WebCore/platform/xr/cocoa/PlatformXRCocoa.h.
* WebProcess/cocoa/PlatformXRSystemProxy.messages.in: Copied from Source/WebCore/platform/xr/cocoa/PlatformXRCocoa.h.
* WebProcess/cocoa/PlatformXRSystemProxy.mm: Added.
(WebKit::PlatformXRSystemProxy::PlatformXRSystemProxy):
(WebKit::PlatformXRSystemProxy::~PlatformXRSystemProxy):
(WebKit::PlatformXRSystemProxy::enumerateImmersiveXRDevices):
(WebKit::PlatformXRSystemProxy::initializeTrackingAndRendering):
(WebKit::PlatformXRSystemProxy::shutDownTrackingAndRendering):
(WebKit::PlatformXRSystemProxy::requestFrame):
(WebKit::PlatformXRSystemProxy::sessionDidEnd):
(WebKit::PlatformXRSystemProxy::deviceByIdentifier):
2021-04-12 Adrian Perez de Castro <aperez@igalia.com>
[WPE][GTK] Use g_object_notify_by_pspec() whenever possible
https://bugs.webkit.org/show_bug.cgi?id=224366
Reviewed by Carlos Garcia Campos.
Keep a static array with the GParamSpec pointer for each property, and trigger
property change notifications using g_object_notify_by_pspec() to avoid looking
up by its name each time.
* Shared/API/glib/WebKitURIRequest.cpp:
(webkit_uri_request_class_init):
(webkit_uri_request_set_uri):
* UIProcess/API/glib/WebKitDownload.cpp:
(webkitDownloadDecideDestination):
(webkit_download_class_init):
(webkitDownloadSetResponse):
(webkitDownloadNotifyProgress):
(webkit_download_set_destination):
(webkit_download_set_allow_overwrite):
* UIProcess/API/glib/WebKitEditorState.cpp:
(webkit_editor_state_class_init):
(webkitEditorStateSetTypingAttributes):
* UIProcess/API/glib/WebKitGeolocationManager.cpp:
(webkitGeolocationManagerSetEnableHighAccuracy):
(webkit_geolocation_manager_class_init):
* UIProcess/API/glib/WebKitInputMethodContext.cpp:
(webkit_input_method_context_class_init):
(webkit_input_method_context_set_input_purpose):
(webkit_input_method_context_set_input_hints):
* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_class_init):
(webkit_settings_set_enable_javascript):
(webkit_settings_set_auto_load_images):
(webkit_settings_set_load_icons_ignoring_image_load_setting):
(webkit_settings_set_enable_offline_web_application_cache):
(webkit_settings_set_enable_html5_local_storage):
(webkit_settings_set_enable_html5_database):
(webkit_settings_set_enable_xss_auditor):
(webkit_settings_set_enable_frame_flattening):
(webkit_settings_set_enable_java):
(webkit_settings_set_javascript_can_open_windows_automatically):
(webkit_settings_set_enable_hyperlink_auditing):
(webkit_settings_set_default_font_family):
(webkit_settings_set_monospace_font_family):
(webkit_settings_set_serif_font_family):
(webkit_settings_set_sans_serif_font_family):
(webkit_settings_set_cursive_font_family):
(webkit_settings_set_fantasy_font_family):
(webkit_settings_set_pictograph_font_family):
(webkit_settings_set_default_font_size):
(webkit_settings_set_default_monospace_font_size):
(webkit_settings_set_minimum_font_size):
(webkit_settings_set_default_charset):
(webkit_settings_set_enable_developer_extras):
(webkit_settings_set_enable_resizable_text_areas):
(webkit_settings_set_enable_tabs_to_links):
(webkit_settings_set_enable_dns_prefetching):
(webkit_settings_set_enable_caret_browsing):
(webkit_settings_set_enable_fullscreen):
(webkit_settings_set_print_backgrounds):
(webkit_settings_set_enable_webaudio):
(webkit_settings_set_enable_webgl):
(webkit_settings_set_allow_modal_dialogs):
(webkit_settings_set_zoom_text_only):
(webkit_settings_set_javascript_can_access_clipboard):
(webkit_settings_set_media_playback_requires_user_gesture):
(webkit_settings_set_media_playback_allows_inline):
(webkit_settings_set_draw_compositing_indicators):
(webkit_settings_set_enable_site_specific_quirks):
(webkit_settings_set_enable_page_cache):
(webkit_settings_set_user_agent):
(webkit_settings_set_enable_smooth_scrolling):
(webkit_settings_set_enable_write_console_messages_to_stdout):
(webkit_settings_set_enable_media_stream):
(webkit_settings_set_enable_mock_capture_devices):
(webkit_settings_set_enable_spatial_navigation):
(webkit_settings_set_enable_mediasource):
(webkit_settings_set_enable_encrypted_media):
(webkit_settings_set_enable_media_capabilities):
(webkit_settings_set_allow_file_access_from_file_urls):
(webkit_settings_set_allow_universal_access_from_file_urls):
(webkit_settings_set_allow_top_navigation_to_data_urls):
(webkit_settings_set_hardware_acceleration_policy):
(webkit_settings_set_enable_back_forward_navigation_gestures):
(webkit_settings_set_enable_javascript_markup):
(webkit_settings_set_enable_media):
(webkit_settings_set_media_content_types_requiring_hardware_support):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextGetProperty):
(webkitWebContextSetProperty):
(webkit_web_context_class_init):
(webkit_web_context_set_use_system_appearance_for_scrollbars):
* UIProcess/API/glib/WebKitWebResource.cpp:
(webkit_web_resource_class_init):
(webkitWebResourceUpdateURI):
(webkitWebResourceSetResponse):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewSetIsLoading):
(webkitWebViewIsPlayingAudioChanged):
(webkitWebViewUpdateFavicon):
(webkit_web_view_class_init):
(webkitWebViewLoadChanged):
(webkitWebViewDidChangePageID):
(webkit_web_view_set_is_muted):
(webkit_web_view_set_settings):
(webkit_web_view_set_zoom_level):
(webkit_web_view_set_editable):
* UIProcess/API/glib/WebKitWindowProperties.cpp:
(webkit_window_properties_class_init):
(webkitWindowPropertiesSetGeometry):
(webkitWindowPropertiesSetToolbarVisible):
(webkitWindowPropertiesSetMenubarVisible):
(webkitWindowPropertiesSetStatusbarVisible):
(webkitWindowPropertiesSetLocationbarVisible):
(webkitWindowPropertiesSetScrollbarsVisible):
(webkitWindowPropertiesSetResizable):
(webkitWindowPropertiesSetFullscreen):
* UIProcess/API/gtk/WebKitColorChooserRequest.cpp:
(webkit_color_chooser_request_class_init):
(webkit_color_chooser_request_set_rgba):
* UIProcess/API/gtk/WebKitPrintOperation.cpp:
(webkit_print_operation_class_init):
(webkit_print_operation_set_print_settings):
(webkit_print_operation_set_page_setup):
* UIProcess/API/gtk/WebKitWebInspector.cpp:
(webkit_web_inspector_class_init):
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(webkitWebPageSetURI):
(webkit_web_page_class_init):
2021-04-11 Sam Weinig <weinig@apple.com>
Simplify WebKitTestRunner preference reset to be more like DRT
https://bugs.webkit.org/show_bug.cgi?id=224410
Reviewed by Darin Adler.
Add WKPreferencesStartBatchingUpdates/WKPreferencesEndBatchingUpdates
to support batching preferences updates by clients.
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesStartBatchingUpdates):
(WKPreferencesEndBatchingUpdates):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/WebPreferences.h:
2021-04-10 Alex Christensen <achristensen@webkit.org>
Use WeakHashSet<WebProcessProxy> instead of HashSet<WebProcessProxy*>
https://bugs.webkit.org/show_bug.cgi?id=224393
Reviewed by Chris Dumez.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::requestHighPerformanceGPU):
(WebKit::WebProcessProxy::releaseHighPerformanceGPU):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::~WebProcessPool):
(WebKit::WebProcessPool::enableProcessTermination):
(WebKit::WebProcessPool::shouldTerminate):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::startedUsingGamepads):
(WebKit::WebProcessPool::stoppedUsingGamepads):
(WebKit::WebProcessPool::processStoppedUsingGamepads):
(WebKit::WebProcessPool::gamepadConnected):
(WebKit::WebProcessPool::gamepadDisconnected):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::~WebProcessProxy):
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::maybeShutDown):
(WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
* UIProcess/mac/HighPerformanceGPUManager.mm:
(WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
(WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
(WebKit::HighPerformanceGPUManager::updateState):
2021-04-10 Chris Dumez <cdumez@apple.com>
Crash under WebProcessProxy::shouldSendPendingMessage()
https://bugs.webkit.org/show_bug.cgi?id=224377
<rdar://75329251>
Reviewed by David Kilzer.
We are crashing with a null-dereference of pendingMessage.encoder inside WebProcessProxy::shouldSendPendingMessage().
However, pendingMessage.encoder is a UniqueRef<> and thus cannot be null. Also, we know that the WebProcessProxy
is alive because WebProcessProxy::didFinishLaunching() has a protector.
One thing that I believe could theoretically happen and would not be safe though is AuxiliaryProcessProxy::sendMessage()
being called on a non-main thread. Sending IPC off the main thread is safe in general and something we commonly do with
an IPC::Connection. To make this safe, IPC::Connection uses a Lock to protect its vector of messages. However, sending
IPC via an AuxiliaryProcessProxy is currently not thread safe as it relies on the process state (which gets updated on
the main thread) and access to the m_pendingMessages is not synchronized.
As a speculative fix, I have added logic in AuxiliaryProcessProxy::sendMessage() to dispatch to the main thread if
we're not already on it. I have also used WTF::DestructionThread::MainRunLoop to make sure all AuxiliaryProcessProxy
objects get destroyed on the main thread.
In a follow-up, I am planning to add a release assertion in AuxiliaryProcessProxy::sendMessage() to make sure we're
on a main thread. We'll then be able to drop the "dispatching the main thread" logic. For now though, I think we
should start with the "dispatch to main thread" logic, so that we have a patch that we can cherry-pick to a branch.
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::sendMessage):
(WebKit::AuxiliaryProcessProxy::didFinishLaunching):
(WebKit::AuxiliaryProcessProxy::replyToPendingMessages):
* UIProcess/AuxiliaryProcessProxy.h:
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp:
(WebKit::WebAuthnProcessProxy::singleton):
* UIProcess/WebProcessProxy.h:
2021-04-10 Charlène Wendling <julianaito@posteo.jp>
Properly use CompletionHandler when USE_OPENGL_OR_ES is set to OFF
https://bugs.webkit.org/show_bug.cgi?id=224149
Reviewed by Fujii Hironori.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
(WebKit::LayerTreeHost::forceRepaintAsync):
2021-04-10 Sihui Liu <sihui_liu@apple.com>
Unreviewed, reverting r275794, r275784, r275779
r275779 caused bots to crash and r275794, r275784 didn't fully fix it; reverting the patches to investigate.
Reverted changeset:
"Create WebIDBServer only when it is needed"
https://bugs.webkit.org/show_bug.cgi?id=224305
https://commits.webkit.org/r275779
2021-04-10 Sihui Liu <sihui_liu@apple.com>
Unreviewed, fix test crashes after r275779
https://bugs.webkit.org/show_bug.cgi?id=224305
rdar://71962196
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::WebIDBServer): rolling back change on setting thread name as we see crash in
pthread_setname_np.
2021-04-09 Simon Fraser <simon.fraser@apple.com>
[iOS WK2] CADisplayLink in the web process is used unintentionally
https://bugs.webkit.org/show_bug.cgi?id=224395
Reviewed by Tim Horton.
When RemoteLayerTreeDrawingArea called windowScreenDidChange() from its constructor,
m_page.drawingArea() was null which resulted in DisplayRefreshMonitor::create()
receiving a null DisplayRefreshMonitorFactory*, so it fell back to the legacy
DisplayRefreshMonitorIOS, instead of using RemoteLayerTreeDisplayRefreshMonitor.
Fix by sending windowScreenDidChange() from the UI process, with the synthetic
DisplayID generated from the webPageID(). This has the advantage that
WebPageProxy will also store the correct DisplayID, and is more similar to macOS.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
2021-04-09 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r271660): Tap highlight no longer shows when tapping clickable elements without touch event listeners
https://bugs.webkit.org/show_bug.cgi?id=224385
<rdar://problem/76462370>
Reviewed by Tim Horton.
In r271660, I added a call to `-finishInteraction` when resetting the synthetic tap gesture to fix a bug where
it was possible for the tap highlight to remain indefinitely when tapping on a clickable element with a touchend
event listener. This was because the touch end deferring gesture defers `-_singleTapDidReset:` until after
`-_didGetTapHighlightForRequest:…nodeHasBuiltInClickHandling:`, where we receive the tap highlight information.
```
2021-04-09 13:05:27.141097-0700 -[WKContentView(WKInteraction) _singleTapIdentified:]
2021-04-09 13:05:27.148678-0700 -[WKContentView(WKInteraction) _didGetTapHighlightForRequest:…nodeHasBuiltInClickHandling:]
2021-04-09 13:05:27.162525-0700 -[WKContentView(WKInteraction) _singleTapRecognized:]
2021-04-09 13:05:27.162675-0700 ↳ -[WKContentView(WKInteraction) _showTapHighlight]
2021-04-09 13:05:27.163250-0700 -[WKContentView(WKInteraction) _singleTapDidReset:]
2021-04-09 13:05:51.849481-0700 ↳ -[WKContentView(WKInteraction) _finishInteraction]
```
However, in the case where there is no touchend event listener and when fast-click is active, we reset the tap
gesture before receiving the tap highlight information:
```
2021-04-09 13:05:51.836638-0700 -[WKContentView(WKInteraction) _singleTapIdentified:]
2021-04-09 13:05:51.846152-0700 -[WKContentView(WKInteraction) _singleTapRecognized:]
2021-04-09 13:05:51.847196-0700 -[WKContentView(WKInteraction) _singleTapDidReset:]
2021-04-09 13:05:51.848563-0700 -[WKContentView(WKInteraction) _didGetTapHighlightForRequest:…nodeHasBuiltInClickHandling:]
2021-04-09 13:05:51.848851-0700 ↳ -[WKContentView(WKInteraction) _showTapHighlight]
2021-04-09 13:05:51.849481-0700 ↳ -[WKContentView(WKInteraction) _finishInteraction]
```
Critically, this means that calling `-_finishInteraction` in `-_singleTapDidReset:` prematurely flagged the
tap highlight request as complete (by setting `_isTapHighlightIDValid` to `NO`) in the case where we aren't
deferring gestures, which caused us to avoid showing the tap highlight at all when we eventually receive the tap
highlight information.
To fix this, only fade out the tap highlight view in `-_singleTapDidReset:` if the tap highlight request has
already finished (i.e. `_isTapHighlightIDValid` has been set to `NO`). Additionally, split logic for fading out
the highlight view into a separate method, and add a `BOOL` flag to make the fading idempotent.
Test: fast/events/touch/ios/tap-highlight-during-synthetic-click.html
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _tapHighlightViewRect]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView tapHighlightViewRect]):
Also add a testing-only method to report the frame of the tap highlight view. Note that this only attempts to
return the current `frame` of the tap highlight view instead of converting the frame to the coordinate system of
the content view (as other similar testing hooks do), since the tap highlight view only exists in the view
hierarchy for a brief duration.
(-[WKContentView _finishInteraction]):
(-[WKContentView _fadeTapHighlightViewIfNeeded]):
(-[WKContentView _singleTapDidReset:]):
2021-04-09 Brent Fulgham <bfulgham@apple.com>
[iOS] Correct process-info rules to restrict to self
https://bugs.webkit.org/show_bug.cgi?id=224383
<rdar://problem/66582454>
Reviewed by Eric Carlson.
The sandbox allows 'process-info' by default, so our allow rules have no real impact.
We need to deny access first, as we do on macOS, so that the allow rules have meaning.
I reviewed the macOS sandbox, and made sure the iOS sandbox allows the same items.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2021-04-09 Wenson Hsieh <wenson_hsieh@apple.com>
Web process crashes if image extraction is requested for an element that is pending image extraction
https://bugs.webkit.org/show_bug.cgi?id=224397
<rdar://problem/76472254>
Reviewed by Tim Horton.
Add a missing null check, so that we don't append (and then end up attempting to call) a null completion handler
in the case where image extraction is re-requested for an element that already has a pending image extraction
request.
This is currently not possible to reliably test this; in a future patch, I will add testing infrastructure that
will allow us to simulate image extraction requests and responses at the client layer.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestImageExtraction):
2021-04-09 Sihui Liu <sihui_liu@apple.com>
Unreviewed, fix for test crashes after r275779.
https://bugs.webkit.org/show_bug.cgi?id=224305
rdar://71962196
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createWebIDBServer): hitting an assertion when deref the WeakPtr, so rolling back to
old impl.
2021-04-09 Jer Noble <jer.noble@apple.com>
[Cocoa] Don't set LD_RUNPATH_SEARCH_PATHS in the WebKit project file.
https://bugs.webkit.org/show_bug.cgi?id=224392
Reviewed by Eric Carlson.
* WebKit.xcodeproj/project.pbxproj:
2021-04-09 Sihui Liu <sihui_liu@apple.com>
Create WebIDBServer only when it is needed
https://bugs.webkit.org/show_bug.cgi?id=224305
rdar://71962196
Reviewed by Alex Christensen.
Currently each WebIDBServer comes with a thread, so we don't want to keep WebIDBServer if it's not in use.
Now there are two cases where network process needs a WebIDBServer:
1. handle requests from UI process to collect or remove data
2. handle requests from Web process to perform IDB operations
We created a WebIDBServer when network process connects to a web process, and we should create it when
web process is about to perform IDB operations. Also, we should remove WebIDBServer if it's done handling
requests, i.e count of pending requests from UI process is 0 and WebIDBServer is not associated with any web
process connection.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::create):
(WebKit::WebIDBServer::WebIDBServer): Add SessionID to thread name so we know which session to blame in crash
traces.
(WebKit::m_closeCallback):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::tryClose):
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::addIDBConnection):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in: Add a message for web process to ask network process
to create WebIDBServer if not exists, and associate the web process connection with WebIDBServer.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::createWebIDBServer):
(WebKit::NetworkProcess::connectionToWebProcessClosed):
(WebKit::NetworkProcess::removeWebIDBServerIfPossible): Deleted. Move the removal code to WebIDBServer.
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
2021-04-09 Chris Dumez <cdumez@apple.com>
Need to propagate and use 'canShowWhileLocked' in the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=224345
<rdar://76011262>
Reviewed by Tim Horton.
The GPUProcess was previously creating a single visibility propagation view even though
it was potentially serving several web views. Also, it would also pass
`canShowWhileLocked=false` when constructing the visibility propagation view, ignoring
the value of WKWebViewConfiguration._canShowWhileLocked. This would lead to issues for
apps relying on WKWebView to show content on the lock screen.
To address the issue, we now have the RemoteRenderingBackend construct its own
visibility propagation view in the GPUProcess. The GPUProcess constructs a
RemoteRenderingBackend per WebPage being served so this is convenient. When sending the
IPC to the GPUProcess to construct the RemoteRenderingBackend, the WebProcess now sends
the page identifier as well as the value of the canShowWhileLocked flag so that we
can use the correct canShowWhileLocked flag when constructing the visibility propagation
view.
The logic in the UIProcess for dealing with GPUProcess visibility propagation views
is now almost identical to WebProcess visibility propagation views. They are stored on
the WebPageProxy and get swapped on process-swap (since a new WebPage gets created).
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createRenderingBackend):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcess.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::create):
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackendCreationParameters.h: Added.
(WebKit::RemoteRenderingBackendCreationParameters::encode const):
(WebKit::RemoteRenderingBackendCreationParameters::decode):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::didCreateContextInWebProcessForVisibilityPropagation):
(WebKit::WebPageProxy::didCreateContextInGPUProcessForVisibilityPropagation):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::getGPUProcessConnection):
(WebKit::GPUProcessProxy::didCreateContextForVisibilityPropagation):
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/GPU/GPUProcessProxy.messages.in:
* UIProcess/PageClient.h:
(WebKit::PageClient::didCreateContextInWebProcessForVisibilityPropagation):
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::didCreateContextInWebProcessForVisibilityPropagation):
(WebKit::ProvisionalPageProxy::didCreateContextInGPUProcessForVisibilityPropagation):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
* UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::contextIDForVisibilityPropagationInWebProcess const):
(WebKit::ProvisionalPageProxy::contextIDForVisibilityPropagationInGPUProcess const):
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToProvisionalPage):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::gpuProcessCrashed):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessProxy.cpp:
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didCreateContextInWebProcessForVisibilityPropagation):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
(-[WKContentView _setupVisibilityPropagationViewForWebProcess]):
(-[WKContentView _setupVisibilityPropagationViewForGPUProcess]):
(-[WKContentView _removeVisibilityPropagationViewForWebProcess]):
(-[WKContentView _processDidExit]):
(-[WKContentView _gpuProcessCrashed]):
(-[WKContentView _didRelaunchProcess]):
(-[WKContentView _webProcessDidCreateContextForVisibilityPropagation]):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::create):
(WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy):
(WebKit::RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy):
(WebKit::RemoteRenderingBackendProxy::connectToGPUProcess):
(WebKit::RemoteRenderingBackendProxy::reestablishGPUProcessConnection):
(WebKit::RemoteRenderingBackendProxy::messageSenderDestinationID const):
(WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
(WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
(WebKit::RemoteRenderingBackendProxy::sharedMemoryForGetImageData):
(WebKit::RemoteRenderingBackendProxy::destroyGetImageDataSharedMemory):
(WebKit::RemoteRenderingBackendProxy::getDataURLForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getDataForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getBGRADataForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
(WebKit::RemoteRenderingBackendProxy::cacheNativeImage):
(WebKit::RemoteRenderingBackendProxy::cacheFont):
(WebKit::RemoteRenderingBackendProxy::deleteAllFonts):
(WebKit::RemoteRenderingBackendProxy::releaseRemoteResource):
(WebKit::RemoteRenderingBackendProxy::sendWakeupMessage):
(WebKit::RemoteRenderingBackendProxy::didAppendData):
(WebKit::RemoteRenderingBackendProxy::createItemBuffer):
(WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
(WebKit::WebPage::updatePreferences):
(WebKit::WebPage::ensureRemoteRenderingBackendProxy):
2021-04-08 Darin Adler <darin@apple.com>
[Cocoa] Reduce usage of autorelease, fix mistakes noticed nearby code using autorelease
https://bugs.webkit.org/show_bug.cgi?id=224340
Reviewed by Anders Carlsson.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Use RetainPtr<NSURLRequest> instead of
__strong NSURLRequest*& for the in/out argument of the
applySniffingPoliciesAndBindRequestToInferfaceIfNeeded function.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
Updated to use RetainPtr instead of __strong. Also fixed some incorrect uses of %llu
to log NSUInteger and uint64_t, switching to "%lu" (and casting to unsigned long to
retain 32-bit compatibility) and "%" PRIu64 respectively.
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Ditto.
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Ditto.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(setIgnoreHSTS): Added. Helper function so the code that makes a mutableCopy is isolated
in a helper function for clarity. A good counterpart to the existing ignoreHSTS function.
(updateIgnoreStrictTransportSecuritySetting): Changed to use a RetainPtr<NSURLRequest>
in/out argument instead of an argument plus a return value, obviating the need to use
autorelease and making this easier to read. Used setIgnoreHSTS for brevity in implementation.
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
Update for change to updateIgnoreStrictTransportSecuritySetting.
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): Ditto.
(WebKit::proxyDictionary): Return a RetainPtr instead of something autoreleased.
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Call get() on the result of the
proxyDictionary function.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(makePolicyDecisionBlock): Return a BlockPtr instead of an autoreleased block.
Also use a lambda and retainWK for better clarity on capture semantics rather than
doing a WKRetain in the caller and a WKRelease in the block.
(setUpPagePolicyClient): Call get() on the result of the
makePolicyDecisionBlock function.
* WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
(WebKit::animationValueFromKeyframeValue): Return a RetainPtr instead of an
autoreleased object.
(WebKit::createAnimation): Call get() on the result of the
animationValueFromKeyframeValue function.
2021-04-09 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Silence a CFNetwork preference file access warning
https://bugs.webkit.org/show_bug.cgi?id=224344
<rdar://problem/75839558>
Reviewed by Eric Carlson.
Silence sandbox telemetry and reports when CFNetwork attempts to read an unimportant preference
when executing in the WebContent process. This has been confirmed to be a silent/safe failiure
case (just returns false) and is not needed in the WebContent process.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-09 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Use context menus for text input datalist dropdowns
https://bugs.webkit.org/show_bug.cgi?id=224287
<rdar://problem/76351317>
Reviewed by Wenson Hsieh.
Use context menus rather than popovers to present suggested values for
text inputs with an associated datalist element.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
Expose _isShowingDatalistSuggestions for testing. Previously, the test
runner traversed the view hierarchy in order to determine whether the
suggestions were visible. However, that approach is not reliable since
we no longer own the presented view, and UIKit could change the
implementation details of context menus.
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _isShowingDataListSuggestions]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView doAfterEditorStateUpdateAfterFocusingElement:]):
Add a mechanism to perform actions after an editor state update when
focusing an element. If an update is not expected, run the block
immediately.
See below for details on why this is necessary.
(-[WKContentView _didUpdateEditorState]):
Run any pending blocks that were awaiting an editor state update.
(-[WKContentView isShowingDataListSuggestions]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsDropdown invalidate]):
(-[WKDataListSuggestionsDropdown didSelectOptionAtIndex:]):
(-[WKDataListSuggestionsDropdown _showSuggestions]):
Present a context menu displaying the suggestions if one is not already
presented.
Note that focusing text fields can result in automatic zooming of the
webview. This zooming occurs after an editor state update for focused
elements. The presentation of the context menu is deferred to run
after an editor state update to ensure any zooming occurs before
showing the menu. Without this deferred presentation mechanism, the
context menu can be presented before the state update, partially
obscuring the webview and resulting in an incorrect zoom once the
update occurs.
If a menu is already presented, use `updateVisibleMenuWithBlock:` to
update the contents of the menu.
(-[WKDataListSuggestionsDropdown _updateTextSuggestions]):
(-[WKDataListSuggestionsDropdown _updateSuggestionsMenuElements]):
(-[WKDataListSuggestionsDropdown _removeContextMenuInteraction]):
(-[WKDataListSuggestionsDropdown _suggestionsMenuDidPresent]):
(-[WKDataListSuggestionsDropdown _suggestionsMenuDidDismiss]):
(-[WKDataListSuggestionsDropdown _preferredEdgeInsetsForSuggestionsMenu]):
By default, context menus can obscure the presenting element if there
are too many options. Inset the menu so that it does not overlap the
text field. Present the menu above the text field if there is less
space underneath the field.
(-[WKDataListSuggestionsDropdown contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
(-[WKDataListSuggestionsDropdown _contextMenuInteraction:styleForMenuWithConfiguration:]):
(-[WKDataListSuggestionsDropdown contextMenuInteraction:configurationForMenuAtLocation:]):
(-[WKDataListSuggestionsDropdown contextMenuInteraction:willDisplayMenuForConfiguration:animator:]):
(-[WKDataListSuggestionsDropdown contextMenuInteraction:willEndForConfiguration:animator:]):
2021-04-08 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Wrong KeyboardEvent.key for numeric key pad with NumLock
https://bugs.webkit.org/show_bug.cgi?id=224352
Reviewed by Don Olmstead.
* Shared/win/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebKeyboardEvent):
2021-04-08 Wenson Hsieh <wenson_hsieh@apple.com>
Add a completion handler argument to `ChromeClient::requestImageExtraction`
https://bugs.webkit.org/show_bug.cgi?id=224348
Reviewed by Tim Horton.
Add an optional completion handler argument to `ChromeClient::requestImageExtraction`. If specified, this
completion handler will be invoked with the image overlay host element (if present), once image extraction
finishes, or if the element is not suitable for image extraction.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::requestImageExtraction):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::requestImageExtraction):
Refactor this code, such that the data structure that (weakly) holds elements pending image extraction is
distinct from the set of elements that have completed image extraction. This allows us to queue completion
handlers to each element with a pending image extraction request, and invoke them once image extraction is
finished.
The existing weak set, `m_elementsWithExtractedImages`, is now repurposed to keep track of only elements that
have finished image extraction (and may or may not contain an image overlay). The new member variable,
`m_elementsPendingImageExtraction`, maintains pairs of weak elements and completion handlers; upon finishing
image extraction, each completion handler corresponding to the element (if it still exists) will be invoked.
Since the element is weakly held, in the case where the element is destroyed before image extraction finishes,
we will clean up the (now-null) entries in `m_elementsPendingImageExtraction` when the image extraction request
is finished.
* WebProcess/WebPage/WebPage.h:
2021-04-08 Jiewen Tan <jiewen_tan@apple.com>
PCM: Write more blinded secret tests
https://bugs.webkit.org/show_bug.cgi?id=222018
<rdar://problem/74674160>
Reviewed by John Wilander.
Covered by new tests.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::fireConversionRequest):
The KeyID is no longer truncated.
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _setPrivateClickMeasurementAttributionTokenPublicKeyURLForTesting:completionHandler:]):
(-[WKWebView _setPrivateClickMeasurementAttributionTokenSignatureURLForTesting:completionHandler:]):
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _setUIEventAttributionForTesting:withNonce:]):
Adds SPI for testing.
2021-04-08 Alex Christensen <achristensen@webkit.org>
Serialize URL instead of entire challenge for informing client that modern TLS was negotiated
https://bugs.webkit.org/show_bug.cgi?id=224346
<rdar://76421667>
Reviewed by Geoff Garen.
This callback is only used in Safari, and they only use the host.
We are serializing the certificate chain, during which we evaluate the trustedness and correctness of the certificate chain.
This patch removes that unused operation.
* NetworkProcess/NetworkDataTask.h:
(WebKit::NetworkDataTaskClient::didNegotiateModernTLS):
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didNegotiateModernTLS):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::didNegotiateModernTLS):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::didNegotiateModernTLS):
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::didNegotiateModernTLS):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didNegotiateModernTLS):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didNegotiateModernTLS):
* UIProcess/WebPageProxy.h:
2021-04-08 Tim Horton <timothy_horton@apple.com>
Safari unit tests sometimes fail an ASSERTion in IOSurface.mm's optionsFor32BitSurface()
https://bugs.webkit.org/show_bug.cgi?id=224351
<rdar://problem/76405354>
Reviewed by Wenson Hsieh.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]):
Don't take view snapshots for views that have a empty size.
This triggers both the assertions mentioned in the title, and the newly added ones.
2021-04-08 Kate Cheney <katherine_cheney@apple.com>
Fix incorrect compile-time macro for CFNETWORK_NSURLSESSION_ATTRIBUTED_BUNDLE_IDENTIFIER
https://bugs.webkit.org/show_bug.cgi?id=224347
<rdar://problem/76353792>
Reviewed by Brent Fulgham.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
(WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded):
2021-04-08 Eric Carlson <eric.carlson@apple.com>
[macOS] WebProcessProxy::sendAudioComponentRegistrations leaks CFDataRef
https://bugs.webkit.org/show_bug.cgi?id=224349
<rdar://problem/76176827>
Reviewed by Jer Noble.
Tested manually.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations): The CFDictionary
returned by AudioComponentFetchServerRegistrations is newly allocated, so adopt
it into the RetainPtr so we don't increase the retain count.
2021-04-08 Alex Christensen <achristensen@webkit.org>
REGRESSION(r273541) WKWebView can't load NSURLRequest subclasses
https://bugs.webkit.org/show_bug.cgi?id=224338
Reviewed by Brent Fulgham.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData):
2021-04-08 Kate Cheney <katherine_cheney@apple.com>
Add test infrastructure for app bound request context string
https://bugs.webkit.org/show_bug.cgi?id=224311
<rdar://problem/76229003>
Reviewed by Brent Fulgham.
The app-bound request context string is the eTLD+1 for a load and is
needed by CFNetwork. We should add testing infrastructure to make sure
the context string is being properly set.
Test: http/tests/in-app-browser-privacy/context-string-for-subframe.html
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(contextString):
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* Shared/NavigatingToAppBoundDomain.h:
(WebKit::AppBoundNavigationTestingData::clearAppBoundNavigationDataTesting):
(WebKit::AppBoundNavigationTestingData::updateAppBoundNavigationTestingData):
(WebKit::AppBoundNavigationTestingData::encode const):
(WebKit::AppBoundNavigationTestingData::decode):
Store the context string in the testing struct.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
SPI to get the app-bound request test data for layout testing.
2021-04-08 Chris Dumez <cdumez@apple.com>
Cache NSInvocation objects on _WKRemoteObjectInterface
https://bugs.webkit.org/show_bug.cgi?id=224331
<rdar://75628393>
Reviewed by Geoffrey Garen.
Have _WKRemoteObjectInterface eagerly create the NSInvocation objects and store them
instead of re-constructing them every time they are needed.
* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(decodeInvocation):
* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(methodArgumentTypeEncodingForSelector):
(initializeMethod):
(-[_WKRemoteObjectInterface debugDescription]):
(classesForSelectorArgument):
(-[_WKRemoteObjectInterface _invocationForSelector:]):
(-[_WKRemoteObjectInterface _invocationForReplyBlockOfSelector:]):
(-[_WKRemoteObjectInterface _allowedArgumentClassesForReplyBlockOfSelector:]):
* Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h:
2021-04-08 Dean Jackson <dino@apple.com>
Specify Swift version in configuration
https://bugs.webkit.org/show_bug.cgi?id=224334
Reviewed by Darin Adler.
Specify Swift language version 5 to stop an Xcode warning.
* Configurations/Base.xcconfig:
2021-04-08 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Temporarily retain some media services when GPU Process active
https://bugs.webkit.org/show_bug.cgi?id=224328
<rdar://problem/76370805>
Reviewed by Eric Carlson.
Testing of the GPU Process show that access to the CoreMedia routing service is still needed under
some use cases. To prevent user-facing impact, we will allow these connections while the underlying
issues are resolved.
* UIProcess/WebPageProxy.cpp:
(WebKit::temporaryMachServices): Added.
(WebKit::WebPageProxy::creationParameters): Extend access to the set of temporaryMachServices when
the GPU Process is enabled.
2021-04-08 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, fix the internal build after r275640
https://bugs.webkit.org/show_bug.cgi?id=224239
* WebKit.xcodeproj/project.pbxproj:
This source file was added to the project as a compilation target, but it also appears in unified sources; this
causes the `encode` and `decode` methods to be defined twice, leading to a linker error. Fix this by only
including it as a unified source.
2021-04-08 Jer Noble <jer.noble@apple.com>
[Swift] Move the "Copy Additional Sources" Build Phase into the WebKitSwift target
https://bugs.webkit.org/show_bug.cgi?id=224330
Reviewed by Eric Carlson.
Avoid a dependency cycle (WebKit -> WebKitSwift -> WebKit) due to the Copy Additional Sources phase by moving
that phase to the WebKitSwift target itself.
* WebKit.xcodeproj/project.pbxproj:
2021-04-08 Sihui Liu <sihui_liu@apple.com>
Remove logging for investigating http/tests/IndexedDB/storage-limit-1.html failure
https://bugs.webkit.org/show_bug.cgi?id=223086
<rdar://problem/75591816>
Reviewed by Chris Dumez.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::storageQuotaManager):
(WebKit::NetworkProcess::setQuotaLoggingEnabled): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetQuotaLoggingEnabled): Deleted.
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::setQuotaLoggingEnabled): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setQuotaLoggingEnabled): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-04-08 Kimmo Kinnunen <kkinnunen@apple.com>
Difficult to understand which IPC message caused an ASSERT due to being not handled
https://bugs.webkit.org/show_bug.cgi?id=224269
Reviewed by Chris Dumez.
Add the message name and destination ID to the assertion message about
unhandled IPC message.
* Scripts/webkit/messages.py:
(generate_message_handler):
* Scripts/webkit/tests/TestWithIfMessageMessageReceiver.cpp:
(WebKit::TestWithIfMessage::didReceiveMessage):
* Scripts/webkit/tests/TestWithImageDataMessageReceiver.cpp:
(WebKit::TestWithImageData::didReceiveMessage):
(WebKit::TestWithImageData::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp:
(WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage):
(WebKit::TestWithLegacyReceiver::didReceiveSyncTestWithLegacyReceiverMessage):
* Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp:
(WebKit::TestWithSemaphore::didReceiveMessage):
(WebKit::TestWithSemaphore::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithStreamBufferMessageReceiver.cpp:
(WebKit::TestWithStreamBuffer::didReceiveMessage):
* Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp:
(WebKit::TestWithStream::didReceiveStreamMessage):
* Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp:
(WebKit::TestWithSuperclass::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
(WebKit::TestWithoutAttributes::didReceiveSyncMessage):
2021-04-02 Darin Adler <darin@apple.com>
Use Hasher more, remove IntegerHasher, fix hashing-related mistakes
https://bugs.webkit.org/show_bug.cgi?id=224138
Reviewed by Chris Dumez.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: Added now-needed include
of URLHash.h, since we removed it from a widely-included header.
* NetworkProcess/cache/NetworkCache.h:
(WebKit::NetworkCache::GlobalFrameID::hash const): Use computeHash
instead of combining intHash with StringHasher::hashMemory. This fixes
two mistakes: one is that there is no need to hash a hash. The second is
that intHash takes a 32-bit integer as its parameter, so high bits
of object identifiers were discarded unnecessarily.
* Scripts/webkit/messages.py: Added code so that if URL is in an argument, we include the
URLHash.h header. Would be better to just use URL.h and use URLHash.h only if it's a
HashMap<URL>, but currently the script does not distinguish those cases. This wasn't needed
before becuase a widely included header was always pulling in URLHash.h.
* Shared/API/Cocoa/WKBrowsingContextHandle.mm:
(-[WKBrowsingContextHandle hash]): Use computeHash instead of pairIntHash.
This fixes a mistake: pairIntHash takes two 32-bit integers, so high bits
of object identifiers were discarded unnecessarily.
* NetworkProcess/Storage/WebSWContextManagerConnection.h: Added now-needed include
of URLHash.h, since we removed it from a widely-included header.
2021-04-07 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r275614; make sure SWIFT_VERSION is defined inside the WebKitSwift build target.
* Configurations/WebKitSwift.xcconfig:
2021-04-07 Ada Chan <ada.chan@apple.com>
[WebXR] Introduce XRDeviceIdentifier and XRDeviceInfo to be used to communicate device info
https://bugs.webkit.org/show_bug.cgi?id=224239
Reviewed by Tim Horton.
These classes are codable so they can be used in messages across UI/web process boundary.
In a future patch, these classes will be used to create device objects returned from
WebChromeClient::enumerateImmersiveXRDevices().
* Shared/Cocoa/XRDeviceIdentifier.h: Added.
This codable type will be used to identify a device.
* Shared/Cocoa/XRDeviceInfo.h: Added.
* Shared/Cocoa/XRDeviceInfo.mm: Added.
(WebKit::XRDeviceInfo::encode const):
(WebKit::XRDeviceInfo::decode):
* Shared/WebCoreArgumentCoders.h:
Add EnumTraits for PlatformXR::ReferenceSpaceType so we can encode it.
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-04-07 Michael Catanzaro <mcatanzaro@gnome.org>
[GTK] webkit://gpu should print runtime libwpe and wpebackend-fdo versions
https://bugs.webkit.org/show_bug.cgi?id=224298
Reviewed by Adrian Perez de Castro.
* UIProcess/API/glib/WebKitProtocolHandler.cpp:
(WebKit::WebKitProtocolHandler::handleGPU):
2021-04-07 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Incorrect selector used to set logging level
https://bugs.webkit.org/show_bug.cgi?id=224292
<rdar://problem/75379660>
Reviewed by John Wilander.
Use {public} declarations so we get logging in release builds. These strings
are not sensitive.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID):
2021-04-07 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Incorrect selector used to set logging level
https://bugs.webkit.org/show_bug.cgi?id=224292
<rdar://problem/75379660>
Reviewed by John Wilander.
The wrong selector label was used to configure the low-level network logging level.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID):
2021-04-07 Alex Christensen <achristensen@webkit.org>
Use os_transaction_create instead of deprecated xpc_transaction_begin/end
https://bugs.webkit.org/show_bug.cgi?id=224288
Reviewed by Tim Horton.
xpc_transaction_begin/end are deprecated with os_transaction_t being the replacement.
The transaction object makes it easier to associate a transaction's begin and end with each other,
and it adds a name, which makes system level debugging of what transactions are happening in which
processes much nicer.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::osTransaction):
(WebKit::XPCServiceExit):
2021-04-07 Jer Noble <jer.noble@apple.com>
[Cocoa] Add WebKitAdditions sources to project
https://bugs.webkit.org/show_bug.cgi?id=223803
Reviewed by Eric Carlson.
Enabling swift compilation requires modularization of the WebKit project,
but some of the headers in the WebKitLegacy.h umbrella header conflict with
filenames in the WebKit project, and can't be included in Objective-C or
Swift sources. To work around this issue for now, add "#if defined(__cplusplus)"
guards around those headers.
* Configurations/WebKit.xcconfig:
* UIProcess/API/Cocoa/WebKitLegacy.h:
* UIProcess/WebBackForwardList.h:
* UIProcess/WebPreferences.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebFrame.h:
2021-04-07 Michael Catanzaro <mcatanzaro@gnome.org>
[WPE][GTK] Null pointer dereference when child process exits immediately
https://bugs.webkit.org/show_bug.cgi?id=224209
Reviewed by Carlos Garcia Campos.
We discovered that when the child process exits immediately after it is spawned,
g_subprocess_get_identifier() will return nullptr. In this case, we should crash cleanly
with SIGABRT via g_error(), rather than crashing with a null pointer dereference inside
g_ascii_strtoll(). SIGABRT is much nicer than SIGSEGV and indicates that we really do want
to crash here, whereas SIGSEGV is just a bug.
Also, let's be careful with our terminology in the existing error message here. Although
GSubprocess currently always forks, I'm working to make it use posix_spawn() instead, so
let's not claim that fork() has failed when it soon might not be used at all.
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
2021-04-07 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r275571 and r275537, which introduced conflicting changes.
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]):
(-[WKMediaSessionCoordinatorHelper playSessionWithCompletion:]):
2021-04-06 Wenson Hsieh <wenson_hsieh@apple.com>
Address some post-landing comments after r275491
https://bugs.webkit.org/show_bug.cgi?id=224126
Reviewed by Darin Adler.
Address some minor feedback; no change in behavior.
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::createMenuActionItem):
Remove an unnecessary local variable.
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
Use `WTF::URL` instead of `NSURL`, and remove a header import that is now unnecessary.
(WebKit::WebContextMenuProxyMac::getContextMenuItem):
Remove some more unnecessary local variables.
2021-04-06 Jer Noble <jer.noble@apple.com>
[MediaSession] Add optional mediaTime and hostTime arguments to the playSession() command.
https://bugs.webkit.org/show_bug.cgi?id=224173
Reviewed by Eric Carlson.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::playSession):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::playSession):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.messages.in:
2021-04-06 Brent Fulgham <bfulgham@apple.com>
Add additional page load diagnostic logging
https://bugs.webkit.org/show_bug.cgi?id=224194
<rdar://problem/76227175>
Reviewed by Alex Christensen.
This patch adds new logging to help us diagnose and investigate page load failures.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didClose): Log when the connection from a WebProcess requesting a load
is closed.
(WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier): Log when the WebProcess requests a load
identifier be removed (and cancelled).
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::restartNetworkLoad): Log when an in-process load is cancelled so that the load
can be restarted.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didClose): Log when the network process crashes.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didClose): Add logging when the WebProcess crashes.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad): Remove an erroneous log message that made it appear that no URL handler
had been called. The log message was generated when a normal network load handler was executed, leading to
confusing troubleshooting logs.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::registerURLSchemeHandler): Log when a web page registers a custom URL handler, and for which scheme.
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::pageIDFromWebFrame): Added helper.
(WebKit::frameIDFromWebFrame): Ditto.
(WebKit::WebURLSchemeTaskProxy::startLoading): Add logging to track progress of custom URL handlers.
(WebKit::WebURLSchemeTaskProxy::stopLoading): Ditto.
(WebKit::WebURLSchemeTaskProxy::didPerformRedirection): Ditto.
(WebKit::WebURLSchemeTaskProxy::didReceiveResponse): Ditto.
(WebKit::WebURLSchemeTaskProxy::didReceiveData): Ditto.
(WebKit::WebURLSchemeTaskProxy::didComplete): Ditto.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::networkProcessConnectionClosed): Add logging that the network process crashed.
2021-04-06 Devin Rousso <drousso@apple.com>
[iOS] contextmenu hints can be clipped by the WKWebView
https://bugs.webkit.org/show_bug.cgi?id=224204
<rdar://problem/75504620>
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView cleanUpRelatedViews]): Added.
(-[WKContentView _didScroll]):
(-[WKContentView textEffectsWindow]):
(-[WKContentView _createPreviewContainerWithLayerName:]):
(-[WKContentView containerForDropPreviews]):
(-[WKContentView containerForDragPreviews]):
(-[WKContentView containerForContextMenuHintPreviews]):
(-[WKContentView _hideTargetedPreviewContainerViews]):
(-[WKContentView _updateTargetedPreviewViewsContainerViewFrameIfNeeded]): Added.
(-[WKContentView _removeTargetedPreviewViewsContainerViewIfPossible]): Added.
(-[WKContentView _updateTargetedPreviewScrollViewUsingContainerScrollingNodeID:]): Added.
(-[WKContentView cleanUpDragSourceSessionState]):
(-[WKContentView _createTargetedContextMenuHintPreviewForFocusedElement]):
(-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]):
(-[WKContentView _removeContextMenuViewIfPossible]):
(-[WKContentView dropInteraction:concludeDrop:]):
(-[WKContentView overridePositionTrackingViewForTargetedPreviewIfNecessary:containerScrollingNodeID:]): Deleted.
Instead of attaching the contextmenu hint container (`_contextMenuHintContainerView`) to
the `WKWebView` (via the `_interactionViewsContainerView`), attach it to a new container
(`_targetedPreviewViewsContainerView`) under the `UITextEffectsWindow` so that if the
contextmenu target is near the edge of the `WKWebView` then the shadow of the contextmenu
hint will not be clipped by the `WKWebView`. Whenever any view is scrolled, adjust the
`frame` of the `_targetedPreviewViewsContainerView` so that the contextmenu hint moves.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didMoveToWindow]):
Call `-cleanUpRelatedViews` if no longer attached to a `window` so that the
`_targetedPreviewViewsContainerView` is not left behind if the `WKWebView` is moved.
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollView const): Added.
`ScrollingTreeFrameScrollingNodeRemoteIOS` also has a corresponding `UIScrollView`.
* Platform/spi/ios/UIKitSPI.h:
Remove no longer needed SPI now that WebKit manages the position of the contextmenu hint.
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay label style cleanup
https://bugs.webkit.org/show_bug.cgi?id=224240
Reviewed by BJ Burg.
Mirror changes to constants from `WebCore::InspectorOverlay`.
* UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(createLayoutLabelLayer):
(-[WKInspectorHighlightView _createGridOverlayLayer:scale:]):
2021-04-06 Mike Gorse <mgorse@suse.com>
Build fails when video is disabled
https://bugs.webkit.org/show_bug.cgi?id=224198
Reviewed by Adrian Perez de Castro.
Add #if ENABLE(VIDEO) where needed.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
* UIProcess/gtk/ClipboardGtk3.cpp:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::committedLoad):
2021-04-06 Fujii Hironori <Hironori.Fujii@sony.com>
Add IPC::Semaphore stub for Unix ports
https://bugs.webkit.org/show_bug.cgi?id=224223
Reviewed by Don Olmstead.
PlayStation, GTK and WPE ports don't use it yet. Just add stubs
instead of scattering #if everywhere using Semaphore.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::populateGetImageDataSharedMemory):
* Platform/IPC/StreamClientConnection.cpp:
(IPC::StreamClientConnection::setWakeUpSemaphore):
(IPC::StreamClientConnection::wakeUpServer):
* Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::tryAcquire):
(IPC::StreamClientConnection::tryAcquireAll):
* Platform/IPC/StreamConnectionWorkQueue.cpp:
(IPC::StreamConnectionWorkQueue::StreamConnectionWorkQueue):
(IPC::StreamConnectionWorkQueue::removeStreamConnection):
(IPC::StreamConnectionWorkQueue::stop):
(IPC::StreamConnectionWorkQueue::wakeUp):
(IPC::StreamConnectionWorkQueue::wakeUpProcessingThread):
* Platform/IPC/StreamConnectionWorkQueue.h:
* Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnectionBase::release):
(IPC::StreamServerConnectionBase::releaseAll):
* Platform/IPC/unix/IPCSemaphoreUnix.cpp: Added.
(IPC::Semaphore::Semaphore):
(IPC::Semaphore::signal):
(IPC::Semaphore::wait):
(IPC::Semaphore::waitFor):
(IPC::Semaphore::encode const):
(IPC::Semaphore::decode):
(IPC::Semaphore::destroy):
* PlatformPlayStation.cmake:
* Sources.txt:
* SourcesGTK.txt:
* SourcesWPE.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::waitForGetImageDataToComplete):
(WebKit::RemoteRenderingBackendProxy::didAppendData):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::startRenderingThread):
(WebKit::RemoteAudioDestinationProxy::stopRenderingThread):
2021-04-06 Ryosuke Niwa <rniwa@webkit.org>
Delay the end of printing while PrintContext is in use.
https://bugs.webkit.org/show_bug.cgi?id=224229
Reviewed by Antti Koivisto.
Added a new RAII object, PrintContextAccessScope, to delay the call to endPrinting
and deployed in various IPC messages used during printing.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::beginPrinting): Deployed PrintContextAccessScope.
(WebKit::WebPage::endPrinting): Exit early without ending printing if there is an active
PrintContextAccessScope in the stack.
(WebKit::WebPage::endPrintingImmediately): Extracted from endPrintingImmediately.
(WebKit::WebPage::computePagesForPrinting): Deployed PrintContextAccessScope.
(WebKit::WebPage::computePagesForPrintingImpl): Ditto.
(WebKit::WebPage::drawRectToImage): Ditto.
(WebKit::WebPage::drawPagesToPDF): Ditto.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::PrintContextAccessScope): Added.
(WebKit::WebPage::PrintContextAccessScope::PrintContextAccessScope): Added.
(WebKit::WebPage::PrintContextAccessScope::~PrintContextAccessScope): Added.
2021-04-06 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r274610): Unable to drag images when image extraction is enabled
https://bugs.webkit.org/show_bug.cgi?id=224211
<rdar://problem/76229563>
Reviewed by Tim Horton.
r274610 introduced a new deferring gesture recognizer intended to prevent several text interaction gestures from
recognizing during pending image extraction. However, this also causes dragging on iOS to fail, since the
gesture used to initiate dragging is excluded by the new deferring gesture recognizer. To fix this, allow the
new deferring gesture to recognize simultaneously alongside all gestures with the exception of only the gestures
it is intended to defer (i.e. text interaction gestures).
Test: fast/events/ios/dragstart-on-image-by-long-pressing.html
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _isAnimatingDragCancel]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[UIGestureRecognizer _wk_isTapAndAHalf]):
Add a WebKit category method that returns whether or not a gesture recognizer is a tap-and-a-half gesture.
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
Allow the image extraction deferring gesture to recognize alongside all other gestures, with the exception of
the text interaction gestures determined by `-shouldDeferGestureDueToImageExtraction:`. This limits the impact
of this new deferring gesture, such that it only affects the text interaction gestures it is intended to defer.
(-[WKContentView shouldDeferGestureDueToImageExtraction:]):
Add a helper method to determine whether or not a gesture recognizer should be deferred, due to pending image
extraction. We pull this logic behind a helper method because it's now consulted from two call sites.
(-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
(-[WKContentView isAnimatingDragCancel]):
Add a testing hook to return whether or not the drag cancel animation is running. See Tools/ChangeLog and the
new layout test for more detail.
(tapAndAHalfRecognizerClass): Deleted.
2021-04-06 Alex Christensen <achristensen@webkit.org>
Hold strong reference to xpc_connection_t in XPCServiceEventHandler
https://bugs.webkit.org/show_bug.cgi?id=224242
<rdar://74308418>
Reviewed by David Kilzer.
There is a reasonable chance that by the time we get to the block of xpc_connection_set_event_handler
and back through WorkQueue::main().dispatchSync the xpc_connection_t has been freed.
Also, the adoption in each entry points was incorrect, causing a late overrelease when tearing down the process.
It was incorrect because we did not just create the connection or get it from any NS_RETURNS_RETAINED-like function.
It was causing rare crashes once everything else had released their hold on the connection.
* GPUProcess/EntryPoint/Cocoa/XPCService/GPUServiceEntryPoint.mm:
(GPU_SERVICE_INITIALIZER):
* NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm:
(NETWORK_SERVICE_INITIALIZER):
* PluginProcess/EntryPoint/Cocoa/XPCService/PluginServiceEntryPoint.mm:
(PLUGIN_SERVICE_INITIALIZER):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnServiceEntryPoint.mm:
(WEBAUTHN_SERVICE_INITIALIZER):
* WebProcess/EntryPoint/Cocoa/XPCService/WebContentServiceEntryPoint.mm:
(WEBCONTENT_SERVICE_INITIALIZER):
2021-04-06 Brent Fulgham <bfulgham@apple.com>
[macOS] Allow access to 'com.apple.system.logger' in the Base System
https://bugs.webkit.org/show_bug.cgi?id=224241
<rdar://problem/75960194>
Reviewed by Alex Christensen.
Deeper testing has revealed that some test configurations used internally require access to 'com.apple.system.logger' in the base
system to support certain diagnostic operations outside the normal user release logging paths.
This patch restores access to the 'com.apple.system.logger' endpoint when running in the Base System.
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-06 Eric Carlson <eric.carlson@apple.com>
[macOS] Add MediaSessionCoordinator API test
https://bugs.webkit.org/show_bug.cgi?id=224140
<rdar://problem/76171173>
Reviewed by Jer Noble.
* Sources.txt: Include RemoteMediaSessionCoordinatorProxy.cpp and RemoteMediaSessionCoordinator.cpp
so they don't have to be included in the Xcode project.
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: Declare enums, struct, and protocols
necessary to implement and use an object derived from MediaSessionCoordinatorProxyPrivate.
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]): New private
method to create a MediaSessionCoordinatorProxyPrivate.
(-[WKMediaSessionCoordinatorHelper initWithCoordinator:]):
(-[WKMediaSessionCoordinatorHelper seekSessionToTime:withCompletion:]):
(-[WKMediaSessionCoordinatorHelper playSessionWithCompletion:]):
(-[WKMediaSessionCoordinatorHelper pauseSessionWithCompletion:]):
(-[WKMediaSessionCoordinatorHelper setSessionTrack:withCompletion:]):
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::mediaSessionCoordinatorForTesting): MediaSessionCoordinatorProxyPrivate
getter.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setMediaSessionCoordinatorForTesting): Setter for
MediaSessionCoordinatorProxyPrivate drived object.
* UIProcess/Media/MediaSessionCoordinatorProxyPrivate.h: Add typedef for the completion
handler used by many coordinator proxy methods.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::RemoteMediaSessionCoordinatorProxy):
Set the private coordinator client so calls to the session can be forwarded.
(WebKit::RemoteMediaSessionCoordinatorProxy::join): Use MediaSessionCommandCompletionHandler.
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSeekTo): Ditto.
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePlay): Ditto.
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePause): Ditto.
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSetTrack): Ditto.
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatorStateChanged): Ditto.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createMediaSessionCoordinator): Change completion handler
parameter to return a bool instead of a RemoteMediaSessionCoordinatorProxy as the
client interface provides all of the session access needed.
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj: Remove RemoteMediaSessionCoordinatorProxy.cpp
and RemoteMediaSessionCoordinator.cpp
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::join): Use ExceptionData's toException()
method instead of creating an Exception directly. Remove the destination ID parameter
to sendWithAsyncReply so messageSenderDestinationID() will be used.
(WebKit::RemoteMediaSessionCoordinator::leave): Ditto.
(WebKit::RemoteMediaSessionCoordinator::seekTo) Ditto.:
(WebKit::RemoteMediaSessionCoordinator::play): Ditto.
(WebKit::RemoteMediaSessionCoordinator::pause): Ditto.
(WebKit::RemoteMediaSessionCoordinator::setTrack): Ditto.
(WebKit::RemoteMediaSessionCoordinator::positionStateChanged): Ditto.
(WebKit::RemoteMediaSessionCoordinator::readyStateChanged): Ditto.
(WebKit::RemoteMediaSessionCoordinator::playbackStateChanged): Ditto.
(WebKit::RemoteMediaSessionCoordinator::coordinatorStateChanged): Ditto.
2021-04-06 Aditya Keerthi <akeerthi@apple.com>
[iOS] Prevent background blur when presenting date/time pickers
https://bugs.webkit.org/show_bug.cgi?id=224189
<rdar://problem/76220352>
Reviewed by Wenson Hsieh.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker _contextMenuInteraction:styleForMenuWithConfiguration:]):
Presenting a UIContextMenuInteraction results in the application of a
blur effect to the background view. However, the peripheral presented
when interacting with a UIDatePicker across the rest of the system
does not blur the background.
To align our behavior with the rest of the system, remove the blur
effect by specifying an empty UIVisualEffect for the
_UIContextMenuStyle's preferredBackgroundEffects. The empty effect
must be explicitly specified, since setting an empty array will result
in the default effect being applied.
2021-04-06 Alex Christensen <achristensen@webkit.org>
Revert part of crash fix to keep test infrastructure
https://bugs.webkit.org/show_bug.cgi?id=224196
These two tests change the bundle identifier to test what it's like to not be in a test:
http/tests/in-app-browser-privacy/app-bound-domain-gets-app-bound-session.html
http/tests/in-app-browser-privacy/non-app-bound-iframe-under-app-bound-domain-is-app-bound.html
This partial revert of r275486 allows the test to dynamically change whether it's in testing mode.
* Shared/Cocoa/DefaultWebBrowserChecks.mm:
(WebKit::doesParentProcessHaveITPEnabled):
(WebKit::isParentProcessAFullWebBrowser):
2021-04-06 Peng Liu <peng.liu6@apple.com>
[GPUP] Clean up two messages.in files
https://bugs.webkit.org/show_bug.cgi?id=224153
Reviewed by Eric Carlson.
No new tests, no functional change.
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
2021-04-06 Tyler Wilcock <twilco.o@protonmail.com>
Non-unified build fixes, early April 2021
https://bugs.webkit.org/show_bug.cgi?id=224091
Reviewed by Simon Fraser.
The SelectionRestorationMode enum has been moved out of Document.h so
the entirety of Document.h doesn't need to be included just for that
enum.
* WebProcess/WebPage/WebPage.cpp:
Add #include "SelectionRestorationMode.h".
2021-04-06 Youenn Fablet <youenn@apple.com>
Release WebRTC remote encoder/decoder callback lock right after having changed the encoder/decoder callback
https://bugs.webkit.org/show_bug.cgi?id=224228
<rdar://74560516>
Reviewed by Eric Carlson.
We were locking the callback lock, changing the callback and hopping to codec map thread to free the encoder/decoder.
Then we were unlocking the callback lock.
There was a chance that the encoder/decoder gets freed in the codec map thread before we unlock its callback lock.
Given that we nullify the callback in decoder/encoder Release before going to destructor, we can just remove the lock/nullify code.
Covered by existing test sets.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::releaseDecoder):
(WebKit::LibWebRTCCodecs::releaseEncoder):
2021-04-06 Alex Christensen <achristensen@webkit.org>
Remove definition used for staging change with internal repo
https://bugs.webkit.org/show_bug.cgi?id=224196
* Shared/Cocoa/DefaultWebBrowserChecks.h:
This definition was used to help me land the patch without breaking the internal build.
Now that I've used it to adapt to the open source changes, I can remove it.
2021-04-06 Aditya Keerthi <akeerthi@apple.com>
[iOS] Update UIDatePickerStyle for <input type=time>
https://bugs.webkit.org/show_bug.cgi?id=224187
<rdar://problem/76219729>
Reviewed by Wenson Hsieh.
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker datePickerStyle]):
Use UIDatePickerStyleWheels rather than UIDatePickerStyleInline, since
the inline style now requires an additional tap to present the editable
picker view.
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay does not honor writing modes and RTL layout direction.
https://bugs.webkit.org/show_bug.cgi?id=224127
Reviewed by BJ Burg.
* UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(createLayoutLabelLayer):
- WebCore::backgroundPathForLayoutLabel now treats the `None` arrow direction as being centered on the label's
location.
2021-04-06 Philippe Normand <pnormand@igalia.com>
[WPE] Enable Cog's GTK4 backend
https://bugs.webkit.org/show_bug.cgi?id=224099
Reviewed by Adrian Perez de Castro.
* wpe/wpe-webkit-uninstalled.pc.in: Fix paths to derived sources.
2021-04-06 Ian Gilbert <iang@apple.com>
IPC::decodeObject null dereference in decodeArrayInternal()
https://bugs.webkit.org/show_bug.cgi?id=224214
Reviewed by Ryosuke Niwa.
Add null pointer check to decodeArrayInternal.
Test: ipc/decode-object-array-crash.html
* Shared/Cocoa/ArgumentCodersCocoa.mm:
(IPC::decodeArrayInternal):
2021-04-05 Jiewen Tan <jiewen_tan@apple.com>
Allow the WebAuthn UI to inform users about BiometryLockout
https://bugs.webkit.org/show_bug.cgi?id=224124
<rdar://74815938>
Reviewed by Brent Fulgham.
* UIProcess/WebAuthentication/Cocoa/LocalService.mm:
(WebKit::LocalService::isAvailable):
The LocalService is still available within the BiometryLockout period.
2021-04-05 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Image preview context menu action should be shown conditionally
https://bugs.webkit.org/show_bug.cgi?id=224126
<rdar://problem/76162272>
Reviewed by Devin Rousso.
Add a page client hook to return whether or not the "reveal image" context menu item should be enabled, given
the image URL and decoded image bitmap; we then use this method to conditionally insert a context menu item for
revealing the image in context menu data.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/PageClient.h:
(WebKit::PageClient::computeCanRevealImage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::computeCanRevealImage):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::computeCanRevealImage):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::createMenuActionItem):
Pull logic for mapping a `WebContextMenuItemData` of type `ActionType` or `CheckableActionType` to a platform
`NSMenuItem` out into a separate helper function. Use this helper in `getContextMenuItem`, as well as the
completion handler for the call to `computeCanRevealImage`. Note that this also requires moving the
`menuItemIdentifier` function up above `getContextMenuFromItems`.
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
Special case the `ContextMenuItemTagRevealImage` item; instead of adding this item to the context menu right
away, we hide it by default, and only reinsert it if the page client indicates that we require the item (via
`computeCanRevealImage`).
(WebKit::WebContextMenuProxyMac::getContextMenuItem):
2021-04-05 Alex Christensen <achristensen@webkit.org>
REGRESSION(r267763) NetworkProcess never terminates
https://bugs.webkit.org/show_bug.cgi?id=224191
<rdar://problem/76124590>
Reviewed by Chris Dumez.
Before r267763, when a WebProcessPool was deallocated, the NetworkProcess it owned was terminated.
Since then, once you start using a NetworkProcess, it will be kept until your app closes or it crashes.
To reclaim these resources in a way similar to how we did before, we now terminate the network process in two situations:
1. If all WebsiteDataStores associated with it are deallocated. This happens if you have never used the default WKWebsiteDataStore.
2. If all WebProcessPools are deallocated. This can still happen if you do use the default WKWebsiteDataStore, which is never deallocated.
Covered by API tests.
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _defaultNetworkProcessExists]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::defaultNetworkProcessExists):
(WebKit::NetworkProcessProxy::removeSession):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::~WebProcessPool):
2021-04-05 Alex Christensen <achristensen@webkit.org>
Reduce crash inside getAuditToken
https://bugs.webkit.org/show_bug.cgi?id=224196
<rdar://74536285>
Reviewed by David Kilzer.
Something is crashing inside the call to getAuditToken, and I believe it is happening during teardown of the network process.
After many days of head scratching and many previous attempts at fixing this problem, it persists.
Since direct strategies at fixing this problem have failed, I now try something different.
Instead of calling getAuditToken at the beginning of every resource load to ask if the parent process has an entitlement,
I now call it only once per process. That should make things faster and less crashy. Otherwise no change in behavior.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::activateSessionCleanup):
(WebKit::NetworkSessionCocoa::sessionWrapperForTask):
* Shared/Cocoa/DefaultWebBrowserChecks.h:
* Shared/Cocoa/DefaultWebBrowserChecks.mm:
(WebKit::doesParentProcessHaveITPEnabled):
(WebKit::isParentProcessAFullWebBrowser):
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
(WebKit::WebCore::isWebBrowser):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::isParentProcessAWebBrowser const):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure we no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782
<rdar://problem/67698601>
Reviewed by Darin Adler.
Make sure we no longer show the previous page when running a JS prompt.
If we have not yet done a layer tree commit since the last load commit, then
we are likely still showing the previous page. If we are asked to run a JS
prompt / alert / confirm at this point, it would be confusing to still show
the previous page. In order to address the issue, we now make the view blank
in such scenario (ideally, we'd have painted the new page but this is
currently not a trivial thing to do).
To make the view blank, the approach chosen is the set the opacity of our
root layer to 0 when the JS prompt is requested (before the first paint) and
set the opacity back to 1 after the first paint.
To minimize the risks of breakage, the behavior change is behind a
linked-on-after check. Also, we only trigger this behavior if the WKWebView
client actually implements the corresponding JS prompt delegate.
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::runJavaScriptAlert):
(WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
(WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
* UIProcess/PageClient.h:
(WebKit::PageClient::makeViewBlank):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
(WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::runJavaScriptAlert):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::makeViewBlank):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didCommitLayerTree):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::makeViewBlank):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
Add flag to make sure pending async messages are processed *before* the JS prompt sync IPCs.
Without this, it was possible for the UIProcess to receive the JS prompt IPC *before* the
DidCommitLoadForFrame IPC, which would confuse our logic, since we would think this is a JS
prompt for the previous page.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::sendSyncWithDelayedReply):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updateRendering):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::didUpdateRendering):
2021-04-05 Alex Christensen <achristensen@webkit.org>
Resurrect Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=224084
Reviewed by Tim Horton.
* NetworkProcess/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::PrivateClickMeasurementNetworkLoader::didReceiveBuffer):
* PlatformMac.cmake:
* Shared/Cocoa/SandboxExtensionCocoa.mm:
* SourcesCocoa.txt:
* UIProcess/Media/MediaSessionCoordinatorProxyPrivate.h:
2021-04-05 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION: ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() on various tests
https://bugs.webkit.org/show_bug.cgi?id=209450
<rdar://problem/60799255>
Reviewed by Tim Horton.
See WebCore for more details.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::textAutosizingUsesIdempotentModeChanged):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::textAutosizingUsesIdempotentModeChanged):
Stop the idempotent text autosizing recomputation timer (`m_textAutoSizingAdjustmentTimer`) when idempotent text
autosizing is disabled.
* WebProcess/WebPage/WebPage.h:
2021-04-05 Chris Dumez <cdumez@apple.com>
Protect frame in WebPage::runJavaScriptInFrameInScriptWorld()
https://bugs.webkit.org/show_bug.cgi?id=224210
Reviewed by Alex Christensen.
Between the time we were getting the raw pointer to the frame, and the time were were passing it to
WebPage::runJavaScript(), we were potentially calling WebFrameLoaderClient::dispatchGlobalObjectAvailable().
It is possible in theory for those synchronous injected bundle calls to mess with the frame tree and cause
our frame to go bad. As a result, it is best to protect the frame as soon as we get it.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
2021-04-05 Wenson Hsieh <wenson_hsieh@apple.com>
Add a missing bounds check when mapping display list items from a shared display list handle
https://bugs.webkit.org/show_bug.cgi?id=224156
<rdar://problem/71805209>
Reviewed by Tim Horton.
Add a check to ensure that we don't end up with out-of-bounds memory access when attempting to map an `offset`
and `capacity` in shared display list data into a `WebCore::DisplayList`. It's possible for this to happen if
either the sum of `offset` and `capacity` (i.e. the extent of the mapped segment) overflows `size_t`, or the
extent exceeds the total length of the buffer in shared memory.
* GPUProcess/graphics/DisplayListReaderHandle.cpp:
(WebKit::DisplayListReaderHandle::displayListForReading const):
Note that returning `nullptr` here subsequently causes us to terminate the web process due to the message check
for `displayList` inside `nextDestinationImageBufferAfterApplyingDisplayLists`.
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure service workers use a ScriptSourceCode backed by file-mapped memory when possible
https://bugs.webkit.org/show_bug.cgi?id=224088
Reviewed by Yusuke Suzuki.
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::didFinishLoading):
2021-04-05 Fujii Hironori <Hironori.Fujii@sony.com>
[Win][WK2] Implement IPC::Semaphore to run WebGL in GPU process
https://bugs.webkit.org/show_bug.cgi?id=224014
Reviewed by Don Olmstead.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
* GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp: Added.
(WebKit::RemoteGraphicsContextGL::create):
(WebKit::RemoteGraphicsContextGLWin::RemoteGraphicsContextGLWin):
(WebKit::RemoteGraphicsContextGLWin::platformWorkQueueInitialize):
(WebKit::RemoteGraphicsContextGL::prepareForDisplay):
* Platform/IPC/IPCSemaphore.cpp:
* Platform/IPC/IPCSemaphore.h:
* Platform/IPC/StreamClientConnection.cpp:
(IPC::StreamClientConnection::setWakeUpSemaphore):
(IPC::StreamClientConnection::wakeUpServer):
* Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::tryAcquire):
(IPC::StreamClientConnection::tryAcquireAll):
* Platform/IPC/StreamConnectionWorkQueue.cpp:
(IPC::StreamConnectionWorkQueue::StreamConnectionWorkQueue):
(IPC::StreamConnectionWorkQueue::removeStreamConnection):
(IPC::StreamConnectionWorkQueue::stop):
(IPC::StreamConnectionWorkQueue::wakeUp):
(IPC::StreamConnectionWorkQueue::wakeUpProcessingThread):
* Platform/IPC/StreamConnectionWorkQueue.h:
* Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnectionBase::release):
(IPC::StreamServerConnectionBase::releaseAll):
* Platform/IPC/win/IPCSemaphoreWin.cpp: Added.
(IPC::Semaphore::Semaphore):
(IPC::Semaphore::~Semaphore):
(IPC::Semaphore::operator=):
(IPC::Semaphore::signal):
(IPC::Semaphore::wait):
(IPC::Semaphore::waitFor):
(IPC::Semaphore::encode const):
(IPC::Semaphore::decode):
(IPC::Semaphore::destroy):
* PlatformWin.cmake:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createGraphicsContextGL const):
2021-04-05 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 1: Require encoding/decoding delegates for non-inline display list items
https://bugs.webkit.org/show_bug.cgi?id=223849
Reviewed by Wenson Hsieh.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-04-05 Jer Noble <jer.noble@apple.com>
[MediaSession] Small refactoring of MediaSession implementation classes
https://bugs.webkit.org/show_bug.cgi?id=224141
Reviewed by Eric Carlson.
A smorgasboard of small refactoring changes:
- MediaSessionCoordinatorProxyPrivate should use an Optional<ExceptionData> rather than
an actual ExceptionData, to handle the case where no exception was encoutered.
- RemoteMediaSessionCoordinatorProxy::create() should just return a Ref, not a RefPtr.
- Logging inside a completion handler requires access to this.
- Add RemoteMediaSessionCoordinatorProxy.cpp to the build.
* UIProcess/Media/MediaSessionCoordinatorProxyPrivate.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::create):
(WebKit::RemoteMediaSessionCoordinatorProxy::RemoteMediaSessionCoordinatorProxy):
(WebKit::RemoteMediaSessionCoordinatorProxy::join):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSeekTo):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePlay):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePause):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSetTrack):
(WebKit::RemoteMediaSessionCoordinatorProxy::pauseSession):
(WebKit::RemoteMediaSessionCoordinatorProxy::setSessionTrack):
(WebKit::RemoteMediaSessionCoordinatorProxy::logChannel const):
(WebKit::RemoteMediaSessionCoordinatorProxy::::coordinateSetTrack): Deleted.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
(WebKit::RemoteMediaSessionCoordinatorProxy::logger const):
(WebKit::RemoteMediaSessionCoordinatorProxy::logIdentifier const):
(WebKit::RemoteMediaSessionCoordinatorProxy::logClassName const):
2021-04-05 Jer Noble <jer.noble@apple.com>
[Cocoa] Calling AudioComponentFetchServerRegistrations on main thread causes launch time regression
https://bugs.webkit.org/show_bug.cgi?id=224137
<rdar://76137483>
Reviewed by Eric Carlson.
Run the command to fetch AudioComponent registration data on a generic background queue.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
2021-04-05 Christopher Reid <chris.reid@sony.com>
[WinCairo] Enable Service Worker tests
https://bugs.webkit.org/show_bug.cgi?id=223591
Reviewed by Fujii Hironori.
WPT HTTP tests were failing because SSL Connect errors weren't triggering authentication challenges.
Also Add a suggestedFilename implementation.
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
* NetworkProcess/curl/NetworkDataTaskCurl.h:
2021-04-05 Peng Liu <peng.liu6@apple.com>
[GPUP][iPad] Audio only when airplaying a youtube video
https://bugs.webkit.org/show_bug.cgi?id=224132
Reviewed by Eric Carlson.
While `MediaPlayerPrivateAVFoundationObjC` only implements `setWirelessPlaybackTarget()`
on macOS, `MediaPlayerPrivateMediaSourceAVFObjC` implements it on both macOS and iOS.
Therefore, `RemoteMediaPlayerProxy` has to forward the calls of `setWirelessPlaybackTarget()`
from WebContent processes to "MediaPlayerPrivate*" on both macOS and iOS.
Manually tested.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget):
2021-04-02 Jer Noble <jer.noble@apple.com>
[GPUP] Power regression: audio hardware is configured for 128 frame preferred buffer size during VideoAudio playback
https://bugs.webkit.org/show_bug.cgi?id=224122
Reviewed by Eric Carlson.
The RemoteAudioHardwareListenerProxy tracks when audio hardware changes, and updates the WebContent process with
the supported properies of the new default audio device, including supported buffer sizes. However, it only does
so when the current audio devices changes, and not initially. Instead, ensure the WebContent process is immediately
update with the correct values for supported buffer sizes. This allows VideoAudio playback to enter a lower-power
playback mode by specifying a large preferred buffer size (4096).
* GPUProcess/media/RemoteAudioHardwareListenerProxy.cpp:
(WebKit::RemoteAudioHardwareListenerProxy::RemoteAudioHardwareListenerProxy):
2021-04-02 Brady Eidson <beidson@apple.com>
Add WKURLSchemeTask redirect API.
https://bugs.webkit.org/show_bug.cgi?id=224119
Reviewed by Alex Christensen.
Covered by new API tests.
Instead of the existing "did do a redirect" SPI without completion handler, this one has
a completion handler with a new request for the task, proposed by WebKit.
* UIProcess/API/Cocoa/WKURLSchemeTask.h:
* UIProcess/API/Cocoa/WKURLSchemeTask.mm:
(raiseExceptionIfNecessary):
(-[WKURLSchemeTaskImpl willPerformRedirection:newRequest:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setURLSchemeHandlerForScheme):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::willPerformRedirection):
(WebKit::WebURLSchemeTask::didPerformRedirection):
(WebKit::WebURLSchemeTask::didReceiveResponse):
(WebKit::WebURLSchemeTask::didReceiveData):
(WebKit::WebURLSchemeTask::didComplete):
* UIProcess/WebURLSchemeTask.h:
(WebKit::WebURLSchemeTask::waitingForRedirectCompletionHandlerCallback const):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::urlSchemeTaskWillPerformRedirection):
(WebKit::WebPage::urlSchemeTaskDidPerformRedirection):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::taskDidPerformRedirection):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
* WebProcess/WebPage/WebURLSchemeTaskProxy.h:
2021-04-02 Chris Dumez <cdumez@apple.com>
Introduce ScriptBuffer class to wrap SharedBuffer containing a script
https://bugs.webkit.org/show_bug.cgi?id=224092
Reviewed by Yusuke Suzuki and Geoff Garen.
Introduce ScriptBuffer class to wrap SharedBuffer containing a script. We started using SharedBuffer to represent
worker scripts instead of String, so that they can hold file mapped data and be shared across processes.
This patch introduces a new ScriptBuffer to wrap those SharedBuffers. The type makes it clearer what type of
data we're dealing with. The helper functions used to convert between String and SharedBuffer can now simply
be member functions on ScriptBuffer. This also simplifies IPC code.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::didSaveScriptsToDisk):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
Use ScriptBuffer instead SharedBuffer.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::tryConvertToShareableResourceHandle):
(IPC::decodeScriptBufferAsShareableResourceHandle):
(IPC::ArgumentCoder<WebCore::ScriptBuffer>::encode):
(IPC::ArgumentCoder<WebCore::ScriptBuffer>::decode):
* Shared/WebCoreArgumentCoders.h:
- Add IPC encoder / decoder for ScriptBuffer which tries to encode / decode as a ShareableResource whenever
possible (single segment that is file mapped). This logic used to be in the ServiceWorkerContextData
coders. Now that the logic is in the ScriptBuffer coder, the ServiceWorkerContextData encoding / decoding
becomes much simpler.
- Moved ServiceWorkerContextData coders from WebCoreArgumentCoders back to its class in WebCore, now that
they no longer need to deal with ShareableResource directly.
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::didSaveScriptsToDisk):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
Send scripts over IPC as ScriptBuffer instead of using ShareableResource directly. The new IPC encoder /
decoder for ScriptBuffer takes care of using ShareableResource for us.
2021-04-02 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r275434.
Need to figure out a better strategy to chose the color
Reverted changeset:
"Make sure we are no longer show the previous page when
running a JS prompt"
https://bugs.webkit.org/show_bug.cgi?id=215782
https://commits.webkit.org/r275434
2021-04-01 Simon Fraser <simon.fraser@apple.com>
Allow wheel events to trigger high frequency DisplayLinks
https://bugs.webkit.org/show_bug.cgi?id=224095
Reviewed by Sam Weinig.
When scrolling via wheel events, we may want to drive scrolling tree updates
(which are driven by EventDispatcher::displayWasRefreshed()) at a higher rate
than the main thread does rendering updates.
To support this, give DisplayLink a count of "full speed" clients, and when this count is
greater than zero, have DisplayLink::notifyObserversDisplayWasRefreshed() send
EventDispatcher IPC at full framerate, while passing a flag based on the usual
relevantForUpdateFrequency() about whether to update the main thread for a given update.
Allow DisplayLink connection info objects with non-zero fullSpeedUpdatesClientCount
to stick around, because that fullSpeedUpdatesClientCount needs to be stored for
connections that may not yet have observers.
Since DisplayLink might have info for connections with no observers, adjust the logic in
DisplayLink::notifyObserversDisplayWasRefreshed() to do the CVDisplayLinkStop
after traversing the observers.
The "full speed" client count is maintained by a HysteresisActivity on WebPageProxy,
whose impulse is wheel events. This replaces a singleton HysteresisActivity which
was used to determine whether IPC goes to EventDispatcher or the main thread of
the web process.
WebPageProxy needs to track the PlatformDisplayID for the screen that its view is on,
so it knows which DisplayLink to message.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::setDisplayLinkForDisplayWantsFullSpeedUpdates):
* UIProcess/WebPageProxy.cpp:
(WebKit::m_wheelEventActivityHysteresis):
(WebKit::WebPageProxy::wheelEventHysteresisUpdated):
(WebKit::WebPageProxy::sendWheelEvent):
(WebKit::WebPageProxy::windowScreenDidChange):
(WebKit::ScrollingObserver::willSendWheelEvent): Deleted.
(WebKit::ScrollingObserver::ScrollingObserver): Deleted.
(WebKit::ScrollingObserver::singleton): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.h:
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::~DisplayLink):
(WebKit::DisplayLink::addObserver):
(WebKit::DisplayLink::removeObserver):
(WebKit::DisplayLink::removeInfoForConnectionIfPossible):
(WebKit::DisplayLink::incrementFullSpeedRequestClientCount):
(WebKit::DisplayLink::decrementFullSpeedRequestClientCount):
(WebKit::DisplayLink::setPreferredFramesPerSecond):
(WebKit::DisplayLink::notifyObserversDisplayWasRefreshed):
* UIProcess/mac/DisplayLink.h:
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::displayWasRefreshed):
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/EventDispatcher.messages.in:
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::startNotificationMechanism):
(WebKit::DisplayRefreshMonitorMac::adjustPreferredFramesPerSecond):
2021-04-02 Chris Dumez <cdumez@apple.com>
Make sure we are no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782
<rdar://problem/67698601>
Reviewed by Simon Fraser.
Make sure we are no longer show the previous page when running a JS prompt.
If we have not yet done a layer tree commit since the last load commit, then
we are likely still showing the previous page. If we are asked to run a JS
prompt / alert / confirm at this point, it would be confusing to still show
the previous page. In order to address the issue, we now make the view blank
in such scenario (ideally, we'd have painted the new page but this is
currently not a trivial thing to do).
To make the view blank, the approach chosen was to add a blank overlay view
on top of the content. This overlay view gets taken down as soon as we
paint the view again.
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _hasBlankOverlay]):
(-[WKWebView _setHasBlankOverlay:]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/PageClientImplCocoa.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::setHasBlankOverlay):
* UIProcess/Cocoa/WKBlankOverlayView.h: Added.
* UIProcess/Cocoa/WKBlankOverlayView.mm: Added.
(-[WKBlankOverlayView initWithFrame:]):
* UIProcess/PageClient.h:
(WebKit::PageClient::setHasBlankOverlay):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didCommitLayerTree):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updateRendering):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::didUpdateRendering):
2021-04-02 Per Arne <pvollan@apple.com>
Add IOKit method filter telemetry
https://bugs.webkit.org/show_bug.cgi?id=223652
<rdar://problem/75751391>
Reviewed by Brent Fulgham.
Add IOKit method filter telemetry in the WebContent sandbox on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-02 Youenn Fablet <youenn@apple.com>
Capture rotation is wrong after Safari is backgrounded then foregrounded
https://bugs.webkit.org/show_bug.cgi?id=224103
Reviewed by Eric Carlson.
WebPage computes rotation either based on rotation notification or viewport notification.
Apply the same technique in UIProcess to let GPUProcess get the right information.
Manually tested.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2021-04-02 Youenn Fablet <youenn@apple.com>
Do not send samples to GPUProcess if mediastream video is not playing
https://bugs.webkit.org/show_bug.cgi?id=224100
<rdar://74809558>
Reviewed by Eric Carlson.
In case video is paused, there is no need to send samples to GPUProcess.
Instead, we can just exit early.
This fixes the issue of freezing camera in case a hidden video element tries to play the camera feed.
Manually tested.
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::play):
(WebKit::SampleBufferDisplayLayer::pause):
(WebKit::SampleBufferDisplayLayer::enqueueSample):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
2021-04-02 John Wilander <wilander@apple.com>
PCM: PrivateClickMeasurementManager::getTokenPublicKey() should not use PrivateClickMeasurement::PcmDataCarried::PersonallyIdentifiable when validating the token before the attribution report is sent
https://bugs.webkit.org/show_bug.cgi?id=223956
<rdar://problem/76086936>
Reviewed by Youenn Fablet.
No new tests. This just changes the NetworkLoadParameters field pcmDataCarried
for the initial public key load and for PCM Debug Mode. This network load setting
is not observable in tests.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
Now sends PrivateClickMeasurement::PcmDataCarried::PersonallyIdentifiable
to PrivateClickMeasurementManager::getTokenPublicKey() since it's required.
(WebKit::generateNetworkLoadParameters):
Now takes the parameter isDebugModeEnabled and if it's true, forces
PrivateClickMeasurement::PcmDataCarried::PersonallyIdentifiable since
Debug Mode disables privacy measures making PCM network requests likely
to be personally identifiable.
(WebKit::generateNetworkLoadParametersForHttpPost):
Now forwards isDebugModeEnabled to generateNetworkLoadParameters().
(WebKit::generateNetworkLoadParametersForHttpGet):
Now forwards isDebugModeEnabled to generateNetworkLoadParameters().
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
Now takes a PrivateClickMeasurement::PcmDataCarried parameter to be able
to request the public key in either network load mode.
Now also forwards isDebugModeEnabled to generateNetworkLoadParameters().
(WebKit::PrivateClickMeasurementManager::fireConversionRequest):
Now sends PrivateClickMeasurement::PcmDataCarried::NonPersonallyIdentifiable
to PrivateClickMeasurementManager::getTokenPublicKey() since it's required.
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
Now forwards isDebugModeEnabled to generateNetworkLoadParameters().
* NetworkProcess/PrivateClickMeasurementManager.h:
2021-04-02 Youenn Fablet <youenn@apple.com>
Use webrtc GPU Process feature flag for audio capture on MacOS
https://bugs.webkit.org/show_bug.cgi?id=223682
Reviewed by Eric Carlson.
Manually tested.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
2021-04-02 Youenn Fablet <youenn@apple.com>
No audio output when unplugged wired headset during a call
https://bugs.webkit.org/show_bug.cgi?id=216389
<rdar://problem/68692800>
Reviewed by Eric Carlson.
Make use of WebCore methods instead of reimplementing them here.
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::startMonitoringWirelessRoutesInternal):
(WebKit::RemoteMediaSessionHelper::stopMonitoringWirelessRoutesInternal):
(WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange):
(WebKit::RemoteMediaSessionHelper::startMonitoringWirelessRoutes): Deleted.
(WebKit::RemoteMediaSessionHelper::stopMonitoringWirelessRoutes): Deleted.
(WebKit::RemoteMediaSessionHelper::applicationWillEnterForeground): Deleted.
(WebKit::RemoteMediaSessionHelper::applicationDidEnterBackground): Deleted.
(WebKit::RemoteMediaSessionHelper::applicationWillBecomeInactive): Deleted.
(WebKit::RemoteMediaSessionHelper::applicationDidBecomeActive): Deleted.
(WebKit::RemoteMediaSessionHelper::externalOutputDeviceAvailableDidChange): Deleted.
(WebKit::RemoteMediaSessionHelper::isPlayingToAutomotiveHeadUnitDidChange): Deleted.
(WebKit::RemoteMediaSessionHelper::activeAudioRouteDidChange): Deleted.
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
2021-04-02 Youenn Fablet <youenn@apple.com>
[MacOS] Enable NSURLSession WebSocket code path in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=220973
<rdar://problem/73655870>
Reviewed by Darin Adler.
Disable a debug assert until it gets fixed below WebKit.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:webSocketTask:didOpenWithProtocol:]):
2021-04-01 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Introduce RobinHoodHashTable
https://bugs.webkit.org/show_bug.cgi?id=223895
Reviewed by Fil Pizlo.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ObservedDomainsTableSchemaV1Alternate):
(WebKit::expectedUnattributedColumns):
(WebKit::expectedAttributedColumns):
(WebKit::createTableQueries):
* Platform/IPC/ArgumentCoders.h:
* Shared/Cocoa/DefaultWebBrowserChecks.mm:
(WebKit::getAppBoundDomainsTesting):
* Shared/WebPreferencesStore.cpp:
(WebKit::WebPreferencesStore::decode):
* Shared/WebPreferencesStore.h:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::platformPathsWithAssumedReadAccess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::platformPathsWithAssumedReadAccess):
* UIProcess/WebProcessProxy.h:
2021-04-02 Youenn Fablet <youenn@apple.com>
Pass the main frame URL to requestGeolocationAuthorizationForURL delegate SPI
https://bugs.webkit.org/show_bug.cgi?id=224045
Reviewed by Alex Christensen.
Simplify code path using requestGeolocationAuthorizationForURL SPI.
We store the URL in the GeolocationRequestData since it might change over time given the requests may be processed asynchronously.
Once geolocation access check is done, we then process each request one at a time using a Deque.
We pass the main frame URL instead of the URL of the frame that called the API, following getUserMedia and device motion orientation.
Manually tested in the simulator.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
Remove shouldRequestGeolocationAuthorizationForURL SPI that is not used.
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
Remove unneeded origin creation.
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:completionHandler:view:]):
(-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
(-[WKGeolocationProviderIOS geolocationAuthorizationDenied]):
* UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
(WebKit::decidePolicyForGeolocationRequestFromOrigin):
2021-04-01 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275387.
https://bugs.webkit.org/show_bug.cgi?id=224094
IOKit method list not complete
Reverted changeset:
"Add IOKit method filter telemetry"
https://bugs.webkit.org/show_bug.cgi?id=223652
https://trac.webkit.org/changeset/275387
2021-04-01 Said Abou-Hallawa <said@apple.com>
Add a macro to help staging logDiagnosticMessageWithDomain in Safari
https://bugs.webkit.org/show_bug.cgi?id=224081
Reviewed by Wenson Hsieh.
Checking this macro will allow the webkit clients to implement this API
and build with or without r275103.
* UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2021-04-01 Kimmo Kinnunen <kkinnunen@apple.com>
RemoteRenderingBackend should clean up CG resources after last Canvas is destroyed in Gpu process
https://bugs.webkit.org/show_bug.cgi?id=223885
<rdar://problem/75637356>
Reviewed by Simon Fraser.
Release CoreGraphics resources (Metal device command buffers,
and other per-device resources) 1s after last
- RemoteRenderingBackend drawable resource
- RemoteGraphicsContextGL instance
- RemoteMediaPlayerProxy instance
has been destroyed.
Adds ScopedRenderingResourcesRequest and
ScopedWebGLRenderingResourcesRequest to hold the intent to
use the global rendering resources. The names are called 'Request'
because the implementation is not guaranteed to do anything specific.
E.g. ResourcesRequest == "I'd like the resources to be available"
ResourcesLock, ResourcesHolder, ... = "The resources are guaranteed
to be held."
The naming tries to be consistent with the similar class
ScopedHighPerformanceGPURequest.
For sequence like:
1) Visit a page with simple Context2D usage
2) Close the page (but leave the browser running)
This saves 2mb of IOAccelMemory at step 2 on a tested device.
* Configurations/WebKit.xcconfig:
Link WebKit to Metal in order to use the RemoteRenderingRequest
(_MTLCopyAllDevices symbol).
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::didClose):
Clear the map containing RemoteGraphicsContextGL objects
when connection to WebContent process is closed.
This stops the RemoteGraphicsContextGL listening for IPC
and destroys them in scenarios where the connection is
closed but the GPUConnectionToWebProcess is staying alive
for some reason. In this patch, this would happen for example
during reload of the page.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::remoteGraphicsContextGLStreamWorkQueue):
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::initialize):
(WebKit::RemoteGraphicsContextGL::stopListeningForIPC):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
Hold the ScopedWebGLRenderingResourcesRequest for
the duration of the RemoteGraphicsContextGL context lifetime.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::~RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::createImageBuffer):
(WebKit::RemoteRenderingBackend::releaseRemoteResource):
(WebKit::RemoteRenderingBackend::updateRenderingResourceRequest):
* GPUProcess/graphics/RemoteRenderingBackend.h:
Hold the ScopedRenderingResourcesRequest for the duration that
there are ImageBuffers or NativeImages in the RemoteResourceCache.
A RemoteRenderingBackend might exist without any drawable due to
a) Context2D being created and then destroyed
b) WebGL taking a reference to the RemoteRenderingBackend in order
to submit work in case the caller would request Image -> texture
upload.
In case of WebGL context being created and then destroyed, there is
a RRB instance alive but not doing any rendering. In these cases,
we want the rendering resources to be released and not held by
the empty RRB.
* GPUProcess/graphics/ScopedRenderingResourcesRequest.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/MetalSPI.h.
(WebKit::ScopedRenderingResourcesRequest::scheduleFreeRenderingResources):
(WebKit::ScopedRenderingResourcesRequest::freeRenderingResources):
* GPUProcess/graphics/ScopedRenderingResourcesRequest.h: Added.
(WebKit::ScopedRenderingResourcesRequest::ScopedRenderingResourcesRequest):
(WebKit::ScopedRenderingResourcesRequest::~ScopedRenderingResourcesRequest):
(WebKit::ScopedRenderingResourcesRequest::operator=):
(WebKit::ScopedRenderingResourcesRequest::isRequested const):
(WebKit::ScopedRenderingResourcesRequest::acquire):
(WebKit::ScopedRenderingResourcesRequest::reset):
* GPUProcess/graphics/ScopedRenderingResourcesRequestCocoa.mm: Copied from Source/WebCore/PAL/pal/spi/cocoa/MetalSPI.h.
(WebKit::ScopedRenderingResourcesRequest::scheduleFreeRenderingResources):
(WebKit::ScopedRenderingResourcesRequest::freeRenderingResources):
Add a scoped holder for the rendering resources. Currently it purges
all Metal device memory.
* GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/MetalSPI.h.
(WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
(WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources):
* GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h: Added.
(WebKit::ScopedWebGLRenderingResourcesRequest::ScopedWebGLRenderingResourcesRequest):
(WebKit::ScopedWebGLRenderingResourcesRequest::~ScopedWebGLRenderingResourcesRequest):
(WebKit::ScopedWebGLRenderingResourcesRequest::operator=):
(WebKit::ScopedWebGLRenderingResourcesRequest::isRequested const):
(WebKit::ScopedWebGLRenderingResourcesRequest::acquire):
(WebKit::ScopedWebGLRenderingResourcesRequest::reset):
* GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/MetalSPI.h.
(WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
(WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources):
Add a scoped holder for the WebGL global resources. Currently it frees
the ANGLE related global data. It also purges all Metal device memory
via RenderingResourcesRequest.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy):
(WebKit::RemoteMediaPlayerProxy::invalidate):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
Hold RenderingResourcesRequest for the duration of a media player
existing in the GPU process. It's not known if media playback needs
Metal. At least some videos do not need it. However, this is erring
on the side of caution in order to avoid potential video frame skips
the video playback using Metal but then the devices being purged by
a Context2D or WebGL -related destruction.
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-04-01 Kate Cheney <katherine_cheney@apple.com>
Clear network website data when a user clears history/website data
https://bugs.webkit.org/show_bug.cgi?id=224030
<rdar://problem/75288338>
Reviewed by David Kilzer.
Clear network-related website data for domains when clearing history/
website data.
No new tests. Unable to test due to recent changes in a dependent
framework's infrastructure for setting network website data for
testing. Will post a followup test once that is resolved.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteData):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::removeNetworkWebsiteData):
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(NetworkSessionCocoa::removeNetworkWebsiteData):
* Scripts/process-entitlements.sh:
2021-04-01 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Contact AutoFill suggestions no longer show up in non-username or password fields
https://bugs.webkit.org/show_bug.cgi?id=224087
<rdar://problem/76080205>
Reviewed by Tim Horton.
For the time being, limit use of `PUICQuickboardController` to text content types that would allow for login
credential AutoFill in Quickboard. We can remove this logic when `PUICQuickboardController` can be updated with
and present arbitrary text suggestion values.
* UIProcess/ios/WKContentViewInteraction.mm:
(canUseQuickboardControllerFor):
(-[WKContentView presentViewControllerForCurrentFocusedElement]):
2021-04-01 BJ Burg <bburg@apple.com>
v2: REGRESSION(r266890): [Cocoa] Fix API::InspectorClient leak
https://bugs.webkit.org/show_bug.cgi?id=223899
<rdar://problem/75249282>
Reviewed by Devin Rousso.
Refactor to *not* use the helper ObjC class InspectorDelegate.
Instead, store the _WKInspectorDelegate in _WKInspector directly
using a WeakObjCPtr ivar. Move the C++ bridge class to be defined
inside _WKInspector.mm since it's only used there. Adapt it to
work better with a nil delegate.
* UIProcess/API/APIInspectorClient.h:
(API::InspectorClient::openURLExternally):
* UIProcess/API/Cocoa/_WKInspectorInternal.h:
* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector delegate]):
(-[_WKInspector setDelegate:]):
(-[_WKInspector dealloc]):
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* UIProcess/Inspector/Cocoa/InspectorDelegate.h: Removed.
* UIProcess/Inspector/Cocoa/InspectorDelegate.mm: Removed.
* UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController initWithConfiguration:inspectedPage:]):
Drive-by, fix the leak of _WKInspectorConfiguration.
2021-04-01 Chris Dumez <cdumez@apple.com>
Share same code between network process termination and crash handling
https://bugs.webkit.org/show_bug.cgi?id=224056
Reviewed by Darin Adler.
Share same code between network process termination and crash handling. This would avoid
bugs such as Bug 224022.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::terminate):
(WebKit::NetworkProcessProxy::networkProcessDidTerminate):
(WebKit::NetworkProcessProxy::didClose):
(WebKit::NetworkProcessProxy::didFinishLaunching):
(WebKit::NetworkProcessProxy::didTerminate): Deleted.
(WebKit::NetworkProcessProxy::networkProcessCrashed): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::networkProcessDidTerminate):
(WebKit::WebProcessPool::networkProcessCrashed): Deleted.
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::networkProcessDidTerminate):
(WebKit::WebsiteDataStore::terminateNetworkProcess):
(WebKit::WebsiteDataStore::networkProcessCrashed): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-04-01 Per Arne <pvollan@apple.com>
Add IOKit method filter telemetry
https://bugs.webkit.org/show_bug.cgi?id=223652
<rdar://problem/75751391>
Reviewed by Brent Fulgham.
Add IOKit method filter telemetry in the WebContent sandbox on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-01 Dean Jackson <dino@apple.com>
Add #import for when unified sources doesn't import it first.
* Shared/ios/WebIconUtilities.h:
2021-04-01 Chris Dumez <cdumez@apple.com>
Have the ServiceWorker process hold on to a file mapped version of the service worker scripts to save dirty memory
https://bugs.webkit.org/show_bug.cgi?id=224015
<rdar://75637679>
Reviewed by Geoffrey Garen.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::didSaveScriptsToDisk):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::didSaveScriptsToDisk):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
When the NetworkProcess is done saving the service worker scripts to disk and it gets
a file mapped version, it now sends them to the ServiceWorker process as ShareableResource
handles via IPC. This allows the ServiceWorker process to replace its heap-allocated
versions of the script and save on dirty memory use (in the cold case).
* Shared/ShareableResource.h:
Fix bug where 2 of ShareableResource data members were not properly initialized by the default
constructor.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::encodeServiceWorkerContextDataScript):
(IPC::decodeServiceWorkerContextDataScript):
(IPC::ArgumentCoder<ServiceWorkerContextData::ImportedScript>::encode):
(IPC::ArgumentCoder<ServiceWorkerContextData::ImportedScript>::decode):
(IPC::ArgumentCoder<ServiceWorkerContextData>::encode):
(IPC::ArgumentCoder<ServiceWorkerContextData>::decode):
(IPC::tryConvertToShareableResourceHandle):
* Shared/WebCoreArgumentCoders.h:
Moved IPC encoders / decoders for ServiceWorkerContextData and ServiceWorkerContextData::ImportedScript
to the WebKit layer, in WebCoreArgumentCoders. This allows us to encode / decode the scripts as
WebKit::ShareableHandle whenever possible. This way, when the NetworkProcess sends a
ServiceWorkerContextData to the ServiceWorker process to launch a service worker, both the
ServiceWorker process and the Network process share the same mmap'd versions of the scripts and we
save on dirty memory use. This helps reduce dirty memory use in the ServiceWorker process in the
warm case, where the scripts are loaded straight from the disk (via SWScriptStorage).
2021-04-01 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] REGRESSION(r272999): User-installed fonts no longer work in Mail
https://bugs.webkit.org/show_bug.cgi?id=223985
<rdar://problem/75975210>
Reviewed by Per Arne Vollan.
The sandbox extension which allows user-installed fonts to work was part of the WebPage,
but XType may already have been initialized to use the static registry by the time the WebPage
has been created. Therefore, simply _having_ a sandbox extension isn't sufficient; instead,
WebPage's constructor needs to call CTFontManagerEnableAllUserFonts() to switch to using fontd
in addition to using the sandbox extension.
Test: WebKit.UserInstalledFontsWork
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
(WebKit::WebPage::~WebPage):
* WebProcess/WebPage/WebPage.h:
2021-03-31 Jiewen Tan <jiewen_tan@apple.com>
Allow ASCWebKitSPISupport to be used on macOS
https://bugs.webkit.org/show_bug.cgi?id=224036
<rdar://76028645>
Reviewed by Brent Fulgham.
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm:
2021-04-01 Per Arne <pvollan@apple.com>
[GPU process] Enable CFPrefs direct mode
https://bugs.webkit.org/show_bug.cgi?id=223817
<rdar://74748933>
Reviewed by Brent Fulgham.
Enable CFPrefs direct mode in the GPU process.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::shouldEnableCFPrefsDirectMode):
(WebKit::XPCServiceMain):
2021-04-01 Alex Christensen <achristensen@webkit.org>
Use sendWithAsyncReply for NetworkProcess messages with async replies
https://bugs.webkit.org/show_bug.cgi?id=224025
Reviewed by Youenn Fablet.
This will prevent us from having to manually store and handle the callback IDs and other things.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::~NetworkProcessProxy):
(WebKit::NetworkProcessProxy::fetchWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcessProxy::networkProcessCrashed):
(WebKit::NetworkProcessProxy::clearCallbackStates): Deleted.
(WebKit::NetworkProcessProxy::didFetchWebsiteData): Deleted.
(WebKit::NetworkProcessProxy::didDeleteWebsiteData): Deleted.
(WebKit::NetworkProcessProxy::didDeleteWebsiteDataForOrigins): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
2021-04-01 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275350.
https://bugs.webkit.org/show_bug.cgi?id=224048
Introduced perf regression
Reverted changeset:
"Add IOKit method filter telemetry"
https://bugs.webkit.org/show_bug.cgi?id=223652
https://trac.webkit.org/changeset/275350
2021-04-01 Martin Robinson <mrobinson@igalia.com>
Expose an alias for ScrollSnapOffsetInfo<T> to make it easier to use
https://bugs.webkit.org/show_bug.cgi?id=223986
Reviewed by Sergio Villar Senin.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateScrollingNode>::decode): Use new aliases.
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::encode): Ditto.
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::decode): Ditto.
(ArgumentCoder<ScrollSnapOffsetsInfo<float>>::encode): Deleted.
(ArgumentCoder<ScrollSnapOffsetsInfo<float>>::decode): Deleted.
2021-04-01 Per Arne <pvollan@apple.com>
Add IOKit method filter telemetry
https://bugs.webkit.org/show_bug.cgi?id=223652
<rdar://problem/75751391>
Reviewed by Brent Fulgham.
Add IOKit method filter telemetry in the WebContent sandbox on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-04-01 Said Abou-Hallawa <said@apple.com>
[GPU Process] Process the pending messages of GPUProcessProxy before its destructor is called
https://bugs.webkit.org/show_bug.cgi?id=224017
Reviewed by Simon Fraser.
Ensure all the pending messages of the singleton GPUProcessProxy are
processed every time a WebProcessPool is about to be deleted. When calling
the completion handlers of these messages, the GPUProcessProxy and the
WebProcessPool have to be valid
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::~AuxiliaryProcessProxy):
(WebKit::AuxiliaryProcessProxy::replyToPendingMessages):
* UIProcess/AuxiliaryProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::~WebProcessPool):
2021-03-31 Simon Fraser <simon.fraser@apple.com>
Feed preferred frames per second back to the UI process for each DisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=224023
Reviewed by Sam Weinig.
DisplayLink needs to track the preferredFramesPerSecond of each of its client
observers. notifyObserversDisplayWasRefreshed() can then avoid sending IPC to
a process a frequency which is higher than that process needs.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::startDisplayLink):
(WebKit::WebProcessPool::setDisplayLinkPreferredFramesPerSecond):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::addObserver):
(WebKit::DisplayLink::removeObserver):
(WebKit::DisplayLink::removeObservers):
(WebKit::DisplayLink::setPreferredFramesPerSecond):
(WebKit::DisplayLink::notifyObserversDisplayWasRefreshed):
* UIProcess/mac/DisplayLink.h:
* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::startDisplayLink):
(WebKit::WebProcessProxy::setDisplayLinkPreferredFramesPerSecond):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::adjustPreferredFramesPerSecond):
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond): Deleted.
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::startNotificationMechanism):
(WebKit::DisplayRefreshMonitorMac::adjustPreferredFramesPerSecond):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h:
2021-03-31 Patrick Angle <pangle@apple.com>
Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler can exceed the soft thread limit when opening multiple inspectors simultaneously.
https://bugs.webkit.org/show_bug.cgi?id=223958
Reviewed by BJ Burg.
In engineering builds, the Web Inspector is loaded as hundreds of separate resources instead of the handful of
minified sources used for released builds. When two Web Inspector windows are opened their loads can overlap
and it is possible for the sum total of file load operations to exceed the dispatch soft thread limit. To
resolve this, we set a sensible limit to the number of simultaneous inspector loading operations. A higher
number of allowed concurrent operations yielded no noticeable increase in load speeds.
* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
(-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com>
List of extents should be bounds-checked when iterating display list items
https://bugs.webkit.org/show_bug.cgi?id=224019
<rdar://problem/71851600>
Reviewed by Tim Horton.
Rename `InvalidItem` to `InvalidItemOrExtent`.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
2021-03-31 Chris Dumez <cdumez@apple.com>
REGRESSION: The NetworkProcess fails to relaunch after it crashes
https://bugs.webkit.org/show_bug.cgi?id=224022
<rdar://75148724>
Reviewed by Darin Adler.
NetworkProcessProxy::networkProcessCrashed() failed to clear defaultNetworkProcess() like we do on
network process termination (in NetworkProcessProxy::didTerminate()). As a result, upon a
network process crash, WebsiteDataStore::networkProcessCrashed() would get called and
properly clear WebsiteDataStore::m_networkProcess. However, when calling
WebsiteDataStore::networkProcess() later on, it would re-initialize m_networkProcess with
the same dead NetworkProcessProxy, since networkProcessForSession() relies on
NetworkProcessProxy::defaultNetworkProcess().
No new tests, will land an API test shortly as a follow-up.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessCrashed):
2021-03-31 Eric Carlson <eric.carlson@apple.com>
[macOS] MediaSessionCoordinator should have join and leave methods
https://bugs.webkit.org/show_bug.cgi?id=223955
<rdar://problem/76021588>
Reviewed by Jer Noble.
* UIProcess/Media/MediaSessionCoordinatorProxyPrivate.h: Renamed from Source/WebKit/UIProcess/Media/MediaSessionCoordinatorPrivateProxy.h.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::create):
(WebKit::RemoteMediaSessionCoordinatorProxy::RemoteMediaSessionCoordinatorProxy):
(WebKit::RemoteMediaSessionCoordinatorProxy::join):
(WebKit::RemoteMediaSessionCoordinatorProxy::leave):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatorStateChanged):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createMediaSessionCoordinator):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::create):
(WebKit::RemoteMediaSessionCoordinator::RemoteMediaSessionCoordinator):
(WebKit::RemoteMediaSessionCoordinator::join):
(WebKit::RemoteMediaSessionCoordinator::leave):
(WebKit::RemoteMediaSessionCoordinator::coordinatorStateChanged):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createMediaSessionCoordinator):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* UIProcess/Media/MediaSessionCoordinatorProxyPrivate.h: Renamed from Source/WebKit/UIProcess/Media/MediaSessionCoordinatorPrivateProxy.h.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::create):
(WebKit::RemoteMediaSessionCoordinatorProxy::RemoteMediaSessionCoordinatorProxy):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatorStateChanged):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createMediaSessionCoordinator):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::create):
(WebKit::RemoteMediaSessionCoordinator::RemoteMediaSessionCoordinator):
(WebKit::RemoteMediaSessionCoordinator::coordinatorStateChanged):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createMediaSessionCoordinator):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Update a couple of icons in the file upload context menu
https://bugs.webkit.org/show_bug.cgi?id=224013
<rdar://problem/73234218>
Reviewed by Tim Horton.
Use updated symbols for the "Photo Library" and "Take Photo or Video" menu items.
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
2021-03-30 Simon Fraser <simon.fraser@apple.com>
Assertions in DisplayUpdate when dragging WebView windows between screens with different refresh rates
https://bugs.webkit.org/show_bug.cgi?id=223984
Reviewed by Sam Weinig.
RemoteLayerTreeDisplayRefreshMonitor knows its m_preferredFramesPerSecond so can
return that.
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::displayNominalFramesPerSecond):
2021-03-31 Sihui Liu <sihui_liu@apple.com>
Add logging in IndexedDB to help debug flaky quota tests
https://bugs.webkit.org/show_bug.cgi?id=223578
<rdar://problem/75956789>
Reviewed by Alexey Proskuryakov.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::storageQuotaManager):
2021-03-31 Alex Christensen <achristensen@webkit.org>
Add deprecation macros.
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::encodeNSError):
* UIProcess/Authentication/mac/WebCredentialMac.mm:
(WebKit::leafCertificate):
(WebKit::chain):
2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com>
WKContentView should support UIKit protocol methods for becoming focused
https://bugs.webkit.org/show_bug.cgi?id=224003
<rdar://problem/75313658>
Reviewed by Megan Gardner.
Implement a few protocol methods on `UIFocusEnvironment`. See below for more details.
Test: UIFocusTests.OverrideCanBecomeFocused
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView canBecomeFocused]):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView canBecomeFocused]):
(-[WKContentView canBecomeFocusedForWebView]):
Implement `-canBecomeFocused`, and return `YES` by default. If `-canBecomeFocused` is overridden on `WKWebView`,
then defer to that overridden method instead.
(-[WKContentView didUpdateFocusInContext:withAnimationCoordinator:]):
Handle the focus environment change by advancing to the next or previous focusable element, depending on the
focus context's heading direction.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
Add a null check so that callers that don't need to know when the focus change is complete are able to pass in a
`nil` completion handler.
2021-03-31 Youenn Fablet <youenn@apple.com>
Make use of NSURLSessionWebSocket.sendCloseCode if available
https://bugs.webkit.org/show_bug.cgi?id=223999
Reviewed by Alex Christensen.
If available, we just call sendCloseCode, cancel will happen when NetworkSocketChannel is destroyed.
Covered by LayoutTests/http/tests/websocket/tests/hybi/client-close-2.html.
* NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
(WebKit::WebSocketTask::close):
2021-03-31 Youenn Fablet <youenn@apple.com>
Send WebSocket cocoa authentication challenge to AuthenticationManager
https://bugs.webkit.org/show_bug.cgi?id=223998
Reviewed by Alex Christensen.
In case of authentication challenge related to WebSocketTask, send it to the AuthenticationManager for evaluation.
Minor refactoring to reuse the same completion handler as for network data tasks.
Covered by LayoutTests/http/tests/websocket/tests/hybi/simple-wss.html with NSURLSessionWebSocket code path enabled.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost):
(WebKit::CompletionHandler<void):
(WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
(WebKit::NetworkSessionCocoa::createWebSocketTask):
* NetworkProcess/cocoa/WebSocketTaskCocoa.h:
(WebKit::WebSocketTask::pageID const):
(WebKit::WebSocketTask::partition const):
* NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
2021-03-31 Chris Dumez <cdumez@apple.com>
ServiceWorkerContextData should not be saved both on ServiceWorkerThread & ServiceWorkerGlobalScope
https://bugs.webkit.org/show_bug.cgi?id=224001
Reviewed by Geoffrey Garen.
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/Storage/WebSWContextManagerConnection.h:
2021-03-30 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Fall back to context menu presentation after long pressing image overlay text
https://bugs.webkit.org/show_bug.cgi?id=223967
<rdar://problem/76028620>
Reviewed by Tim Horton.
Add support for this behavior; see <rdar://problem/76028620> for more details.
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
Add a couple of new flags (`isSelected` and `isImageOverlayText`) to indicate whether the interaction is over
selected text, and also whether the interaction is over text in an image overlay, respectively.
* Shared/ios/InteractionInformationRequest.cpp:
(WebKit::InteractionInformationRequest::encode const):
(WebKit::InteractionInformationRequest::decode):
(WebKit::InteractionInformationRequest::isValidForRequest const):
Add a new position information request option to ignore user agent shadow root content.
* Shared/ios/InteractionInformationRequest.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
Add a flag that's set when `_imageExtractionTimeoutGestureRecognizer` is recognized, and is about to present a
context menu, and is unset upon starting the context menu presentation.
(-[WKContentView setUpInteraction]):
(-[WKContentView cleanUpInteraction]):
(-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]):
(-[WKContentView gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]):
Make the timeout gesture (`_imageExtractionTimeoutGestureRecognizer`) require the failure of the context menu
initiation gesture, such that this image extraction timeout gesture won't trigger if the context menu has
already been triggered.
(-[WKContentView _invalidateCurrentPositionInformation]):
(-[WKContentView _didCommitLoadForMainFrame]):
Pull logic for resetting cached position information into a helper, and call it inside
`-_didCommitLoadForMainFrame`.
(-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
Reset the new flag (`_contextMenuWasTriggeredByImageExtractionTimeout`) if necessary, and use its existing value
to determine whether we should ignore UA shadow root content when performing a hit-test for the context menu
configuration.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::imageRendererAndImage):
(WebKit::imagePositionInformation):
(WebKit::elementPositionInformation):
Additionally supply the image URL and image data if `includeImageData` is set, even if the hit-tested node is
just a text node underneath an image element's overlay.
(WebKit::selectionPositionInformation):
(WebKit::WebPage::positionInformation):
Add support for the new position information flags.
2021-03-30 Chris Dumez <cdumez@apple.com>
ASSERT(m_sendPort) in IPC::Connection::open() when running some iOS unit tests
https://bugs.webkit.org/show_bug.cgi?id=223982
<rdar://75974285>
Reviewed by Alexey Proskuryakov.
If the UIProcess exits or severs it connection to the WebProcess while the WebProcess is
launching, the WebProcess ends up getting an invalid mach port upon initialization. This
is expected and XPCServiceInitializerDelegate::getConnectionIdentifier() was dealing with
this. getConnectionIdentifier() was checking if the port was invalid by checking if it was
MACH_PORT_NULL and calling exit() in such case. However, something has changed (likely
at OS level) and we are now sometimes getting MACH_PORT_DEAD instead of MACH_PORT_NULL.
The proper way to check if a mach port is valid is to call MACH_PORT_VALID(), which checks
for both MACH_PORT_NULL and MACH_PORT_DEAD. I therefore updated getConnectionIdentifier()
to use MACH_PORT_VALID() instead of an explicit check for MACH_PORT_NULL. This gets rid
of debug assertions we were seeing in the output of some iOS unit tests.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getConnectionIdentifier):
2021-03-30 Chris Dumez <cdumez@apple.com>
Service Worker scripts use too much memory in the network process
https://bugs.webkit.org/show_bug.cgi?id=223808
<rdar://75637093>
Reviewed by Geoff Garen.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
Pass a ServiceWorkerContextData::ImportedScript struct in the SetScriptResource IPC
for convenience. We used to pass the ImportedScript data members separately.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
(WebKit::CacheStorage::Engine::clearCachesForOriginFromDirectories):
(WebKit::CacheStorage::Engine::deleteNonEmptyDirectoryOnBackgroundThread):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
* NetworkProcess/cache/NetworkCacheFileSystem.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::deleteOldVersions):
Drop deleteDirectoryRecursively() implementation and use the existing
FileSystem::deleteNonEmptyDirectory() in wtf instead.
* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::Data::mapToFile const):
Moved some of the mapToFile() logic to WTF, so that it can be reused.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::encodeSharedBuffer):
(IPC::decodeSharedBuffer):
Update SharedBuffer's IPC argument coder to distinguish a null SharedBuffer
and an empty one. We now use SharedBuffer to store service worker script sources
and it is possible for the script sources to be empty (and they are in some of
our API tests).
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::setScriptResource):
Pass a ServiceWorkerContextData::ImportedScript struct in the SetScriptResource IPC
for convenience. We used to pass the ImportedScript data members separately.
2021-03-30 Jiewen Tan <jiewen_tan@apple.com>
PCM: Introduce PrivateClickMeasurementNetworkLoader
https://bugs.webkit.org/show_bug.cgi?id=222217
<rdar://74817863>
Reviewed by Youenn Fablet.
This patch refactors PrivateClickMeasurementManager to use a newly introduced PrivateClickMeasurementNetworkLoader
instead of the PingLoad to handle network traffics such that PCMM can receive and process response bodies.
PrivateClickMeasurementNetworkLoader is a stripped down version of the ServiceWorkerSoftUpdateLoader, which is also
a derived class of NetworkLoadClient.
Covered by new test contents within existing test files.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::addPrivateClickMeasurementNetworkLoader):
(WebKit::NetworkSession::removePrivateClickMeasurementNetworkLoader):
Modifies the PCMM to use PCMNL. And then introduces a hash table to manage the lifetime of each PCMNL.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
(WebKit::generateNetworkLoadParameters):
(WebKit::generateNetworkLoadParametersForHttpPost):
(WebKit::generateNetworkLoadParametersForHttpGet):
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
(WebKit::generateNetworkResourceLoadParameters): Deleted.
(WebKit::generateNetworkResourceLoadParametersForHttpPost): Deleted.
(WebKit::generateNetworkResourceLoadParametersForHttpGet): Deleted.
* NetworkProcess/PrivateClickMeasurementManager.h:
(WebKit::PrivateClickMeasurementManager::setNetworkLoadFunction):
(WebKit::PrivateClickMeasurementManager::setPingLoadFunction): Deleted.
Modifies the PCMM to use PCMNL. Specifically, changes the token_public_key and unlinkable_token to be extracted
from the JSON content of the response.
* NetworkProcess/PrivateClickMeasurementNetworkLoader.cpp: Added.
(WebKit::PrivateClickMeasurementNetworkLoader::start):
(WebKit::PrivateClickMeasurementNetworkLoader::PrivateClickMeasurementNetworkLoader):
(WebKit::PrivateClickMeasurementNetworkLoader::fail):
(WebKit::PrivateClickMeasurementNetworkLoader::willSendRedirectedRequest):
(WebKit::PrivateClickMeasurementNetworkLoader::didReceiveResponse):
(WebKit::PrivateClickMeasurementNetworkLoader::didReceiveBuffer):
(WebKit::PrivateClickMeasurementNetworkLoader::didFinishLoading):
(WebKit::PrivateClickMeasurementNetworkLoader::didFailLoading):
(WebKit::PrivateClickMeasurementNetworkLoader::didComplete):
* NetworkProcess/PrivateClickMeasurementNetworkLoader.h: Added.
Introduces the PCMNL.
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h:
Fixes an Unified Build issue.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
Some paperwork.
2021-03-30 Jiewen Tan <jiewen_tan@apple.com>
Allow WebAuthn process talk to the ASD
https://bugs.webkit.org/show_bug.cgi?id=223947
<rdar://75908828>
Reviewed by Brent Fulgham.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
2021-03-30 Alex Christensen <achristensen@webkit.org>
REGRESSION (r275172): Many com.apple.WebKit.Networking.Development crashes appearing in "other crashes"
https://bugs.webkit.org/show_bug.cgi?id=223952
Reviewed by Geoffrey Garen.
Use OS_REASON_FLAG_NO_CRASH_REPORT to prevent crash reports. xpc_connection_kill didn't generate crash reports.
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
(IPC::Connection::kill):
* Platform/spi/Cocoa/ReasonSPI.h:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::platformInvalidate):
2021-03-30 Brent Fulgham <bfulgham@apple.com>
[macOS] Reduce logging for uninteresting sandbox violations
https://bugs.webkit.org/show_bug.cgi?id=223943
<rdar://problem/76014115>
Reviewed by Per Arne Vollan.
Testing has shown some IOKit properties needed by the macOS Network Process, and a handful of items needed when running in recovery mode. We should
allow these items to support proper function and to reduce telemetry for items that we don't need to learn more about.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-30 Myles C. Maxfield <mmaxfield@apple.com>
Address post-commit comments on r275180
https://bugs.webkit.org/show_bug.cgi?id=223915
Reviewed by Kimmo Kinnunen.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
(WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
(WebKit::RemoteRenderingBackendProxy::sharedMemoryForGetImageData):
(WebKit::RemoteRenderingBackendProxy::waitForGetImageDataToComplete):
(WebKit::RemoteRenderingBackendProxy::getDataURLForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getDataForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getBGRADataForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
2021-03-30 Jon Lee <jonlee@apple.com>
Remove obsolete WebGL2 feature flag
https://bugs.webkit.org/show_bug.cgi?id=223945
Reviewed by Darin Adler.
* FeatureFlags/WebKit-appletvos.plist: Feature flag is not referenced anywhere.
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
2021-03-30 Peng Liu <peng.liu6@apple.com>
[GPUP] Add an IPC message to implement RemoteImageDecoderAVF::clearFrameBufferCache()
https://bugs.webkit.org/show_bug.cgi?id=223707
Reviewed by Youenn Fablet.
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::deleteDecoder):
Replace `const ImageDecoderIdentifier&` with `ImageDecoderIdentifier`.
(WebKit::RemoteImageDecoderAVFProxy::encodedDataStatusChanged): Ditto.
(WebKit::RemoteImageDecoderAVFProxy::setExpectedContentSize): Ditto.
(WebKit::RemoteImageDecoderAVFProxy::setData): Ditto.
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex): Ditto.
(WebKit::RemoteImageDecoderAVFProxy::clearFrameBufferCache):
* GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
Add IPC message `clearFrameBufferCache()`, and replace `uint32_t` with `size_t`
because IPC messages support it now.
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::setData):
(WebKit::RemoteImageDecoderAVF::clearFrameBufferCache):
Implement the same behavior as `ImageDecoderAVFObjC::clearFrameBufferCache()`.
This change will reduce the peak memory usage.
2021-03-30 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r275210. Disambiguate the WeakPtrFactory in RemoteMediaSessionCoordinatorProxy with a using statement.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
2021-03-30 Jiewen Tan <jiewen_tan@apple.com>
Unreviewed, reverting r275197.
The change is spooky.
Reverted changeset:
"Safari crashed and lost all tabs, after unlocking sleeping
device"
https://bugs.webkit.org/show_bug.cgi?id=223832
https://commits.webkit.org/r275197
2021-03-30 Aditya Keerthi <akeerthi@apple.com>
[iOS] Two taps required to view <select> options on Square Checkout
https://bugs.webkit.org/show_bug.cgi?id=223933
<rdar://problem/74828029>
Reviewed by Wenson Hsieh.
Some sites, such as Square Checkout, wrap all the <option>s in a
<select> element in a single <optgroup>. With the new context menu
appearance for <select> on iOS, this means that users have to tap twice
to view the options on some sites (once to bring up the menu and once
to expand the grouped menu).
To fix, promote the the contents of the grouped submenu to the root menu
if all the options are contained within a single submenu.
Test: fast/forms/ios/form-control-refresh/select/all-options-in-single-optgroup.html
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker createMenu]):
2021-03-29 Simon Fraser <simon.fraser@apple.com>
Allow non-60fps display updates to be driven by DisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=223912
Reviewed by Sam Weinig.
Improve the logging.
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::addObserver):
2021-03-30 Jer Noble <jer.noble@apple.com>
MediaSessionCoordinatorPrivateProxy should have a Client
https://bugs.webkit.org/show_bug.cgi?id=223935
Reviewed by Eric Carlson.
Similar to the non-proxy MediaSessionCoordinatorPrivate, the Proxy
version should have a client, used for communicating state changes
downstream.
* UIProcess/Media/MediaSessionCoordinatorPrivateProxy.h:
(WebKit::MediaSessionCoordinatorPrivateProxy::setClient):
(WebKit::MediaSessionCoordinatorPrivateProxy::client const):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::seekSessionToTime):
(WebKit::RemoteMediaSessionCoordinatorProxy::playSession):
(WebKit::RemoteMediaSessionCoordinatorProxy::pauseSession):
(WebKit::RemoteMediaSessionCoordinatorProxy::setSessionTrack):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.messages.in:
2021-03-30 Peng Liu <peng.liu6@apple.com>
[GPUP] Add "CodeComplete" attribute to some feature flags
https://bugs.webkit.org/show_bug.cgi?id=223907
Reviewed by Daniel Bates.
Add "CodeComplete" attribute for three feature flags:
- gpu_process_canvas_rendering
- gpu_process_media
- gpu_process_webrtc
Also replace tabs in the plist files with spaces.
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
* Scripts/combine-feature-flags-plist.py:
(main): Fix an issue to merge "attributes".
2021-03-30 Jean-Yves Avenard <jya@apple.com>
Now Playing content isn't updated when media session's Metadata is modified
https://bugs.webkit.org/show_bug.cgi?id=223795
Reviewed by Eric Carlson.
* UIProcess/Media/MediaSessionCoordinatorPrivateProxy.h: Update for new method prototyping.
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::positionStateChanged): Update for new method prototyping.
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::positionStateChanged): Update for new method prototyping.
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h:
2021-03-29 Jiewen Tan <jiewen_tan@apple.com>
Safari crashed and lost all tabs, after unlocking sleeping device
https://bugs.webkit.org/show_bug.cgi?id=223832
<rdar://75555287>
Reviewed by David Kilzer.
A speculative fix for this crash. A possible explanation from the crash log suggests that the protectedThis
could be elided because of compiler optimization given it is not used in the block. To prevent such optimization,
protectedThis is therefore used explicitly in the block.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::dismissViewController):
2021-03-29 Alex Christensen <achristensen@webkit.org>
[Big Sur arm64] TestWebKitAPI.WebKit.AccessibilityReduceMotion is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=222824
Reviewed by Tim Horton.
Use smart pointers instead of storing raw ObjC pointers as ivars.
* UIProcess/Cocoa/PreferenceObserver.mm:
(-[WKUserDefaults findPreferenceChangesAndNotifyForKeys:toValuesForKeys:]):
2021-03-29 Wenson Hsieh <wenson_hsieh@apple.com>
Add a way for internal clients to hit-test for selectable text in user agent shadow roots
https://bugs.webkit.org/show_bug.cgi?id=223894
<rdar://problem/75968068>
Reviewed by Tim Horton.
Augment some Objective-C injected bundle SPI to allow internal clients to hit-test for selectable text,
including content in UA shadow roots. Refer to <rdar://problem/75753666> for more context.
Tests: InjectedBundleHitTest.TextParagraph
InjectedBundleHitTest.ImageOverlay
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(-[WKWebProcessPlugInFrame hitTest:options:]):
Add a new version of `-hitTest:` that takes hit testing options (for now, the only option is whether or not we
should allow UA shadow root content when hit-testing).
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(-[WKWebProcessPlugInNodeHandle isSelectableTextNode]):
Add a readonly getter to return whether or not the hit-tested node is a selectable text node.
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::isSelectableTextNode const):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::hitTest const):
* WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::defaultHitTestRequestTypes):
2021-03-29 Said Abou-Hallawa <said@apple.com>
[GPU Process] Don't record DisplayList items if the GPU Process has been terminated
https://bugs.webkit.org/show_bug.cgi?id=223864
<rdar://73586187>
Reviewed by Simon Fraser.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-03-29 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 2: Rename setItemBufferClient to setItemBuffer{Writing,Reading}Client
https://bugs.webkit.org/show_bug.cgi?id=223863
Reviewed by Wenson Hsieh.
* GPUProcess/graphics/DisplayListReaderHandle.cpp:
(WebKit::DisplayListReaderHandle::displayListForReading const):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
2021-03-26 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process]: Improve getImageData() perf part 2: Use shared memory and a semaphore
https://bugs.webkit.org/show_bug.cgi?id=223732
Reviewed by Ryosuke Niwa.
This patch implements a design for getImageData() where the web process and the GPU process
set up a shmem + semaphore ahead-of-time, so that when we encounter a call to getImageData(),
the GPU process can just write into the shmem and signal the semaphore. The web process just
encodes the getImageData() call into the regular display list, flushAsync()s to kick the GPU
process, then just waits on the semaphore. Initial performance testing shows that this is
way, way faster than sending messages containing pixel color data payloads.
This patch causes a ~40% progression on the Images test in MotionMark on my Mac with the GPU
process enabled. When compared to the GPU process disabled, the results after just running
just a few times seem to be pretty close (within the noise).
If we need more performance, the next step is to try to reduce the memcpy()s.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteImageBuffer.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetImageDataHelper):
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetImageData):
(WebKit::RemoteRenderingBackend::semaphoreForGetImageData):
(WebKit::RemoteRenderingBackend::updateSharedMemoryAndSemaphoreForGetImageData):
(WebKit::RemoteRenderingBackend::destroyGetImageDataSharedMemory):
(WebKit::RemoteRenderingBackend::populateGetImageDataSharedMemory):
(WebKit::RemoteRenderingBackend::getImageData): Deleted.
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* Platform/IPC/IPCSemaphore.h:
* Platform/IPC/darwin/IPCSemaphoreDarwin.cpp:
(IPC::Semaphore::waitFor):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::sharedMemoryForGetImageData):
(WebKit::RemoteRenderingBackendProxy::waitForGetImageDataToComplete):
(WebKit::RemoteRenderingBackendProxy::destroyGetImageDataSharedMemory):
(WebKit::RemoteRenderingBackendProxy::getImageData): Deleted.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
2021-03-29 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Custom fonts don't work in GPU process mode
https://bugs.webkit.org/show_bug.cgi?id=223861
Reviewed by Don Olmstead.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData):
2021-03-29 Alex Christensen <achristensen@webkit.org>
Use terminate_with_reason instead of xpc_connection_kill
https://bugs.webkit.org/show_bug.cgi?id=223618
Reviewed by Darin Adler.
The former was deprecated in rdar://70461770
This does the same thing but adds debugging information so that people looking at process terminations have more information about what is going on.
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
(IPC::Connection::kill):
* Platform/spi/Cocoa/ReasonSPI.h: Added.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::platformInvalidate):
* WebKit.xcodeproj/project.pbxproj:
2021-03-29 Eric Carlson <eric.carlson@apple.com>
[macOS] Add remote MediaSessionCoordinator
https://bugs.webkit.org/show_bug.cgi?id=223854
<rdar://problem/75934650>
Reviewed by Jer Noble.
Define the interface for a remote MediaSessionCoordinatorPrivate and implement
message senders and receivers RemoteMediaSessionCoordinator and
RemoteMediaSessionCoordinatorProxy.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* SourcesCocoa.txt:
* UIProcess/Media/MediaSessionCoordinatorPrivateProxy.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp: Added.
(WebKit::RemoteMediaSessionCoordinatorProxy::create):
(WebKit::RemoteMediaSessionCoordinatorProxy::RemoteMediaSessionCoordinatorProxy):
(WebKit::RemoteMediaSessionCoordinatorProxy::~RemoteMediaSessionCoordinatorProxy):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSeekTo):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePlay):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePause):
(WebKit::RemoteMediaSessionCoordinatorProxy::::coordinateSetTrack):
(WebKit::RemoteMediaSessionCoordinatorProxy::positionStateChanged):
(WebKit::RemoteMediaSessionCoordinatorProxy::playbackStateChanged):
(WebKit::RemoteMediaSessionCoordinatorProxy::readyStateChanged):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h:
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.messages.in: Added.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createMediaSessionCoordinator):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp: Added.
(WebKit::RemoteMediaSessionCoordinator::create):
(WebKit::RemoteMediaSessionCoordinator::RemoteMediaSessionCoordinator):
(WebKit::RemoteMediaSessionCoordinator::~RemoteMediaSessionCoordinator):
(WebKit::RemoteMediaSessionCoordinator::seekTo):
(WebKit::RemoteMediaSessionCoordinator::play):
(WebKit::RemoteMediaSessionCoordinator::pause):
(WebKit::RemoteMediaSessionCoordinator::setTrack):
(WebKit::RemoteMediaSessionCoordinator::positionStateChanged):
(WebKit::RemoteMediaSessionCoordinator::readyStateChanged):
(WebKit::RemoteMediaSessionCoordinator::playbackStateChanged):
(WebKit::RemoteMediaSessionCoordinator::seekSessionToTime):
(WebKit::RemoteMediaSessionCoordinator::playSession):
(WebKit::RemoteMediaSessionCoordinator::pauseSession):
(WebKit::RemoteMediaSessionCoordinator::setSessionTrack):
(WebKit::RemoteMediaSessionCoordinator::logChannel const):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.h: Added.
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createMediaSessionCoordinator):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-03-29 Alex Christensen <achristensen@webkit.org>
Migrate _WKUserContentExtension and older versions of WKContentRuleList to WKContentRuleList during lookup
https://bugs.webkit.org/show_bug.cgi?id=223831
Reviewed by Brady Eidson.
r275078 incremented CurrentContentRuleListFileVersion for the first time in a few years.
As a result, we will get a WKErrorContentRuleListStoreVersionMismatch during lookup for existing compiled WKContentRuleLists.
To make this as compatible as possible, if we see such a WKContentRuleList, try extracting its source and recompiling.
Also, _WKUserContentExtension is used by Safari and being migrated from in rdar://75889414.
To make this succeed and not leave any files behind, we move legacy files to modern filenames during lookup.
We also remove them if they're there when removing the WKContentRuleList from the WKContentRuleListStore,
and we include them in getAvailableContentRuleListIdentifiers. compileContentRuleList only compiles to the modern locations,
and invalidateContentRuleListVersion is only used for tests. All this is done on non-main WorkQueues, so the few additional
file reads/writes aren't an issue.
Luckily, _WKUserContentExtensionStore was only used by Safari, and its defaultStore was never used.
All this is covered by API tests.
* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::defaultStore):
(API::ContentRuleListStore::storeWithPath):
(API::ContentRuleListStore::ContentRuleListStore):
(API::openAndMapContentRuleList):
(API::getContentRuleListSourceFromMappedFile):
(API::ContentRuleListStore::lookupContentRuleList):
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::compileContentRuleList):
(API::ContentRuleListStore::removeContentRuleList):
(API::ContentRuleListStore::invalidateContentRuleListVersion):
(API::ContentRuleListStore::getContentRuleListSource):
(API::ContentRuleListStore::legacyDefaultStore): Deleted.
(API::ContentRuleListStore::nonLegacyDefaultStore): Deleted.
(API::ContentRuleListStore::~ContentRuleListStore): Deleted.
(API::openAndMapOrCopyContentRuleList): Deleted.
* UIProcess/API/APIContentRuleListStore.h:
* UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
(WKUserContentExtensionStoreCreate):
* UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
(API::ContentRuleListStore::defaultStorePath):
* UIProcess/API/Cocoa/WKContentRuleListStore.h:
* UIProcess/API/Cocoa/WKContentRuleListStore.mm:
(+[WKContentRuleListStore defaultStore]):
(+[WKContentRuleListStore storeWithURL:]):
(+[WKContentRuleListStore defaultStoreWithLegacyFilename]):
(+[WKContentRuleListStore storeWithURLAndLegacyFilename:]):
* UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
2021-03-28 Simon Fraser <simon.fraser@apple.com>
Plumb DisplayUpdate through the display refresh monitors
https://bugs.webkit.org/show_bug.cgi?id=223847
Reviewed by Sam Weinig.
Future work will allow DisplayRefreshMonitorClients to request different frame rates, which
are whole fractions of the display's nominal refresh rate. These various frame rate requests
flow up through the DisplayRefreshMonitors, and in WebKit2, up through IPC to the
per-display DisplayLink which may even service multiple processes.
For power reasons, we don't want to trigger display refresh notifications down the chain at
the highest possible frequency; at various stages of propagation the rate might be halved if
that's necessary for downstream clients.
To make this frequency splitting logic simple, this patch introduces DisplayUpdate, which
represents an update of the display, and contains data about it in the form of a numerator
is the frame index, and the denominator is the nominal frame rate. Frame index wraps to zero
every second.
For example, a 60Hz display will generate display refreshes with DisplayUpdates which
sequentially will be { 0, 60 }, { 1, 60 }, { 2, 60 } ... { 59, 60 }, { 0, 60 }. The
zeroth frame is at some arbitrary time and not aligned with wallclock time.
Thus a client with a 30Hz update requirement can simply ignore every odd-numbered frame, and
a client downstream from it with a 15Hz requirement, which only receives those even-numbered
frames, still has enough information to compute which frames to ignore.
Classes which are sources of callbacks for DisplayRefreshMonitor need to generate these
DisplayUpdates; that includes the various platform DisplayRefreshMonitor subclasses in
WebCore, and those in WebKit that live in the UI process and trigger updates over IPC.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor): Deleted.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::addObserver):
(WebKit::DisplayLink::notifyObserversDisplayWasRefreshed):
* UIProcess/mac/DisplayLink.h:
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::displayWasRefreshed):
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/EventDispatcher.messages.in:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::RemoteLayerTreeDisplayRefreshMonitor):
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond):
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::dispatchDisplayDidRefresh):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::displayWasRefreshed):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
2021-03-29 Youenn Fablet <youenn@apple.com>
Promote WKWebView getUserMedia SPI to API
https://bugs.webkit.org/show_bug.cgi?id=223806
Reviewed by Eric Carlson.
Move SPI to API.
Update delegate to take an enumeration instead of two booleans.
Make setters completion handlers nullable.
Covered by API tests.
* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView cameraCaptureState]):
(-[WKWebView microphoneCaptureState]):
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
(WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2021-03-28 Said Abou-Hallawa <said@apple.com>
[GPU Process] Don't ever replay DisplayList items of a RemoteImageBuffer in WebProcess
https://bugs.webkit.org/show_bug.cgi?id=223780
<rdar://75852494>
Reviewed by Wenson Hsieh.
Make sure the destructor of RemoteImageBufferProxy clears its DisplayList
so the destructor of the base class does not replay its items in WebProcess.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-03-28 Sam Weinig <weinig@apple.com>
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS, it seems like it is on for all ports
https://bugs.webkit.org/show_bug.cgi?id=223810
Reviewed by Simon Fraser.
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS conditionals.
* NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
* NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/IndexedDB/WebIDBServer.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::addWebsiteDataStore):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
(WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
(WebKit::NetworkProcess::renameOriginInWebsiteData):
(WebKit::NetworkProcess::storageQuotaManager):
(WebKit::NetworkProcess::connectionToWebProcessClosed):
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::SessionStorageQuotaManager::idbRootPath const):
* Shared/Databases/IndexedDB/IDBUtilities.cpp:
* Shared/Databases/IndexedDB/IDBUtilities.h:
* Shared/Databases/IndexedDB/WebIDBResult.cpp:
* Shared/Databases/IndexedDB/WebIDBResult.h:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<IDBKeyPath>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::addSession):
(WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
* WebProcess/Databases/WebDatabaseProvider.cpp:
(WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
* WebProcess/Databases/WebDatabaseProvider.h:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didReceiveMessage):
(WebKit::NetworkProcessConnection::didClose):
(WebKit::NetworkProcessConnection::idbConnectionToServer):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::networkProcessConnectionClosed):
2021-03-28 Youenn Fablet <youenn@apple.com>
Use-after-move in UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition
https://bugs.webkit.org/show_bug.cgi?id=223842
<rdar://problem/75791668>
Reviewed by Eric Carlson.
Use request decision handler instead of already moved completion handler.
Tests: fast/speechrecognition/start-recognition-after-denied-gum.html
fast/speechrecognition/start-recognition-after-gum.html
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition):
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Have DisplayLink compute its displayNominalFramesPerSecond just once
https://bugs.webkit.org/show_bug.cgi?id=223845
Reviewed by Zalan Bujtas.
Rather than calling CVDisplayLinkGetNominalOutputVideoRefreshPeriod() every time,
just store displayNominalFramesPerSecond in a member variable.
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::nominalFramesPerSecondFromDisplayLink):
(WebKit::DisplayLink::nominalFramesPerSecond const): Deleted.
* UIProcess/mac/DisplayLink.h:
(WebKit::DisplayLink::nominalFramesPerSecond const):
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Allow DisplayRefreshMonitor to be more long-lived objects
https://bugs.webkit.org/show_bug.cgi?id=223844
Reviewed by Chris Dumez.
The existing behavior for DisplayRefreshMonitors was that they were created and destroyed
frequently, as their clients are registered and unregistered. In addition, some of
their subclasses had duplicated logic related to how often they fired without clients
before they were removed.
The 1:1 correspondance between DisplayRefreshMonitors and physical displays makes them
a useful place to store per-display information (like refresh rate), which should
persist whether or not they have clients, so this change prepares for that.
The main changes in this patch are:
1. Provide virtual startNotificationMechanism()/stopNotificationMechanism() functions on
DisplayRefreshMonitor that subclasses can use to start their CVDisplayLink or related
functionality.
2. Provide some shared maxUnscheduledFireCount logic that subclasses can tune to
provide the hysteresis used to control the start/stop of the underlying
notification mechanism.
3. Provide a shared dispatchDisplayDidRefresh() function that most implementations
can use.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::~DisplayLink):
(WebKit::DisplayLink::addObserver):
(WebKit::DisplayLink::notifyObserversDisplayWasRefreshed):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::dispatchDisplayDidRefresh):
(WebKit::DisplayRefreshMonitorMac::startNotificationMechanism):
(WebKit::DisplayRefreshMonitorMac::stopNotificationMechanism):
(WebKit::DisplayRefreshMonitorMac::requestRefreshCallback): Deleted.
(WebKit::DisplayRefreshMonitorMac::displayLinkFired): Deleted.
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h:
2021-03-27 Kate Cheney <katherine_cheney@apple.com>
PCM: Send report to both click source and attribution destination website
https://bugs.webkit.org/show_bug.cgi?id=223615
<rdar://problem/75849443>
Reviewed by Brent Fulgham.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
Move these queries to the correct INSERT OR REPLACE category. Stop
inserting null for earliestTimeToSendToDestination and starting
binding a parameter to it now that we are supporting reports to both
sites.
Now that earliestTimeToSend* can be null if a report has been sent
to a site, we need queries to set the value to null, and also need
to sort attributions by the minimum of either the two reporting times,
or the non-null time if one is null.
(WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements):
(WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement):
We should not attribute a PCM value if it has already been reported to
either the source or destination. This is covered by checking
secondsUntilSend.hasValidSecondsUntilSendValues() and
previouslyAttributed.value().hasPreviouslyBeenReported() before
inserting anything into the attributed PCM table.
(WebKit::ResourceLoadStatisticsDatabaseStore::earliestTimesToSend):
(WebKit::ResourceLoadStatisticsDatabaseStore::markReportAsSentToSource):
(WebKit::ResourceLoadStatisticsDatabaseStore::markReportAsSentToDestination):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution):
Clear a value from the attributed table only if it has been sent to
both source and destination site. Otherwise, set the corresponding
attribution endpoint to null so we don't send it here again.
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
For the sake of testing we can set the destination earliest time to
send to null. We are only confirming here that the expired attribution
gets sent.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement):
(WebKit::WebResourceLoadStatisticsStore::clearSentAttribution):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
We currently have no way of setting the destination token URL site for
testing. To avoid flakiness, we should not make a ping load for the
token URL if we are reporting to the destination in test mode.
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::fireConversionRequest):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
(WebKit::PrivateClickMeasurementManager::clearSentAttribution):
(WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
* NetworkProcess/PrivateClickMeasurementManager.h:
2021-03-27 Tyler Wilcock <twilco.o@protonmail.com>
Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
https://bugs.webkit.org/show_bug.cgi?id=223837
Reviewed by Simon Fraser.
Fixes build for GTK + WPE after
https://trac.webkit.org/changeset/275134/webkit.
Quoting that revision:
> handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
> the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
> all subclasses of DisplayRefreshMonitor with that detail.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
Replace call to DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread(this)
with displayDidRefresh().
2021-03-27 David Kilzer <ddkilzer@apple.com>
Fix leaks in WKInspectorResourceURLSchemeHandler
<https://webkit.org/b/223824>
Reviewed by Joseph Pecoraro.
* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
(-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
- Make use of adoptNS() when assigning a newly allocated, +1
retained Objective-C object to a RetainPtr<>.
- Also fix leak of local NSHTTPURLResponse object by using a
RetainPtr<>.
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
https://bugs.webkit.org/show_bug.cgi?id=223837
Reviewed by Tim Horton.
handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
all subclasses of DisplayRefreshMonitor with that detail.
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::displayLinkFired):
2021-03-26 Patrick Angle <pangle@apple.com>
Web Inspector: Grid layout labels can be drawn outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=221972
Reviewed by BJ Burg.
Add support for the new `WebCore::InspectorOverlay::LabelArrowEdgePosition` property to grid overlays on iOS.
* UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(createLayoutLabelLayer):
- Support the new `WebCore::InspectorOverlay::LabelArrowEdgePosition`.
- Use new helpers in WebCore::InspectorOverlay to reduce code duplication.
(-[WKInspectorHighlightView _createGridOverlayLayer:scale:]):
2021-03-26 Wenson Hsieh <wenson_hsieh@apple.com>
Use PUICQuickboardController for text input when HAVE(QUICKBOARD_CONTROLLER) is defined
https://bugs.webkit.org/show_bug.cgi?id=223809
<rdar://problem/56730407>
Reviewed by Tim Horton.
Enable `PUICQuickboardController` by default, and remove a runtime preference that previously disabled this
feature by default when `HAVE(QUICKBOARD_CONTROLLER)` is defined.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateTextInputTraits:]):
Add a couple of missing selector checks before attempting to configure smart quotes and smart dash editing
behaviors.
(-[WKContentView _createQuickboardController:]):
Additionally opt into a quickboard controller API to bypass the interstitial Quickboard view controller when
using `PUICQuickboardController`.
(-[WKContentView presentViewControllerForCurrentFocusedElement]):
Remove a check for the (now-removed) preference.
2021-03-26 Brady Eidson <beidson@apple.com>
Refactor NetworkSessionCocoa to prepare for per-WebPageProxy sessions
https://bugs.webkit.org/show_bug.cgi?id=223776
Reviewed by Alex Christensen.
No new tests (No behavior change refactor)
A NetworkSessionCocoa has (n) NSURLSessions associated with it.
When a network load needs to happen - based on the context for that load - the appropriate
NSURLSession is chosen (or created).
In a future patch, there will be an additional bit of context used for choosing the appropriate
NSURLSession - The WKWebView the load was triggered from.
This patch takes those (n) NSURLSessions and wraps them in a SessionSet object.
It also adds the concept of looking up the appropriate SessionSet based on the WebPageProxyIdentifier
triggering the load.
This patch by itself should not be a behavior change, but allows the followup to be much simpler.
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::resume):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::createSocketChannel):
(WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::createWebSocketTask):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::removeWebSocketTask):
(WebKit::NetworkSession::addWebSocketTask):
* NetworkProcess/NetworkSocketChannel.cpp:
(WebKit::NetworkSocketChannel::create):
(WebKit::NetworkSocketChannel::NetworkSocketChannel):
(WebKit::NetworkSocketChannel::~NetworkSocketChannel):
* NetworkProcess/NetworkSocketChannel.h:
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::hstsStorage const):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
(WebKit::NetworkSessionCocoa::initializeStandardSessionsInSet):
(WebKit::NetworkSessionCocoa::sessionSetForPage):
(WebKit::NetworkSessionCocoa::sessionSetForPage const):
(WebKit::NetworkSessionCocoa::initializeEphemeralStatelessSessionIfNeeded):
(WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded):
(WebKit::NetworkSessionCocoa::sessionWrapperForTask):
(WebKit::NetworkSessionCocoa::appBoundSession):
(WebKit::NetworkSessionCocoa::hasAppBoundSession const):
(WebKit::NetworkSessionCocoa::clearAppBoundSession):
(WebKit::NetworkSessionCocoa::isolatedSession):
(WebKit::NetworkSessionCocoa::SessionSet::isolatedSession):
(WebKit::NetworkSessionCocoa::hasIsolatedSession const):
(WebKit::NetworkSessionCocoa::clearIsolatedSessions):
(WebKit::NetworkSessionCocoa::invalidateAndCancelSessionSet):
(WebKit::NetworkSessionCocoa::invalidateAndCancel):
(WebKit::NetworkSessionCocoa::createWebSocketTask):
(WebKit::NetworkSessionCocoa::addWebSocketTask):
(WebKit::NetworkSessionCocoa::removeWebSocketTask):
(WebKit::NetworkSessionCocoa::hostNamesWithAlternativeServices const):
(WebKit::NetworkSessionCocoa::deleteAlternativeServicesForHostNames):
(WebKit::NetworkSessionCocoa::clearAlternativeServices):
(WebKit::NetworkSessionCocoa::initializeEphemeralStatelessSession): Deleted.
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::createWebSocketTask):
* NetworkProcess/soup/NetworkSessionSoup.h:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::create):
(WebKit::WebSocketChannel::WebSocketChannel):
(WebKit::WebSocketChannel::connect):
* WebProcess/Network/WebSocketChannel.h:
* WebProcess/Network/WebSocketProvider.cpp:
(WebKit::WebSocketProvider::createWebSocketChannel):
* WebProcess/Network/WebSocketProvider.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::establishConnection):
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
2021-03-26 Wenson Hsieh <wenson_hsieh@apple.com>
Allow some image overlay content to render in fully transparent image elements
https://bugs.webkit.org/show_bug.cgi?id=223781
<rdar://problem/75886351>
Reviewed by Tim Horton.
Implement a new chrome client hook. See WebCore ChangeLog for more information.
* WebProcess/WebCoreSupport/WebChromeClient.h:
2021-03-26 Don Olmstead <don.olmstead@sony.com>
[CMake] Deprecate using DERIVED_SOURCES_DIR/FOWARDING_HEADERS_DIR directly
https://bugs.webkit.org/show_bug.cgi?id=223763
Reviewed by Michael Catanzaro.
Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.
* PlatformGTK.cmake:
* PlatformMac.cmake: Remove creation of forwarding headers.
2021-03-26 Per Arne <pvollan@apple.com>
Enforce notifyd message filtering
https://bugs.webkit.org/show_bug.cgi?id=223601
<rdar://75098580>
Reviewed by Brent Fulgham.
Enable Notify filtering by setting Notify options before entering sandbox.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::compileAndApplySandboxSlowCase):
2021-03-26 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274938.
https://bugs.webkit.org/show_bug.cgi?id=223811
Introduced perf regression
Reverted changeset:
"Add IOKit method filter telemetry"
https://bugs.webkit.org/show_bug.cgi?id=223652
https://trac.webkit.org/changeset/274938
2021-03-26 Kate Cheney <katherine_cheney@apple.com>
Implement PCM SQLite changes based on spec review
https://bugs.webkit.org/show_bug.cgi?id=223726
<rdar://problem/75818526>
Reviewed by Brent Fulgham.
This patch makes 2 significant changes in the SQLite database for
PCM. First, it renames attributeOnSiteDomainID to destinationSiteDomainID
based on spec review. Second, it adds support for sending reports to
both click source and destination sites. This involved adding an
additional column to the AttributedPrivateClickMeasurement table to
store the earliest time to send a report to the destination, renaming
the earliestTimeToSend column to specify source, and removing the NOT NULL
constraint on earliestTimeToSend in order to mark in the database when
a report has been send to the source site.
Since we need to remove a NOT NULL constraint and update foreign keys
and unique constraints, this requires a full migration of data from
the PCM tables.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
earliestTimeToSendToDestination should be null for now until we
implement the rest of the PCM work in
https://bugs.webkit.org/show_bug.cgi?id=223615.
Remove semi-colons from create table queries. They don't matter in
this context and if we remove them we can use the create table
queries to check for a correct schema.
(WebKit::attributedPrivateClickMeasurementSchemaV1):
(WebKit::attributedPrivateClickMeasurementSchemaV1Alternate):
Capture the table info from AttributedPrivateClickMeasurement to check
if we need an update.
(WebKit::expectedUnattributedColumns):
(WebKit::expectedAttributedColumns):
Instead of storing outdated columns, we should store expected columns
and add any missing ones in addMissingColumnsToTable.
(WebKit::ResourceLoadStatisticsDatabaseStore::tableSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::missingReferenceToObservedDomains):
Separate out some duplicated code.
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::columnsForTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnInTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnsIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary):
Simplify the way we update the schema by first adding columns, then
renaming, then migrating. This way we don't need to worry about a
mismatch in number of columns or column name when transferring data.
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution):
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::unattributedPrivateClickMeasurementSchemaV1): Deleted.
(WebKit::unattributedPrivateClickMeasurementSchemaV1Alternate): Deleted.
(WebKit::outdatedUnattributedColumns): Deleted.
(WebKit::outdatedAttributedColumns): Deleted.
(WebKit::columnsToCopy): Deleted.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::statisticsDatabaseColumnsForTable):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::statisticsDatabaseColumnsForTable):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _statisticsDatabaseColumnsForTable:completionHandler:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::statisticsDatabaseColumnsForTable):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::statisticsDatabaseColumnsForTable):
* UIProcess/WebsiteData/WebsiteDataStore.h:
New function for testing.
2021-03-26 Said Abou-Hallawa <said@apple.com>
Allow logging minimal info about uploading media files in the system diagnose
https://bugs.webkit.org/show_bug.cgi?id=223706
Reviewed by Alex Christensen.
Add the new method logDiagnosticMessageWithDomain to the modern ObjC API
WKDiagnosticLoggingDelegate and make it accessible from DiagnosticLoggingClient.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* UIProcess/API/APIDiagnosticLoggingClient.h:
(API::DiagnosticLoggingClient::logDiagnosticMessageWithDomain):
* UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
* UIProcess/Cocoa/DiagnosticLoggingClient.h:
* UIProcess/Cocoa/DiagnosticLoggingClient.mm:
(WebKit::DiagnosticLoggingClient::setDelegate):
(WebKit::toWKDiagnosticLoggingDomain):
(WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithDomain):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::logDiagnosticMessageWithDomain):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithDomain):
* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2021-03-26 Jer Noble <jer.noble@apple.com>
[Cocoa] Enable the UseGPUProcessForMedia preference by default
https://bugs.webkit.org/show_bug.cgi?id=223771
Reviewed by Eric Carlson.
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-watchos.plist:
2021-03-26 Youenn Fablet <youenn@apple.com>
Use webrtc GPU Process feature flag for video capture on MacOS
https://bugs.webkit.org/show_bug.cgi?id=223683
Reviewed by Eric Carlson.
Manually tested.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCaptureVideoInGPUProcessEnabled):
2021-03-26 Jessie Berlin <jberlin@webkit.org>
Update the BEFORE/SINCE, SYSTEM_VERSION_PREFIX, and MACOSX_DEPLOYMENT_TARGET flags
https://bugs.webkit.org/show_bug.cgi?id=223779
Reviewed by Tim Horton.
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
* Configurations/WebKit.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:
2021-03-25 Alex Christensen <achristensen@webkit.org>
Allow WKContentRuleList to block only in frames or only in main frame
https://bugs.webkit.org/show_bug.cgi?id=219001
Reviewed by Ben Poulain.
* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::getContentRuleListSource):
* UIProcess/API/APIContentRuleListStore.h:
2021-03-25 Megan Gardner <megan_gardner@apple.com>
Have App Highlights be a Configuration Setting instead of an internal Preference setting.
https://bugs.webkit.org/show_bug.cgi?id=223720
rdar://75196085
Reviewed by Wenson Hsieh.
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultAppHighlightsEnabled): Deleted.
* Shared/WebPreferencesDefaultValues.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setupPageConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _setAppHighlightsEnabled:]):
(-[WKWebViewConfiguration _appHighlightsEnabled]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/WebPage/WebPage.h:
2021-03-25 Jessie Berlin <jberlin@webkit.org>
Remove 10.13 DEPLOYMENT_TARGETs and SYSTEM_VERSION_PREFIXs
https://bugs.webkit.org/show_bug.cgi?id=223765
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
2021-03-25 Said Abou-Hallawa <said@apple.com>
[GPU Process] Turn GPU process rendering for 2D canvas on by default
https://bugs.webkit.org/show_bug.cgi?id=223772
<rdar://75799739>
Reviewed by Tim Horton.
Enable the 'gpu_process_canvas_rendering' feature flag.
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
2021-03-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275057.
https://bugs.webkit.org/show_bug.cgi?id=223768
Caused build failure
Reverted changeset:
"Enforce notifyd message filtering"
https://bugs.webkit.org/show_bug.cgi?id=223601
https://trac.webkit.org/changeset/275057
2021-03-25 Per Arne <pvollan@apple.com>
Enforce notifyd message filtering
https://bugs.webkit.org/show_bug.cgi?id=223601
<rdar://75098580>
Reviewed by Brent Fulgham.
Enable Notify filtering by setting Notify options before entering sandbox.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::compileAndApplySandboxSlowCase):
2021-03-25 Aditya Keerthi <akeerthi@apple.com>
[iOS] Date picker view jumps to center when switching between MobileSafari and another app
https://bugs.webkit.org/show_bug.cgi?id=223662
<rdar://problem/74748727>
Reviewed by Tim Horton.
Tapping on a date input presents a UIDatePicker inside of a
UIContextMenuInteraction. The presentation of context menus is
dependent on the _positionInformation in WKContentViewInteraction being
up-to-date.
To ensure the value is up-to-date, a position information request is
made prior to presenting the date picker. However, the location used
for the request is the current FocusedElementInformation's
lastInteractionLocation. This is fine in most cases, since the date
picker is usually present immediately after tapping on the date input.
However, the date picker can be closed and presented again when
switching between MobileSafari and another app, as the input is focused
again when MobileSafari is reopened. If the switch is performed using a
gesture, the last interaction location is modified. Consequently, the
last interaction location does not always correspond to the position
of the date input, and the position information request gives us
incorrect information, leading to incorrect presentation of the picker.
To fix, add a new way of presenting context menus that is not dependent
on position information. Instead, form controls can use the information
they already have in FocusedElementInformation to present their
peripherals.
No new tests, since this bug only reproduces when swiping to switch apps.
Other touches in the web view immediately dismiss the date picker, making
the bug difficult to reproduce in a test.
* Shared/FocusedElementInformation.cpp:
(WebKit::FocusedElementInformation::encode const):
(WebKit::FocusedElementInformation::decode):
* Shared/FocusedElementInformation.h:
Added a member to inform FocusedElementInformation whether the focused
element is in a subscrollable region.
See r248447 for more details on why this information is needed when
creating a UITargetedPreview.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView overridePositionTrackingViewForTargetedPreviewIfNecessary:containerScrollingNodeID:]):
Factored out the logic that overrides the targeted preview's position
tracking view when the element is in a subscrollable region.
(-[WKContentView _createTargetedContextMenuHintPreviewForFocusedElement]):
Create a targeted preview using the current FocusedElementInformation.
(-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]):
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker controlBeginEditing]):
Displaying the context menu no longer needs to be done asynchronously
since the FocusedElementInformation is already available during
controlBeginEditing.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
Adopt the new logic for <select> elements, since the presented context
menu is an input peripheral, and can run into the same issues as the
date picker.
(-[WKSelectPicker controlBeginEditing]):
(-[WKSelectPicker contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
Remove a redundant call to elementDidRefocus following r258333. The
FocusController already calls elementDidRefocus before this point, when
the mousepress event is dispatched.
The redundant call was uncovered when making the context menu
presentation synchronous, and causes problems with the presentation.
Specifically, the first call to elementDidRefocus causes the context
menu to be presented. The second call then results in an attempt
to scroll the web view, since the context menu can obscure the
assisted node. The additional scrolling is unwanted behavior, since it
does not occur when focusing the node for the first time.
This issue was previously unobserved, since the asynchronous presentation
of the context menu (after obtaining new position information) resulted
in both calls to elementDidRefocus occuring before presentation.
(WebKit::WebPage::getFocusedElementInformation):
Forward the scrolling node information to the UIProcess, so that the
position tracking view of the UITargetedPreview can be overridden
if necessary.
2021-03-25 BJ Burg <bburg@apple.com>
SendKeys on Input of type=file returns element not found in some cases
https://bugs.webkit.org/show_bug.cgi?id=223028
<rdar://problem/75526126>
Reviewed by Devin Rousso.
This bizarre behavior is triggered by removing the <input type=file> element inside an onclick() handler
for the input element. This confuses safaridriver, which expects to be able to query the file input's .value
via JavaScript after setting the files.
As part of the fix, provide the list of selected filenames in the Automation.fileChooserDismissed event.
On the safaridriver side, just use the list of filenames provided in this event to avoid an extra JS evaluation
that may race with page content.
* UIProcess/Automation/Automation.json:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::handleRunOpenPanel):
2021-03-25 Alex Christensen <achristensen@webkit.org>
REGRESSION (r272376): [iOS] ASSERTION FAILED: sessionID.isEphemeral() || !path.isEmpty() in WebKit::NetworkProcess::swServerForSession
https://bugs.webkit.org/show_bug.cgi?id=222713
Reviewed by Geoff Garen.
Because NetworkProcess::CreateNetworkConnectionToWebProcess is sent with SendOption::DispatchMessageEvenWhenWaitingForSyncReply, it is possible
for two messages of type NetworkProcess::AddWebsiteDataStore and two messages of type NetworkProcess::CreateNetworkConnectionToWebProcess to be in the queue,
but the second NetworkProcess::CreateNetworkConnectionToWebProcess jumps to the front of the line while the UI process is waiting for the reply to the first.
Then, when calling NetworkProcess::swServerForSession we expect the session's parameters to have been initialized in the network process already, but we cut
ahead of the parameter initialization message. This is a realistically rare condition that can only be hit when using SPI, but it is hit in the
ResourceLoadStatistics.StoreSuspension API test. To fix this, we send the WebsiteDataStoreParameters from each WebsiteDataStore in the NetworkProcessCreationParameters.
To avoid doing extra work, we introduce an early return in NetworkProcessProxy::addSession if we have already added parameters from this session to the network process.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::addSessionStorageQuotaManager):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess):
(WebKit::NetworkProcessProxy::addSession):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parametersFromEachWebsiteDataStore):
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-03-25 John Wilander <wilander@apple.com>
PCM: Rename attributeOn to attributionDestination and change the IDL data type of attributionSourceId to unsigned long
https://bugs.webkit.org/show_bug.cgi?id=223661
<rdar://problem/75762075>
Reviewed by Brent Fulgham.
The PR review of the update of the PCM spec lead WebKit, Mozilla, and Google to decide on two changes:
1. Rename attributeOn to attributionDestination
2. Change the IDL data type of attributionSourceId from DOMString to unsigned long
The spec change can be seen in this commit:
https://github.com/privacycg/private-click-measurement/pull/75/commits/8623b5df5e899e6652bc5b00313585f7eeafa797
This patch makes those changes, plus changes names of SPIs, functions, and variables accordingly.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed):
(WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement):
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setPrivateClickMeasurementAttributionReportURLsForTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::setPrivateClickMeasurementAttributionReportURLsForTesting):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::handleAttribution):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::setAttributionReportURLsForTesting):
* NetworkProcess/PrivateClickMeasurementManager.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPrivateClickMeasurementAttributionReportURLsForTesting):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _setPrivateClickMeasurementAttributionReportURLsForTesting:destinationURL:completionHandler:]):
(-[WKWebView _setPrivateClickMeasurementAttributionReportURLsForTesting:attributeOnURL:completionHandler:]): Deleted.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setUIEventAttribution:]):
(-[WKWebView _uiEventAttribution]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::setPrivateClickMeasurementAttributionReportURLsForTesting):
* UIProcess/WebPageProxy.h:
2021-03-25 Chris Dumez <cdumez@apple.com>
Do not do process pre-warming when the system is under memory pressure
https://bugs.webkit.org/show_bug.cgi?id=223717
<rdar://problem/75810423>
Reviewed by Antti Koivisto.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::prewarmGlobally):
Only do prewarming if we're not under memory pressure as this would make
the situation worse.
2021-03-25 Youenn Fablet <youenn@apple.com>
Switch from PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION to filtering interfaces in Network process
https://bugs.webkit.org/show_bug.cgi?id=223679
Reviewed by Eric Carlson.
When starting to monitor, pass whether to enumerate all interfaces from WebProcess to NetworkProcess as a boolean.
In NetworkProcess, do network interface enumeration as usual, but use the boolean to decide whether to send the full list or the list that is related to the default IP addresses to WebProcess.
* NetworkProcess/webrtc/NetworkRTCMonitor.cpp:
(WebKit::NetworkManagerWrapper::addListener):
(WebKit::NetworkManagerWrapper::onNetworksChanged):
(WebKit::NetworkRTCMonitor::startUpdatingIfNeeded):
(WebKit::NetworkRTCMonitor::onNetworksChanged):
* NetworkProcess/webrtc/NetworkRTCMonitor.h:
* NetworkProcess/webrtc/NetworkRTCMonitor.messages.in:
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createPeerConnection):
* WebProcess/Network/webrtc/WebRTCMonitor.cpp:
(WebKit::WebRTCMonitor::setEnumeratingAllNetworkInterfacesEnabled):
(WebKit::WebRTCMonitor::StartUpdating):
* WebProcess/Network/webrtc/WebRTCMonitor.h:
2021-03-25 Tim Horton <timothy_horton@apple.com>
All Books quirks are flakily not applied in modern WebKit
https://bugs.webkit.org/show_bug.cgi?id=157101
<rdar://problem/25965028>
Reviewed by Darin Adler.
In r200121, a quirk was introduced that queried the isIBooks()
RuntimeApplicationChecks method from inside commonVM().
RuntimeApplicationChecks bundle checks cache the result of the bundle
check, and, as such, must not be called until the bundle identifer of
the UI application is known. In legacy WebKit, this is not a problem,
because the check is running in the application process; in modern WebKit,
there is a short window between process launch and the InitializeWebProcess
message being received where we won't know the bundle identifier, and if
isIBooks() (or any other bundle check) is called during this time, it will
cache the wrong result.
It is possible for commonVM() to be called in this window; one possible path
to this is by triggering an os_log_fault during this time, which WebKit
observes (via os_state_add_handler()) in order to dump memory usage
(which happens to call commonVM() and results in isIBooks getting called
and caching the wrong value).
Add an assertion, and move the quirk to live as a setting on the process
pool configuration, to be set via SPI by Books, instead of as a bundle check.
Also, ensure that client bundle identifier and SDK version are set in
all WebKit subprocesses, so that bundle/SDK checks work everywhere
(previously, the GPU process was using SDK checks without having pushed
the values from the UI process, resulting in incorrect results, and
running afoul of the assertion added above).
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
(API::defaultShouldThrowExceptionForGlobalConstantRedeclaration):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration shouldThrowExceptionForGlobalConstantRedeclaration]):
(-[_WKProcessPoolConfiguration setShouldThrowExceptionForGlobalConstantRedeclaration:]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Plumb a new _WKProcessPoolConfiguration parameter to the Web Content process,
and set the bit on the commonVM when launched.
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
(WebKit::AuxiliaryProcess::platformInitialize):
* Shared/AuxiliaryProcess.h:
* Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::initializeTimerCoalescingPolicy):
(WebKit::AuxiliaryProcess::platformInitialize):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getClientSDKVersion):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
Remove an extra unused member.
* Shared/ios/AuxiliaryProcessIOS.mm:
(WebKit::AuxiliaryProcess::platformInitialize): Deleted.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::initializeTimerCoalescingPolicy): Deleted.
(WebKit::AuxiliaryProcess::platformInitialize): Deleted.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Plumb the client bundle identifer and SDK version to all auxiliary processes
at process initialization time instead of InitializeWebProcess/NetworkProcess
message receipt time, closing the window in which it is invalid to use
bundle checks, and ensuring that bundle checks work in all processes.
2021-03-24 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in TextChecker::updateSpellingUIWithGrammarString()
https://bugs.webkit.org/show_bug.cgi?id=223716
Reviewed by Ryosuke Niwa.
Prevent a crash by checking the GrammarDetail's range.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::updateSpellingUIWithGrammarString):
2021-03-24 Simon Fraser <simon.fraser@apple.com>
Add DisplayLink log channels in WebCore and WebKit
https://bugs.webkit.org/show_bug.cgi?id=223669
Reviewed by Tim Horton.
DisplayRefreshMonitor code involves some non-trivial object
fan-out and WebProcess/UI Process interaction, and it deserves
a log channel.
* Platform/Logging.h:
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::displayLinkFired):
2021-03-24 Kate Cheney <katherine_cheney@apple.com>
Remove deprecated WKMediaPlayback APIs
https://bugs.webkit.org/show_bug.cgi?id=223704
<rdar://problem/74611683>
Reviewed by Tim Horton.
We kept these API around after updating the names to give clients
time to adopt the new versions. We can remove them now.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView pauseAllMediaPlayback:]): Deleted.
(-[WKWebView suspendAllMediaPlayback:]): Deleted.
(-[WKWebView resumeAllMediaPlayback:]): Deleted.
(-[WKWebView closeAllMediaPresentations:]): Deleted.
(-[WKWebView requestMediaPlaybackState:]): Deleted.
2021-03-24 Alex Christensen <achristensen@webkit.org>
Call InitializeWebKit2 when initializing a _WKUserInitiatedAction
https://bugs.webkit.org/show_bug.cgi?id=223708
<rdar://75788877>
Reviewed by Chris Dumez.
There is a test that deallocates a _WKUserInitiatedAction before anything calls InitializeWebKit2.
Calling constructInWrapper calls InitializeWebKit2.
Since r274227 it has been asserting s_mainRunLoop in RunLoop::isMain. This fixes it.
We don't have test infrastructure to test this in WebKit because TestWebKitAPI initializes the main thread for us before doing anything.
* UIProcess/API/APIUserInitiatedAction.h:
* UIProcess/API/Cocoa/_WKUserInitiatedAction.mm:
(-[_WKUserInitiatedAction init]):
2021-03-24 Youenn Fablet <youenn@apple.com>
Update GPUProcess sandbox to support camera access
https://bugs.webkit.org/show_bug.cgi?id=223681
Reviewed by Eric Carlson.
Give access to com.apple.appleh13camerad in GPUProcess.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-03-24 Per Arne <pvollan@apple.com>
The media accessibility service is not an XPC service
https://bugs.webkit.org/show_bug.cgi?id=223699
<rdar://75750989>
Reviewed by Brent Fulgham.
The media accessibility service is not an XPC service, but is listed as such in the sandbox.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-24 Per Arne <pvollan@apple.com>
Enforce notifyd message filtering
https://bugs.webkit.org/show_bug.cgi?id=223601
<rdar://75098580>
Reviewed by Per Arne Vollan.
Enforce notifyd message filtering on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-24 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Revise loadSimulatedRequest API with final review comments (223657)
https://bugs.webkit.org/show_bug.cgi?id=223657
<rdar://75757727>
Reviewed by Alex Christensen.
Tested by TestWebKitAPI.
Update the WKWebView API to match final review comments. Deprecate the prior draft API so that we
can smoothly transition away from the original methods.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadSimulatedRequest:response:responseData:]):
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
(-[WKWebView loadSimulatedRequest:responseHTMLString:]):
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
2021-03-24 Sihui Liu <sihui_liu@appe.com>
Ignore middle commits during animated resize
https://bugs.webkit.org/show_bug.cgi?id=223530
Reviewed by Tim Horton.
For animated resize, UI process sets layer transform to fit new size until web process picks up size change and
paints. It is possible that UI process receives a commit during animated resize and the commit is not for the
animated resize (web process commits before animated resize). In this case, our current implementation is: if
SPI client species there will be no other update (!_waitingForEndAnimatedResize), we change layer transform to
reflect change of the middle commit.
However, that commit does not mean web process issues new paint, so the adjustment can be wrong. We find the
handling of middle commits causes issues in SPI client's use case (rdar://47623140). Also by manual testing,
it's not clear how the code can benefit current SPI clients. It seems to cause the same trouble sometimes. So
let's just remove it.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _didCommitLayerTreeDuringAnimatedResize:]):
2021-03-24 Per Arne <pvollan@apple.com>
Add IOKit method filter telemetry
https://bugs.webkit.org/show_bug.cgi?id=223652
<rdar://problem/75751391>
Reviewed by Brent Fulgham.
Add IOKit method filter telemetry in the WebContent sandbox on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-24 Pablo Saavedra <psaavedra@igalia.com>
[WPE] Build error in ARMv7 invalid 'static_cast' for GLNativeWindowType
https://bugs.webkit.org/show_bug.cgi?id=223684
Fixes this error:
error: invalid 'static_cast' from type 'uintptr_t' {aka 'unsigned
int'} to type 'GLNativeWindowType' {aka 'void*'}
; an invalid 'static_cast' from type error for ARMv7 (rpi3 and mesa driver)
by using the same solution chosen in
https://bugs.webkit.org/show_bug.cgi?id=179511:
EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
implementation, its build options, and the libepoxy build options. Using "static_cast"
works when it is a numeric value and the width of the value needs to be optionally
extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
cases. Therefore it seems reasonable to use a plain C cast expression to solve this
particular situation.
https://trac.webkit.org/changeset/274869/webkit
Reviewed by Philippe Normand.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::createGLContext):
2021-03-23 Simon Fraser <simon.fraser@apple.com>
Add DisplayRefreshMonitorFactory.
https://bugs.webkit.org/show_bug.cgi?id=223648
Reviewed by Chris Dumez.
Future work will require that it's possible to create a DisplayRefreshMonitor
without having a DisplayRefreshMonitorClient. It was also weird that the way to
create a DisplayRefreshMonitor was via the DisplayRefreshMonitorClient, so
this change fixes both by adding DisplayRefreshMonitorFactory.
In WK2, the drawing areas are DisplayRefreshMonitorFactories. If there is no
factory, we fall back to the default implementations.
Remove DrawingAreaMac.cpp since its code was entirely related to creating
DisplayRefreshMonitorMac objects.
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::displayRefreshMonitorFactory const):
(WebKit::WebChromeClient::createDisplayRefreshMonitor const): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::createDisplayRefreshMonitor): Deleted.
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::createDisplayRefreshMonitor):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp: Renamed from Source/WebKit/WebProcess/WebPage/mac/DrawingAreaMac.cpp.
(WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
(WebKit::DisplayRefreshMonitorMac::displayLinkFired):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h: Copied from Source/WebCore/platform/graphics/GraphicsLayerUpdater.h.
(WebKit::DisplayRefreshMonitorMac::create):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::createDisplayRefreshMonitor):
2021-03-23 Kate Cheney <katherine_cheney@apple.com>
Service worker loads are not marked as app-bound
https://bugs.webkit.org/show_bug.cgi?id=222635
<rdar://problem/74395950>
Reviewed by Youenn Fablet.
Mark the service worker document loader as app-bound or not when
initiating a fetch event.
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::startFetch):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createDocumentLoader):
Fix capitalization error.
2021-03-23 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Implement inspector-resource:// URL scheme handler for Web Inspector resources
https://bugs.webkit.org/show_bug.cgi?id=223619
Reviewed by Don Olmstead.
Implemented inspector-resource:// URL scheme handler for WinCairo
port. Mac port did it in Bug 179904.
http/tests/inspector tests were crashing due to
RELEASE_ASSERT_WITH_SECURITY_IMPLICATION failure (See Bug 223566).
* PlatformWin.cmake:
* UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.cpp: Added.
(WebKit::InspectorResourceURLSchemeHandler::platformStartTask):
* UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.h: Added.
* UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp:
(WebKit::WebInspectorUIProxy::platformCreateFrontendPage):
(WebKit::WebInspectorUIProxy::inspectorPageURL):
(WebKit::WebInspectorUIProxy::inspectorTestPageURL):
* WebProcess/Inspector/win/WebInspectorUIWin.cpp:
(WebKit::WebInspectorUI::localizedStringsURL const):
(WebKit::RemoteWebInspectorUI::localizedStringsURL const):
2021-03-23 Kate Cheney <katherine_cheney@apple.com>
Add getter to textInteractionEnabled property
https://bugs.webkit.org/show_bug.cgi?id=223638
<rdar://problem/73990298>
Reviewed by Darin Adler.
During API review, it was pointed out that the textInteractionEnabled
property should have a getter/Swift name prefixed with "is" so the
call site reads like an assertion about the receiver.
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences isTextInteractionEnabled]):
(-[WKPreferences textInteractionEnabled]): Deleted.
2021-03-23 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274889.
https://bugs.webkit.org/show_bug.cgi?id=223653
Sandbox change not ready yet
Reverted changeset:
"Enforce notifyd message filtering"
https://bugs.webkit.org/show_bug.cgi?id=223601
https://trac.webkit.org/changeset/274889
2021-03-23 Jiewen Tan <jiewen_tan@apple.com>
Provide a way to specify platform vs security key when requesting an assertion in the SPI
https://bugs.webkit.org/show_bug.cgi?id=223547
<rdar://74034746>
Reviewed by Brent Fulgham.
This patch adds the authenticator attachment option to the getAssertion SPI such that the caller
can decide what transports it needs.
* UIProcess/API/Cocoa/_WKAuthenticatorAttachment.h: Added.
* UIProcess/API/Cocoa/_WKAuthenticatorSelectionCriteria.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialRequestOptions.h:
* UIProcess/API/Cocoa/_WKPublicKeyCredentialRequestOptions.mm:
(-[_WKPublicKeyCredentialRequestOptions init]):
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(authenticatorAttachment):
(+[_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:]):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::collectTransports):
(WebKit::AuthenticatorManager::getTransports const):
* WebKit.xcodeproj/project.pbxproj:
2021-03-23 Jer Noble <jer.noble@apple.com>
[GPUP] 2 web audio WPT tests fail when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=221696
<rdar://problem/74440772>
Reviewed by Eric Carlson.
Test fails when AudioDestination.maxChannelCount is queried and returns 0; pipe the correct
value through from the GPU process.
* GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::configuration):
* WebProcess/GPU/media/RemoteAudioSession.h:
* WebProcess/GPU/media/RemoteAudioSessionConfiguration.h:
(WebKit::RemoteAudioSessionConfiguration::encode const):
(WebKit::RemoteAudioSessionConfiguration::decode):
2021-03-23 Per Arne <pvollan@apple.com>
Enforce notifyd message filtering
https://bugs.webkit.org/show_bug.cgi?id=223601
<rdar://75098580>
Reviewed by Brent Fulgham.
Enforce notifyd message filtering on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-23 Philippe Normand <pnormand@igalia.com>
[GTK] X11 build fixes
https://bugs.webkit.org/show_bug.cgi?id=223577
Reviewed by Adrian Perez de Castro.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::createGLContext): GLNativeWindowType might be a long unsigned
int, which can't be reinterpret casted to uin64_t on 32-bit platforms.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Use
WebCore::Region to prevent clashes with X11's Region.
(WebKit::DrawingAreaCoordinatedGraphics::scroll):
(WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaCoordinatedGraphics::display):
2021-03-23 Aditya Keerthi <akeerthi@apple.com>
[iPadOS] Stale checked item when reopening <select>
https://bugs.webkit.org/show_bug.cgi?id=223592
<rdar://problem/75629529>
Reviewed by Wenson Hsieh.
Reopening a select element after changing its value displays the
original value as checked, rather than the current value on iPadOS. This
is incorrect, since the checked value in the context menu should match
the selected value in-page.
The behavior is incorrect on iPadOS, but works correctly on iPhone, since
dismissing input peripherals on iPhone blurs the focused element,
resulting in a new peripheral being created each time. However, on iPad
the same peripheral is reused when interacting with the same element.
Since the presented UIMenu is only created once during the initialization
of the peripheral, the checked item can be stale on iPads. To fix, update
the menu each time the peripheral is presented, rather than each time it
is created.
Test: fast/forms/ios/form-control-refresh/select/no-stale-checked-items-in-select-picker.html
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker initWithView:]):
Do not create the presented UIMenu during initialization.
(-[WKSelectPicker controlBeginEditing]):
Create the UIMenu when the peripheral is about to be presented. This
ensures the state of the menu is up-to-date.
(-[WKSelectPicker didSelectOptionIndex:]):
Update the underlying data structure for <select> elements, so that a
newly created UIMenu will have the correct state.
(-[WKSelectPicker createMenu]):
Use a separate local variable to avoid modifying a reference. The
incorrect logic here was masked by the fact that the UIMenu was
previously only created once per WKSelectPicker.
(-[WKSelectPicker actionForOptionIndex:]):
Factored logic to get a UIAction from an option index for testing.
(-[WKSelectPicker selectRow:inComponent:extendingSelection:]):
Call accessoryDone to simulate the dismissal of the presented UIMenu
when using this testing method.
(-[WKSelectPicker selectFormAccessoryHasCheckedItemAtRow:]):
Implement this method so that the checked item can be obtained in tests.
2021-03-23 Kimmo Kinnunen <kkinnunen@apple.com>
Move instanced drawing functionality from ExtensionsGL to GraphicsContextGL
https://bugs.webkit.org/show_bug.cgi?id=223179
Reviewed by Kenneth Russell.
Remove unused instanced rendering functions from ExtensionsGL.
They are already in GraphicsContextGL interfaces.
ExtensionsGL is being removed as it is redundant. The extension object
is the same object as the context object and not useful.
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(drawBuffersEXT):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
2021-03-23 Youenn Fablet <youenn@apple.com>
Enable webrtc GPU Process feature flag
https://bugs.webkit.org/show_bug.cgi?id=223582
Reviewed by Eric Carlson.
Enable WebRTC GPU process feature flag.
Make use of it for WebRTC codecs experimental flag default value.
Make use of it for WebRTC video capture experimental flag default value on iOS. Keep it to false on MacOS.
Update audio capture experimental flag default value to false on MacOS until we can use the feature flag value.
No change of behavior.
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
(WebKit::defaultCaptureVideoInGPUProcessEnabled):
(WebKit::defaultWebRTCCodecsInGPUProcess):
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process]: Improve getImageData() perf part 1: Add a GetImageData display list item
https://bugs.webkit.org/show_bug.cgi?id=223544
Reviewed by Wenson Hsieh.
* GPUProcess/graphics/RemoteImageBuffer.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Move management of RemoteCommandListener from MediaSessionManagerCocoa into NowPlayingManager
https://bugs.webkit.org/show_bug.cgi?id=223435
<rdar://problem/75567198>
Reviewed by Eric Carlson.
* GPUProcess/GPUConnectionToWebProcess.cpp: Update methods to use new NowPlayingManager API.
(WebKit::GPUConnectionToWebProcess::clearNowPlayingInfo):
(WebKit::GPUConnectionToWebProcess::setNowPlayingInfo):
(WebKit::GPUConnectionToWebProcess::updateSupportedRemoteCommands): explicitly call setSupportsSeek
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in: Remove argument that can be easily inferred in code.
* WebProcess/GPU/media/WebMediaStrategy.cpp: Override createNowPlayingManager method when using the GPU process.
(WebKit::WebMediaStrategy::createNowPlayingManager const):
(WebKit::WebMediaStrategy::clearNowPlayingInfo): Deleted.
(WebKit::WebMediaStrategy::setNowPlayingInfo): Deleted.
* WebProcess/GPU/media/WebMediaStrategy.h:
2021-03-22 Patrick Angle <pangle@apple.com>
Web Inspector: Port grid overlay drawing to iOS
https://bugs.webkit.org/show_bug.cgi?id=223396
Reviewed by BJ Burg.
Port drawing routines from `WebCore::InspectorOverlay` to use `CALayer`s on iOS to enable drawing grid overlays
on iOS. Drawing logic is, as much as possible, equivalent to that defined in `WebCore::InspectorOverlay`, with
changes to fit the CALayer model.
* UIProcess/Inspector/ios/WKInspectorHighlightView.h:
* UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(-[WKInspectorHighlightView initWithFrame:]):
(-[WKInspectorHighlightView _removeAllLayers]):
(-[WKInspectorHighlightView _createLayers:]):
(layerPath):
- Path should be closed so that objects being stroked are stroked on all edges.
(-[WKInspectorHighlightView _layoutForNodeListHighlight:]):
(-[WKInspectorHighlightView _layoutForRectsHighlight:]):
(-[WKInspectorHighlightView _createGridOverlayLayers:scale:]):
(createLayoutHatchingLayer):
(createLayoutLabelLayer):
(-[WKInspectorHighlightView _createGridOverlayLayer:scale:]):
- Create layers for the grid overlays.
(-[WKInspectorHighlightView update:scale:]):
- Obtain the view scale so that `CATextLayer`s can have the correct content scale set.
(-[WKInspectorHighlightView update:]): Deleted.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _showInspectorHighlight:]):
2021-03-22 Peng Liu <peng.liu6@apple.com>
[GPUP] Add a "wallTime" field to struct RemoteMediaPlayerState
https://bugs.webkit.org/show_bug.cgi?id=223523
Reviewed by Eric Carlson.
Function `MediaPlayerPrivateRemote::currentMediaTime()` returns the
current media time in the cached state, which is not the "current"
media time of the media player. This patch adds a "wallTime" field
to struct `RemoteMediaPlayerState`, so that `MediaPlayerPrivateRemote`
can adjust the `currentTime` in the cached state based on `m_rate`
and `WallTime::now()` and returns a more accurate value.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerPlaybackStateChanged):
(WebKit::RemoteMediaPlayerProxy::updateCachedState):
(WebKit::RemoteMediaPlayerProxy::performTaskAtMediaTime):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::pause):
(WebKit::MediaPlayerPrivateRemote::currentMediaTime const):
(WebKit::MediaPlayerPrivateRemote::playbackStateChanged):
(WebKit::MediaPlayerPrivateRemote::updateCachedState):
(WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
* WebProcess/GPU/media/RemoteMediaPlayerState.h:
(WebKit::RemoteMediaPlayerState::encode const):
(WebKit::RemoteMediaPlayerState::decode):
2021-03-22 BJ Burg <bburg@apple.com>
Web Inspector: rename WebInspectorProxy to WebInspectorUIProxy
https://bugs.webkit.org/show_bug.cgi?id=223551
Reviewed by Devin Rousso.
To improve clarity in the codebase, I'm renaming this to be consistent
with it's WebProcess-side counterpart, WebInspectorUI. There are many
different classes with the 'WebInspector' prefix, so it can be difficult
to understand whether a class is associated with the WebInspectorUI
frontend or the InspectorController backend. This fixes one of the biggest
offenders.
For brevity, I have elided function-level changelog entries from files
that have been renamed. This is a mechanical refactoring.
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* PlatformFTW.cmake:
* PlatformWin.cmake:
* Sources.txt:
* SourcesCocoa.txt:
* SourcesGTK.txt:
* UIProcess/API/APIInspectorClient.h:
(API::InspectorClient::openURLExternally):
* UIProcess/API/APIUIClient.h:
(API::UIClient::didAttachLocalInspector):
(API::UIClient::willCloseLocalInspector):
(API::UIClient::configurationForLocalInspector):
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKInspector.cpp:
(WKInspectorGetTypeID):
* UIProcess/API/C/WKPage.cpp:
* UIProcess/API/C/mac/WKInspectorPrivateMac.h:
* UIProcess/API/Cocoa/_WKInspectorInternal.h:
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
(-[_WKRemoteWebInspectorViewController initWithConfiguration:]):
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerInternal.h:
* UIProcess/API/gtk/WebKitWebInspector.cpp:
(webkitWebInspectorCreate):
* UIProcess/API/gtk/WebKitWebInspectorPrivate.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/Automation/WebAutomationSession.cpp:
* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::configurationForLocalInspector):
(WebKit::UIDelegate::UIClient::didAttachLocalInspector):
(WebKit::UIDelegate::UIClient::willCloseLocalInspector):
* UIProcess/Cocoa/WebViewImpl.mm:
* UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp:
* UIProcess/Inspector/Cocoa/InspectorDelegate.h:
* UIProcess/Inspector/Cocoa/InspectorDelegate.mm:
(WebKit::InspectorDelegate::InspectorClient::openURLExternally):
* UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm:
* UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp: Renamed from Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.cpp.
(WebKit::RemoteWebInspectorUIProxy::RemoteWebInspectorUIProxy):
(WebKit::RemoteWebInspectorUIProxy::~RemoteWebInspectorUIProxy):
(WebKit::RemoteWebInspectorUIProxy::invalidate):
(WebKit::RemoteWebInspectorUIProxy::setDiagnosticLoggingAvailable):
(WebKit::RemoteWebInspectorUIProxy::load):
(WebKit::RemoteWebInspectorUIProxy::closeFromBackend):
(WebKit::RemoteWebInspectorUIProxy::closeFromCrash):
(WebKit::RemoteWebInspectorUIProxy::show):
(WebKit::RemoteWebInspectorUIProxy::sendMessageToFrontend):
(WebKit::RemoteWebInspectorUIProxy::frontendLoaded):
(WebKit::RemoteWebInspectorUIProxy::frontendDidClose):
(WebKit::RemoteWebInspectorUIProxy::reopen):
(WebKit::RemoteWebInspectorUIProxy::resetState):
(WebKit::RemoteWebInspectorUIProxy::bringToFront):
(WebKit::RemoteWebInspectorUIProxy::save):
(WebKit::RemoteWebInspectorUIProxy::append):
(WebKit::RemoteWebInspectorUIProxy::setSheetRect):
(WebKit::RemoteWebInspectorUIProxy::setForcedAppearance):
(WebKit::RemoteWebInspectorUIProxy::startWindowDrag):
(WebKit::RemoteWebInspectorUIProxy::openURLExternally):
(WebKit::RemoteWebInspectorUIProxy::showCertificate):
(WebKit::RemoteWebInspectorUIProxy::sendMessageToBackend):
(WebKit::RemoteWebInspectorUIProxy::createFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::closeFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformCreateFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformResetState):
(WebKit::RemoteWebInspectorUIProxy::platformBringToFront):
(WebKit::RemoteWebInspectorUIProxy::platformSave):
(WebKit::RemoteWebInspectorUIProxy::platformAppend):
(WebKit::RemoteWebInspectorUIProxy::platformSetSheetRect):
(WebKit::RemoteWebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::RemoteWebInspectorUIProxy::platformStartWindowDrag):
(WebKit::RemoteWebInspectorUIProxy::platformOpenURLExternally):
(WebKit::RemoteWebInspectorUIProxy::platformShowCertificate):
(WebKit::RemoteWebInspectorUIProxy::platformCloseFrontendPageAndWindow):
* UIProcess/Inspector/RemoteWebInspectorUIProxy.h: Renamed from Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h.
(WebKit::RemoteWebInspectorUIProxyClient::~RemoteWebInspectorUIProxyClient):
(WebKit::RemoteWebInspectorUIProxy::create):
(WebKit::RemoteWebInspectorUIProxy::setClient):
(WebKit::RemoteWebInspectorUIProxy::isUnderTest const):
(WebKit::RemoteWebInspectorUIProxy::extensionController const):
(WebKit::RemoteWebInspectorUIProxy::window const):
(WebKit::RemoteWebInspectorUIProxy::sheetRect const):
* UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in: Renamed from Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.messages.in.
* UIProcess/Inspector/WebInspectorUIProxy.cpp: Renamed from Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp.
(WebKit::WebInspectorUIProxy::WebInspectorUIProxy):
(WebKit::WebInspectorUIProxy::~WebInspectorUIProxy):
(WebKit::WebInspectorUIProxy::setInspectorClient):
(WebKit::WebInspectorUIProxy::inspectionLevel const):
(WebKit::WebInspectorUIProxy::inspectorPagePreferences const):
(WebKit::WebInspectorUIProxy::invalidate):
(WebKit::WebInspectorUIProxy::sendMessageToFrontend):
(WebKit::WebInspectorUIProxy::isFront):
(WebKit::WebInspectorUIProxy::connect):
(WebKit::WebInspectorUIProxy::show):
(WebKit::WebInspectorUIProxy::hide):
(WebKit::WebInspectorUIProxy::close):
(WebKit::WebInspectorUIProxy::closeForCrash):
(WebKit::WebInspectorUIProxy::reopen):
(WebKit::WebInspectorUIProxy::resetState):
(WebKit::WebInspectorUIProxy::reset):
(WebKit::WebInspectorUIProxy::updateForNewPageProcess):
(WebKit::WebInspectorUIProxy::setFrontendConnection):
(WebKit::WebInspectorUIProxy::showConsole):
(WebKit::WebInspectorUIProxy::showResources):
(WebKit::WebInspectorUIProxy::showMainResourceForFrame):
(WebKit::WebInspectorUIProxy::attachBottom):
(WebKit::WebInspectorUIProxy::attachRight):
(WebKit::WebInspectorUIProxy::attachLeft):
(WebKit::WebInspectorUIProxy::attach):
(WebKit::WebInspectorUIProxy::detach):
(WebKit::WebInspectorUIProxy::setAttachedWindowHeight):
(WebKit::WebInspectorUIProxy::setAttachedWindowWidth):
(WebKit::WebInspectorUIProxy::setSheetRect):
(WebKit::WebInspectorUIProxy::startWindowDrag):
(WebKit::WebInspectorUIProxy::togglePageProfiling):
(WebKit::WebInspectorUIProxy::toggleElementSelection):
(WebKit::WebInspectorUIProxy::isMainOrTestInspectorPage):
(WebKit::WebInspectorUIProxy::createFrontendPage):
(WebKit::WebInspectorUIProxy::openLocalInspectorFrontend):
(WebKit::WebInspectorUIProxy::open):
(WebKit::WebInspectorUIProxy::didClose):
(WebKit::WebInspectorUIProxy::closeFrontendPageAndWindow):
(WebKit::WebInspectorUIProxy::sendMessageToBackend):
(WebKit::WebInspectorUIProxy::frontendLoaded):
(WebKit::WebInspectorUIProxy::bringToFront):
(WebKit::WebInspectorUIProxy::bringInspectedPageToFront):
(WebKit::WebInspectorUIProxy::attachAvailabilityChanged):
(WebKit::WebInspectorUIProxy::setForcedAppearance):
(WebKit::WebInspectorUIProxy::openURLExternally):
(WebKit::WebInspectorUIProxy::inspectedURLChanged):
(WebKit::WebInspectorUIProxy::showCertificate):
(WebKit::WebInspectorUIProxy::elementSelectionChanged):
(WebKit::WebInspectorUIProxy::timelineRecordingChanged):
(WebKit::WebInspectorUIProxy::setDeveloperPreferenceOverride):
(WebKit::WebInspectorUIProxy::setDiagnosticLoggingAvailable):
(WebKit::WebInspectorUIProxy::save):
(WebKit::WebInspectorUIProxy::append):
(WebKit::WebInspectorUIProxy::shouldOpenAttached):
(WebKit::WebInspectorUIProxy::evaluateInFrontendForTesting):
(WebKit::WebInspectorUIProxy::platformCreateFrontendPage):
(WebKit::WebInspectorUIProxy::platformCreateFrontendWindow):
(WebKit::WebInspectorUIProxy::platformCloseFrontendPageAndWindow):
(WebKit::WebInspectorUIProxy::platformDidCloseForCrash):
(WebKit::WebInspectorUIProxy::platformInvalidate):
(WebKit::WebInspectorUIProxy::platformResetState):
(WebKit::WebInspectorUIProxy::platformBringToFront):
(WebKit::WebInspectorUIProxy::platformBringInspectedPageToFront):
(WebKit::WebInspectorUIProxy::platformHide):
(WebKit::WebInspectorUIProxy::platformIsFront):
(WebKit::WebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::WebInspectorUIProxy::platformInspectedURLChanged):
(WebKit::WebInspectorUIProxy::platformShowCertificate):
(WebKit::WebInspectorUIProxy::platformSave):
(WebKit::WebInspectorUIProxy::platformAppend):
(WebKit::WebInspectorUIProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorUIProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorUIProxy::platformAttach):
(WebKit::WebInspectorUIProxy::platformDetach):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorUIProxy::platformSetSheetRect):
(WebKit::WebInspectorUIProxy::platformStartWindowDrag):
(WebKit::WebInspectorUIProxy::inspectorPageURL):
(WebKit::WebInspectorUIProxy::inspectorTestPageURL):
(WebKit::WebInspectorUIProxy::infoForLocalDebuggable):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowWidth):
(WebKit::WebInspectorUIProxy::platformAttachAvailabilityChanged):
* UIProcess/Inspector/WebInspectorUIProxy.h: Renamed from Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h.
(WebKit::WebInspectorUIProxy::create):
(WebKit::WebInspectorUIProxy::inspectorClient):
(WebKit::WebInspectorUIProxy::inspectedPage const):
(WebKit::WebInspectorUIProxy::inspectorPage const):
(WebKit::WebInspectorUIProxy::extensionController const):
(WebKit::WebInspectorUIProxy::isConnected const):
(WebKit::WebInspectorUIProxy::isVisible const):
(WebKit::WebInspectorUIProxy::inspectorWindow const):
(WebKit::WebInspectorUIProxy::sheetRect const):
(WebKit::WebInspectorUIProxy::inspectorView const):
(WebKit::WebInspectorUIProxy::attachmentSide const):
(WebKit::WebInspectorUIProxy::isAttached const):
(WebKit::WebInspectorUIProxy::isProfilingPage const):
(WebKit::WebInspectorUIProxy::isElementSelectionActive const):
(WebKit::WebInspectorUIProxy::isUnderTest const):
(WebKit::WebInspectorUIProxy::platformCanAttach):
(WebKit::WebInspectorUIProxy::canAttach const):
* UIProcess/Inspector/WebInspectorUIProxy.messages.in: Renamed from Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in.
* UIProcess/Inspector/glib/RemoteInspectorClient.cpp:
* UIProcess/Inspector/glib/RemoteInspectorClient.h:
* UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp: Renamed from Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp.
(WebKit::RemoteWebInspectorUIProxy::updateWindowTitle):
(WebKit::remoteInspectorViewDestroyed):
(WebKit::RemoteWebInspectorUIProxy::platformCreateFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformCloseFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformResetState):
(WebKit::RemoteWebInspectorUIProxy::platformBringToFront):
(WebKit::remoteFileReplaceContentsCallback):
(WebKit::RemoteWebInspectorUIProxy::platformSave):
(WebKit::RemoteWebInspectorUIProxy::platformAppend):
(WebKit::RemoteWebInspectorUIProxy::platformSetSheetRect):
(WebKit::RemoteWebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::RemoteWebInspectorUIProxy::platformStartWindowDrag):
(WebKit::RemoteWebInspectorUIProxy::platformOpenURLExternally):
(WebKit::RemoteWebInspectorUIProxy::platformShowCertificate):
* UIProcess/Inspector/gtk/WebInspectorUIProxyClient.h: Renamed from Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyClient.h.
* UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp: Renamed from Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp.
(WebKit::inspectorViewDestroyed):
(WebKit::WebInspectorUIProxy::setClient):
(WebKit::WebInspectorUIProxy::updateInspectorWindowTitle const):
(WebKit::exceededDatabaseQuota):
(WebKit::webProcessDidCrash):
(WebKit::decidePolicyForNavigationAction):
(WebKit::getContextMenuFromProposedMenu):
(WebKit::inspectorWebsiteDataStore):
(WebKit::WebInspectorUIProxy::platformCreateFrontendPage):
(WebKit::WebInspectorUIProxy::platformCreateFrontendWindow):
(WebKit::WebInspectorUIProxy::platformCloseFrontendPageAndWindow):
(WebKit::WebInspectorUIProxy::platformDidCloseForCrash):
(WebKit::WebInspectorUIProxy::platformInvalidate):
(WebKit::WebInspectorUIProxy::platformHide):
(WebKit::WebInspectorUIProxy::platformResetState):
(WebKit::WebInspectorUIProxy::platformBringToFront):
(WebKit::WebInspectorUIProxy::platformBringInspectedPageToFront):
(WebKit::WebInspectorUIProxy::platformIsFront):
(WebKit::WebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::WebInspectorUIProxy::platformInspectedURLChanged):
(WebKit::WebInspectorUIProxy::platformShowCertificate):
(WebKit::WebInspectorUIProxy::inspectorPageURL):
(WebKit::WebInspectorUIProxy::inspectorTestPageURL):
(WebKit::WebInspectorUIProxy::infoForLocalDebuggable):
(WebKit::WebInspectorUIProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorUIProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorUIProxy::platformAttach):
(WebKit::WebInspectorUIProxy::platformDetach):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowWidth):
(WebKit::WebInspectorUIProxy::platformSetSheetRect):
(WebKit::WebInspectorUIProxy::platformStartWindowDrag):
(WebKit::fileReplaceContentsCallback):
(WebKit::WebInspectorUIProxy::platformSave):
(WebKit::WebInspectorUIProxy::platformAppend):
(WebKit::WebInspectorUIProxy::platformAttachAvailabilityChanged):
* UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp:
(webkitInspectorWindowNew):
* UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm: Renamed from Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm.
(-[WKRemoteWebInspectorUIProxyObjCAdapter window:willPositionSheet:usingRect:]):
(-[WKRemoteWebInspectorUIProxyObjCAdapter initWithRemoteWebInspectorUIProxy:]):
(-[WKRemoteWebInspectorUIProxyObjCAdapter inspectorWKWebViewDidBecomeActive:]):
(-[WKRemoteWebInspectorUIProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
(-[WKRemoteWebInspectorUIProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
(WebKit::RemoteWebInspectorUIProxy::webView const):
(WebKit::RemoteWebInspectorUIProxy::didBecomeActive):
(WebKit::RemoteWebInspectorUIProxy::platformCreateFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformCloseFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformResetState):
(WebKit::RemoteWebInspectorUIProxy::platformBringToFront):
(WebKit::RemoteWebInspectorUIProxy::platformSave):
(WebKit::RemoteWebInspectorUIProxy::platformAppend):
(WebKit::RemoteWebInspectorUIProxy::platformSetSheetRect):
(WebKit::RemoteWebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::RemoteWebInspectorUIProxy::platformStartWindowDrag):
(WebKit::RemoteWebInspectorUIProxy::platformOpenURLExternally):
(WebKit::RemoteWebInspectorUIProxy::platformShowCertificate):
* UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController webView]):
* UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm: Renamed from Source/WebKit/UIProcess/Inspector/mac/WebInspectorProxyMac.mm.
(-[WKWebInspectorUIProxyObjCAdapter inspectorRef]):
(-[WKWebInspectorUIProxyObjCAdapter inspector]):
(-[WKWebInspectorUIProxyObjCAdapter initWithWebInspectorUIProxy:]):
(-[WKWebInspectorUIProxyObjCAdapter invalidate]):
(-[WKWebInspectorUIProxyObjCAdapter window:willPositionSheet:usingRect:]):
(-[WKWebInspectorUIProxyObjCAdapter windowDidMove:]):
(-[WKWebInspectorUIProxyObjCAdapter windowDidResize:]):
(-[WKWebInspectorUIProxyObjCAdapter windowWillClose:]):
(-[WKWebInspectorUIProxyObjCAdapter windowDidEnterFullScreen:]):
(-[WKWebInspectorUIProxyObjCAdapter windowDidExitFullScreen:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectedViewFrameDidChange:]):
(-[WKWebInspectorUIProxyObjCAdapter observeValueForKeyPath:ofObject:change:context:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectorViewControllerDidBecomeActive:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectorViewController:willMoveToWindow:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectorViewControllerDidMoveToWindow:]):
(-[WKWebInspectorUIProxyObjCAdapter inspectorViewController:openURLExternally:]):
(WebKit::WebInspectorUIProxy::didBecomeActive):
(WebKit::WebInspectorUIProxy::attachmentViewDidChange):
(WebKit::WebInspectorUIProxy::attachmentWillMoveFromWindow):
(WebKit::WebInspectorUIProxy::attachmentDidMoveToWindow):
(WebKit::WebInspectorUIProxy::updateInspectorWindowTitle const):
(WebKit::WebInspectorUIProxy::createFrontendWindow):
(WebKit::WebInspectorUIProxy::platformCreateFrontendPage):
(WebKit::WebInspectorUIProxy::platformCreateFrontendWindow):
(WebKit::WebInspectorUIProxy::closeFrontendPage):
(WebKit::WebInspectorUIProxy::closeFrontendAfterInactivityTimerFired):
(WebKit::WebInspectorUIProxy::platformCloseFrontendPageAndWindow):
(WebKit::WebInspectorUIProxy::platformDidCloseForCrash):
(WebKit::WebInspectorUIProxy::platformInvalidate):
(WebKit::WebInspectorUIProxy::platformHide):
(WebKit::WebInspectorUIProxy::platformResetState):
(WebKit::WebInspectorUIProxy::platformBringToFront):
(WebKit::WebInspectorUIProxy::platformBringInspectedPageToFront):
(WebKit::WebInspectorUIProxy::platformIsFront):
(WebKit::WebInspectorUIProxy::platformCanAttach):
(WebKit::WebInspectorUIProxy::platformAttachAvailabilityChanged):
(WebKit::WebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::WebInspectorUIProxy::platformInspectedURLChanged):
(WebKit::WebInspectorUIProxy::platformShowCertificate):
(WebKit::WebInspectorUIProxy::platformSave):
(WebKit::WebInspectorUIProxy::platformAppend):
(WebKit::WebInspectorUIProxy::windowFrameDidChange):
(WebKit::WebInspectorUIProxy::windowFullScreenDidChange):
(WebKit::WebInspectorUIProxy::inspectedViewFrameDidChange):
(WebKit::WebInspectorUIProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorUIProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorUIProxy::platformAttach):
(WebKit::WebInspectorUIProxy::platformDetach):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowWidth):
(WebKit::WebInspectorUIProxy::platformSetSheetRect):
(WebKit::WebInspectorUIProxy::platformStartWindowDrag):
(WebKit::WebInspectorUIProxy::inspectorPageURL):
(WebKit::WebInspectorUIProxy::inspectorTestPageURL):
(WebKit::systemVersionPlist):
(WebKit::WebInspectorUIProxy::infoForLocalDebuggable):
(WebKit::WebInspectorUIProxy::applyForcedAppearance):
* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
* UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp: Renamed from Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp.
(WebKit::RemoteWebInspectorUIProxy::WndProc):
(WebKit::registerWindowClass):
(WebKit::RemoteWebInspectorUIProxy::sizeChange):
(WebKit::RemoteWebInspectorUIProxy::onClose):
(WebKit::RemoteWebInspectorUIProxy::platformCreateFrontendPageAndWindow):
(WebKit::RemoteWebInspectorUIProxy::platformResetState):
(WebKit::RemoteWebInspectorUIProxy::platformBringToFront):
(WebKit::RemoteWebInspectorUIProxy::platformSave):
(WebKit::RemoteWebInspectorUIProxy::platformAppend):
(WebKit::RemoteWebInspectorUIProxy::platformSetSheetRect):
(WebKit::RemoteWebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::RemoteWebInspectorUIProxy::platformStartWindowDrag):
(WebKit::RemoteWebInspectorUIProxy::platformOpenURLExternally):
(WebKit::RemoteWebInspectorUIProxy::platformShowCertificate):
(WebKit::RemoteWebInspectorUIProxy::platformCloseFrontendPageAndWindow):
* UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp: Renamed from Source/WebKit/UIProcess/Inspector/win/WebInspectorProxyWin.cpp.
(WebKit::getInspectedWindowInfo):
(WebKit::WebInspectorUIProxy::windowReceivedMessage):
(WebKit::WebInspectorUIProxy::wndProc):
(WebKit::WebInspectorUIProxy::registerWindowClass):
(WebKit::decidePolicyForNavigationAction):
(WebKit::webProcessDidCrash):
(WebKit::WebInspectorUIProxy::platformCreateFrontendPage):
(WebKit::WebInspectorUIProxy::platformCloseFrontendPageAndWindow):
(WebKit::WebInspectorUIProxy::inspectorPageURL):
(WebKit::WebInspectorUIProxy::inspectorTestPageURL):
(WebKit::WebInspectorUIProxy::infoForLocalDebuggable):
(WebKit::WebInspectorUIProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorUIProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorUIProxy::platformAttach):
(WebKit::WebInspectorUIProxy::platformDetach):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowWidth):
(WebKit::WebInspectorUIProxy::platformSetSheetRect):
(WebKit::WebInspectorUIProxy::platformIsFront):
(WebKit::WebInspectorUIProxy::platformHide):
(WebKit::WebInspectorUIProxy::platformResetState):
(WebKit::WebInspectorUIProxy::platformBringToFront):
(WebKit::WebInspectorUIProxy::platformBringInspectedPageToFront):
(WebKit::WebInspectorUIProxy::platformSetForcedAppearance):
(WebKit::WebInspectorUIProxy::platformInspectedURLChanged):
(WebKit::WebInspectorUIProxy::platformShowCertificate):
(WebKit::WebInspectorUIProxy::platformSave):
(WebKit::WebInspectorUIProxy::platformAppend):
(WebKit::WebInspectorUIProxy::platformAttachAvailabilityChanged):
(WebKit::WebInspectorUIProxy::platformCreateFrontendWindow):
(WebKit::WebInspectorUIProxy::platformDidCloseForCrash):
(WebKit::WebInspectorUIProxy::platformInvalidate):
(WebKit::WebInspectorUIProxy::platformStartWindowDrag):
* UIProcess/WebPageProxy.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPageProxy::inspector const):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::sendMessageToBackend):
(WebKit::RemoteWebInspectorUI::frontendLoaded):
(WebKit::RemoteWebInspectorUI::changeSheetRect):
(WebKit::RemoteWebInspectorUI::setForcedAppearance):
(WebKit::RemoteWebInspectorUI::startWindowDrag):
(WebKit::RemoteWebInspectorUI::bringToFront):
(WebKit::RemoteWebInspectorUI::closeWindow):
(WebKit::RemoteWebInspectorUI::reopen):
(WebKit::RemoteWebInspectorUI::resetState):
(WebKit::RemoteWebInspectorUI::openURLExternally):
(WebKit::RemoteWebInspectorUI::save):
(WebKit::RemoteWebInspectorUI::append):
(WebKit::RemoteWebInspectorUI::showCertificate):
* WebProcess/Inspector/WebInspector.cpp:
(WebKit::WebInspector::openLocalInspectorFrontend):
(WebKit::WebInspector::closeFrontendConnection):
(WebKit::WebInspector::bringToFront):
(WebKit::WebInspector::elementSelectionChanged):
(WebKit::WebInspector::timelineRecordingChanged):
(WebKit::WebInspector::setDeveloperPreferenceOverride):
(WebKit::WebInspector::updateDockingAvailability):
* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::updateConnection):
(WebKit::WebInspectorUI::frontendLoaded):
(WebKit::WebInspectorUI::startWindowDrag):
(WebKit::WebInspectorUI::bringToFront):
(WebKit::WebInspectorUI::closeWindow):
(WebKit::WebInspectorUI::reopen):
(WebKit::WebInspectorUI::resetState):
(WebKit::WebInspectorUI::setForcedAppearance):
(WebKit::WebInspectorUI::requestSetDockSide):
(WebKit::WebInspectorUI::changeAttachedWindowHeight):
(WebKit::WebInspectorUI::changeAttachedWindowWidth):
(WebKit::WebInspectorUI::changeSheetRect):
(WebKit::WebInspectorUI::openURLExternally):
(WebKit::WebInspectorUI::save):
(WebKit::WebInspectorUI::append):
(WebKit::WebInspectorUI::inspectedURLChanged):
(WebKit::WebInspectorUI::showCertificate):
(WebKit::WebInspectorUI::sendMessageToBackend):
2021-03-22 Devin Rousso <drousso@apple.com>
Remove unused JS and CSS files of media controls
https://bugs.webkit.org/show_bug.cgi?id=214955
<rdar://problem/66604040>
Reviewed by Eric Carlson.
Cocoa platforms are already using modern media controls so there's no reason to keep the old
media controls resources/logic around any longer. It just wastes space.
The non-iOS Apple controls must be kept though as they are still used on Windows.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetModernMediaControlsEnabled): Deleted.
(WKPreferencesGetModernMediaControlsEnabled): Deleted.
Replace `ModernMediaControlsEnabled` setting with `ENABLE_MODERN_MEDIA_CONTROLS` build flag.
* UIProcess/mac/WKFullScreenWindowController.mm:
Update the static `minVideoWidth` value for modern media controls.
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] ASSERTION FAILED: isMainThread() in GPU process for some canvas/philip/tests tests
https://bugs.webkit.org/show_bug.cgi?id=223500
Reviewed by Alex Christensen.
In WinCairo GPU process mode, WebCore::Font IPC decoder was using
FontCache::fontForFamily that should be called only in the main
thread. However, It is was called in IPC thread. Reimplemented the
decoder without using FontCache::fontForFamily.
Encode LOGFONT for WebCore::Font, and decode it and create a font
directly from it.
This change also encodes and decodes the
FontPlatformData::CreationData of custom fonts. However, custom
fonts still don't work in GPU process mode because
FontCustomPlatformData is destructed soon. In non-GPU process
mode, FontCustomPlatformData is retained by CachedFont. In GPU
process mode, fontReference of FontCustomPlatformData should be
refcounted and retained by WebCore::Font.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<LOGFONT>::encode):
(IPC::ArgumentCoder<LOGFONT>::decode):
(IPC::ArgumentCoder<Ref<Font>>::encodePlatformData):
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData):
2021-03-22 Per Arne <pvollan@apple.com>
Allow additional fcntl
https://bugs.webkit.org/show_bug.cgi?id=223590
<rdar://problem/75702241>
Reviewed by Brent Fulgham.
An additional fcntl is being used and should be allowed.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-22 Youenn Fablet <youenn@apple.com>
RealtimeMediaSource does not need to be a WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=223573
<rdar://75583258>
Reviewed by Eric Carlson.
* UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h:
2021-03-22 Chris Dumez <cdumez@apple.com>
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:2681:9: runtime error: load of value nnn, which is not a valid value for type 'BOOL' (aka 'signed char')
https://bugs.webkit.org/show_bug.cgi?id=223581
Reviewed by Simon Fraser.
The code was implicitly casting an uint64_t identifier into a BOOL variable. The intention was
to check whether the identifier is 0 or not. To silence the UBSAN error, we now use the bool
type instead of BOOL (since BOOL is defined as a signed char on some platforms).
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
2021-03-22 Youenn Fablet <youenn@apple.com>
Add an early return in UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList
https://bugs.webkit.org/show_bug.cgi?id=223571
Reviewed by Eric Carlson.
Update code to early return as soon as possible.
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
2021-03-19 Darin Adler <darin@apple.com>
[Cocoa] Make it possible to release a WKWebView on a non-main thread without a crash due to WKScriptMessage race
https://bugs.webkit.org/show_bug.cgi?id=222336
Reviewed by Chris Dumez.
* Platform/spi/Cocoa/objcSPI.h: Removed this unused file.
* UIProcess/API/C/mac/WKPagePrivateMac.mm:
(WKPageGetWebView): Use WKPageProxy::cocoaView instead of fromWebPageProxy.
* UIProcess/API/Cocoa/WKDownload.mm:
(-[WKDownload webView]): Ditto.
* UIProcess/API/Cocoa/WKFrameInfo.mm:
(-[WKFrameInfo webView]): Ditto.
* UIProcess/API/Cocoa/WKUserContentController.mm:
(ScriptMessageHandlerDelegate::didPostMessage): Use WKPageProxy::cocoaView
instead of fromWebPageProxy and add null checks.
(ScriptMessageHandlerDelegate::didPostMessageWithAsyncReply): Ditto.
* UIProcess/API/Cocoa/WKWebView.mm:
(pageToViewMap): Deleted.
(fromWebPageProxy): Deleted.
(-[WKWebView _initializeWithConfiguration:]): Use WKPageProxy::setCocoaView
instead of adding the page/view pair to a map.
(-[WKWebView dealloc]): Removed code that removed the page/view pair from the map.
* UIProcess/API/Cocoa/WKWebViewInternal.h: Removed fromWebPageProxy.
* UIProcess/API/Cocoa/_WKDownload.mm:
(-[_WKDownload originatingWebView]): Use WKPageProxy::cocoaView instead of fromWebPageProxy.
* UIProcess/API/Cocoa/_WKFrameTreeNode.mm:
(-[_WKFrameTreeNode webView]): Ditto.
* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector webView]): Ditto.
* UIProcess/API/Cocoa/_WKInspectorTesting.mm:
(-[_WKInspector inspectorWebView]): Ditto.
* UIProcess/Cocoa/AutomationSessionClient.mm:
(WebKit::AutomationSessionClient::requestSwitchToPage): Use WKPageProxy::cocoaView
instead of fromWebPageProxy and add a null check.
(WebKit::AutomationSessionClient::requestHideWindowOfPage): Ditto.
(WebKit::AutomationSessionClient::requestRestoreWindowOfPage): Ditto.
(WebKit::AutomationSessionClient::requestMaximizeWindowOfPage): Ditto.
(WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage): Ditto.
(WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage): Ditto.
(WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage): Ditto.
(WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage): Ditto.
(WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage): Ditto.
(WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage): Ditto.
(WebKit::AutomationSessionClient::currentPresentationOfPage): Ditto.
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::alertForPermission): Use WKPageProxy::cocoaView instead of fromWebPageProxy.
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
(WebKit::PopUpSOAuthorizationSession::abortInternal): Added a null check since
initSecretWebView is no longer guaranteed to allocate m_secretWebView in the case
where the WKWebView is nil.
(WebKit::PopUpSOAuthorizationSession::completeInternal): Ditto.
(WebKit::PopUpSOAuthorizationSession::initSecretWebView): Use WKPageProxy::cocoaView
instead of fromWebPageProxy and added a null check.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy): Use WKPageProxy::cocoaView
instead of fromWebPageProxy.
* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
(WebKit::WebURLSchemeHandlerCocoa::platformStartTask): Use WKPageProxy::cocoaView
instead of fromWebPageProxy and added a null check.
(WebKit::WebURLSchemeHandlerCocoa::platformStopTask): Ditto. Also call the
new suppressTaskStoppedExceptions if we are unable to call the delegate method due to
the WKWebView already being nil.
* UIProcess/PDF/WKPDFHUDView.mm:
(-[WKPDFHUDView hitTest:]): Use WKPageProxy::cocoaView instead of fromWebPageProxy.
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didPerformRedirection): Don't raise the "task stopped"
exception if it has been explicitly suppressed.
(WebKit::WebURLSchemeTask::didReceiveResponse): Ditto.
(WebKit::WebURLSchemeTask::didReceiveData): Ditto.
(WebKit::WebURLSchemeTask::didComplete): Ditto.
* UIProcess/WebURLSchemeTask.h: Added a suppressTaskStoppedExceptions function,
which we use to prevent exceptions in the case where the WKWebView was deallocated.
Since we were not able to call the delegate method in that case, the caller can't
be expected to refrain from calling methods. Eventually, clients of WKWebView could avoid this
by calling the _close method instead of relying for deallocation to do web view teardown,
but we need to promote that from SPI to API.
* UIProcess/WebPageProxy.h: Tweaked forward declarations a bit, and added one for WKWebView.
Marked the class final and use final instead of override. Added Cocoa-only cocoaView and
setCocoaView function members, and m_cocoaView data member. Also added inline implementations
but only compile them when included from an Objective-C source file.
* WebKit.xcodeproj/project.pbxproj: Removed objcSPI.h.
2021-03-22 Youenn Fablet <youenn@apple.com>
Implement RTCDataChannel transfer out of process
https://bugs.webkit.org/show_bug.cgi?id=223443
Reviewed by Eric Carlson.
Add support for connecting remote sources to remote data channels.
This is done by connection detached data channels to remote source that will send messages to network process.
Network process then sends to the process in which was reattached the data channel.
Pairing of data channels is done in main thread through connectToSource message.
The data then flows in background threads, network process being the proxy between web processes.
RTCDataChannelRemoteManagerProxy is the forwarding entity in NetworkProcess.
RTCDataChannelRemoteManager is the entity in WebProcess doing the messaging from and to data channels.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
(WebKit::NetworkConnectionToWebProcess::connectToRTCDataChannelRemoteSource):
(WebKit::NetworkConnectionToWebProcess::registerToRTCDataChannelProxy):
(WebKit::NetworkConnectionToWebProcess::unregisterToRTCDataChannelProxy):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::rtcDataChannelProxy):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp: Added.
(WebKit::RTCDataChannelRemoteManagerProxy::RTCDataChannelRemoteManagerProxy):
(WebKit::RTCDataChannelRemoteManagerProxy::registerConnectionToWebProcess):
(WebKit::RTCDataChannelRemoteManagerProxy::unregisterConnectionToWebProcess):
(WebKit::RTCDataChannelRemoteManagerProxy::sendData):
(WebKit::RTCDataChannelRemoteManagerProxy::close):
(WebKit::RTCDataChannelRemoteManagerProxy::changeReadyState):
(WebKit::RTCDataChannelRemoteManagerProxy::receiveData):
(WebKit::RTCDataChannelRemoteManagerProxy::detectError):
(WebKit::RTCDataChannelRemoteManagerProxy::bufferedAmountIsDecreasing):
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h: Added.
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.messages.in: Added.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::connectToRTCDataChannelRemoteSource):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Network/NetworkProcessConnection.messages.in:
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createRTCDataChannelRemoteHandlerConnection):
* WebProcess/Network/webrtc/LibWebRTCProvider.h:
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: Added.
(WebKit::RTCDataChannelRemoteManager::sharedManager):
(WebKit::RTCDataChannelRemoteManager::RTCDataChannelRemoteManager):
(WebKit::RTCDataChannelRemoteManager::setConnection):
(WebKit::RTCDataChannelRemoteManager::connectToRemoteSource):
(WebKit::RTCDataChannelRemoteManager::remoteHandlerConnection):
(WebKit::RTCDataChannelRemoteManager::remoteSourceConnection):
(WebKit::RTCDataChannelRemoteManager::postTaskToHandler):
(WebKit::RTCDataChannelRemoteManager::sourceFromIdentifier):
(WebKit::RTCDataChannelRemoteManager::sendData):
(WebKit::RTCDataChannelRemoteManager::close):
(WebKit::RTCDataChannelRemoteManager::changeReadyState):
(WebKit::RTCDataChannelRemoteManager::receiveData):
(WebKit::RTCDataChannelRemoteManager::detectError):
(WebKit::RTCDataChannelRemoteManager::bufferedAmountIsDecreasing):
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::create):
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::RemoteHandlerConnection):
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::connectToSource):
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::sendData):
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::close):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::create):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::RemoteSourceConnection):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didChangeReadyState):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveRawData):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didDetectError):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::bufferedAmountIsDecreasing):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h: Added.
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.messages.in: Copied from Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in.
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
2021-03-19 Kate Cheney <katherine_cheney@apple.com>
Cannot login to microsoftonline.com without allowing storage access
https://bugs.webkit.org/show_bug.cgi?id=223510
<rdar://problem/75619058>
Reviewed by John Wilander.
Disable the storage access quirk for non-default web browsers and
don't cancel the login click on sites even if the user denies storage
access. See WebCore changelog for more details.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::isParentProcessAFullWebBrowser const):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::hasDeniedCrossPageStorageAccess const):
(WebKit::WebResourceLoadObserver::setHasDeniedCrossPageStorageAccess):
* WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::pageIsParentProcessAFullWebBrowser):
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
2021-03-19 Brent Fulgham <bfulgham@apple.com>
[macOS] Allow opendirectoryd access in base system
https://bugs.webkit.org/show_bug.cgi?id=223527
<rdar://problem/75492699>
Reviewed by Per Arne Vollan.
Allow the WebContent process to communicate with opendirectoryd when running in the base system.
* WebProcess/com.apple.WebProcess.sb.in:
2021-03-19 BJ Burg <bburg@apple.com>
Web Inspector: remove unnecessary inspectorBaseURL() and assumed read access
https://bugs.webkit.org/show_bug.cgi?id=223526
Reviewed by Devin Rousso.
inspectorBaseURL() is only used to call WebProcess::assumeReadAccessToBaseURL, which
generates a sandbox extension. However, after r274697, all ports now use non-file:///
schemes to load inspector resources, so any needed sandbox extensions are handled in
port-specific code or by the URL scheme handler.
* UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
(WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
* UIProcess/Inspector/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::createFrontendPage):
(WebKit::WebInspectorProxy::inspectorBaseURL): Deleted.
* UIProcess/Inspector/WebInspectorProxy.h:
* UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorTestPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL): Deleted.
* UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::inspectorBaseURL): Deleted.
* UIProcess/Inspector/win/WebInspectorProxyWin.cpp:
(WebKit::WebInspectorProxy::inspectorBaseURL): Deleted.
* mac/WebKit2.order:
2021-03-19 Jer Noble <jer.noble@apple.com>
[GPUP] platform/mac/media/encrypted-media/fps-clearkey-crash.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=221687
<rdar://problem/74438911>
Reviewed by Eric Carlson.
Add support for passing the value of MediaPlayerPrivate::waitingForKey() across the process boundary.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerWaitingForKeyChanged):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged):
(WebKit::MediaPlayerPrivateRemote::waitingForKey const):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
2021-03-19 Peng Liu <peng.liu6@apple.com>
[GPUP] Test imported/w3c/web-platform-tests/fetch/range/general.window.html fails when media in GPU process is enabled.
https://bugs.webkit.org/show_bug.cgi?id=221817
Reviewed by Jer Noble.
The `didLoadingProgress()` function of `MediaPlayerPrivateAVFoundation`
and `MediaPlayerPrivateMediaSourceAVFObjC` changes their mutable member
variables, so a caller (e.g., RemoteMediaPlayerProxy::didLoadingProgress())
will get false eventually if it calls the function repeatedly. As a result,
`MediaPlayerPrivateRemote::didLoadingProgress()` will always return false.
This patch fixes this issue with a new synchronous message in `RemoteMediaPlayerProxy`.
No new tests. Fix a test failure.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::didLoadingProgress):
(WebKit::RemoteMediaPlayerProxy::updateCachedState):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::didLoadingProgress const):
(WebKit::MediaPlayerPrivateRemote::updateCachedState):
* WebProcess/GPU/media/RemoteMediaPlayerState.h:
(WebKit::RemoteMediaPlayerState::encode const):
(WebKit::RemoteMediaPlayerState::decode):
2021-03-19 Antti Koivisto <antti@apple.com>
Reduce the number of allowed parallel low priority resource loads before visual completion
https://bugs.webkit.org/show_bug.cgi?id=223448
Reviewed by Geoff Garen.
More aggressive scheduling during early page load seems like a win.
* NetworkProcess/NetworkLoadScheduler.cpp:
Reduce from six to two.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
This revealed an issue where allowing scheduling for synchronous XHR can end up in a deadlock
(since the web process won't be able to process redirect requests).
Tested by imported/w3c/web-platform-tests/xhr/responsexml-document-properties.htm.
== Rolled over to ChangeLog-2021-03-18 ==